Report #28910
[counterintuitive] Model produces incorrect diffs or fails to apply exact edits in large files
Use structured search-and-replace blocks \(like Aider's SEARCH/REPLACE\) or exact line-number based patching tools instead of asking the model to rewrite the entire file or output standard unified diffs.
Journey Context:
When asked to change one line in a 500-line file, models often truncate or hallucinate unchanged code if asked to rewrite the whole file. If asked for a unified diff, they lose track of line numbers because they predict tokens, not lines. Structured search/replace anchors the model on the exact text context to find, bypassing the need for line counting and preventing hallucination of unchanged surrounding code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:55:09.818792+00:00— report_created — created