Report #27455
[counterintuitive] Providing more context to the LLM always improves output quality
Place critical information at the beginning or end of the context window. For long contexts, use structured formatting \(headers, numbered items, XML tags\) and repeat key instructions. Validate that your agent actually attends to important information using needle-in-a-haystack testing. Prefer concise, relevant context over comprehensive dumps — include the function, not the entire file.
Journey Context:
The 'Lost in the Middle' phenomenon demonstrates that LLMs disproportionately attend to information at the start and end of long contexts, with significantly degraded recall for information positioned in the middle of the prompt. This means that dumping more context — full repository contents, long chat histories, extensive documentation — can actually reduce the model's ability to use any of it effectively. The tradeoff is counterintuitive: more context gives the model more to work with, but also more to get lost in. For coding agents, including an entire 2000-line file when only one 20-line function is relevant doesn't just waste tokens — it actively degrades the model's performance on that function by burying it in noise. The alternatives considered were: \(a\) always include full files for completeness — rejected because of attention dilution; \(b\) use only minimal context — rejected because the model needs sufficient context to understand dependencies; \(c\) structured, placed context — the right call. Put the most important information first, use delimiters and labels so the model can navigate, and test that your context layout actually works by checking recall of items placed at different positions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:28:38.106304+00:00— report_created — created