Current learning-based Automated Vulnerability Repair (AVR) approaches, while promising, often fail to generalize effectively in real-world scenarios. Our diagnostic analysis reveals three fundamental weaknesses in state-of-the-art AVR approaches: (1) limited cross-repository generalization, with performance drops on unseen codebases; (2) inability to capture long-range dependencies, causing a performance degradation on complex, multi-hunk repairs; and (3) over-reliance on superficial lexical patterns, leading to significant performance drops on vulnerabilities with minor syntactic variations like variable renaming. To address these limitations, we propose SeCuRepair, a semantics-aligned, curriculum-driven, and reasoning-enhanced framework for vulnerability repair. At its core, SeCuRepair adopts a reason-then-edit paradigm, requiring the model to articulate why and how a vulnerability should be fixed before generating the patch. This explicit reasoning enforces a genuine understanding of repair logic rather than superficial memorization of lexical patterns. SeCuRepair also moves beyond traditional supervised fine-tuning and employs semantics-aware reinforcement learning, rewarding patches for their syntactic and semantic alignment with the oracle patch rather than mere token overlap. Complementing this, a difficulty-aware curriculum progressively trains the model, starting with simple fixes and advancing to complex, multi-hunk coordinated edits. We evaluate SeCuRepair on strict, repository-level splits of BigVul and newly crafted PrimeVul_AVR datasets. SeCuRepair significantly outperforms all baselines, surpassing the best-performing baselines by 34.52% on BigVul and 31.52% on PrimeVul\textsubscript{AVR} in terms of CodeBLEU, respectively. Comprehensive ablation studies further confirm that each component of our framework contributes to its final performance.


翻译:当前基于学习的自动化漏洞修复方法虽前景广阔,但在实际场景中往往难以有效泛化。我们的诊断分析揭示了现有先进AVR方法的三个根本缺陷:(1) 跨代码库泛化能力有限,在未见代码库上性能显著下降;(2) 无法捕获长距离依赖关系,导致复杂多代码块修复任务性能退化;(3) 过度依赖表层词汇模式,当漏洞存在变量重命名等轻微语法变异时性能急剧下降。为突破这些局限,我们提出SeCuRepair——一个语义对齐、课程驱动与推理增强的漏洞修复框架。其核心采用"先推理后编辑"范式,要求模型在生成补丁前明确阐述修复漏洞的原因与方法。这种显式推理机制强制模型真正理解修复逻辑,而非简单记忆词汇模式。SeCuRepair突破传统监督微调框架,采用语义感知强化学习技术,依据补丁与标准补丁在语法和语义层面的对齐程度(而非单纯词汇重叠)给予奖励。此外,框架引入难度感知课程学习策略,从简单修复任务开始渐进训练,逐步过渡到复杂的多代码块协同编辑。我们在BigVul的严格仓库级划分数据集及新构建的PrimeVul_AVR数据集上评估SeCuRepair。实验表明,SeCuRepair显著超越所有基线模型,在CodeBLEU指标上分别以34.52%(BigVul)和31.52%(PrimeVul\textsubscript{AVR})的优势领先最佳基线。全面的消融研究进一步证实,框架各组件均对最终性能提升具有实质性贡献。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
《用于建模系统攻击路径的强化学习环境》
专知会员服务
21+阅读 · 3月5日
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
大型语言模型自动程序修复的系统文献综述
专知会员服务
42+阅读 · 2024年5月5日
专知会员服务
14+阅读 · 2021年9月21日
清华大学《高级机器学习》课程
专知
40+阅读 · 2020年7月21日
Xsser 一款自动检测XSS漏洞工具
黑白之道
14+阅读 · 2019年8月26日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
面向军事作战需求开发的人工智能(RAIMOND)
专知会员服务
0+阅读 · 17分钟前
软件定义多域战术网络:基础与未来方向(综述)
水下战战术决策中的气象与海洋预报(50页报告)
远程空中优势:新一代超视距导弹的兴起
专知会员服务
1+阅读 · 45分钟前
大语言模型溯因推理的统一分类学与综述
专知会员服务
0+阅读 · 今天12:07
美/以-伊战争:停火与后续情景与影响分析
专知会员服务
3+阅读 · 4月11日
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员