Skip to main content
Back

Hochschule Esslingen Hits a Hard 0.30 Accuracy Wall Running Vul-RAG Locally

A new reproducibility study of Vul-RAG finds the framework works without proprietary APIs, but every open-weight model tested, including reasoning models, hits a hard ceiling of ~0.30 pairwise accuracy on vulnerability detection.

Pro

  • A reproducibility study of Vul-RAG confirms the framework works fully locally with open-weight models, no proprietary APIs needed.
  • All tested models, including reasoning models like QwQ-32B and DeepSeek-R1, hit a hard ceiling of ~0.30 pairwise accuracy on vulnerability detection.
  • Pairwise accuracy measures whether a model correctly classifies both the vulnerable and patched version of the same code, a strict and meaningful metric.
  • Reasoning models slightly outperform standard models but at 2.6x the token output cost, with no meaningful accuracy gain over the ceiling.
  • Code-specialized models offer no significant advantage over general-purpose models of the same size, since Vul-RAG abstracts code into natural language descriptions.
  • All code and evaluation artifacts are publicly available on GitHub for local deployment.

Security teams have long hoped that LLMs could automate the tedious work of hunting software vulnerabilities. Vul-RAG, a RAG-based vulnerability detection framework published last year, made a compelling case: by grounding LLMs with structured knowledge distilled from historical CVEs, it pushed pairwise accuracy well beyond what raw LLMs could achieve. The catch? Its strongest results relied on proprietary models like GPT-4o and Claude, making independent verification nearly impossible. A new study from researchers at Hochschule Esslingen sets out to fix that, and what they find is both reassuring and sobering.

The reproducibility problem hiding in plain sight

For approaches relying on proprietary models and APIs, reproducibility and replicability remain largely unexplored, raising the question of whether reported results generalize or depend primarily on specific model choices. This is not a minor footnote. If a security tool only works when you pipe code through a closed commercial API, you cannot audit it, run it air-gapped, or trust that results will be consistent as the underlying model silently updates. The ML community has increasingly recognized this gap, but vulnerability detection, a domain with real security stakes, has been slow to catch up.

The original Vul-RAG paper had already shown that LLMs have severe limitations in distinguishing between vulnerable and similar-but-benign patched code, with baseline accuracy of only 0.06 to 0.14. Vul-RAG addressed this by building a structured knowledge layer on top of raw LLM inference, and the gains were real. But reproducing those gains without GPT-4o access was an open question.

How Vul-RAG actually works

Vul-RAG works in three phases: first, it constructs a vulnerability knowledge base by extracting multi-dimensional knowledge via LLMs from existing CVE instances; second, for a given code snippet, it retrieves relevant vulnerability knowledge from the knowledge base based on functional semantics; third, it leverages LLMs to check the vulnerability of the given code snippet by reasoning the presence of vulnerability causes and fixing solutions of the retrieved vulnerability knowledge.

Architecture diagram of the three-phase Vul-RAG system: knowledge base construction, retrieval, and LLM-based detection

The key insight is that the retrieval is not code-level but knowledge-level. Rather than searching for similar code snippets, Vul-RAG retrieves abstract descriptions of vulnerability root causes and their fixes. The representation focuses on high-level features of vulnerabilities rather than lexical code details. This abstraction is what lets the framework generalize across different codebases and vulnerability patterns.

The benchmark: pairs of vulnerable and patched code

The evaluation uses the PairVul benchmark, which is deliberately harder than most vulnerability datasets. The dataset consists of pairs of vulnerable and patched functions extracted from real-world CVEs reported for the Linux kernel, with each pair enriched with Common Weakness Enumeration (CWE) identifiers and descriptions. The dataset comprises 2,903 function pairs covering the ten most prevalent CWEs, split in a 1:4 ratio into a test and training set, where the test set contains 586 pairs and serves as the evaluation benchmark, while the remaining 2,317 pairs form the training set used to construct the knowledge base.

The key metric is pairwise accuracy: a model only gets credit if it correctly classifies both the vulnerable function and its patched counterpart in a pair. This is much stricter than standard accuracy, and it directly measures whether the model understands what actually changed, not just whether it can guess "vulnerable" or "safe" at above-chance rates.

Running it locally, across a diverse model zoo

To enable reproducible experimentation, the authors adapt the Vul-RAG framework to operate entirely with open-weight models and local inference, removing the dependency on proprietary APIs. They then test a broad sweep of models:

  • Code-specialized models: Qwen2.5-Coder-32B-Instruct, DeepSeek-Coder-V2-Instruct
  • General-purpose models: Qwen2.5-32B-Instruct
  • Reasoning models: QwQ-32B, DeepSeek-R1 (8B, 14B, 32B)

The reasoning models here are models trained to produce explicit chain-of-thought before giving a final answer, similar to how OpenAI's o-series works. They are generally slower and more compute-intensive, but are expected to handle complex logical tasks better.

The ceiling that won't move

The results confirm that the findings of Vul-RAG are reproducible under local deployment, but with minor deviations. That's the good news. The harder news is what happens when you push further.

Across all evaluated models, there is a performance plateau at approximately 0.30 pairwise accuracy. Notably, this plateau persists even for more recent and advanced models, indicating that improvements in model capacity alone do not substantially enhance performance.

Violin plot comparing token output distributions across five models including QwQ-32B and DeepSeek-R1 variants

Reasoning models do close some of the gap. The reasoning models consistently outperform the non-reasoning baseline, achieving the highest pairwise accuracy of 0.29, nearly matching the reported DeepSeek-Coder-V2 baseline of 0.30. However, this performance gain entails a trade-off in computational overhead: QwQ-32B increases the median output length from 540 to 1,385 tokens compared to Qwen2.5-Coder-32B-Instruct. More tokens, more compute, essentially the same ceiling.

Perhaps the most surprising finding is how little code specialization matters. By abstracting code and vulnerabilities into high-level semantic descriptions, Vul-RAG reframes a specialized programming task as a logical reasoning task. The small performance difference between code-specialized and general-purpose models suggests that this abstraction can compensate for the absence of explicit code specialization, and that natural language understanding capabilities may be as critical as domain-specific exposure.

What this actually means for security tooling

The reproducibility result is genuinely useful. Teams that want to run vulnerability detection locally, without sending proprietary code to external APIs, now have a validated, open-source path. The full implementation and evaluation artifacts are publicly available on GitHub.

But the plateau finding reframes the ambition of the whole approach. The hard limit is not the model. It is the task itself. Distinguishing a vulnerable function from its patch, where the two differ by only a few lines, requires understanding subtle semantic changes in code behavior. That is a different problem from general code comprehension, and throwing a bigger or smarter model at it does not appear to solve it. The implication is that future progress likely requires better retrieval strategies, richer knowledge representations, or task-specific training, not just model upgrades.

For practitioners, the trade-offs are now clearer:

  • A mid-sized code-specialized model (e.g., Qwen2.5-Coder-32B) gives you most of the performance at lower inference cost
  • Reasoning models add marginal accuracy but multiply token output and latency significantly
  • General-purpose models of equivalent size perform nearly as well as code-specialized ones, giving more flexibility in model selection
  • The framework is fully reproducible locally, making it viable for air-gapped or compliance-sensitive environments

The paper is a reminder that reproducibility studies are not just academic housekeeping. They reveal where the real bottlenecks are, and in this case, the bottleneck is not the model provider. It is the fundamental difficulty of teaching a model to reason about the semantics of a security patch.