Vul-LMGNNs:融合语言模型与在线蒸馏图神经网络的代码漏洞检测方法
Vul-LMGNNs: Fusing language models and online-distilled graph neural networks for code vulnerability detection
AI总结:
针对代码漏洞检测中GNN层间结构传播受限、codeLMs与GNN协作不足的问题,提出融合预训练codeLMs与在线蒸馏门控GNN的Vul-LMGNNs,通过隐式-显式联合训练实现语义与结构信息跨层传播,性能优于17种现有最优方法。
摘要:
代码语言模型(codeLMs)和图神经网络(GNNs)被广泛应用于代码漏洞检测领域。然而,GNNs通常依赖于从相邻节点聚合信息,这限制了结构信息在层间的传播。尽管codeLMs可以为GNNs补充语义信息,但现有的集成方法尚未充分挖掘二者的协作潜力。为应对这些挑战,我们提出了Vul-LMGNNs,将预训练codeLMs与GNNs相集成,以实现语义信息和结构信息的跨层传播。Vul-LMGNNs利用代码属性图(Code Property Graphs, CPGs)整合语法、控制流和数据依赖关系,采用门控GNNs进行结构提取。在线知识蒸馏(KD)机制使学生GNN能够通过交替训练从已训练的对应模型中捕获结构信息。此外,一个“隐式-显式”联合训练框架利用codeLMs初始化嵌入并传播代码语义;在显式阶段,该框架通过线性插值实现后期融合。在真实世界漏洞数据集上的评估结果显示,Vul-LMGNNs的性能优于17种当前最优方法。源代码可在以下链接获取:https://github.com/Vul-LMGNN/vul-LMGNN。
英文摘要:
Code Language Models (codeLMs) and Graph Neural Networks (GNNs) are widely used in code vulnerability detection. However, GNNs often rely on aggregating information from adjacent nodes, limiting structural information propagation across layers. While codeLMs can supplement GNNs with semantic information, existing integration methods underexplore their collaborative potential. To address these challenges, we propose Vul-LMGNNs, integrating pre-trained codeLMs with GNNs to enable cross-layer propagation of semantic and structural information. Vul-LMGNNs leverage Code Property Graphs (CPGs) to incorporate syntax, control flow, and data dependencies, using gated GNNs for structural extraction. An online knowledge distillation (KD) mechanism allows a student GNN to capture structural information from a trained counterpart via alternating training. Additionally, an "implicit-explicit" joint training framework leverages codeLMs to initialize embeddings and propagate code semantics. In the explicit phase, it performs late fusion via linear interpolation. Evaluations on real-world vulnerability datasets show Vul-LMGNNs outperform 17 state-of-the-art approaches. Source code is available at: https://github.com/Vul-LMGNN/vul-LMGNN.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。