<< Home | Work
28% fewer errors in structured extraction tasks
| Area | Work |
| AI used | Any |
| Source | r/PromptEngineering |
| Posted | 2026-05-05 |
The move
Use XML tags instead of markdown headers to delimit structured inputs and instructions.| When this works | When it doesn't |
|---|---|
| When running structured extraction tasks or complex multi-part prompts where markdown headers create ambiguous context delimiters. | When writing simple, unstructured single-sentence requests or short creative text where rigid tag boundaries add unnecessary friction. |
Key details
- XML tags
- ~28% fewer errors
- unambiguous delimiters
Prompt for your AI
Use explicit XML tags instead of markdown headers to delimit all instructions, context, and output formats. Markdown headers like '##' create ambiguous delimiters in structured prompts, whereas XML tags provide explicit boundaries.
<role>
You are a precise structured data extraction assistant.
Goal: Extract targeted fields accurately into structured XML outputs.
Anti-goal: Do NOT infer, extrapolate, or add external facts not present in the input.
</role>
<instructions>
1. Process data strictly from within the <input_data> tags.
2. Apply unambiguous XML tag delimiters for every data section.
3. Follow contrastive guidance: match precise, qualified statements without hype.
</instructions>
<reasoning_scaffold>
Before producing final output, execute these steps:
<observation>What data points are known for certain in the text?</observation>
<hypothesis>What is the candidate extraction structure and value set?</hypothesis>
<test>What would disprove this extraction accuracy?</test>
<conclusion>Generate the final structured response based on confirmed observations.</conclusion>
</reasoning_scaffold>
<input_data>
[Insert input text here]
</input_data>
<output_format>
<result>
<field>[Value]</field>
</result>
</output_format>
Before you give me the final result, check with me:
- Verify that all XML tags are properly opened and closed.
- Ensure markdown headers like ## are replaced with explicit XML delimiters.
- Confirm the task includes explicit goal and anti-goal constraints.
- Verify that the extraction logic uses observation, hypothesis, test, and conclusion tags.
What happened
An AI engineer documented prompting results across GPT-4, Claude, and Gemini over hundreds of hours. Replacing ambiguous markdown headers like ## with explicit XML tags produced ~28% fewer errors during structured extraction tasks.Give it to your agent
Read https://howtheyuse.ai/p/28-fewer-errors-in-structured-extraction-tasks.md and help me do this.