Make Every Expansion Count: Learning to Search Efficiently in LLM Code Repair

Elad Sharony, Ido Greenberg, Jialin Song, Shie Mannor, Gal Chechik, Eli MeiromarXiv 2026

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).

Figure 1: The search problem. (a) Repair tree: each expanded node proposes k edits; the policy expands one edge at a time, in the circled order, until a node passes every test. (b) Expanded node: what the policy observes, i.e. the program, its pass rate, the execution feedback, the diagnosis, and the k proposed edits. (c) Frontier (shaded): all proposed edits not yet expanded (dashed, blue); their programs have not been generated, so their pass rates are unknown.

The core of CodeTriage is a lightweight 0.6B-parameter priority model. For every potential edit in the search frontier, the model reads:

  1. Execution Feedback: The actual error messages from the failed tests.
  2. Failure Diagnosis: The proposer's explanation of what went wrong.
  3. Proposed Edit Text: A natural language description of the intended change (e.g., "guard the empty-list case").
  4. Numerical Features: Pass rate, tree depth, etc.
Figure 2: CodeTriage. Left to right: the parent feedback, diagnosis, and proposed edit for each frontier edge are serialized into one sequence and passed through a 0.6B language model. Four numeric features are concatenated (⊕) before the MLP head emits a (D+1)-bin distribution over the edge’s solve distance t, the number of expansions its branch needs to reach a fix. That distribution reduces to one scalar priority s, and deterministic best-first search expands the argmax (green).

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.
Figure 4: Transfer to eleven unseen repair LLMs. CodeTriage (green) consistently achieves higher success rates at lower mean expansion costs across a wide variety of proposer models.
  • 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

BibTeX
@misc{sharony2026make,
  author = {Elad Sharony and Ido Greenberg and Jialin Song and Shie Mannor and Gal Chechik and Eli Meirom},
  title = {{Make Every Expansion Count: Learning to Search Efficiently in LLM Code Repair}},
  year = {2026},
  eprint = {2610.15894},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.15894},
}
Figure