# Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities

> This study tests 13 LLMs on execution-confirmed C/C++ vulnerabilities, probing verdicts, explanations, edits and run predictions. Commercial models localized faults beyond keyword rules, but single-function verdicts remained unreliable and execution-prediction gains over a guard rule were unclear on post-cutoff cases.

- arXiv: https://arxiv.org/abs/2611.28584
- Authors: Leizhen Zhang, Sheng Chen
- Published: 2026-11-25
- Topic: Interpretability
- Visual carousel: https://instaxiv.com/p/2611.28584
- Explanation by InstaXiv, a secondary educational summary. Cite the original paper for exact results. InstaXiv is not affiliated with or endorsed by arXiv or Cornell University.

## Can a model find the fault, yet miss its fix?

**43.4 pp** Claude Opus 5.5 P-C over chance, pre-cutoff

## A correct verdict can hide a wrong reason

**Benchmark score:** A high detection score can reward answers that fail to separate a function from its fix.

**The test:** Across 515 C/C++ functions and 13 models, this study asks whether verdicts track the execution that proves a fault.

## Pair-level scoring demands both judgments

$$
\mathrm{P\!\!-\!C}=\Pr\!\left[\hat y(f_v)=V\ \land\ \hat y(f_f)=N\right]
$$

A pair counts only if the vulnerable version is flagged and its screened repair is cleared.

- $\hat y(f_v)=V$: The vulnerable version gets a vulnerable verdict
- $\hat y(f_f)=N$: The fixed version gets a not-vulnerable verdict

## Five levels separate different kinds of evidence

1. **Separate (L1)**: Show vulnerable and screened fixed versions separately; P-C requires both verdicts right and is compared with chance and a surface-feature classifier.
2. **Locate (L2)**: Compare cited lines with the trigger or dynamic slice, against risky-keyword and random-line rules.
3. **Intervene (L3-L4)**: Blank or mark evidence; then test label-preserving edits, execution-confirmed fixes, local fixes and decoys.
4. **Predict a run (L5)**: Give the driver and input; compare fault and line predictions with guard rules and clean-input controls.

## Build a reference from the faulting run

1. **Replay one proof**: Replay one proof-of-concept input against both builds; keep instances where the vulnerable build faults and the fixed build runs clean.
2. **Mark the fault**: Use the fault-report line; if no in-function report frame exists, mark a separately flagged patch-derived trigger.
3. **Trace dependencies**: Trace data, memory, address, control and call/return dependencies back through that run; the resulting dynamic slice averages 16.7% of a function.

## A repair line is not always the fault line

**Fix lines:** Among 341 paired functions where a fix changed vulnerable code and the trigger was observed, it changed the trigger line in 40.2%.

**Execution:** The trigger names where one run faults; its dynamic slice contains executed lines on dependence chains leading to that fault.

A run-grounded target is narrower than a universal root-cause map.

## F1 can look strong while pair separation fails

**Aggregate F1:** CodeLlama-34B labels almost every version vulnerable, reaching F1 0.665.

**Matched pairs:** Its pair-wise-correct rate is 0.0%; an always-vulnerable detector also gets F1 0.67 without separating any pair.

A useful score must ask whether the model distinguishes the fix.

## What this evidence cannot establish

- **Selected programs**: The sample is C/C++ functions with reproducible proofs of concept, complete slices and screened fixes, not every vulnerability or detector.
- **Reference boundary**: A dynamic slice captures one run; causes mediated by heap state or checks missing from the function can fall outside it.
- **Exposure and generated edits**: The pre/post-cutoff samples may differ beyond exposure; GPT-6.1-sol and Claude Opus 5.5 generated some edits they later evaluated.

Best used when: Use this ladder to distinguish localization, evidence sensitivity and run-specific prediction, not to certify general security understanding.

## Jaccard penalizes both kinds of mismatch

$$
J(E,T)=\frac{|E\cap T|}{|E\cup T|}
$$

Shared lines raise the score; omitted reference lines and extra citations both lower it.

- $|E\cap T|$: Lines shared by the evidence and reference
- $|E\cup T|$: All lines in either set

## Commercial models beat the keyword shortcut

**Keyword rule:** It cites as many lines, prioritizing risky identifiers, and finds the trigger about twice as often as random selection.

**Commercial models:** Their explanations cite four to five lines and beat the keyword rule by 30.5 to 52.9 percentage points on trigger-line hits.

This shows localization beyond a shortcut, not faithfulness to the model's stated reason.

## Does the verdict use the evidence?

1. **Matched removal**: Blank dynamic-slice lines only in vulnerable code; compare pair discrimination with equally many random lines blanked.
2. **Most models shift**: Against random blanking, removal lowers P-C by 8.7 pp for GPT-6.1-sol, 9.8 for GPT-5.6-sol and 4.6 for Claude Opus 4.8.
3. **One exception, then not**: Claude Opus 5.5's pre-cutoff P-C barely moves; on post-cutoff cases, slice removal lowers it 13.5 pp versus random blanking.

## Stable under renaming, uneven on real fixes

**Surface changes:** Renaming preserves the verdict on vulnerable versions in 87.5 to 96.9% of functions; pair discrimination stays within a few points of the original.

**Actual repairs:** Among cases already called vulnerable, Claude Opus 5.5 accepts 83.3% of developer fixes; GPT-6.1-sol, 42.7%. Variant labels were execution-confirmed.

Label-preserving robustness is not the same as recognizing a repair that removes the tested fault.

## A concrete input changes the prediction task

1. **See the actual run**: Models get driver code, command line, input bytes and a function version, then predict whether and where this run faults.
2. **Beat a guard shortcut**: All four reach 86.3 to 94.6% on 533 versions from 109 functions, versus 80.3% for a rule that treats an added conditional as a fix.
3. **Follow the input**: For vulnerable functions, clean-run predictions on 60 benign inputs reach 98.3 to 100%; both attack and benign outcomes are right on 68.3 to 88.3% of functions.

## New vulnerabilities preserve some skills, not all

**Before cutoffs:** All four commercial models beat the added-guard rule by 6.0 to 14.3 percentage points on run prediction.

**Post-cutoff cases:** Among 97 later CVEs with complete slices, localization stays 34.2 to 46.7 points above keywords. Later-set L5 margins versus the guard rule span -6.0 to +2.0 points; all intervals include zero.

Claude Opus 5.5 falls from 67.2% to 37.1%; on 97 all-slice pairs, it remains 16.0 points above chance.

## Key takeaways

- Fault localization is a real strength here, but a cited fault line does not prove a verdict depends on it.
- Evaluate patches with matched versions and execution-confirmed inputs, and compare explanations against risky-keyword shortcuts.
- Open question: can execution-grounded tools improve decisions on new code without making ambiguous single-function cases default to vulnerable?

## Links

- arXiv: https://arxiv.org/abs/2611.28584
- PDF: https://arxiv.org/pdf/2611.28584

## Citation

```bibtex
@article{zhang2026right,
  title   = {Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities},
  author  = {Zhang, Leizhen and Chen, Sheng},
  journal = {arXiv preprint arXiv:2611.28584},
  year    = {2026},
  url     = {https://arxiv.org/abs/2611.28584}
}
```
