TL;DR
CodeTriage is a learned search policy that makes LLM-based code repair significantly more efficient by "looking before it leaps." By analyzing test failures and proposed edit descriptions before generating any code, it reduces program revisions by 21% and token usage by 12% compared to state-of-the-art baselines, while generalizing seamlessly across different repair models.
What Problem Does This Paper Address?
Repairing buggy code with Large Language Models (LLMs) is typically an iterative process: the model generates a fix, runs tests, sees what failed, and tries again. This "feedback loop" is powerful but incredibly expensive. Every single attempt (or "expansion") requires generating hundreds of tokens and executing a full test suite.
Existing search strategies for exploring these "repair trees" often rely on simple statistics, like the fraction of unit tests passed or how many times a particular branch has been tried. However, these metrics are "blind" to the actual content of the code and the nature of the errors. A program passing 90% of tests might be one character away from a fix, or it might have a fundamental architectural flaw. The challenge is deciding which proposed repair path is most promising before spending the compute to generate and test the code.
Methods
The authors introduce CodeTriage, a system that separates the proposer (the LLM suggesting what to fix) from the priority model (the model deciding which suggestion to try first).
The core of CodeTriage is a lightweight 0.6B-parameter priority model. For every potential edit in the search frontier, the model reads:
- Execution Feedback: The actual error messages from the failed tests.
- Failure Diagnosis: The proposer's explanation of what went wrong.
- Proposed Edit Text: A natural language description of the intended change (e.g., "guard the empty-list case").
- Numerical Features: Pass rate, tree depth, etc.
Instead of predicting a simple "success/fail" binary, the model predicts a solve-distance distribution—the probability that a fix is 1, 2, 3, or more steps away. It uses a "discrete-survival likelihood" for training, which allows it to learn even from "censored" data (branches where a fix wasn't found within the search depth, providing a lower bound on the distance).
Datasets
The researchers constructed a massive new corpus to support this work:
- Source: Approximately 8,700 Python problems from the "hard" subset of KodCode-V1 (including problems from Codeforces, APPS, and others).
- The Corpus: A collection of 12.2 million executed program versions organized into repair trees.
- Proposers: The main corpus was built using Qwen3-Coder-30B, with auxiliary data from three other models (Devstral, Nemotron, etc.) to test generalization.
Key Insights and Ideas
- Semantic Prioritization: The biggest "aha moment" is that the textual description of a planned edit is a highly predictive signal. Knowing what the model intends to do is often more useful than knowing how many tests the current (broken) version passes.
- Global Comparisons: CodeTriage doesn't just rank edits for a single program; it compares all pending edits across the entire search frontier. It might decide that the second-best idea for "Program A" is actually more promising than the best idea for "Program B."
- Learning from Failure: By using survival analysis techniques, the model treats failed repair paths not as useless noise, but as valuable evidence that a fix is "at least X steps away," which helps calibrate its distance predictions.
- Model Agnosticism: Because the priority model only looks at the descriptions of edits and errors, a small model trained on one LLM's repair attempts can successfully guide much larger, completely different LLMs.
Key Results
CodeTriage consistently outperforms traditional search algorithms like Breadth-First Search (BFS), Monte Carlo Tree Search (MCTS), and REx:
- Efficiency: It finds fixes with 21% fewer program revisions than the strongest baseline (AB-MCTS) and 12% fewer output tokens than REx.
- Zero-Shot Transfer: When tested on 11 unseen repair LLMs (ranging from Gemma to GPT-OSS), CodeTriage achieved the highest success rate across all search budgets without any retraining.
- Qualitative Success: In complex cases, CodeTriage was shown to correctly prioritize a branch with a lower initial pass rate because the semantic description of the edit suggested a more fundamental and correct fix than its siblings.
Limitations and Future Work
- Language Scope: The current study is limited to Python. While the principles should generalize, the model would likely need training on other languages to handle their specific error formats and idioms.
- Information Sharing: The current model treats each branch independently. The authors suggest that sharing information across different branches of the repair tree could further improve efficiency.
- Horizon: The experiments focused on a maximum repair depth of 4. Exploring how these learned policies behave over much longer, more complex repair trajectories is a noted direction for future research.
Summary updated