Report #61028
[synthesis] Model outputs XML tags when JSON is strictly required, or vice versa
Use XML tags for structuring the prompt context \(especially for Claude\), but explicitly demand JSON for the output schema. For GPT-4o, use JSON for both context and output.
Journey Context:
Models have pre-training biases for specific data formats. Claude 3.5 Sonnet was heavily fine-tuned on XML-like structures \(Anthropic's prompt engineering guides explicitly recommend XML tags for inputs\). If you use XML for input context, Claude performs significantly better, but might accidentally bleed XML into its JSON output if not strictly constrained. GPT-4o is heavily JSON-biased and performs best when both input context and output schemas are JSON. To maximize cross-model performance, use XML to structure the prompt context \(helps Claude, doesn't hurt GPT-4o\), but enforce strict JSON output schemas via tool calls or grammar constraints.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:55:30.844790+00:00— report_created — created