- The paper introduces PatchFusion, a novel approach that deterministically fuses evidence across candidate patches to produce a single correct repair without relying on runtime tests.
- It demonstrates significant performance gains over state-of-the-art selectors, achieving higher bug-repair counts and operating at 3.28 ms per bug.
- The paper’s method ensures auditable, reproducible patch selection through atomic-level fusion, effectively bridging the pass@k to pass@1 gap in automated program repair.
Deterministic Fusion in Automated Patch Selection: A Review of "A Single Patch Is Not Enough: Deterministic Fusion of Repair Candidates" (2607.01597)
Problem Context and Motivation
Automated program repair (APR) has leveraged LLM-based agents to generate pools of candidate patches for software bugs, with effectiveness typically measured using pass@k metrics—where a bug is considered solved if any of the k generated candidates repairs it [jimenez2024swebench]. However, in practice, developers or deployment systems must select and apply a single patch (pass@1), introducing a significant pass@k-to-pass@1 gap. This gap persists, even when candidate pools contain the correct patch, due to the inability of existing selection or ranking methods to consistently choose the correct solution. Traditional selection methods are limited: they either rank full candidates or utilize runtime signals (e.g., tests, LLM-as-judge), but none deterministically fuse evidence shared across candidate patches to construct accurate composite repairs.
PatchFusion: Approach
PatchFusion proposes a deterministic, static, and test-free approach for fusing evidence from multiple candidate patches, constructing a single auditable final solution from atomic edit-level agreement across candidates. It operates on fixed candidate pools, leveraging only pool structure (diffs, token/file overlap, edit atoms support) without consulting tests or model endpoints at decision-time. PatchFusion consists of four staged components:
- Candidate View and Exact Support: Diffs are canonicalized, and exact duplicates are merged with associated support counts, forming a distinct set of unique patches per bug.
- Repair-Neighborhood Fusion: Candidates are grouped into neighborhoods based on file and identifier-token overlap, using overlap graphs without fixed similarity cutoffs. The neighborhood most strongly supported (via Copeland's majority rule over support, size, cohesion, and file-concentration signals) is selected.
- Representative Selection: Within the dominant neighborhood, candidates are ranked on support and token centrality; local edits are optionally admitted if they do not cross file boundaries (same-surface guard), routed via confidences computed from pool centrality and fragmentation.
- Evidence-Constrained Fusion (ECF): Candidate patches are decomposed into scope-local edit atoms. Only atoms supported by multiple candidates are retained; unsupported atoms are pruned. Fused atoms are reconstructed into a final patch, subject to additional static guards (surface containment, strict contraction, and support dominance).
This pipeline produces a single, auditable patch per bug, ensuring traceability and reproducibility—a critical need for high-stakes deployment and code review workflows.
Experimental Evaluation
Benchmark and Baselines
A new benchmark, PatchFuseBench, is constructed from fixed multi-source candidate pools on SWE-bench Verified (500 Python bugs), SWE-bench Multilingual (300 bugs, 7 languages), and Defects4J (371 Java bugs). Candidate pools aggregate leaderboard entries and published runs, allowing direct, label-aligned evaluation of any selector on identical pools.
PatchFusion is compared against a comprehensive suite of state-of-the-art baselines including:
- Deterministic selectors: minimal-change, token medoid, hunk consensus, Borda/Copeland/MC4 rank aggregation, and Agentless [xia2025agentless].
- Learned rankers: LM naturalness [kang2022lmpatch].
- LLM-inference-based selectors: DeepSeek-V4-Pro, both in selection and free-form generative fusion modes.
- Test-based selectors that utilize regression outcomes.
- Upper/lower bounds: uniform-random selection and best-single-source per bug.
Numerical Results
PatchFusion achieves the highest bug-repair counts on all primary benchmarks:
- SWE-bench Verified: 426/500 bugs solved, +38 vs. random, +30 net uniquely solved over best single-source, within 17 of the candidate-reachable oracle ceiling.
- SWE-bench Multilingual: 236/300, +24 vs. random, +18 net uniquely solved over best single-source.
- Defects4J: 87/371 plausible, +40 vs. random, 25 above token medoid.
Ablation confirms that ECF content-fusion contributes +5/+6/+9 solved bugs across the three main benchmarks with no observed regression; these patches are compositional fusions not present in any single candidate. Notably, PatchFusion captures solutions that require synthesizing evidence across multiple candidates—recovering repairs unreachable by candidate-level selectors.
PatchFusion executes in 3.28 ms/bug (excluding candidate generation and preprocessing), outperforming LLM-based and test-based selectors by 2–3 orders of magnitude in decision latency. It is test/model-free, deterministic, incurs no API cost, and always produces auditable patches.
LLM-based free-form fusion (DeepSeek-V4-Pro), despite stronger underlying generation, performs substantially worse, with high rates of malformed/unapplicable outputs and frequent failure to select existing correct patches.
Theoretical and Practical Implications
PatchFusion advances the state of the art by reframing the selection problem: optimal use of candidate-pool complementarity demands edit-level aggregation, not full-candidate ranking. Deterministic, model-free fusion mitigates the risks of test overfitting and model-induced variance, supporting robust, scalable, and auditable repair deployment.
The strong numerical results undermine any presumed speed-accuracy tradeoff in this context; all evaluable methods relying on additional model or test cost underperform PatchFusion even as they incur greater resource and infrastructure burden. ECF's atomic-level selective fusion further anticipates compositional bugs requiring cross-candidate patching, which will be increasingly prevalent as future LLM agents sample larger, more diverse pools.
Practical implications include integration into agentic repair pipelines, code review tools, and automated maintenance. By ensuring low-latency, deterministic, and reproducible decisions, PatchFusion aligns with software engineering best practices and the growing scale of agentic code generation.
Limitations and Future Directions
PatchFusion’s benefit scales with the degree of complementarity in the candidate pool. While the methodology recovers substantial gains even in single-model pass@k settings, the greatest leverage emerges from multi-model/system pools. The residual selection gap is attributed to within-neighborhood candidate variance, suggesting future work should enhance static signals for edit necessity and explore hybridization with semantic or dynamic feedback.
Integrating deterministic atomic fusion with LLM-based agentic workflows presents an intriguing avenue for further expanding candidate pool diversity and bridging the final coverage gap toward candidate-reachable optima.
Conclusion
PatchFusion, via deterministic repair-neighborhood fusion and edit-atom evidence-constrained fusion, systematically surpasses prior deterministic, test-based, and model-augmented patch selectors across multiple APR benchmarks, at a negligible marginal compute cost. The approach formalizes a new paradigm for post-generation patch selection—compositional, auditable, and practical—offering robust implications for the future design of agentic software repair systems and code synthesis workflows (2607.01597).