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日
专知会员服务
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日
Arxiv
0+阅读 · 3月24日
VIP会员
最新内容
BES:让语言模型通过双向进化搜索自我改进
专知会员服务
0+阅读 · 5月30日
以色列-美国-伊朗战争中的无人机:关键要点
专知会员服务
3+阅读 · 5月30日
《Palantir任务保障性软件安全标准(MA-S2)》
专知会员服务
7+阅读 · 5月30日
基于声学的无人机检测技术综述
专知会员服务
5+阅读 · 5月30日
《当代混合战争分析框架:俄乌战争经验教训》
战略前沿人工智能的再思考(中文)
专知会员服务
7+阅读 · 5月29日
《量化地基防空系统间接效应的博弈论方法》
专知会员服务
5+阅读 · 5月29日
相关VIP内容
《用于建模系统攻击路径的强化学习环境》
专知会员服务
21+阅读 · 3月5日
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
专知会员服务
14+阅读 · 2021年9月21日
相关基金
国家自然科学基金
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会员