Guided example selection raises LLM patch success to 49.2% pass@3
Selecting repair examples based on security impact improves LLM vulnerability repair pass@3 to up to 49.2%
Software arXiv 24 Nov 2026 Measurement Prototype evidence
Published as “Not Just Any Example: Security Requirements and Fix Patterns for Guiding LLM Vulnerability Repair”
Why it matters
Retrieval-augmented LLM repair can substantially improve automated vulnerability fixing, making open-weight models more practical for real-world security maintenance.
Summary
Guided example selection improves LLM vulnerability patch generation, raising the four-model mean pass@3 from 37.9% under zero-shot prompting to up to 49.2% (Cluster-guided) and 48.5% (Impact-guided), while random examples achieve only 36.9%. The study clusters 3,816 security patches, defines 12 security-impact classes, and maps them to concrete fix patterns. Retrieval-augmented repair also enables open-weight models to match or exceed a leading closed-source model on easy and medium targets. Gains shrink on harder targets, and random examples can hurt performance. The evidence is based on a real-world corpus of open-source patches and evaluation on 291 vulnerability targets.
What they found 2
- Guided example selection raises mean pass@3 from 37.9% to up to 49.2%, outperforming random selection (36.9%).
“Guided example selection raises the four-model mean pass@3 from 37.9% under zero-shot prompting to up to 49.2%, whereas randomly selected examples reach only 36.9%.”
- An oracle that uses carefully screened examples achieves 56.9% pass@3.
“Oracle provides an optimistic reference for carefully screened examples, reaching 56.9%.”
Caveats 3
- The gains for Cluster-guided and Impact-guided fall from 20.0 and 16.4 points on easy targets to 10.3 and 11.2 on medium targets and 3.8 and 4.8 on hard targets.
- Random examples instead reduce repair rates for three models, emphasizing that relevance matters.
- The remaining gaps on harder repairs motivate further research on retrieving and applying fix-pattern and security-impact knowledge.
What’s new here 3
- Provides a large-scale mapping between 12 security-impact classes and concrete fix patterns mined from 3,816 patches.
- Introduces retrieval-augmented LLM repair using cluster-guided and impact-guided example selection, showing substantial pass@3 improvements over zero-shot and random baselines.
- Demonstrates that relevant fix examples can bring open-weight LLMs to parity with a leading closed-source model on many targets.