A web version of Anthropic's prompt engineering interactive tutorial
thenameless.net
thenameless.net
The downside is that you might lose information (the improved prompt might not be an exact semantic match with the original prompt), plus it becomes less and less useful as model's ability to understand commands improve.
Basically, if you express yourself clearly, betting on model improvement is enough, there is no need to add a faillible extra-step.
Don’t underestimate how bleeding edge this all is.
I've done a lot of testing with this and found that XML is the best input AND output if you want to produce machine readable data. Markdown is okay as input, but testing shows better accuracy if input components are wrapped in XML tags. While it would be ideal for extracting data, JSON syntax is too sensitive as output. Often an offending character will be unescaped no matter how good your prompt is.
If you stay within the very basic syntax of XML (just tags) it is also the best output. I suspect it is to do with the descriptive nature of the tag structure. Something wrapped in the tag <summary> will hint to the model that it should produce a summary, reinforcing the input prompt as the output is being constructed.
See also https://python.useinstructor.com/
1. The specific way different models were trained.
Claude was specifically trained with these XML tags in the input and output. For Claude it works well to say things along the lines of "use a scratchpad for thinking out loud in XML tags first". While you can force GPT to do the same, it may not be as "natural" e.g. high chance of GPT3.5 not doing it.
2. XML tags vs full XML
Using XML tags doesn't mean it would be amazing at outputting full valid XML. XML tags are great because there's no further formatting needed within. If you only want to separate sections in your prompt or response, XML tags are perfect for clearly marking start and end, as well as featuring syntax (<>) that's rarely seen in natural text.
If it comes to generating a full data schema valid object, my experience is that JSON works way better than XML. It just seems to be a good middle ground between structure while having little overhead. I remember a recent AirBnB posts saying that YAML works even better than JSON. That's not my personal experience. Plus, YAML is something a bit weird and slow on read.
https://github.com/narenaryan/promptml/ https://www.promptml.org/
It isn't XML nor JSON, but a DSL built especially for writing prompts. We do not have published benchmarks but running few examples, we see consistent outputs from LLM, and supplements RAG by separating context and using it for enriching prompt.
https://gist.github.com/narenaryan/651d8081eaaffa846e05da7a3...
You can test it with Claude and GPT-3.5 or GPT-4o, and they all will bring strikingly bring similar results with differences in detail.
YAML & XML serializations are coming in v0.6.0 of PromptML.
https://docs.google.com/spreadsheets/d/19jzLgRruG9kjUQNKtCg1...
i converted the content to a web-friendly format as a personal learning exercise. hopefully it improves the accessibility as well.
If anything, prompt engineering has become more nuanced, down to the choice of each token: