arXiv:2505.20630cs.SEcs.CL2025-05被引 21

评测大模型在C语言漏洞分析中的结构与语义推理能力

SV-TrustEval-C: Evaluating Structure and Semantic Reasoning in Large Language Models for Source Code Vulnerability Analysis

  • 构建双维度基准:结构与语义推理能力评估
  • 现有大模型依赖模式匹配,逻辑推理能力不足
  • 适合关注代码安全与模型可信度的研究者

随着大型语言模型(LLMs)在代码理解与生成方面的发展,准确评估其在源代码漏洞分析中的可靠性变得日益重要。尽管已有研究考察了模型在漏洞检测与修复任务中的表现,但往往忽视了结构与语义推理对可信漏洞分析的关键作用。为此,我们提出SV-TrustEval-C基准,通过两个核心维度评估LLMs在C语言代码漏洞分析中的能力:结构推理——考察模型在数据流与控制流复杂性变化下识别代码元素间关系的能力;语义推理——评估模型在代码被结构性和语义性扰动时的逻辑一致性。实验结果表明,当前大模型在理解复杂代码关系方面仍不理想,其漏洞分析更多依赖模式匹配而非稳健的逻辑推理。该发现验证了SV-TrustEval-C基准的有效性,并指出了提升大模型在真实漏洞分析任务中推理能力与可信度的关键方向。初始基准数据集已公开。

原文摘要 · Abstract (English)

As Large Language Models (LLMs) evolve in understanding and generating code, accurately evaluating their reliability in analyzing source code vulnerabilities becomes increasingly vital. While studies have examined LLM capabilities in tasks like vulnerability detection and repair, they often overlook the importance of both structure and semantic reasoning crucial for trustworthy vulnerability analysis. To address this gap, we introduce SV-TrustEval-C, a benchmark designed to evaluate LLMs' abilities for vulnerability analysis of code written in the C programming language through two key dimensions: structure reasoning - assessing how models identify relationships between code elements under varying data and control flow complexities; and semantic reasoning - examining their logical consistency in scenarios where code is structurally and semantically perturbed. Our results show that current LLMs are far from satisfactory in understanding complex code relationships and that their vulnerability analyses rely more on pattern matching than on robust logical reasoning. These findings underscore the effectiveness of the SV-TrustEval-C benchmark and highlight critical areas for enhancing the reasoning capabilities and trustworthiness of LLMs in real-world vulnerability analysis tasks. Our initial benchmark dataset is publicly available.

代码安全大模型评估逻辑推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。