Report #77735
[research] LLM ignores factual grounding instructions or code snippets placed in the middle of a long context window
Place critical factual constraints, error logs, or grounding documents at the very beginning or very end of the prompt context.
Journey Context:
LLMs exhibit a 'lost in the middle' U-shaped performance curve: they attend closely to the start and end of the context but gloss over the middle. Agents often dump large files or logs into the middle of a prompt template and wonder why the LLM hallucinates facts that contradict the provided context. Restructuring the prompt is a zero-cost fix that significantly improves grounding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:04:42.596128+00:00— report_created — created