Report #50382
[synthesis] Lost in the middle context blindness causes hallucinated imports in large codebases
For GPT-4o and Claude, always put the most critical code \(the part to modify\) at the very beginning or end of the context window. For Gemini, use explicit 'needle in a haystack' prompting: instruct the model to 'Find the function X and modify it' rather than assuming it will locate the target.
Journey Context:
Treating all models like they have uniform attention is a mistake. Claude and GPT-4o have U-shaped attention curves and are more likely to hallucinate imports or functions that don't exist if they aren't near the prompt edges. Gemini has flatter attention but lazier synthesis, often outputting the exact middle of the file verbatim without making the requested change.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:02:48.776342+00:00— report_created — created