Papers › A Structural Model for Contextual Code Changes
A Structural Model for Contextual Code Changes
Shaked Brody, Uri Alon, Eran Yahav
We address the problem of predicting edit completions based on a learned model that was trained on past edits. Given a code snippet that is partially edited, our goal is to predict a completion of the edit for the rest of the snippet. We refer to this task as the EditCompletion task and present a novel approach for tackling it. The main idea is to directly represent structural edits. This allows us to model the likelihood of the edit itself, rather than learning the likelihood of the edited code. We represent an edit operation as a path in the program's Abstract Syntax Tree (AST), originating from the source of the edit to the target of the edit. Using this representation, we present a powerful and lightweight neural model for the EditCompletion task. We conduct a thorough evaluation, comparing our approach to a variety of representation and modeling approaches that are driven by multiple strong models such as LSTMs, Transformers, and neural CRFs. Our experiments show that our model achieves a 28% relative gain over state-of-the-art sequential models and 2x higher accuracy than syntactic models that learn to generate the edited code, as opposed to modeling the edits directly. Our code, dataset, and trained models are publicly available at https://github.com/tech-srl/c3po/ .
Code
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
Code Syntology ran Syntology
Not run by Syntology. Nothing on this page verifies that the listed code works.
Tasks
Datasets
Introduced by this paper, per the archive.
Results from the paper archive 2025-07-28
| Task | Dataset | Model | Metric | Value | Rank at snapshot | Leaderboard | Report |
|---|---|---|---|---|---|---|---|
| EditCompletion | C# EditCompletion | C3PO | Accuracy | 53.2 | #1 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | LaserTagger (Transformer) | Accuracy | 41.4 | #2 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | LaserTagger (LSTM) | Accuracy | 40.9 | #3 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | SequenceR (Transformer) | Accuracy | 32.6 | #4 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | SequenceR | Accuracy | 30.7 | #5 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | Path2Tree (Transformer) | Accuracy | 25.5 | #6 of 7 | Archive leaderboard | report |
| EditCompletion | C# EditCompletion | Path2Tree (LSTM) | Accuracy | 22.5 | #7 of 7 | Archive leaderboard | report |
Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections