AI-assisted coding ranges from fully agentic coding to inline code suggestions in the editor. Inline suggestions require predicting a developer's most likely next edit from an editing session. The next edit may lie at the cursor, in nearby lines, or farther away, and one editing intent can span several of these. The preceding system queries separate completion, nearby edit, and long-distance edit models, each with its own output format, in a fixed sequence; it thus cannot express intents spanning distant locations in one response, can require several sequential model calls per suggestion, and prioritizes completion even when a correction would serve better. We present a unified model that predicts all three edit types in one output space: a sequence of anchored diff patches specifying locations, deleted lines, and added lines. This representation permits multiple edits per response, so the client can serve later edits from a cache without further model calls. We train this model in two phases, first unifying next edit and long-distance edit prediction, then adding code completion. We synthesize multi-edit supervision from single-edit data via model pseudolabeling and edit history playback. We use a binary LLM-graded reward, a patch validity taxonomy shared by data filtering, reward, and evaluation, and grader boosting for targeted failure modes. Phase 2 also adapts how the client processes and presents model outputs. In controlled online A/B experiments in GitHub Copilot, Phase 1 significantly reduces time to display by 6.77% and output tokens by 58.93% relative to the three-model baseline. In Phase 2, the 3-in-1 model and client adaptations reduce dismissed suggestions per user by 10.06% relative to the 2-in-1 model paired with the completion model. Throughout this report, we also share our methodology and learnings in evaluation, training, and end-to-end model and system design.
Figures & tables
Figure 1: A single unified model response spanning two edits that completes a message field at the cursor and updates the validation logic a few lines below. Predicting both edits together in a single response allows the client to show the second edit from its cache without another model call.
Figure 2: The seven possible NES view kinds as rendered by the VS Code client. The client chooses the rendering based on the diff between the suggested edit and the original code.
Figure 3: Suggestions predicted by the (a) standalone three-model baseline and (b) unified model for the same editing context. The baseline deterministically queries the completion model first, which completes Fa to FastingPenguin . The unified model rewrites Fa to Fish . Unification allows a single model to choose a context-appropriate correction end-to-end rather than always prioritizing completion.
Figure 4: Client-side orchestration for the three-model baseline. A single suggestion trigger can require up to four sequential model calls before the client displays an edit, adding latency and orchestration complexity.
Figure 5: Two-phase model unification strategy. Phase 1 combines NES and long-distance NES and Phase 2 adds completion. This allows completion training to build on the patch-format editing capabilities developed in Phase 1.
Figure 6: The three standalone response formats and the unified diff patch format for the same editing context. Diff patches express the parameter rename at the cursor and its propagation within and across files in one response without rewriting unchanged lines.
Section
NES prompt
Unified prompt
Backtick fences around the prompt
yes
no
Recently viewed code snippets
yes, without line numbers
yes, with line numbers
Current file
yes, without line numbers
yes, with line numbers
Edit history, unified diff
yes
yes
Padded region around target
yes
no
Code to edit, rewrite window
yes
no
Table 1: Changes to input context sections between the NES and unified prompts. The unified prompt replaces the padded target region and rewrite window with a cursor block, and adds line numbers to the current file and recently viewed code snippets.
Metric
Definition
Shown suggestions
Mean suggestions displayed per user during the experiment
Accepted suggestions
Mean suggestions accepted per user during the experiment
Dismissed suggestions
Mean suggestions explicitly dismissed per user during the experiment
Ignored suggestions
Mean suggestions neither accepted nor dismissed per user during the experiment
Accepted and Retained Characters (ARC)
Mean characters accepted and not reverted per user at each retention window (30 seconds or 5 minutes after acceptance)
Recurring engagement
Proportion of users who accept an inline suggestion on ≥2 different days
Table 2: Online metric definitions. We use multiple metrics to assess various dimensions of the user experience, including suggestion quality, engagement, latency, and inference efficiency.
Figure 7: Progressive model selection process. Lightweight canary checks narrow the candidate set before broader and more extensive offline, internal, and online evaluation. If no candidate meets a stage’s criteria, we return to an earlier stage to iterate.
Figure 8: Multi-patch synthesis from single-edit data through iterative model pseudolabeling and edit history playback. Both pipelines bootstrap multi-edit samples from samples with single-edit supervision to teach the model when and how to continue edits beyond the first patch.
Figure 9: Targeted behavior curation pipelines. Iterative rewriting repairs examples of a recurring failure mode. After rewriting, quality and patch validity checks ensure that the repairs also meet the general training data quality requirements.
Source
Samples
Description
Converted NES data
8,447
The format converter expresses NES training samples as patches.
Bootstrapped data
8,447
Bootstrapping transfers edits from recorded histories and retains samples with at least one jump of 5 or more lines.
Invalid patch repairs
560
The repair pipeline corrects model outputs that fail a patch validity check and uses the corrections as ground truth labels.
Total
17,454
55% edit samples and 45% no-edit samples.
Table 3: SFT dataset composition. Converted NES and bootstrapped data contribute equally, and repaired invalid patch data supplements them.
Patches
1
2
3
4
5
6
7
8
9
% of edit samples
48.30
29.70
12.89
5.63
2.35
1.04
0.05
0.03
0.01
Table 4: Patch-count distribution among SFT samples that contain at least one edit. Single-patch and multi-patch examples each account for roughly half of samples with edits.
Category
0 edits
1 edit
2+ edits
Total
NES-converted no-edit
4,832
0
0
4,832
NES-converted single-edit
0
6,865
0
6,865
NES-converted multi-edit
0
0
745
745
Small, exact edits
132
1,200
167
1,499
Partial edits
19
2,000
471
2,490
Highly desired edits
369
14,485
1,576
16,430
Table 5: Phase 1 RL data by scenario and edit count. The mixture combines diverse edit scenarios with targeted repairs of known failure modes.
Source
All samples
0 edits
1 edit
2+ edits
Count
%
Count
%
Count
%
Count
%
Original NES data
33,177
50.3%
8,572
13.0%
22,383
34.0%
2,222
3.4%
New data
32,737
49.7%
5,177
7.9%
9,768
14.8%
17,792
27.0%
Total
65,914
100.0%
13,749
20.9%
32,151
48.8%
20,014
30.4%
Table 6: Phase 1 RL data by source and edit count, with percentages relative to the full mixture. The new data contributes roughly half of the samples but provides the majority of multi-edit examples.
Figure 11: Core logic behind the reinforcement learning custom grader, expressed as a decision tree focused on edit type. Given a rollout response yij and task ground truth, the grader branches on whether the ground truth requires no edit or contains edits, routing to rules-based checks, the no-edit LLM judge (thresholded at 0.5), or single- and multi-edit LLM judges (thresholded at 0.8) to determine the final binary reward Rij . We omit additional granular rules-based checks such as patch validity mentioned in Section 4.3.3 for brevity.
Figure 12: Grader boosting technique, illustrated by the insertion pattern propagation example (a) and the generalized RL grader-boosting mechanism (b).
Figure 13: Comparison of patch count reward configurations on key POE metrics after RL training. Candidates trained with the rules-based patch count bonus have a higher median patch count but lower median acceptance rate, patch validity, and acceptance-to-rejection ratio. Though these descriptive comparisons do not isolate causal effects, they motivate removing the bonus from the grader.
Figure 14: Augmented HumanEval subdataset scores against (a) critical and (b) total patch validity error rates. These results motivate our choice of critical-only penalties. Model checkpoints trained with them generally achieve higher completion scores with comparable critical error rates, though they exhibit more suboptimal patch errors. Notably, the shipped 2-in-1 checkpoint still maintains a low total error rate despite using critical-only penalties.
STests v1
STests v2
Augmented HumanEval
POE
QMH
Model
MustAvoid
Total
MustAvoid
Total
Single
Multi
Span
Mean patches
R/A → NE
Passes
SFT
89.6%
48.0/77
86.7%
36.8/79
79.6
53.9
72.5
1.32
1.59
13/19
RL stage 1
91.2%
51.6/77
91.4%
45.4/79
89.6
65.9
79.8
1.29
2.11
18/19
RL stage 2
91.2%
51.7/77
89.1%
45.6/79
92.0
75.9
84.2
1.30
2.23
19/19
Table 7: Phase 1 offline results for SFT and two RL stages. RL improves STests, Augmented HumanEval, and POE over SFT while maintaining a similar mean patch count; we use QMH for checkpoint selection and show it for reference.
Metric
Rel. change (%)
p -value
Shown suggestions
+2.25±8.58
0.6069
Accepted suggestions
−2.63±9.35
0.5819
Dismissed suggestions
+16.00±19.10
0.1006
Ignored suggestions
+3.40±8.50
0.4327
ARC at 30 seconds
+2.94±9.08
0.5257
ARC at 5 minutes
+1.26±9.56
0.7966
Table 8: Phase 1 online A/B experiment results for the 2-in-1 model paired with the completion model relative to the three-model baseline. Latency and token counts decrease, with no statistically significant regression in other quality and engagement metrics.
Metric
Rel. change (%)
Accepted suggestions
−22.45±11.24
ARC at 30 seconds
−18.99±11.73
Table 9: Initial Phase 2 online experiment removing the separate completion model. Relative changes compare the 2-in-1 model alone with the 2-in-1 model paired with the completion model. Using the 2-in-1 model for completion without additional training results in statistically significant regressions.
Source
Samples
Upsampling
Converted completion
40,000
1x
Converted NES
33,000
1x
Converted joint model
11,069
1x
Multi-edit with first edit ghost text at cursor
2,653
1x
Completion length
908
10x
Table 10: Datasets added to the Phase 2 RL mixture. Added examples target ghost text at the cursor and completion length. Completion length examples receive tenfold upsampling to increase their representation.
Source
Samples
Phase 1 Upsampling
Phase 2 Upsampling
Rewritten invalid patches
560
1x
5x
Rewritten incorrect insertion pattern propagation
355
5x
50x
Table 11: Upsampling of inherited patch validity and insertion pattern propagation data. Phase 2 increases both factors to maintain coverage of known failure modes as the mixture expands.
Source
Samples
Ghost text share
Inherited 2-in-1 RL data
84,129
32.09%
Added Phase 2 data
95,802
92.38%
Total
179,931
65.52%
Table 12: Phase 2 RL sample counts and ghost text shares after upsampling. We use the same view-kind classifier as Output View Kind v1 (Section 3.1 ). We compute the ghost text share by dividing the ghost text count by the total sample response count excluding no edit, whitespace-only, and unknown responses. The added data raises the mixture’s ghost text share from approximately 32% to 66%.
/path/to/util.py: 0
-def count_words(text: str) -> int:
+def count_words(text: str) -> int:
+ return len(text.split())
Figure 15: Speculative decoding drafts for a function body completion. The function signature is present when the client triggers the request; the body is the suggested insertion. Both lower panels show the same diff patch response and highlight the respective draft prefix.
Model response
Diff-based rendering
/path/to/aquarium.py:2
Insertion before cuttlefish :
-cuttlefish
+axolotl
+axolotl
+blobfish
+blobfish
+cuttlefish
Insertion after cuttlefish :
+dolphin
+dolphin
Figure 16: Diff-based view kind rendering of a replacement-shaped patch. The raw patch replaces cuttlefish with four lines, which the client can display as a side-by-side replacement. Computing the diff identifies cuttlefish as unchanged and separates the effective change into two insertions: axolotl and blobfish before it, and dolphin after it. The first insertion is at the cursor, so the client can render it as ghost text. Both presentations produce the same final code; the right column shows the inserted text, not additional model-generated patches.
Change from full configuration
Use 2-in-1 draft
Disable progressive reveal
Disable diff-based rendering
Metric
Rel. change (%)
p -value
Rel. change (%)
p -value
Rel. change (%)
p -value
Shown suggestions
−8.40±5.03
0.0011
−6.51±5.03
0.0113
+0.16±5.48
0.9534
Accepted suggestions
−7.87±5.50
0.0051
−10.22±5.44
0.0002
−1.28±6.12
0.6830
Dismissed suggestions
−4.47±8.93
0.3268
+1.92±9.15
0.6807
+2.67±9.29
0.5727
Ignored suggestions
−8.80±4.98
0.0005
−5.57±5.00
0.0290
+0.57±5.45
0.8385
Table 13: Rendering and speculative decoding ablations relative to the full configuration. The 3-in-1 draft and progressive reveal each increase accepted suggestions, while the draft also reduces latency. Diff-based rendering shows no statistically significant effect on measured outcomes.
Metric
Rel. change (%)
p -value
Shown suggestions
−5.31±5.35
0.0517
Accepted suggestions
−1.53±5.91
0.6106
Dismissed suggestions
−22.40±8.87
≈0
Ignored suggestions
−5.77±5.30
0.0328
ARC at 30 seconds
+1.41±5.77
0.6325
ARC at 5 minutes
+2.03±6.07
0.5119
Table 14: Cross-mode suppression ablation with the final 3-in-1 checkpoint held fixed and the other three client adaptations enabled in both groups. Relative changes compare the suppression-enabled treatment with the suppression-disabled control. Suppression reduces dismissed and ignored suggestions but increases latency.
Metric
Rel. change (%)
p -value
Shown suggestions
+2.09±11.55
0.7226
Accepted suggestions
−4.66±11.87
0.4410
Dismissed suggestions
+14.41±25.86
0.2748
Ignored suggestions
+3.76±11.53
0.5231
ARC at 30 seconds
−2.79±11.44
0.6321
ARC at 5 minutes
−3.12±11.80
0.6043
Table 15: Cache delay ablation using an earlier 3-in-1 checkpoint. Relative changes compare the zero-delay treatment with the existing 200-millisecond control. Removing the delay reduces time to display and time to produce, without statistically significant differences in suggestion quality or recurring engagement.
Figure 17: Learning curves of training-time metrics on sampled training data across three successive training stages. Phase 1 stage 2 improves insertion placement, while Phase 2 increases ghost text generation. Phase 2 changes the task mixture and reward criterion, so its lower starting reward is not directly comparable with Phase 1.
STests v1
STests v2
Augmented HumanEval
POE
QMH
Output View Kind v1
Model
MustAvoid
Total
MustAvoid
Total
Single
Multi
Span
Mean patches
Passes
No-edit ratio
Ghost text ratio
2-in-1
91.2%
51.7/77
89.1%
45.6/79
92.0
75.9
84.2
1.30
19/19
55.46%
47.47%
3-in-1
92.0%
52.8/77
89.1%
48.5/79
93.7
82.3
88.0
1.40
18/19
47.10%
72.51%
Table 16: Phase 2 offline comparison against the standalone 2-in-1 RL stage 2 checkpoint. The 3-in-1 model improves completion accuracy on all three Augmented HumanEval subsets and achieves the desired higher ghost text ratio, while matching or improving Simulation Tests scores. QMH passes decrease from 19/19 to 18/19.
Model only
Model + client
Metric
Rel. change (%)
p -value
Rel. change (%)
p -value
Shown suggestions
+7.73±6.85
0.0270
+4.78±6.22
0.1326
Accepted suggestions
+2.92±7.50
0.4447
+4.43±7.41
0.2408
Dismissed suggestions
+12.24±12.20
0.0492
−10.06±9.85
0.0453
Ignored suggestions
+9.31±6.91
0.0082
+5.64±6.05
0.0675
ARC at 30 seconds
−13.27±7.45
0.0005
−3.25±5.67
0.2613
Table 17: Phase 2 online results from two experiments, each relative to the 2-in-1 model paired with the completion model. The model-plus-client experiment applies all four client adaptations.
Figure 18: Suggestions by view kind for the 2-in-1-plus-completion control and the 3-in-1 release candidate with all four client adaptations applied, with counts reported as per-user means. The release candidate and client configuration together show fewer ghost text suggestions per user and lower dismissal rates in both view kind groups.
Question
Response format
1
How satisfied are you with the quality of inline suggestions in the past week (07/29 - 08/04, last Wednesday to this Tuesday)?
Numerical rating, 1 to 5
2
How does the quality of inline suggestions in the past week (07/29 - 08/04) compare with previous weeks (before 07/29)?
Much better; slightly better; same or no noticed difference; slightly worse; much worse
3
What improvements would you like to see for inline suggestions? (e.g., what are some common bad suggestions that you’ve encountered lately?)
Free text
4
In a typical week, on how many days do you use inline suggestions while coding?
Less than 1 day; 1 to 2 days; 3 to 4 days; 5 days or more
5
On days when you use inline suggestions, approximately how many hours do you actively use them?
Less than 1 hour; 1 to 2 hours; 2 to 4 hours; 4 to 6 hours; more than 6 hours
Table 18: Perception survey questionnaire for the 3-in-1 treatment group.
Figure 19: Perceived quality and days of use among survey respondents in the 3-in-1 treatment group. Respondents report either no change or an improvement relative to their recollection of the previous 2-in-1-plus-completion setup.
Phase
SFT runs
RL runs
A/B experiment candidates
Client-side PRs
Phase 1 (2-in-1)
15
173
14
96
Phase 2 (3-in-1)
0
35
10
17
Table 19: Development iterations by phase. Building on the 2-in-1 model, Phase 2 requires no SFT runs, about one-fifth as many RL runs, and fewer A/B experiment candidates and client-side PRs.
Figure 20: Key online metric relative changes compared to the control (expressed in % with 95% confidence intervals) and qualitative assessments across model candidates. ARC uses the 5-minute retention window. Controls are the three standalone models in Phase 1 and the 2-in-1-plus-completion model in Phase 2. Multiple rounds of iteration on data, model training, offline and online evaluation methods, client implementation, and other factors in each phase produce the final shipped configurations that meet both quantitative and qualitative quality standards.
Figure 22: Representative offline-online associations for Simulation Tests, Augmented HumanEval, and Output View Kind, separated by phase. Online changes are relative to each experiment’s control. Associations vary by benchmark and phase; none meets the adjusted significance threshold. Appendix E shows all pairings.
Figure 23: Representative offline-online associations for POE and QMH (continued), with online changes relative to each experiment’s control. Higher POE acceptance-to-rejection ratios accompany fewer dismissals in both phases, while QMH has little association with ARC in Phase 2. The single Phase 1 QMH observation does not support a correlation estimate; none of the displayed associations meets the adjusted significance threshold.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 24: The five draft formats in the comparison. Each panel shows the same illustrative diff patch response; purple highlighting marks the supplied draft prefix, and green marks the suggested insertion in the file content. No draft prefix is supplied in panel (a).
Figure 25: Request latency versus achieved RPS for five draft formats on the fixed 2-in-1 model: average, p50, and p95. From left to right, the five points on each curve correspond to 1, 4, 8, 12, and 16 concurrent clients. Lines connect measured points and do not represent additional experiments. Statistics retain failed requests, matching the source comparison report.
Reference file test.py , as it appears in the prompt
Table 20: Critical patch validity taxonomy. These responses either cannot be correctly parsed and applied to the file or produce a visible defect. Each minimal example uses the reference file shown at the top, with line numbers as they appear in the prompt.
Patch deletes and re-adds lines it does not change
Patch
test.py:2 - print("hello") - x = 1 + print("hello") + x = 2
Too many unchanged lines separate the modified lines
Patch
test.py:2 - print("hello") - x = 1 - return True + print("world") + x = 1 + return False
Pure deletion carries unneeded additions and deletions
Patch
test.py:2 - print("hello") - x = 1 + print("hello")
Appendix
Table 21: Suboptimal patch validity taxonomy. These responses are applicable and correct, but inefficient. Each minimal example uses the reference file of Table 20 .
Figure 27: Augmented HumanEval Multi-Line accuracy versus ARC at 30 seconds and 5 minutes, relative to each experiment’s control. Accuracy has only weak positive associations with retained characters in both phases.
Figure 28: Simulation Tests Total versus online suggestion changes, relative to each experiment’s control. Higher scores accompany more shown and dismissed suggestions in both phases, a pattern consistent with the benchmark capturing variation in suggestion frequency.
Figure 29: Output View Kind no-edit counts versus ARC at 30 seconds and 5 minutes, relative to each experiment’s control. Rank correlations are weakly positive in Phase 1 and negative in Phase 2, providing no consistent association between abstention and retained characters.
Figure 30: POE rejection rate and acceptance-to-rejection ratio versus dismissals and ARC, relative to each experiment’s control. Higher rejection rates and lower acceptance-to-rejection ratios accompany more dismissals in both phases; associations with ARC are less consistent.
Figure 31: POE counts of previously accepted suggestions converted to no edit versus ARC at 30 seconds and 5 minutes, relative to each experiment’s control. Rank correlations change sign between phases, providing no consistent association between these conversions and retained characters.
Figure 32: QMH passes versus ARC, shown, and accepted suggestions, relative to each experiment’s control. Associations are weak among the nine 3-in-1 candidates; the single 2-in-1 observation cannot support a correlation estimate. These results do not establish QMH as a predictor of online performance.
Diffusion large language models (dLLMs) are appealing for code generation because they can update many tokens in parallel, yet many are optimized for sequence synthesis rather than edit prediction. This setting is poorly matched to modern AI-assisted IDEs, where edit prediction must infer the next code change from recent edits, the current file, and cursor-local context. Such changes are usually sparse and preserve most source tokens, so regenerating a full code segment wastes computation. We propose Diff Diffusion, a diffusion-inspired LLM framework for code editing that predicts edit paths from an original snippet to its revised form. Diff Diffusion represents denoising as structured edit operations, and combines this formulation with multi-stage training and efficient parallel decoding. By focusing computation on changed regions, Diff Diffusion supports accurate low-latency edits and multi-position parallel modification. Across public edit-completion benchmarks, edit-prediction evaluations, and online validation, Diff Diffusion matches or leads autoregressive baselines while delivering 2.78 times faster inference on public edit-completion benchmarks and a 39.0% P50 model-latency reduction in production. This work provides a new modeling perspective for AI applications that require high accuracy and low latency.
Imperfections in AI-generated code require that software developers modify generations through manual code edits. However, little is known about how developers edit AI-generated code, and to what extent LLMs can infer implicit developer intent from this data, given the lack of high-quality, realistic code editing data. This information is essential for designing and building usable AI-developer interactions. To address this gap, we introduce DECODE (Developer Edits of Code Dataset), a dataset of 53.6K real-world in-IDE code edits of AI-generated code sourced from 1K+ developers. First, we use DECODE to analyze when, why, and how AI-generated code is edited. Developers invest little effort in editing code and abandon AI-generated code quickly, thereby motivating the need for LLMs to understand developer intents through their edits. Therefore, we next use DECODE to understand to what extent LLMs could infer developer edits. Predicting code edits is a challenging task for both frontier and fine-tuned models. Frontier models generate edits that best reflect developer intents, but are prone to over-editing and reverting developer-written edits. Fine-tuning LLMs can improve their ability to predict edits that are more similar to developers' as well as better reflect developer intent, but do not fully bridge the gap to frontier models. Together, our results demonstrate the unique insights on developer and LLM behavior that can be obtained through studying realistic code edit data to promote more better developer-AI interactions.
Large language models (LLMs) have become ubiquitous tools for code generation and editing. However, development teams often use multiple LLM assistants. Different developers may prefer different models, and individual developers may switch between models across different coding sessions. Because of this, the edits any one model makes are frequently applied to foreign code originally generated by another model. These LLMs are often trained on different datasets, and as a result have different stylistic preferences. Do LLMs behave differently when they edit foreign code originally written by a different LLM with a different coding style? We find that models tend to make more, and often excessive, edits on foreign code. We introduce CROCODIL (Cross-model Code Editing with LLMs), a post-training framework for reducing excessive edits while preserving functional correctness. CROCODIL's similarity reward penalizes large changes, while its execution reward scores build and test success. We use the product of these two rewards to encourage the policy to decrease the edit size without decreasing the edit task success rate. CROCODIL is available at https://github.com/EngineeringSoftware/Crocodil.