Source code and its accompanying comments are complementary yet naturally aligned modalities-code encodes structural logic while comments capture developer intent. However, existing vulnerability detection methods mostly rely on single-modality code representations, overlooking the complementary semantic information embedded in comments and thus limiting their generalization across complex code structures and logical relationships. To address this, we propose MultiVul, a multimodal contrastive framework that aligns code and comment representations through dual similarity learning and consistency regularization, augmented with diverse code-text pairs to improve robustness. Experiments on widely adopted DiverseVul and Devign datasets across four large language models (LLMs) (i.e., DeepSeek-Coder-6.7B, Qwen2.5-Coder-7B, StarCoder2-7B, and CodeLlama-7B) show that MultiVul achieves up to 27.07% F1 improvement over prompting-based methods and 13.37% over code-only Fine-Tuning, while maintaining comparable inference efficiency.


翻译:源代码及其附带的注释是互补且自然对齐的多模态——代码编码结构逻辑,而注释捕捉开发者的意图。然而,现有的漏洞检测方法大多依赖单模态的代码表示,忽视了注释中蕴含的互补语义信息,从而限制了其在复杂代码结构和逻辑关系上的泛化能力。为解决这一问题,我们提出MultiVul,这是一个多模态对比框架,通过双重相似性学习和一致性正则化对齐代码与注释的表示,并利用多样化的代码-文本对增强鲁棒性。在广泛采用的DiverseVul和Devign数据集上,基于四种大型语言模型(即DeepSeek-Coder-6.7B、Qwen2.5-Coder-7B、StarCoder2-7B和CodeLlama-7B)的实验表明,MultiVul相较于基于提示的方法实现了最高27.07%的F1提升,相较于仅代码的微调实现了13.37%的提升,同时保持了可比的推理效率。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【CVPR2023】基于文本驱动软掩码的多模态表示学习
专知会员服务
21+阅读 · 2023年4月10日
多模态深度学习
专知会员服务
136+阅读 · 2023年1月15日
【Paul Liang】多模态深度学习,Multimodal Deep Learning
专知会员服务
186+阅读 · 2022年4月12日
专知会员服务
149+阅读 · 2020年9月6日
【Google】多模态Transformer视频检索,Multi-modal Transformer
专知会员服务
103+阅读 · 2020年7月22日
多模态视觉语言表征学习研究综述
专知
27+阅读 · 2020年12月3日
深度多模态表示学习综述论文,22页pdf
专知
33+阅读 · 2020年6月21日
多模态深度学习综述,18页pdf
专知
51+阅读 · 2020年3月29日
这可能是「多模态机器学习」最通俗易懂的介绍
计算机视觉life
113+阅读 · 2018年12月20日
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
14+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
美国从乌克兰无人机战争中学习经验
专知会员服务
1+阅读 · 今天15:03
ICML 2026 | 面向视觉语言模型的语义鲁棒性认证
专知会员服务
0+阅读 · 今天14:31
学习数据的几何:形状空间分析数学综述
专知会员服务
8+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
10+阅读 · 6月17日
相关基金
国家自然科学基金
4+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
14+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员