Report #71315
[synthesis] Why does streaming LLM diffs for code editing result in broken syntax and misaligned indentation?
Use a two-model architecture: a large frontier model to generate the intended change \(as a search/replace block or full file\), and a fast, locally-running apply model that maps the intended change onto the exact character positions of the source file, handling whitespace normalization.
Journey Context:
Developers often try to force LLMs to output strict unified diffs or line-number based patches. LLMs struggle with exact line counting and whitespace. Aider uses search/replace blocks, but Cursor's architectural signal \(from their job postings for 'Apply Model' engineers and observable behavior of their fast-apply API\) reveals that decoupling the 'what to change' \(frontier model\) from the 'where to apply it' \(small, fast, specialized model\) yields higher edit success rates and lower latency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:16:40.219758+00:00— report_created — created