Most automated debugging tools for large language models (LLMs) put a pile of evidence in front of the model and ask it to point at the buggy line. That evidence includes the bug report, the failing test, and a ranking of lines that run more often in failing tests than in passing ones. This works when a crash leaves an explicit clue. It breaks down on logic bugs, where the program runs to completion and quietly returns the wrong answer. We propose a different question. Record the actual inputs and outputs of every method call during a failing test. Then walk the call tree and ask an LLM, acting as a judge, one narrow question per call: given these recorded inputs and what the bug report says the program should do, is this recorded output already wrong? The root cause is a call whose output the judge marks wrong while every call it made returned correct values. The LLM never has to imagine execution. It only judges whether concrete, observed values are correct.
The opportunity matters because logic errors are where current LLM fault localization fails. In FuseFL, the large majority of failures were logical output errors rather than crashes. Meanwhile, LLM-as-a-judge research has shown two things: judges become reliable when their verdicts are decomposed into step-level checks with error-propagation tracking, and judges reading code without execution tend to pattern-match on surface features. Our proposal turns the judge into a correctness oracle for real runtime values, and it uses the passing tests and the fixed program version both to calibrate the judge and to grade it.
Core Claim
A narrow, per-call correctness judgment over real recorded values should localize logic bugs better than a single holistic prompt containing the same information. Two reasons support this. First, each judgment is local and checkable: the judge compares one input-output pair against intent. It no longer has to reason across an entire failing execution. Second, the search can prune whole subtrees whose outputs are judged correct. SBFL (spectrum-based fault localization, which scores code by how often it runs in failing versus passing tests) is used only to order which child calls to inspect first. It is not treated as evidence of guilt.
This also lets us measure, for the first time on real Java and Python bugs, how accurate an LLM judge is as a per-step oracle. The ground truth comes for free: re-run the test on the developer-fixed version, align the calls, and label each call as "infected" if its output differs. Ordering the inspection by SBFL rather than giving the judge SBFL scores also guards against the shortcut anchoring documented in The Silent Judge. That paper found GPT-4o shifting verdicts on recency and expertise cues while never acknowledging those cues in its reasoning.
Relation to Prior Work
Two lines of fault localization work motivate the proposal and supply its baselines.
The statistical fusion methods combine text retrieval with test spectra, and they show the two modalities are complementary:
- AML adaptively weights text, spectra, and suspicious-word scores.
- NetML regularizes over bug and method similarity graphs.
- SBIR aggregates statement-level BM25 with SBFL without training labels.
All three produce rankings from co-occurrence statistics. None ever inspects a runtime value.
The LLM line puts this evidence into prompts:
- FuseFL feeds Ochiai rankings, test inputs and outputs, and code descriptions to GPT-3.5 in one chain-of-thought pass.
- AgentFL splits project-level localization across comprehension, navigation, and confirmation agents.
- FlexFL narrows the search space with IR and SBFL before an open model refines it.
These systems ask the model to generate a location. We instead ask it to verify local value correctness. That turns an open-ended search into a sequence of yes/no checks whose accuracy we can measure.
The judge literature supplies the method and the constraints:
- AgentEval shows that step-level judging over a dependency graph, with propagation tracking, sharply raises failure-detection recall and root-cause accuracy. Its graphs, however, are over agent actions, not program calls. We transfer the idea to dynamic call trees, which are trees per test and so avoid the unbounded-loop problem AgentEval reports.
- MCTS-Judge improves code judgment through search with simulated execution. Simulated state is exactly what the logic-error failures in FuseFL suggest LLMs get wrong, so we replace simulation with recorded values.
- AutoCalibrate induces judge rubrics from a handful of labeled examples. We reuse that procedure to induce a per-call correctness rubric.
- The Silent Judge constrains the design. Any metadata shown to the judge must be tested for unacknowledged influence.
The patch-assessment works (PatchZero, Quatrain, Invalidator) judge whole patches, not intermediate states. Invalidator's reliance on the fixed reference is something we use only offline, for grading, never at inference.
Research Program
Recording the call tree. We build a recorder that, for each failing test, captures the dynamic call tree restricted to project code. Each node stores:
- the callee's source,
- serialized arguments and receiver state on entry,
- the return value and the mutated receiver state on exit.
Large objects are summarized by field-level diffs and truncated collections. For Java we use a bytecode agent; for Python, a trace hook. The recorder also indexes the same method's input-output pairs from passing tests. These serve as "known-good" behavior the judge can consult.
The judge prompt. For each node, the judge sees:
- the bug report or test intent,
- the method's code and documentation,
- the recorded entry and exit values,
- up to a few passing-test examples of the same method.
It returns a probability that the output is already wrong.
The search. Search starts at the test's entry call and descends into the children judged most likely wrong. Children are ordered by Ochiai suspiciousness so the most suspicious callees are checked first. A node is reported as the root cause when it is judged wrong and all its project-code children are judged correct. Candidates are ranked by the product of these probabilities.
Calibration. The rubric is induced with AutoCalibrate from 10–12 labeled nodes per project. Verdict probabilities are then temperature-calibrated on held-out nodes. Calibration matters here because errors compound along a path. If each verdict is right with probability $p$ and the root cause sits at depth $d$, a greedy descent succeeds with roughly $p^{d}$ before backtracking. This makes per-node accuracy, not overall prompt quality, the quantity to improve. It is also why we keep the top few frontiers rather than one path.
Measuring the oracle itself. The per-node infection labels, derived by diffing against the fixed version, let us report judge accuracy and calibration at the node level. We expect this to be a reusable dataset of its own.
Baselines
Pure SBFL. The naive reference point is Ochiai over method-level spectra. It is what our ordering heuristic uses, so any gain must come from the judge rather than from the ordering.
Statistical fusion without an LLM. This is SBIR's rank aggregation of BM25 and SBFL from Better Automatic Program Repair by Using Bug Reports and Tests Together, lifted to method level. It is the cheapest serious competitor and needs no model. We run it on identical bug sets with the same tests. The file reports no Top-1 localization number for SBIR on Lacuna, so we will measure it ourselves.
Strongest LLM competitor at project level. This is AgentFL. AgentFL reports 157 of 395 Defects4J v1.2.0 bugs localized at Top-1, at $0.074 per bug.
Strongest open-model competitor. This is FlexFL. FlexFL reports that with Llama3-8B it located 42 and 63 more Top-1 bugs than AutoFL and AgentFL on Defects4J v2.0.0. The file gives these only as relative counts.
Non-agentic learned baseline. This is BAP, which reports 33.4% Top-1 on Defects4J. We include it as the strongest method that uses no execution at all.
Single-file baseline. On Refactory, the baseline is FuseFL, with 197 of 324 Top-1 per FuseFL.
Fairness. We rerun AgentFL, FlexFL, and FuseFL with the same backbone models as our judge, one closed and one open 8B model. We cap total tokens per bug at the competitor's measured average and give every method the same prompt-tuning budget on the same development projects.
What counts as winning. Beating AgentFL means more Top-1 bugs than its rerun count at equal or lower token cost, with the margin concentrated on assertion-failure bugs.
Ablation of the key ingredient. The decisive ablation keeps the identical search and judge but withholds recorded values. The judge then sees only code and test inputs, so it must simulate execution, as MCTS-Judge does. If this ablation matches the full system, recorded values are not the ingredient that matters.
Why not just…?
Why not just paste the recorded values into a FuseFL- or AgentFL-style prompt? This is the most serious threat. It would test whether the per-call decomposition matters or only the extra evidence. We run exactly this "flat-dump" variant: the same recorded values for the top SBFL-ranked methods, at the same token budget, in one pass. Two pieces of prior evidence suggest decomposition should help. AgentEval's large recall gap between step-level and end-to-end judging points that way, as do the context-length degradations reported for both AgentFL and BAP. Still, if the flat-dump variant matches us, we will report that the contribution is the recorder rather than the judge.
Why not just use rank aggregation like SBIR or NetML, which is fast and deterministic? These methods cannot tell coincidental execution from infection, because they never look at values. Coincidental correctness is precisely SBFL's known failure mode. We expect them to stay competitive on crash bugs and to fall behind on assertion-failure bugs. The error-type split in our experiments tests this directly.
Why not just let the judge simulate execution, as MCTS-Judge does, and skip instrumentation? Simulation removes engineering cost but asks the model to track state mutations. FuseFL's logic-error failures suggest this is where LLMs fail. The no-values ablation answers the question, and node-level accuracy under the two conditions will show where simulation breaks.
Why not just train a probe like BAP? BAP is cheap and strong, but it degrades beyond roughly 50–60 lines and uses neither bug reports nor execution. We report it as a reference. We also test a hybrid in which BAP scores replace Ochiai for child ordering, since ordering is the slot where it could genuinely help.
Proposed Experiments
Benchmarks. We evaluate at the method level on Defects4J v1.2.0 and v2.0.0, using Top-1, Top-3, and Top-5 counts, judge queries, and dollar and token cost. We report results statement-level on Refactory, where calls are fewer and lines can be ranked within the root-cause function.
Error-type split. Each bug is labeled as an exception or an assertion failure from its failing-test outcome. The central prediction is that our gain over AgentFL and FuseFL is larger on assertion failures. If the gain is uniform or concentrated on crashes, the logic-bug motivation is wrong.
Oracle quality. From the fixed-version node labels, we report per-node judge accuracy, expected calibration error, and how localization success decays with root-cause depth. We check this decay against the $p^{d}$ prediction to see whether backtracking is doing real work.
Shortcut sensitivity. We follow The Silent Judge's design, measuring both how often verdicts flip and how often the judge's reasoning mentions the injected cue. Two perturbations are tested. First, we show the judge a falsified suspiciousness score or a fabricated "recently changed by" note on correct nodes. Second, we swap descriptive identifier names for neutral ones. A judge whose verdicts move with these cues while never mentioning them is not trustworthy as an oracle. In that case, the design must keep such metadata out of the judge's view, as the current proposal already does.
Generalization. We run a transfer check on a sample of SWE-bench Verified instances, using the Python recorder and the issue text as intent. This tests whether a rubric calibrated on Defects4J carries over to a different language and to issue-style intent descriptions.
References
- The Silent Judge: Unacknowledged Shortcut Bias in LLM-as-a-Judge
- Information retrieval and spectrum based bug localization: better together
- Network-Clustered Multi-Modal Bug Localization
- Better Automatic Program Repair by Using Bug Reports and Tests Together
- Demystifying Faulty Code: Step-by-Step Reasoning for Explainable Fault Localization
- AgentFL: Scaling LLM-based Fault Localization to Project-Level Context
- FlexFL: Flexible and Effective Fault Localization With Open-Source Large Language Models
- AgentEval: DAG-Structured Step-Level Evaluation for Agentic Workflows with Error Propagation Tracking
- MCTS-Judge: Test-Time Scaling in LLM-as-a-Judge for Code Correctness Evaluation
- Calibrating LLM-Based Evaluator
- PatchZero: Zero-Shot Automatic Patch Correctness Assessment
- Is this Change the Answer to that Problem? Correlating Descriptions of Bug and Code Changes for Evaluating Patch Correctness
- Invalidator: Automated Patch Correctness Assessment Via Semantic and Syntactic Reasoning
- Where's the Bug? Attention Probing for Scalable Fault Localization