arXiv:2512.14018cs.SEcs.AI2025-12ACL被引 3

让大模型学会可解释的代码优化,提升运行效率。

PerfCoder: Large Language Models for Interpretable Code Performance Optimization

  • 基于真实优化轨迹和运行时反馈微调,生成可解释的性能改进策略。
  • 在PIE基准上实现更快的运行速度和更高的优化成功率。
  • 适合需要高效代码优化的开发者和系统级研究者使用。

大型语言模型(LLMs)在自动代码生成方面取得了显著进展,但其生成高性能代码的能力仍受限——这在实际软件系统中至关重要。我们认为,当前模型的不足不仅源于数据稀缺,更关键在于缺乏指导可解释、有效性能提升的监督信号。本文提出PerfCoder,一类专为通过可解释的定制化优化生成性能增强代码而设计的LLM。PerfCoder在经过人工可读标注的真实世界优化轨迹上进行微调,并通过运行时度量进行强化学习对齐,使其能够提出针对输入的优化策略并直接应用,无需迭代精炼。在PIE代码性能基准测试中,PerfCoder在运行时加速和有效优化率上均超越所有现有模型,表明性能优化不能仅靠规模实现,而需具备优化策略意识。此外,PerfCoder能生成关于源代码的可解释反馈,当作为输入提供给更大的LLM,在规划-优化协同工作流中可进一步提升结果。具体而言,我们显著提升了32B模型与GPT-5在代码优化上的表现,远超其原始性能。

原文摘要 · Abstract (English)

Large language models (LLMs) have achieved remarkable progress in automatic code generation, yet their ability to produce high-performance code remains limited--a critical requirement in real-world software systems. We argue that current LLMs struggle not only due to data scarcity but, more importantly, because they lack supervision that guides interpretable and effective performance improvements. In this work, we introduce PerfCoder, a family of LLMs specifically designed to generate performance-enhanced code from source code via interpretable, customized optimizations. PerfCoder is fine-tuned on a curated collection of real-world optimization trajectories with human-readable annotations, and preference-aligned by reinforcement fine-tuning using runtime measurements, enabling it to propose input-specific improvement strategies and apply them directly without relying on iterative refinement. On the PIE code performance benchmark, PerfCoder surpasses all existing models in both runtime speedup and effective optimization rate, demonstrating that performance optimization cannot be achieved by scale alone but requires optimization stratetgy awareness. In addition, PerfCoder can generate interpretable feedback about the source code, which, when provided as input to a larger LLM in a planner-and-optimizer cooperative workflow, can further improve outcomes. Specifically, we elevate the performance of 32B models and GPT-5 to new levels on code optimization, substantially surpassing their original performance.

代码优化大模型可解释性性能提升

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