BaxBench:LLM能否生成正确且安全的后端?
BaxBench: Can LLMs Generate Correct and Secure Backends?
AI总结:
研究提出了BaxBench基准,包含392个后端应用生成任务,通过测试用例和端到端漏洞利用评估LLMs生成代码的功能正确性与安全性,发现当前模型在正确率和安全性上存在显著局限。
摘要:
自动程序生成长期以来一直是计算机科学中的一个基本挑战。最近的基准测试表明,大型语言模型(LLMs)能够有效地在函数级别生成代码、进行代码编辑以及解决算法编程任务。然而,要实现完全自动化,LLMs应当能够生成生产质量、独立的应用程序模块。为了评估LLMs在解决这一挑战方面的能力,我们引入了BaxBench,这是一个新颖的评估基准,包含392个用于生成后端应用程序的任务。我们关注后端有三个关键原因:(i)它们具有实际相关性,构建了大多数现代Web和云软件的核心组件;(ii)它们很难正确实现,需要多个函数和文件才能达到所需的功能;(iii)它们是安全关键的,因为它们暴露给不受信任的第三方,这使得防止部署时攻击的安全解决方案成为必然要求。BaxBench通过全面的测试用例验证生成应用程序的功能,并通过执行端到端漏洞利用来评估其安全暴露情况。我们的实验揭示了当前LLMs在功能性和安全性方面的关键局限性:(i)即使是最好的模型OpenAI o1,在代码正确性上也仅达到62%;(ii)平均而言,我们能够对每个LLM生成的正确程序中的约一半成功执行安全漏洞利用;(iii)在不太流行的后端框架中,模型进一步难以生成正确且安全的应用程序。在BaxBench上的进展标志着朝着使用LLMs进行自主且安全的软件开发迈出了重要一步。
英文摘要:
Automatic program generation has long been a fundamental challenge in computer science. Recent benchmarks have shown that large language models (LLMs) can effectively generate code at the function level, make code edits, and solve algorithmic coding tasks. However, to achieve full automation, LLMs should be able to generate production-quality, self-contained application modules. To evaluate the capabilities of LLMs in solving this challenge, we introduce BaxBench, a novel evaluation benchmark consisting of 392 tasks for the generation of backend applications. We focus on backends for three critical reasons: (i) they are practically relevant, building the core components of most modern web and cloud software, (ii) they are difficult to get right, requiring multiple functions and files to achieve the desired functionality, and (iii) they are security-critical, as they are exposed to untrusted third-parties, making secure solutions that prevent deployment-time attacks an imperative. BaxBench validates the functionality of the generated applications with comprehensive test cases, and assesses their security exposure by executing end-to-end exploits. Our experiments reveal key limitations of current LLMs in both functionality and security: (i) even the best model, OpenAI o1, achieves a mere 62% on code correctness; (ii) on average, we could successfully execute security exploits on around half of the correct programs generated by each LLM; and (iii) in less popular backend frameworks, models further struggle to generate correct and secure applications. Progress on BaxBench signifies important steps towards autonomous and secure software development with LLMs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。