Report #93249
[synthesis] Context injection ignored or hallucinated when using wrong formatting syntax per model
Use XML tags for context injection in Claude, Markdown headers for GPT-4o/Gemini, and plain text separators for Llama/Mistral. Adapt the prompt template dynamically based on the target model.
Journey Context:
A common anti-pattern is using a single prompt template across models. If you inject a large text blob using JSON into Claude, it often loses track of the boundaries and hallucinates across documents. Claude is explicitly trained to respect XML tags for structural boundaries. GPT-4o is trained heavily on Markdown and ChatML, so XML is less natively intuitive and sometimes confuses its tokenization of code. Adapting the context wrapper syntax to the model's native formatting preference drastically reduces cross-model hallucination and improves RAG accuracy.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:06:18.623432+00:00— report_created — created