Diff와 전체 파일: Flutter/Dart 코드 모델을 위한 반복 편집 기반 생성과 직접 생성의 실증적 비교
Diffs vs. Whole Files: An Empirical Comparison of Iterative Edit-Based and Direct Generation for Flutter/Dart Code Models
September 5, 2026
저자: Andrej Andrejev
cs.AI
초록
코드 편집에 사용되는 대규모 언어 모델은 최소 두 가지 출력 방식으로 학습되고 배포될 수 있다. 하나는 직접 생성으로, 모델이 수정된 전체 파일을 한 번에 출력하는 방식이다. 다른 하나는 반복적 diff 기반 생성("steps")으로, 모델이 국소적 검색/치환 편집의 시퀀스를 출력하고 완료를 알리거나 스텝 예산이 소진될 때까지 이를 한 번에 하나씩 적용하는 방식이다. diff 기반 방식은 개발자가 코드를 편집하는 방식과 유사하고 턴당 생성 토큰 수를 훨씬 적게 요구할 것으로 기대되므로 매력적이다. 우리는 두 개의 코드 모델, 즉 처음부터 학습한 100M 파라미터 모델(Rainbow-Pony-100M)과 미세조정된 Qwen2.5-Coder-0.5B를 공유 Flutter/Dart 데이터셋에서 두 방식 모두로 학습시키고, 그 결과로 나온 네 모델 모두를 모델당 약 1,790개 태스크로 구성된 홀드아웃 세트에서 평가한다. 직접 생성은 우리가 측정하는 모든 지표, 즉 컴파일/정적 분석 통과율, 바이트당 비트, 참조와의 문자 수준 유사도, 그리고 목표 충족, 정확성, 코드 품질에 대한 블라인드 LLM 심사 평가에서 diff 기반 생성보다 크게 우수하며, 이러한 격차는 매칭 ID 비교를 통해 태스크 난이도를 통제한 뒤에도, 그리고 양쪽 모두에서 컴파일되는 코드로 제한했을 때도 지속된다. 그런 다음 우리는 diff 기반 생성이 실제로 우세를 보이는 조건의 배후에 있는 단일하고 아키텍처 독립적인 메커니즘을 규명한다. 그것은 짧고 공간적으로 국소화된 편집에서 경쟁력이 있으며, 범주 수준의 우세는 우리 데이터셋에서 평균 편집 스텝 수가 가장 낮은 바로 두 태스크 범주, 즉 리팩터링과 오류 처리/엣지 케이스 수정에 정확히 집중된다. 우리는 이를 태스크 국소성(task locality)이라고 부르고, 편집 기반 학습 방식이 코드 편집 모델에 적절한 선택인 경우와 그렇지 않은 경우에 대한 함의를 논의한다.
English
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.