Datasets:
image imagewidth (px) 1.05k 1.6k |
|---|
Technical report — independent replication & boundary analysis (draft). This repository is a response to Nie et al., VulnLLM-R: Specialized Reasoning LLM with Agent Scaffold for Vulnerability Detection (arXiv:2512.07533, 2025). It reproduces that paper's in-distribution result and then delimits where single-function vulnerability detection meets an informational ceiling on out-of-distribution, paired data. Model under study:
Euraika/VulnLLM-R-7B-GGUF· Benchmark: PrimeVul. Every empirical number is reproducible from thephase0_*data andmake_figures.pyin this repo. Citation metadata for the two central works has been verified against arXiv; remaining references are canonical.
The Interprocedural Ceiling: A Replication and Boundary Analysis of Single-Function Vulnerability Detection with VulnLLM-R-7B
A response to Nie et al., "VulnLLM-R: Specialized Reasoning LLM with Agent Scaffold for Vulnerability Detection" (arXiv:2512.07533, 2025).
Author's draft — prepared for a Findings / short-paper venue.
Abstract
Specialized reasoning language models have recently reported strong results on function-level vulnerability detection, with VulnLLM-R-7B — a Qwen2.5-7B-Instruct model fine-tuned with an agent scaffold — achieving approximately 80% F1 on its curated benchmark. We independently reproduce that in-distribution result and then ask a different question: does the capability transfer to hard, out-of-distribution code under the balanced pairwise protocol of PrimeVul, where a model must correctly judge both a vulnerable function and its minimally-patched twin? Serving the released model locally in 8-bit and evaluating blind on 564 PrimeVul pairs, we find pair-correct accuracy collapses to 17.4% (per-function F1 44.7), close to the floor of the metric. We then attempt to raise this number through five orthogonal interventions — verdict-only LoRA, self-taught reasoning distillation, frontier-teacher reasoning distillation, a sevenfold scaling of that distillation, and substitution of a 3.8×-larger base model. None reliably exceeds the base; the best (frontier-teacher distillation at 212 traces) reaches 20.0% before regressing to 14.2% when scaled, and the larger base scores 0.0%. To explain this capacity wall, we introduce a two-part decidability probe. A frontier oracle, shown both twins of each pair, judges that only 29.3% of pairs are decidable from the vulnerable function's own text; 70.7% require information defined outside the function (caller-established bounds, externally-defined types, global or configuration state). An off-the-shelf static analyzer run on the same functions recovers a directional signal on just 2% of pairs. We conclude that single-function detection has an information-theoretic ceiling near 29% pair-correct on distribution-shifted code, that this ceiling — not model capacity — bounds every in-function method, and that the honest deployment posture is high-precision triage over the decidable minority rather than uniform per-function verdicts. Our findings are consistent with, rather than contradictory to, the original paper: they delimit where its reported capability does and does not extend.
1. Introduction
Large language models fine-tuned for code have become a prominent tool for automated vulnerability detection, and a recent line of work has shown that domain-specialized reasoning models can substantially outperform general-purpose baselines on function-level classification. The VulnLLM-R system exemplifies this trend, pairing a 7-billion-parameter base model with a structured reasoning procedure and an agent scaffold to report approximately 80% F1 on its evaluation set (arXiv:2512.07533). Results of this magnitude invite an obvious and consequential question for practitioners: if a 7B model can detect vulnerabilities this well, is function-level detection effectively solved for local, privacy-preserving deployment?
This paper argues that the answer depends entirely on the evaluation distribution, and that the gap between benchmark performance and deployable capability is not a matter of degree but of kind. Our motivation is practical. A security engineer who downloads the released weights and runs them over unfamiliar C or C++ functions is operating out-of-distribution relative to the model's training curation, and is typically interested in a stringent question — can the model tell a genuinely vulnerable function from a nearly-identical safe one — rather than the marginal per-function accuracy that dominates many benchmark scores. The PrimeVul benchmark was constructed precisely to expose this gap: it pairs each vulnerable function with its minimally-patched counterpart and rewards a model only when it judges both correctly, a protocol that punishes the label priors and superficial pattern-matching that inflate single-function metrics.
We make three contributions. First, we confirm that the original paper's headline result reproduces: under the authors' own prompt and task formulation, the released model recovers roughly 80% F1, so the low numbers we report elsewhere reflect distribution shift and protocol, not a failure to reproduce. Second, we show through five independent interventions — spanning supervised fine-tuning, reasoning distillation from a frontier teacher, data scaling, and a substantial increase in base-model size — that the out-of-distribution pairwise ceiling is remarkably rigid, and that additional in-function training or capacity does not move it. Third, and most importantly, we explain why: using a frontier oracle with access to the ground-truth patch, we quantify how much of the deciding vulnerable-versus-patched signal actually resides inside the function being judged, and find that it is a minority. The remainder is interprocedural — it lives in callers, in externally-defined types, or in program state that no single-function method can observe. This reframes the problem from "the model is not good enough" to "the information is not present," with direct implications for how such models should be deployed and evaluated.
2. Background and Related Work
Function-level vulnerability detection has historically been benchmarked on datasets whose vulnerable and non-vulnerable examples are drawn from different functions, allowing models to exploit spurious correlations between surface features and labels. PrimeVul (Ding et al., 2024) responds to this weakness with a paired protocol: each vulnerable function is matched to the function that results from applying only the security patch, so that the two members of a pair differ minimally and share nearly all surface features. The associated pair-wise metrics — most stringently, the pair-correct rate, in which both members must be classified correctly — isolate genuine discrimination from label-prior exploitation. It is against this protocol that we evaluate.
VulnLLM-R builds on Qwen2.5-7B-Instruct (Qwen Team, 2024) and a structured chain-of-thought procedure, reporting strong results on its own curated data. Our interventions draw on established adaptation techniques: low-rank adaptation for parameter-efficient fine-tuning (Hu et al., 2021), self-taught reasoning in which a model's own correct-verdict rationales become training targets (Zelikman et al., 2022), and self-consistency as a test-time aggregation strategy (Wang et al., 2022). Our diagnostic contribution — measuring the fraction of pairs whose deciding signal is intra- versus inter-procedural — is, to our knowledge, a novel way of bounding the achievable performance of any single-function detector on a paired benchmark, and it complements static-analysis literature that has long distinguished intra- from inter-procedural dataflow.
3. Methods
3.1 Model and serving
We evaluate the publicly released VulnLLM-R-7B weights, a fine-tune of Qwen2.5-7B-Instruct. To reflect a realistic local-deployment setting, we serve the model through Ollama with 8-bit (Q8_0) quantization on an Apple M5 Pro with 48 GB of unified memory using the Metal backend. Unless otherwise noted, inference uses a temperature of 0.2 and the model's native ChatML formatting with the four-step reasoning procedure specified by the original authors, and a 32,768-token context window. Reproduction experiments (Section 4.1) additionally use the authors' exact prompt and candidate-CWE task framing.
3.2 Benchmark and metrics
Out-of-distribution evaluation uses the test_paired split of the ASSERT-KTH distribution of PrimeVul: 564 vulnerable/patched pairs (1,128 functions), balanced by construction and overwhelmingly C and C++ (predominantly Chromium, TensorFlow, and similar large projects). We report per-function accuracy, precision, recall, and F1, and the PrimeVul pair-wise outcomes, of which the primary quantity is the pair-correct rate: the fraction of pairs in which the vulnerable function is judged vulnerable and its patched twin judged safe. Every judgment is blind — the model receives one function at a time with no indication of its pair membership or ground-truth label — and verdicts are parsed from the model's structured final line. All comparisons within an experiment use a fixed harness and identical decoding.
3.3 Improvement interventions
We attempted to raise pair-correct accuracy through five interventions, each holding the base model and serving stack fixed except where noted. The first, verdict-only supervised fine-tuning, trained a LoRA adapter on 3,000 PrimeVul-training functions labeled with their correct verdicts. The second, self-taught reasoning distillation, sampled the base model's own reasoning traces on training functions and retained only those reaching the correct verdict as supervision targets. The third, frontier-teacher reasoning distillation, used a frontier model (GPT-5.6-Sol at maximal reasoning effort, accessed via a command-line interface) to write correct diagnostic reasoning for functions the base model misjudged, distilling those rationales into a LoRA adapter; a fourth intervention scaled this teacher set approximately sevenfold, from 212 to 1,307 traces. Adapters were trained with mlx-lm, fused into the base weights, converted to GGUF, and served identically to the base. The fifth intervention replaced the base entirely with a general-purpose model of 3.8× the parameter count (Qwen3.6-27B) under the same blind protocol.
3.4 Decidability probe
To explain the observed ceiling, we designed a two-part probe on 100 randomly selected pairs. The first part measures decidability: a frontier oracle (GPT-5.6-Sol at maximal reasoning effort) is shown both members of a pair — so that the security-relevant difference between them is fully observable — and asked to classify whether the vulnerability is determinable from the vulnerable function's own text (labeled INTRA: the unsafe operation and the missing or insufficient guard are both visible within the function) or whether a correct judgment requires information defined outside the function (labeled INTER: a caller-established bound, an externally-defined type or size, or global and configuration state). The oracle returned a classification and a short justification naming the specific deciding operation or the specific external fact required. The second part measures the differential rate of a concrete extractor: we ran the cppcheck static analyzer (version 2.21, with all checks enabled and common typedefs stubbed to compensate for absent headers) on both members of each pair and recorded how often its security-relevant findings differed between twins, and in particular how often they were directional — present on the vulnerable function and absent on its patch. The differential rate upper-bounds the discriminative signal that this off-the-shelf tool could contribute, and is by construction no larger than the decidable fraction.
4. Results
4.1 The reported result reproduces in-distribution
Under the original authors' prompt and task formulation, the released model recovers approximately 81% accuracy and 80% F1 on a curated in-distribution sample, in line with the paper's claims and confirming that the weights and our serving stack are faithful. This reproduction is essential context for everything that follows: the sharply lower numbers reported below are a consequence of distribution shift and evaluation protocol, not of an inability to reproduce the original work. The left panel of Figure 2 places the two regimes side by side; moving from the authors' setup to a blind out-of-distribution evaluation reduces accuracy from 81% to 53% and F1 from 80 to 44.7.
4.2 Pairwise discrimination collapses out-of-distribution
Evaluated blind on the 564 PrimeVul pairs, the base model achieves a pair-correct rate of 17.4%, with per-function accuracy of 53.0% and F1 of 44.7. A pair-correct rate near 17% indicates that, when confronted with a vulnerable function and its minimally-different patch, the model usually cannot assign the two the opposite verdicts they require. Per-function accuracy barely above 50% on a balanced set tells the same story from the pointwise side: the model's apparent competence in-distribution does not survive the removal of the label priors and surface cues that the paired protocol neutralizes. This is the number that all subsequent interventions attempt to raise.
4.3 The generalization boundary is mechanism novelty, not label novelty
Before attempting to move the ceiling, we characterized what the model had actually learned, to avoid misattributing its limits. Two findings, summarized in the right panel of Figure 2, are relevant. First, an untrained CWE label whose underlying mechanism the model had seen transferred fully: functions labeled with buffer-family CWEs absent from training were classified at 80% accuracy, slightly above the 72% observed on trained buffer CWEs, because they invoke the identical bounds-checking reasoning. The model therefore did not merely memorize CWE labels. Second, and in contrast, genuinely novel mechanisms degraded substantially: on a balanced set of never-seen mechanism classes, accuracy fell from 85% to 70% and F1 from 87 to 64, driven almost entirely by a recall collapse from 100% to 53.3%. The model retains specificity on unfamiliar vulnerability logic but loses sensitivity, under-detecting what it has not been taught. This establishes that the model learned transferable reasoning rather than surface patterns, and locates its fragility in recall on unfamiliar mechanisms — a boundary distinct from, and milder than, the out-of-distribution collapse of Section 4.2.
4.4 No intervention beats the wall
Figure 1 reports the pair-correct rate for the base model and all five interventions on the same protocol. Verdict-only fine-tuning (17.2%) and self-taught reasoning distillation (17.1%) were statistically indistinguishable from the base. Frontier-teacher reasoning distillation produced the only improvement, reaching 20.0% from 212 carefully-targeted traces — but scaling the same procedure sevenfold to 1,307 traces did not extend the gain; it reversed it, dropping pair-correct to 14.2% while raising recall, the signature of a decision threshold sliding toward indiscriminate positives rather than of improved discrimination. Most tellingly, replacing the base with a general-purpose model of 3.8× the size produced a pair-correct rate of 0.0%, accompanied by a high rate of unparseable outputs; additional capacity, absent task-specific grounding, made discrimination worse rather than better. The consistent picture across parameter-efficient tuning, reasoning distillation, data scaling, and model scaling is that the ceiling is a property of the task as posed, not of the model's capacity to fit it.
4.5 The signal is mostly outside the function
The decidability probe explains the wall directly, and its result is shown in Figure 3. Of 99 scored pairs, the frontier oracle judged only 29.3% to be decidable from the vulnerable function's own text; the remaining 70.7% required information defined outside the function. The oracle's justifications for the interprocedural majority are concrete and consistent: whether a caller had already bounded an argument ("actual capacity of caller-provided szLine versus the strcpy output"), the externally-defined size or semantics of a parameter ("requires external BuildTensorShape semantics for malformed attacker-controlled dimensions"), or invariants established elsewhere in the program ("whether pad_width_ is prevalidated during construction is not visible in Compute"). Because these facts are absent from the function under judgment, no method restricted to that function — regardless of its training or size — can recover them. The 29.3% decidable fraction is therefore the ceiling on pair-correct accuracy for any single-function detector on this distribution, and it aligns closely with the 25–30% cap that a debate of five independent models had estimated a priori.
The second part of the probe shows that even the decidable minority is not cheaply recoverable by conventional tooling. Running cppcheck on the same functions produced findings that differed between twins in only 5% of pairs and were directional — flagging the vulnerable member and clearing its patch — in just 2%. On 65% of pairs the analyzer emitted the identical finding on both members, contributing no discriminative signal, and on 30% it flagged neither. An off-the-shelf intra-procedural analyzer applied to header-less functions from large C++ projects thus recovers almost none of even the in-function signal; the decidable pairs are decidable by semantic reasoning, not by pattern-matching linters. This closes the argument: the interprocedural majority is unrecoverable in principle by single-function methods, and the intra-procedural minority is not recovered in practice by the cheap tool most often proposed to supply it.
5. Discussion
Our results are best read not as a refutation of the original paper but as a demarcation of its scope. VulnLLM-R-7B does what it claims on the distribution it was built for, and it learned transferable reasoning rather than brittle pattern-matching, as its full transfer to untrained labels of familiar mechanisms shows. What our experiments add is a precise account of where that capability stops. When the evaluation shifts to distribution-shifted code and to a protocol that demands genuine vulnerable-versus-patched discrimination, performance falls to a rigid ceiling that neither fine-tuning, reasoning distillation, data scaling, nor a near-quadrupling of model size can raise. The decidability probe identifies the cause as informational rather than representational: roughly seven in ten decisions depend on facts that are simply not present in the function being judged.
This reframing carries a clear methodological implication. Reporting single-function detection performance without a paired or otherwise prior-controlled protocol risks conflating label-prior exploitation with capability, and reporting it in-distribution risks overstating deployability. The pair-correct rate on distribution-shifted pairs is a demanding but honest summary, and by that measure the achievable ceiling for local single-function models is near 29% — a number practitioners should hold in mind when a benchmark advertises 80%. It also clarifies why the field's most promising direction is architectural rather than parametric: to move the ceiling one must supply the missing interprocedural context — callers, resolved types, reaching definitions — which necessarily means ingesting more of the program than a single function. The original paper's agent scaffold is precisely such a mechanism, and our results can be read as quantitative evidence for why scaffolding, rather than a larger model or more in-function data, is the lever that matters.
Finally, the decidability decomposition suggests a deployment posture that is honest about the ceiling rather than defeated by it. Because the decidable minority is identifiable in principle — these are the functions whose unsafe operation and missing guard are both locally visible — a practical system can route for high-precision triage: emit confident verdicts where the signal is in-function and abstain, flagging "insufficient context," where it is not. Such a system trades coverage for trustworthiness and aligns the model's outputs with the information actually available to it, which is preferable to uniform per-function verdicts that are reliable on only a third of cases. We regard this as the constructive conclusion of an otherwise negative result.
6. Limitations
Several caveats bound our conclusions. Our serving stack uses 8-bit quantization and a single decoding configuration; although we matched all within-experiment comparisons, absolute numbers could shift modestly under full precision or alternative sampling. The decidability probe relies on a frontier model as an oracle, and although it was given the ground-truth patch and asked a narrowly-scoped structural question, its INTRA/INTER labels are judgments rather than proofs; a human-expert audit of a subset would strengthen the estimate, and the single unparsed case was excluded rather than adjudicated. The differential-rate measurement used one analyzer (cppcheck) on the C and C++ majority and did not include the Java minority or a heavier interprocedural tool such as CodeQL configured with a built project, which would recover more signal at substantially greater cost; our claim is specifically about cheap, locally-runnable, single-function static analysis. Our interventions, though spanning several distinct families, do not exhaust the space — notably, we did not build and evaluate the full repository-context scaffold that our own analysis identifies as the only mechanism with headroom, and we did not correct for position bias by evaluating each pair in both orderings. Finally, all results concern one model on one paired benchmark; the interprocedural-ceiling hypothesis should be tested on additional detectors and datasets before being treated as general.
7. Conclusion
We reproduced the reported in-distribution strength of VulnLLM-R-7B and then showed that its capability does not survive the transition to blind, distribution-shifted, pairwise evaluation, where pair-correct accuracy sits at 17.4% and resists every attempt to raise it — verdict-only tuning, self- and frontier-distilled reasoning, sevenfold data scaling, and a 3.8×-larger base alike. A decidability probe explains the wall: only 29.3% of pairs are decidable from the function's own text, and an off-the-shelf analyzer recovers a directional signal on just 2%. The ceiling on single-function detection is therefore informational, not a matter of model capacity, and it is bounded near 29% on this distribution. The path past it is to supply the interprocedural context the task withholds — the very role of an agent scaffold — and, short of that, to deploy the model as a high-precision triage tool over the decidable minority rather than as a uniform per-function oracle. We offer these findings in the same spirit as the original work: as a sharpening of where reasoning-specialized detectors succeed, and of where the problem, not the model, sets the limit.
References
Ding, Y., Fu, Y., Ibrahim, O., Sitawarin, C., Chen, X., Alomair, B., Wagner, D., Ray, B., & Chen, Y. (2024). Vulnerability Detection with Code Language Models: How Far Are We? (PrimeVul). arXiv:2403.18624. To appear, ICSE 2025.
Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L., & Chen, W. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685.
Qwen Team (2024). Qwen2.5 Technical Report. arXiv:2412.15115.
Nie, Y., Li, H., Guo, C., Jiang, R., Wang, Z., Li, B., Song, D., & Guo, W. (2025). VulnLLM-R: Specialized Reasoning LLM with Agent Scaffold for Vulnerability Detection. arXiv:2512.07533.
Wang, X., Wei, J., Schuurmans, D., Le, Q., Chi, E., Narang, S., Chowdhery, A., & Zhou, D. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171.
Zelikman, E., Wu, Y., Mu, J., & Goodman, N. D. (2022). STaR: Bootstrapping Reasoning With Reasoning. arXiv:2203.14465.
Figures
Figure 1. Pair-correct accuracy on PrimeVul test_paired for the base model and five improvement interventions. The dashed line marks the base ceiling (17.4%). No intervention reliably exceeds it; the best (frontier-teacher distillation) reaches 20.0% before regressing to 14.2% under scaling, and a 3.8×-larger general-purpose base scores 0.0%. (figures/fig1_ladder.png)
Figure 2. (A) Distribution shift: accuracy and F1 fall from the authors' in-distribution setup to a blind out-of-distribution PrimeVul evaluation. (B) Generalization boundary: trained versus novel vulnerability mechanisms, showing that recall collapses from 100% to 53.3% on unfamiliar mechanisms while accuracy and F1 degrade more gently. (figures/fig2_boundary.png)
Figure 3. The core finding. (A) A frontier oracle, shown both twins, judges 71% of pairs to require interprocedural context and only 29% to be decidable from the function alone — the ceiling for any single-function method. (B) On the same functions, cppcheck yields a directional (usable) signal on only 2% of pairs, emitting the identical finding on both twins in 65% and flagging neither in 30%. (figures/fig3_ceiling.png)
- Downloads last month
- 62


