arXiv:2610.35829cs.CROct 2026

Manuscript Offprint

arXiv:2610.35829

Reva: Real-Time Vulnerability Detection through Contextual Probing of Large Language Models

Amine Lbath, Massih-Reza Amini

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Amine Lbath, Massih-Reza Amini,

Université Grenoble Alpes, CNRS, France

Abstract—A vulnerability costs more to fix the later it is discovered in the software lifecycle. As coding agents now generate code faster than developers can review it, software needs a stronger first line of defense that screens each new function in real time, as it is generated. LLM agents have recently become capable of finding real-world vulnerabilities by working as a security expert would: they run analysis tools, explore the surrounding code, test hypotheses and weigh the evidence before forming their own judgement. This reasoning, however, spans many model calls, so that each verdict takes minutes of compute, far too long to keep pace with code generation. Faster AI-based detectors, which fine-tune deep learning models or prompt an LLM for a direct verdict, are considerably less accurate: they judge a function without the context an agent gathers, and an LLM's generated verdict has proven unreliable in prior work even when some of that context is given.

We present REVA (REal-time Vulnerability Analysis), an AI vulnerability detector that brings the security context and code understanding components behind agentic detectors into a single forward pass of an LLM. For each new function, REVA provides the LLM with a pre-computed threat model of its module, along with lightweight static analysis findings and call-graph information. Rather than asking the LLM for a verdict, REVA lets a trained probe read the LLM's internal representations of the function in this context. On PrimeVul's held-out test set, REVA on GLM-5.3-Flash reaches 60.0% accuracy in about one second per function. This matches VulTriage (59.2%), the state-of-the-art agentic function-level detector in the literature, run on the same LLM, while being over 250 times faster and less than a tenth as costly. On the same prompt, the probe is 14% to 17% more accurate than the LLM's own direct verdict. Across three open LLMs, REVA is at least as accurate as VulTriage, and about 10% more accurate on two of them. These results suggest that an LLM's internal representations already encode much of what agentic detectors obtain through reasoning.

Index Terms—vulnerability detection, large language models, internal representations, probing, coding agents

I. INTRODUCTION

The cost of remediating a vulnerability grows the later it is discovered in the software lifecycle [1]. Vulnerabilities are therefore cheapest to fix when they are detected as the code is written. Coding agents now generate code faster than developers can review it, which calls for a first line of defense that screens each new function in real time, as it is generated.

Static analyzers run in real time, but at the scale of agent-generated code, they produce more reports than developers can review, many of them false positives [2], [3]. LLM agents have recently become capable of finding real-world vulnerabilities [4], [5] by combining such tools with their own analysis of the code, and agentic detectors bring this approach to function-level detection. VulTriage [6], the state of the art in the function-level detection literature, and VulAgent [7] enrich the prompt with retrieved vulnerability knowledge and program facts, and VulTrial [8] lets several agents debate a verdict. This reasoning, however, spans several model calls, which amounts to minutes per function. Faster AI-based detectors, which fine-tune deep learning models or prompt an LLM for a direct verdict, reduce this latency but are considerably less accurate [9]–[11].

REVA is designed to close this gap between speed and improved accuracy. Instead of letting the LLM gather context through multiple rounds of tool calls, REVA assembles it in the prompt, including a threat model of the function's module, its static analysis findings, its call graph and its file. Instead of reasoning towards a verdict, the LLM then processes this prompt in a single forward pass without generating text, and a small probe trained on labeled functions maps its internal representations of the code tokens to a risk score. This second choice builds on evidence that LLMs encode knowledge that their answers do not express, for example about the truth of a statement [12]–[14] or the correctness of their own answers [15], [16], and that chain-of-thought explanations are not always faithful to the underlying computation [17].

We evaluate REVA on PrimeVul [9], a high-quality dataset of vulnerable C and C++ functions paired with benign versions of the same functions, which spans 651 projects and 121 vulnerability types (CWEs). On its held-out test set, REVA on GLM-5.3-Flash [18] is on par with VulTriage and more accurate than VulAgent run on the same LLM, in about one second per function, over 250 times faster than VulTriage. On two other open LLMs, it is 9% to 13% more accurate than both agentic detectors.

This paper makes three contributions: (i) we propose REVA, a vulnerability detector that combines targeted security context with a probe on an LLM's internal representations, in a single forward pass per function; (ii) we compare it with state-of-the-art agentic function-level detectors run on the same three LLMs, on PrimeVul's held-out test set, in terms of accuracy, cost and robustness; and (iii) we outline a research agenda towards detectors that screen every function as coding agents generate it and escalate likely vulnerabilities to more capable agents that construct a proof of vulnerability.

References (36)