Manuscript Offprint

arXiv:2609.00854

Does Fault Localization Beat a Fresh Attempt? A Placebo-Controlled Study of Test-Guided Code Repair

Anik Jha

Abstract

Fault localization can focus a code model's repair on the statements a failing test implicates, but a targeted edit may succeed merely because it is small, and a second model call may succeed without using the failure at all. We separate these explanations with three arms applied to the same failed candidate (blind whole-solution resampling, spectrum-based localization followed by suspect-span infilling, and same-length infilling at a disjoint random code span) across three frozen 26–32B models, three benchmarks and 488 failing candidates, plus a separately declared 24B fourth model from a third family. Three results follow. First, localization is rarely available: only 9.0% of failing candidates expose a failing public test with a usable spectrum, because the largest group of failures passes every test the user can see. Second, among the 177 candidates localizable from a strong suite, localized infilling loses decisively to blind resampling at a matched number of attempts (3:40, p=3.0×10−9p = 3.0 \times 10^{-9}), in the direction opposite to our hypothesis. That loss replicates in a third family: on 62 candidates from Mistral-Small-24B, run on two of the three benchmarks, it is -11.3 points (0.6% against 11.9%, 95% CI [-16.6, -6.8], discordance 0:25), the largest margin we measure, so our rule's two-family replication clause is satisfied only in the inverted direction, by the method losing to its own comparator. Third, giving the span arm more room does not rescue it: widening the edit until the median span grows from 1 line to 5 lines leaves it still losing, and an adaptive policy adds at most +0.6 points over always editing wider. Against the random-span placebo localized infilling leads pooled (11:1, Holm-adjusted p=.019p = .019), but that lead resolves in no individual model under the per-model attempt-level analysis our shipped analysis plan designates primary (best Holm p=.087p = .087), so we report the location effect as suggestive rather than established. Re-pricing attempts as tokens narrows but does not overturn this: a span attempt spends 21.7 generated tokens against 371.1, yet 16 localized attempts reach 6.8% while one blind attempt already reaches 10.1%. The mechanism is visible in the generations: infilling reproduces the removed span verbatim in 48.9% of attempts and yields 0.23 distinct programs per attempt against 0.83 for resampling. A capability probe down to 0.6B cannot carry the location comparison at all, because 65.5% of the span arms' spliced programs do not parse at that scale, so we restrict every localization conclusion to the 24–32B models tested.

1 Introduction

Testing and debugging are explicitly part of verifiable coding: tests provide executable evidence that a behavior is wrong, while fault localization proposes where to intervene. Large language models (LLMs) make the intervention easy to generate, but they also introduce a basic evaluation problem. If

Preprint.

a model repairs a localized span, did the test signal identify useful code, did any small edit have a better chance than regenerating the whole program, or did an additional sample provide all of the benefit?

These explanations require different controls. Recent placebo-controlled studies of frozen small code models find that blind resampling can match or outperform feedback-conditioned self-repair [Iscan, 2026a,b, Verma, 2026]. In parallel, fault-localization studies show that more precise locations can improve repair when locations are supplied by developer patches or other oracles [Sepidband et al., 2026, Liu et al., 2026]. Neither result answers whether predicted, test-derived localization makes a targeted retry preferable to a fresh attempt. Refining the whole program has been argued to beat localized hunks [Xu et al., 2024], and the closest infilling work varies masked locations [Koutcheme et al., 2023], but neither separates the fresh sample from the edit size with a matched attempt budget and a random-location control.

We test this missing comparison on the same initially failing candidate with three arms: blind whole-solution resampling; Ochiai spectrum-based fault localization (SBFL) from public tests, followed by fill-in-the-middle (FIM) replacement of the most suspicious tied span; and a disjoint, same-length random-code-span placebo. This design separates two questions:

  1. Does the chosen location add value over editing an equally sized but unrelated code region?

  2. Does localized editing add value over spending the same number of attempts on fresh solutions?

We declared a demanding success rule before running the experiment, recorded in the project's kickoff documentation: localized infilling had to beat both controls, exceed the placebo by at least five percentage points with Holm-adjusted p<.05p < .05, and replicate across at least two model families. We call this rule pre-specified rather than preregistered because the study plan was not registered with an external service. The rule was not met: the placebo margin is +3.2 points rather than five, no per-model test of the placebo comparison survives correction under either analysis, and localized infilling loses to blind resampling instead of beating it. Its replication clause is satisfied only in that last, inverted sense. We report what the evidence does support instead.

What it supports is a four-part answer. Localization is usually unavailable: only 9.0% of failing candidates expose a failing public test with a usable spectrum. Where it is available, a fresh attempt beats a targeted one at a matched attempt count (3:40,p=3.0×10−93:40, p = 3.0 \times 10^{-9}), resolving in two of the three original checkpoints under both analyses and again in a fourth model from a third family (-11.3 points, 95% CI [-16.6, -6.8]), so the cross-family bar we set in advance is met by the method losing to its own control. Localized infilling does lead an unrelated edit of the same size when pairs are pooled (11:1, Holm p=.019p = .019), but in no individual model under the primary analysis, so we carry it as suggestive. Widening the edit does not rescue it, and re-pricing attempts as tokens narrows rather than overturns the result: localization leads only below 372 tokens, the price of one fresh attempt.

Our contribution is evaluative rather than a new repair algorithm. We provide (1) a two-control protocol for test-guided repair, in which the random-span placebo is what separates “the location was right” from “the edit was small”; (2) a localizability audit over 488 failures reporting how often public tests support localization at all; (3) a budget analysis in both attempts and tokens, with the edit-diversity measurements that explain why the two disagree; and (4) five concrete safeguards (Appendix B), each of which silently changed a measured result in our own pipeline before it was fixed. We make no formal-verification or correctness-guarantee claim.

References (35)