The widespread reliance on open-source software dramatically increases the risk of vulnerability exploitation, underscoring the need for effective and scalable vulnerability detection (VD). Existing VD techniques, whether traditional machine learning-based or LLM-based approaches like prompt engineering, supervised fine-tuning, or off-policy preference optimization, remain fundamentally limited in their ability to perform context-aware analysis: They depend on fixed inputs or static preference datasets, cannot adaptively explore repository-level dependencies, and are constrained by function-level benchmarks that overlook critical vulnerability context. This paper introduces Vulnerability-Adaptive Policy Optimization (VULPO), an on-policy LLM reinforcement learning framework for context-aware VD. To support training and evaluation, we first construct ContextVul, a new dataset that augments high-quality function-level samples with lightweight method to extract repository-level context information. We then design multi-dimensional reward structuring that jointly captures prediction correctness, vulnerability localization accuracy, and the semantic relevance of vulnerability analysis, thereby guiding the model toward comprehensive contextual reasoning. To address the asymmetric difficulty of different vulnerability cases and mitigate reward hacking, VULPO incorporates label-level and sample-level difficulty-adaptive reward scaling, encouraging the model to explore challenging cases while maintaining balanced reward distribution. Extensive experiments demonstrate the superiority of our VULPO framework in context-aware VD: Our VULPO-4B substantially outperforms existing VD baselines based on prompt engineering and off-policy optimization, improving F1 by 85% over Qwen3-4B and achieving performance comparable to a 150x larger-scale model, DeepSeek-R1-0528.


翻译:对开源软件的广泛依赖显著增加了漏洞利用的风险,这凸显了对高效且可扩展的漏洞检测技术的迫切需求。现有的漏洞检测技术,无论是基于传统机器学习的方法,还是基于大语言模型的提示工程、监督微调或离线策略偏好优化等方法,在实现上下文感知分析方面仍存在根本性局限:它们依赖于固定的输入或静态偏好数据集,无法自适应地探索仓库级别的依赖关系,并且受限于函数级别的基准测试,忽略了关键的漏洞上下文信息。本文提出了漏洞自适应策略优化(VULPO),一种用于上下文感知漏洞检测的在线策略大语言模型强化学习框架。为了支持训练和评估,我们首先构建了ContextVul数据集,该数据集通过轻量级方法提取仓库级别的上下文信息,对高质量的函数级别样本进行了增强。接着,我们设计了多维度的奖励结构,共同捕捉预测正确性、漏洞定位准确性以及漏洞分析的语义相关性,从而引导模型进行全面的上下文推理。为了解决不同漏洞案例的不对称难度并缓解奖励欺骗问题,VULPO引入了标签级别和样本级别的难度自适应奖励缩放机制,鼓励模型探索具有挑战性的案例,同时保持奖励分布的平衡。大量实验证明了我们的VULPO框架在上下文感知漏洞检测方面的优越性:我们的VULPO-4B模型显著优于基于提示工程和离线策略优化的现有漏洞检测基线,其F1分数比Qwen3-4B提高了85%,并且达到了与规模大150倍的模型DeepSeek-R1-0528相当的性能。

0
下载
关闭预览

相关内容

【CVPR2024】VidLA: 大规模视频-语言对齐
专知会员服务
20+阅读 · 2024年3月31日
专知会员服务
22+阅读 · 2021年8月20日
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
17+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员