PreciseCoder: Faithful and Generalizable Debugging Beyond Unit-Test Rewards

Yunkai Zhan, Miaosen Chai, Shangshang Wang, Jike Zhong, Yuqing Yang, Deqing Fu, Serina Chang, Wang Bill ZhuarXiv 2026

TL;DR

PreciseCoder is a novel training algorithm that fixes a major flaw in code-debugging LLMs: the tendency to "over-edit" or hallucinate bugs in perfectly good code. By augmenting standard unit-test rewards with semantically verified edit precision, it produces models that are significantly more surgical and faithful, even generalizing to complex repository-level repairs.

What Problem Does This Paper Address?

Reinforcement learning (RL) from unit tests has become the dominant recipe for post-training code models. However, unit tests only care about the final output—they don't care how you got there. The authors find that this "outcome-only" reward inadvertently teaches models to be sloppy.

Models learn that rewriting large chunks of code is a viable path to passing tests, leading to over-editing (modifying correct lines) and bug hallucination (inventing and "fixing" bugs in code that wasn't broken). This behavior is costly: it inflates code review time, makes patches harder to audit, and can introduce subtle regressions that existing tests don't catch.

Illustration of over-editing and bug hallucination phenomena, alongside training dynamics showing how standard RL (GRPO) increases edit size over time.

Methods

The authors introduce PreciseCoder, which moves beyond simple pass/fail rewards. Its core innovation is a reward signal based on semantically verified precision and recall of edits.

  1. Localized Edit Rewards: Instead of just checking if the whole program passes, they score edits "fault by fault." They align predicted edits to a reference repair and use counterfactual execution to verify if a specific edit actually fixes a specific bug.
  2. $F_1$ Score Integration: They combine these precision and recall metrics into an $F_1$ score. Unlike raw edit size (which is only weakly correlated with correctness), this $F_1$ score provides a stable signal that encourages both passing tests and making minimal changes.
  3. GDPO Optimizer: They utilize Group reward-Decoupled Normalization Policy Optimization (GDPO) to balance the unit-test reward with the new $F_1$ reward, ensuring the model doesn't sacrifice pass rate for the sake of precision.

Datasets

  • PDB (Precise Debugging Benchmark): Used for training (PDB-Single-Full) and evaluation (PDB-Single, PDB-Wild). PDB-Wild is particularly challenging as it contains multi-line and repository-level bugs.
  • SWE-Bench Verified: A rigorous benchmark for real-world software engineering issues used to test generalization.
  • GT Debug: A set of 1,512 ground-truth correct programs used specifically to measure bug hallucination rates.
  • OOD Benchmarks: Evaluation on BigCodeBench, LiveCodeBench, HumanEval+, CruxEval, and DebugBench to ensure general coding capability remains high.

Key Insights and Ideas

  • The "Sloppiness" of Unit Tests: The paper demonstrates that unit-test rewards are a root cause of over-editing. As training progresses, models actually get worse at leaving correct code alone because they are never penalized for unnecessary changes.
  • Precision is Generalizable: Even though PreciseCoder is trained only on single-line bugs, the "discipline" it learns generalizes. It becomes significantly better at multi-line repairs and repository-level tasks without ever seeing them during training.
  • Reasoning as a Transfer Mechanism: A striking finding is "weak-to-strong" transfer. The reasoning traces (the "thinking" blocks) generated by a 9B PreciseCoder model can be fed into much larger frontier models (like GPT-5.6 Sol). This "advice" improves the larger model's precision by up to 12.4 points without any additional training.
  • Linguistic Shifts: Analysis shows that PreciseCoder models think differently. They are more likely to verbatim quote buggy lines and use "hedging" language (e.g., "might be") to weigh whether an edit is truly necessary.
The no-op rate (leaving correct code alone) scales linearly with edit precision across different model sizes and training methods.

Key Results

  • Surgical Edits: Across 4B to 27B models, PreciseCoder slashed the average number of edited lines from 7–15 down to just 3 lines per task, while maintaining pass rates on par with standard RL.
  • Curbing Hallucinations: On bug-free code, PreciseCoder increased the "no-edit" rate to 47–52%, compared to just 19–31% for models trained with standard unit-test RL.
  • Frontier Performance: A 27B PreciseCoder model outperformed its standard GRPO counterpart and several frontier models in both precision and pass rate.
  • Agentic Success: When used in a multi-turn editing agent, a 9B PreciseCoder model reached 67.4% edit precision, the best recorded for a model of its size.
Comparison of PreciseCoder against baselines on multi-line and repository-level repairs, showing superior precision and pass rates.

Limitations and Future Work

  • Language Support: The current implementation and evaluation are focused entirely on Python. While the methodology is language-agnostic, it requires a test harness and reference repairs for other languages.
  • Reference Dependency: Training requires a ground-truth reference repair to calculate precision and recall. While these can be sourced from benchmarks, it limits training on completely "unseen" bugs without a known solution.
  • Computational Overhead: Calculating semantically verified rewards adds a 5–7% increase in training time, though the authors note this can be mitigated through caching.
  • Future Directions: The authors suggest applying this "verified action" reward to other long-horizon agentic tasks where unnecessary actions can lead to safety risks or system instability.

Summary updated

BibTeX
@misc{zhan2026precisecoder,
  author = {Yunkai Zhan and Miaosen Chai and Shangshang Wang and Jike Zhong and Yuqing Yang and Deqing Fu and Serina Chang and Wang Bill Zhu},
  title = {{PreciseCoder: Faithful and Generalizable Debugging Beyond Unit-Test Rewards}},
  year = {2026},
  eprint = {2610.18755},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.18755},
}
Figure