Using XML tags or other delimiters in prompts means wrapping parts of your prompt in clear markers like <context>...</context> so the model can separate instructions, data, and examples more reliably.
This pattern helps when a prompt contains multiple kinds of content at once: instructions, source text, user input, examples, or fields you want the model to treat differently. Delimiters reduce ambiguity and make prompts easier to read, debug, and reuse.
In practice, teams reach for XML-style tags when they want:
It is not magic, and it is not a formal XML parser contract. It is simply a formatting convention that many LLMs handle well because the structure is explicit.
You choose a set of tags or delimiters and assign each section a role. For example, you might put instructions in <instructions>, source material in <document>, and the user query in <question>.
The model then sees the prompt as structured text. This can make it less likely to confuse quoted data with instructions, especially when the input includes long passages, code, or nested examples.
A common pattern is:
This is closely related to delimiter-based prompting in general. XML tags are just one readable delimiter style.
<instructions>
Answer using only the document.
</instructions>
<document>
Acme ships every Friday and supports returns within 30 days.
</document>
<question>
When does Acme ship?
</question>
A model can more easily infer that the answer should come from <document>, not from the instruction block.
In practice, most teams use delimiters for clarity first, and only later add stricter schemas if they need reliable machine parsing.