arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.12890cs.SE
收藏

通过图表示学习引导的大语言模型实现高效代码分析

Efficient Code Analysis via Graph Representation Learning-Guided Large Language Models

Key Laboratory of System Software, Institute of Software, Chinese Academy of Sciences(中国科学院软件研究所系统软件重点实验室);University of Chinese Academy of Sciences(中国科学院大学)

Hang Gao, Tao Peng, Baoquan Cui, Hong Huang, Fengge Wu, Junsuo Zhao, Jian Zhang

AI总结:

提出一种图中心注意力获取流程,利用图神经网络初步检测恶意代码,并引导大语言模型聚焦关键区域,提升跨文件恶意行为定位能力。

摘要:

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

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑