r/PromptEngineering • u/crlowryjr • Sep 20 '25
General Discussion Markdown, XML, JSON, whatever
When I first started writing prompts I used YAML because it's what I was using on a near daily basis with Home Assistant. While OK I didn't see a lot of people using YAML and there were some formatting complications.
I then moved to MarkDown. Better, but, I run experience 2 issues. 1. Sometimes the LLM doesn't properly discern the prompt sections from the examples and the output formatting. 2. Sometimes when I copy+paste the formatting gets munged.
I've started mixing in JSON and XML and yeah ...
So, to those of you that structure your prompts, what do you use?
2
u/fizzbyte Sep 23 '25
AgentMark (specifically for agents). It's markdown + jsx.
3
u/Lumpy-Ad-173 Sep 20 '25
I use Google Docs and plain text.
The majority of users will not be using markdown or json or XML or anything... They'll be using plain text or voice to text.
I think eventually these AI companies will need to optimize it for plain text based on the amount of general users who don't know anything other than Microsoft Word.
3
u/EQ4C Sep 21 '25
Mostly XML+Markdown:
Example Prompt Template:
3
u/TrustGraph Sep 20 '25
Most language models perform best with XML. Even though they can work with JSON, YAML, etc., they are most reliable with XML all around.
2
u/SufficientProcess567 Sep 22 '25
markdown all the way down
1
u/CharlesWiltgen Sep 20 '25
Technically, it doesn't matter much — any popular method of defining structure can work about as well as any other. It's important to understand that LLMs see only a flat sequence of tokens (subwords/bytes) built from your input (vs. a tree/AST). However you choose to define the structure of your input, that structure is retained statistically, not formally.
As a statistical process, unfortunately there aren't hard guarantees. Hard guarantees require calling out to tools, or calling an LLM and then aligning its output using techniques like constrained decoding.
1
u/TheOdbball Sep 20 '25
Definitely don't parse your own sequence and make it plaintext readable, markdown saveable, json exampleable.
Ditching XML is best. I always list data as if it's in YAML
1
u/zettaworf Sep 20 '25
Org Mode and JSON-LD.
8
u/[deleted] Sep 20 '25
[removed] — view removed comment