K-ASTRO:面向代码漏洞检测的LLM结构感知适配
K-ASTRO: Structure-Aware Adaptation of LLMs for Code Vulnerability Detection
AI总结:
K-ASTRO提出轻量级Transformer模型,结合LLM语义嵌入与AST结构特征,通过变异测试增强和结构感知注意力机制,在三个大型数据集上实现高效准确的代码漏洞检测,并支持CPU快速推理。
摘要:
大型语言模型(LLMs)正在变革软件工程任务,包括代码漏洞检测——这是软件安全的一个关键领域。然而,现有方法通常依赖资源密集型模型或基于图的技术,限制了其可访问性和实用性。本文介绍了K-ASTRO,一种轻量级Transformer模型,它将来自LLM的语义嵌入与抽象语法树(ASTs)的结构特征相结合,以提高代码漏洞检测的效率和准确性。我们的方法引入了一种受变异测试启发的基于AST的增强技术、一种结合增强AST特征的结构感知注意力机制,以及一个统一代码语义和语法的联合适配流程。在三个大规模数据集(包括BigVul、DiverseVul和PrimeVul)上的实验结果表明,K-ASTRO在实现最先进性能的同时,能够在CPU上快速推理且训练时间极短。通过提供可扩展、可解释且高效的解决方案,K-ASTRO弥合了LLM进展与实际软件漏洞检测之间的差距,并提供了开源工具以促进进一步研究。
英文摘要:
Large Language Models (LLMs) are transforming software engineering tasks, including code vulnerability detection-a critical area of software security. However, existing methods often rely on resource-intensive models or graph-based techniques, limiting their accessibility and practicality. This paper introduces K-ASTRO, a lightweight Transformer model that combines semantic embeddings from LLMs with structural features of Abstract Syntax Trees (ASTs) to improve both efficiency and accuracy in code vulnerability detection. Our approach introduces an AST-based augmentation technique inspired by mutation testing, a structure-aware attention mechanism that incorporates augmented AST features, and a joint adaptation pipeline to unify code semantics and syntax. Experimental results on three large-scale datasets, including BigVul, DiverseVul, and PrimeVul-demonstrate state-of-the-art performance while enabling rapid inference on CPUs with minimal training time. By offering a scalable, interpretable, and efficient solution, K-ASTRO bridges the gap between LLM advancements and practical software vulnerability detection, providing open-sourced tools to foster further research.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。