用真实开源代码自动生成评测任务,评估大模型写代码的实用性与安全性。
OSS-Bench: Benchmark Generator for Coding LLMs
- 从真实开源项目动态生成评测任务,自动替换函数为大模型生成代码。
- 在17个大模型上测试,发现模型大小与性能不一致,且普遍存在内存安全缺陷。
- 适合关注代码质量、安全性和真实场景评估的研究者和开发者使用。
随着AI编程助手的快速普及,大模型辅助开发日益普遍,亟需对生成代码的质量进行可靠评估。现有基准常依赖大量人工构建静态数据集,任务挑战性不足,或依赖不可扩展的真值标签,且忽视关键的低级别安全问题,尤其是内存安全。本文提出OSS-Bench,一个从真实开源软件自动构建大规模、实时评测任务的基准生成器。它将函数替换为大模型生成代码,并通过编译成功率、功能正确性及内存安全性三个自然指标进行评估,利用编译失败、测试套件违规和沙箱检测警报作为真值信号。我们在OSS-Bench(php)和OSS-Bench(sql)两个实例上评估了17种不同大模型,揭示了同家族模型的行为模式差异,以及模型规模与性能间的不一致性。结果表明,借助开源项目的演进复杂性,OSS-Bench有效缓解了过拟合问题;并通过扩展模糊测试实验,凸显了大模型在低级代码安全理解上的局限性。整体而言,OSS-Bench提供了一种实用且可扩展的框架,用于评估大模型在真实编程场景中的能力。
原文摘要 · Abstract (English)
In light of the rapid adoption of AI coding assistants, LLM-assisted development has become increasingly prevalent, creating an urgent need for robust evaluation of generated code quality. Existing benchmarks often require extensive manual effort to create static datasets, rely on indirect or insufficiently challenging tasks, depend on non-scalable ground truth, or neglect critical low-level security evaluations, particularly memory-safety issues. In this work, we introduce OSS-Bench, a benchmark generator that automatically constructs large-scale, live evaluation tasks from real-world open-source software. OSS-Bench replaces functions with LLM-generated code and evaluates them using three natural metrics: compilability, functional correctness, and memory safety, leveraging robust signals like compilation failures, test-suite violations, and sanitizer alerts as ground truth. In our evaluation, the benchmark, instantiated as OSS-Bench(php) and OSS-Bench(sql), profiles 17 diverse LLMs, revealing insights such as intra-family behavioral patterns and inconsistencies between model size and performance. Our results demonstrate that OSS-Bench mitigates overfitting by leveraging the evolving complexity of OSS and highlights LLMs' limited understanding of low-level code security via extended fuzzing experiments. Overall, OSS-Bench offers a practical and scalable framework for benchmarking the real-world coding capabilities of LLMs.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。