Large Language Models (LLMs) have significantly advanced code analysis tasks, yet they struggle to detect malicious behaviors fragmented across files, whose intricate dependencies easily get lost in the vast amount of benign code. We therefore propose a graph-centric attention acquisition pipeline that enhances LLMs' ability to localize malicious behavior. The approach parses a project into a code graph, uses an LLM to encode nodes with semantic and structural signals, and trains a Graph Neural Network (GNN) under sparse supervision. The GNN performs an initial detection, and by interpreting these predictions, identifies key code sections that are most likely to contain malicious behavior. These influential regions are then used to guide the LLM's attention for in-depth analysis. This strategy significantly reduces interference from irrelevant context while maintaining low annotation costs. Extensive experiments show that the method consistently outperforms existing approaches on multiple public and custom datasets, highlighting its potential for practical deployment in software security scenarios.


翻译:大语言模型(LLMs)在代码分析任务上取得了显著进展,但其在检测跨文件分散的恶意行为时仍面临困难,这些行为之间复杂的依赖关系极易淹没在海量良性代码中。为此,我们提出了一种以图为中心的注意力获取流程,以增强LLMs定位恶意行为的能力。该方法将项目解析为代码图,利用LLM对节点进行语义和结构信号编码,并在稀疏监督下训练图神经网络(GNN)。GNN执行初步检测,并通过解释这些预测结果,识别出最可能包含恶意行为的关键代码段。这些关键区域随后被用于引导LLM的注意力进行深入分析。该策略在保持较低标注成本的同时,显著减少了无关上下文的干扰。大量实验表明,该方法在多个公开和自定义数据集上均持续优于现有方法,凸显了其在软件安全场景中实际部署的潜力。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
《大型语言模型代码生成》综述
专知会员服务
68+阅读 · 2024年6月4日
大型语言模型的高效提示方法综述
专知会员服务
75+阅读 · 2024年4月2日
大型语言模型在预测和异常检测中的应用综述
专知会员服务
70+阅读 · 2024年2月19日
【Code】GraphSAGE 源码解析
AINLP
31+阅读 · 2020年6月22日
自然语言处理中的语言模型预训练方法
PaperWeekly
14+阅读 · 2018年10月21日
深度学习文本分类方法综述(代码)
中国人工智能学会
28+阅读 · 2018年6月16日
超全总结:神经网络加速之量化模型 | 附带代码
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
VIP会员
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
国家自然科学基金
16+阅读 · 2013年12月31日
Top
微信扫码咨询专知VIP会员