Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities
Zhang & Chen in Interpretability
Can a model find the fault, yet miss its fix?
Right Verdict, Right Reason? An Execution-Grounded Study of Whether LLM Vulnerability Detectors Understand Vulnerabilities
A correct verdict can hide a wrong reason
A high detection score can reward answers that fail to separate a function from its fix.
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
A pair counts only if the vulnerable version is flagged and its screened repair is cleared.
- y^(fv)=V
- The vulnerable version gets a vulnerable verdict
- y^(ff)=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
Among 341 paired functions where a fix changed vulnerable code and the trigger was observed, it changed the trigger line in 40.2%.
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
CodeLlama-34B labels almost every version vulnerable, reaching F1 0.665.
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.
Jaccard penalizes both kinds of mismatch
Shared lines raise the score; omitted reference lines and extra citations both lower it.
- ∣E∩T∣
- Lines shared by the evidence and reference
- ∣E∪T∣
- All lines in either set
Commercial models beat the keyword shortcut
It cites as many lines, prioritizing risky identifiers, and finds the trigger about twice as often as random selection.
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
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.
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
All four commercial models beat the added-guard rule by 6.0 to 14.3 percentage points on run prediction.
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.
Why it matters
- 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?
15 slides, 4 min
25 Nov 2026