用AI自动生成代码安全测试题,效率提升12倍
AutoBaxBuilder: Bootstrapping Code Security Benchmarking
- 用大模型自动构建代码安全测试任务,无需人工逐条设计
- 新基准生成时间<2小时,成本低于4美元,准确率接近专家水平
- 适合评估大模型代码安全性,降低安全测试人力门槛
随着大语言模型在软件工程中广泛应用,评估其生成代码的正确性与安全性至关重要。以往研究表明,大模型常生成存在安全漏洞的代码,而这些发现依赖于安全专家耗费大量人力构建的专业评测集。然而,现有评测集存在三个问题:(i)可能污染训练数据,(ii)需持续扩展以覆盖新任务,(iii)需不断提升难度以挑战更强大的大模型。本文提出AutoBaxBuilder,一个从零开始自动生成代码安全评测任务的自动化流程。该流程结合大模型的代码理解能力与可靠的验证机制,构建功能性测试与端到端安全漏洞利用方案。通过与专家标注基准对齐进行定量验证,并经人工逐项检查确保逻辑正确性。我们使用该方法构建了新基准AutoBaxBench并公开发布,同时对主流大模型进行了全面评估。AutoBaxBuilder可在2小时内生成新任务,成本低于4美元;若包含人工验证,整体人力需求降低12倍。
原文摘要 · Abstract (English)
As large language models (LLMs) see wide adoption in software engineering, the reliable assessment of the correctness and security of LLM-generated code is crucial. Notably, prior work showed that LLMs are prone to generating code with security vulnerabilities, highlighting that security is often overlooked. These insights were enabled by specialized benchmarks crafted by security experts through significant manual effort. However, benchmarks (i) inevitably end up contaminating training data, (ii) must extend to new tasks to provide a more complete picture, and (iii) must increase in difficulty to challenge more capable LLMs. In this work, we address these challenges and present AutoBaxBuilder, an automated pipeline that generates code security benchmarking tasks from scratch. It leverages the code-understanding capabilities of LLMs combined with robust reliability checks to construct functional tests and end-to-end security-probing exploits. The quality of the pipeline is quantitatively confirmed by aligning its predictions with an expert-written baseline and qualitatively validated through manual soundness verification. We use AutoBaxBuilder to construct a new benchmark and release it to the public as AutoBaxBench, together with a thorough evaluation on contemporary LLMs. AutoBaxBuilder generates new tasks in under 2 hours, for less than USD 4. Including a manual verification, this reduces the required human effort for benchmark construction by a factor of 12.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。