LeanRepair: Token-Efficient External Control for Local Code Repair
Abstract
Local coding agents keep source code private and give users direct control over deployment, but multi-candidate test-time reasoning incurs severe token costs that strain local serving budgets: under standard branch-and-merge search, every unguided generation, aggregation, and replayed context token burns inference computation without guaranteeing progress. We introduce LeanRepair, a deterministic external controller designed to improve the token efficiency of local code repair while maintaining competitive pass rates, requiring no training and no additional language-model calls. LeanRepair addresses two complementary sources of token expenditure: (1) context inflation, bounded by maintaining compact external edit-geometry state rather than replaying verbose histories, and (2) unproductive search persistence, mitigated via trajectory-aware early stopping that prunes remaining branch expansions when edit trajectories oscillate or stagnate. Across six repair benchmarks and four instruction-tuned backbones (24 cells), LeanRepair reduces token expenditure compared to Graph-of-Thoughts by a median of 23.9% across cells (and 23.0% pooled across the five non-QuixBugs benchmarks, reaching 82.4% on QuixBugs where baseline search suffers pathologically long loops), while achieving a competitive 75.4% aggregate pass rate (vs. 72.9% for GoT; 15 wins, 3 ties, 6 losses). Our findings demonstrate that lightweight, non-parametric external control can substantially reduce test-time token waste in local code repair without relying on expensive model-based reflection or learned value functions.
Then back it, or bet against it.
Related papers
Open the market on this paper to see 7 more related papers.