真实代码库性能优化难题,新基准揭示大模型表现远不如专家。
Evaluating LLMs on Real-World Software Performance Optimization

- 构建基于开源项目的真实优化任务库,支持多维度性能评估。
- 大模型优化效果差:运行时加速几乎为零,内存减少近乎无效果。
- 适合关注大模型工程落地瓶颈的研究者与开发者参考。
软件性能优化是一项复杂且高度依赖人工的任务。尽管大型语言模型(LLMs)被用于代码改进,但缺乏能反映真实代码库中优化过程的基准。现有框架常简化问题,仅关注孤立函数或单一性能指标,忽略了执行时间与内存占用之间的权衡、测量环境噪声,以及输入数据和执行条件变化带来的影响。为此,我们提出SWE-Pro,一个源自102个开源项目中专家编写优化的仓库级基准。不同于以往,SWE-Pro为每个任务配备参数化测试,可在噪声感知的测量条件下,评估不同输入和执行条件下的运行时间、峰值内存和时序加权内存使用量(TWMU)。评估显示,当前大模型表现显著不足:运行时间增益可忽略,内存优化几乎不存在。相比之下,专家实现平均达到15.5倍速度提升和171.3倍峰值内存降低,91.2%的任务在运行时间上有所改进,65.7%在峰值内存上有所改善。研究揭示了当前大模型能力与专家工程需求之间的巨大差距。
原文摘要 · Abstract (English)
Software performance optimization is a notoriously complex and manual task. Despite the growing use of Large Language Models (LLMs) for code refinement, we still lack benchmarks that capture how optimization actually happens in real-world codebases. Existing frameworks often oversimplify the problem by focusing on isolated functions or a single performance metric, missing the critical trade-offs between execution time and memory footprint, the inherent noise of the measurement environment, and the variability introduced by different input data and execution conditions. We address this by introducing SWE-Pro, a repository-level benchmark derived from 102 expert-written optimizations from open-source projects. Unlike previous benchmarks, SWE-Pro pairs each task with parameterized tests to evaluate runtime, peak memory, and Time-Weighted Memory Usage (TWMU) across varying input data and execution conditions under noise-aware measurement conditions. Our evaluation shows that current LLMs struggle significantly: runtime gains are negligible, and memory optimizations are nearly non-existent. This stands in sharp contrast to expert implementations, which achieve an aggregate speedup of 15.5x and peak memory reduction of 171.3x over benchmark tasks. Expert-written improvements are observed in 91.2% of tasks for runtime and 65.7% for peak memory. Our findings expose a substantial gap between current LLM capabilities and the demands of expert-level engineering.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。