Diffs vs. Whole Files: An Empirical Comparison of Iterative Edit-Based and Direct Generation for Flutter/Dart Code Models

Andrej Andrejev

Independent Researcher

Published September 5, 2026 · on the feed September 10, 2026 · ▲ 7 · arXiv 2609.05779

The abstract

Large language models used for code editing can be trained and deployed in at least two output regimes: direct generation, where the model emits the entire modified file in one shot, and iterative diff-based generation ("steps"), where the model emits a sequence of localized search/replace edits applied one at a time until it signals completion or a step budget is exhausted. The diff-based regime is attractive because it mirrors how developers edit code and should require far fewer generated tokens per turn. We train two code models - a 100M-parameter model trained from scratch (Rainbow-Pony-100M) and a fine-tuned Qwen2.5-Coder-0.5B - in both regimes on a shared Flutter/Dart dataset, and evaluate all four resulting models on a held-out set of approx 1,790 tasks per model. Direct generation substantially outperforms diff-based generation on every metric we measure - compilation/static-analysis pass rate, bits-per-byte, character-level similarity to the reference, and blinded LLM-judge ratings of goal fulfillment, correctness, and code quality - and the gap persists after controlling for task difficulty via a matched-ID comparison and when restricting to code that compiles on both sides. We then identify a single, architecture-independent mechanism behind the conditions where diff-based generation does win: it is competitive on short, spatially localized edits, and its category-level wins concentrate in exactly the two task categories - refactoring and error-handling/edge-case fixes - with the lowest mean edit-step count in our dataset. We term this task locality and discuss its implications for when an edit-based training regime is and is not the right choice for a code-editing model.

The Brief

2:55

A short podcast summary of the paper. Written and voiced by AI.

Transcript

Diffs vs. Whole Files. An Empirical Comparison of Iterative Edit-Based and Direct Generation for Flutter/Dart Code Models. By Andrej Andrejev, working independently. Published on the fifth of September. Its code repository is worked out: about sixty source files, with a readme and a licence.

A language model that edits code can produce its answer in one of two ways. In direct generation it writes out the whole modified file in one shot. In iterative diff-based generation, which the authors call steps, it emits a sequence of small search-and-replace edits, applied one at a time, until it signals that it is done or a step budget runs out. The diff-based regime has obvious appeal. It mirrors how developers actually edit, and it ought to need far fewer generated tokens per turn.

The finding runs against that intuition. For the models and data studied here, direct generation substantially outperforms diff-based generation, on every metric measured.

Two code models were trained in both regimes on a shared Flutter and Dart dataset. One is a one hundred million parameter model trained from scratch, named Rainbow-Pony-100M. The other is a fine-tuned Qwen2.5-Coder at zero point five billion parameters. That makes four models, each evaluated on a held-out set of roughly one thousand seven hundred and ninety tasks.

Direct generation wins on the pass rate for compilation and static analysis, on bits per byte, on character-level similarity to the reference, and in blinded ratings by an LLM judge of goal fulfilment, correctness and code quality. The gap survives two controls. It persists when task difficulty is matched through a matched-ID comparison, and it persists when the comparison is restricted to code that compiles on both sides.

The authors then look at the conditions where diffs do win, and trace them to one mechanism that does not depend on architecture. Diff-based generation is competitive on edits that are short and spatially localized. Its wins at the level of task categories concentrate in exactly two categories, refactoring and fixes for error handling or edge cases, which are the two with the lowest mean number of edit steps in the dataset. The authors name this property task locality.

The scope is bounded by the setup. The evidence covers two small models, one language pairing in Flutter and Dart, and one dataset. Within that, the result is broad, holding across every metric and both controls, and the exception is precise.

Task locality is offered as a way to decide between the regimes. When the change a task needs is small and confined to one place, the edit-based approach can hold its own. When it is not, writing the whole file wins. The authors discuss what this implies for when an edit-based training regime is, and is not, the right choice for a code-editing model. The question it leaves a practitioner with is not which regime is better in general, but how local the edits are that a model will be asked to make. Where they are local, diffs remain an option. Everywhere else in this study, the whole file was the stronger output.

Paper Quest · 7 chapters · about 41 min

Play this paper

Learn it by doing: make the calls the authors made, guess the result before you see it, and defend it in a viva graded on your own words. Chapter 1 is right here.

Chapter 1 🧩 · The problem

Everyone assumes small edits beat rewriting. Someone has to check.

You are building a small model that edits Flutter and Dart code. It can either rewrite the whole file each time, or emit small search-and-replace edits applied one by one.

The road ahead

  1. 1 · The problem ~7 min A code-editing model can rewrite the whole file or send small edits, and which works better as a training target is unsettled.
  2. 2 · What came before ~3 min
  3. 3 · The key idea ~9 min With models and data held fixed, whole-file rewriting came out ahead, robustly, while small edits only compete on short, localized changes: task locality.
  4. 4 · Choose your own research ~3 min
  5. 5 · Build the method ~8 min Train two models both ways, score all four alike, then strip out task difficulty and broken code before explaining where edits win.
  6. 6 · The experiment ~6 min You’ll guess: Two small code models were each trained to edit Flutter/Dart code either by rewriting whole files or by emitting search/replace diffs. Which output regime came out ahead?
  7. 7 · The viva ~5 min Three questions from the examiners, answered in your own words. Win it for the paper’s trophy.
Join free to play the whole quest ›

Free, with Google or an email address. Your stars and progress are kept.

KipQuest: the day’s AI research, as podcasts and quests. All papers Android app Privacy Contact Episodes are written and voiced by AI from each paper. Summaries can contain mistakes: the paper is the source.