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

LLM Other LLM AI Systems and Hardware PVDAR
2026年10月26日
漏洞发现得越晚,修复成本就越高。随着编码智能体生成代码的速度远超开发人员的审查能力,软件亟需一道“第一道防线”,对每个新函数进行实时筛查。近期,大语言模型(LLM)智能体已具备识别真实世界漏洞的能力——其工作方式与安全专家一致:运行分析工具、考察周边代码、提出并验证假设,并在综合权衡证据后形成独立判断。然而,此类推理过程需历经多次模型调用,导致每次判定耗时数分钟,远不能满足实时筛查的需求。相比之下,速度更快的检测器(例如通过对深度学习模型进行微调,或直接向LLM发出提示以获取即时判定)准确性却显著偏低:它们在缺乏智能体所构建上下文的情况下对函数作出判断;即便提供部分上下文,LLM生成的直接判定结果依然不可靠。 本文提出REVA(实时漏洞分析,Real-time Vulnerability Analysis),一种新型AI漏洞检测器。它将智能体式检测器背后所依赖的安全上下文建模能力与代码理解能力,全部压缩至单次LLM前向传播中完成。针对每个新函数,REVA向LLM输入三类预计算信息:该函数所属模块的威胁模型、轻量级静态分析结果,以及调用图(call-graph)信息;同时,REVA利用一个经专门训练的探针(probe),读取LLM在该上下文中对新函数所形成的内部表征。在PrimeVul数据集的预留测试集上,REVA搭载GLM-5.3-Flash模型,平均每函数检测耗时约1秒,准确率达60.0%。这一性能与当前最先进的智能体式检测器VulTriage(59.2%)相当——二者均运行于同一LLM之上,但REVA的运行速度提升逾250倍,计算成本则不足其十分之一。在同一提示(prompt)下,REVA所用探针的准确率比LLM自身输出的直接判定高出14%至17%。在三个开源LLM上的实验表明:REVA的准确率均不低于VulTriage;其中,在两个模型上甚至高出约10%。由此可见,LLM的内部表征已蕴含了智能体式检测器通过多步推理所获取的大部分关键信息。
A vulnerability costs more to fix the later it is discovered. As coding agents generate code faster than developers can review it, software needs a first line of defense screening each new function in real time. 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 for real-time screening. Faster detectors, which fine-tune deep learning models or prompt an LLM for a direct verdict, are less accurate: they judge a function without the context an agent gathers, and an LLM's generated verdict is unreliable even when given some of it. 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 gives the LLM a pre-computed threat model of its module, lightweight static analysis findings and call-graph information. REVA leverages a trained probe to read the LLM's internal representations of the new 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 detector, 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. An LLM's internal representations thus encode much of what agentic detectors obtain through reasoning.
许愿