PerfCoder:用于可解释代码性能优化的大型语言模型
PerfCoder: Large Language Models for Interpretable Code Performance Optimization
AI总结:
PerfCoder通过可解释的定制化优化生成高性能代码,优于现有模型,在代码性能基准上实现更高效的优化策略。
摘要:
大型语言模型(LLMs)在自动代码生成方面取得了显著进展,但其生成高性能代码的能力仍然有限,这在现实软件系统中至关重要。我们认为,当前LLMs的局限不仅源于数据稀缺,更重要的是缺乏指导可解释和有效性能改进的监督。本文引入PerfCoder,一组专门设计用于从源代码生成性能增强代码的LLMs,通过可解释、定制化的优化。PerfCoder在经过精心挑选的现实世界优化轨迹上进行微调,通过强化学习进行偏好对齐,使其能够提出输入特定的改进策略并直接应用,而无需迭代优化。在PIE代码性能基准上,PerfCoder在运行时加速和有效优化率上均超越现有模型,证明性能优化不能仅靠规模,而需要优化策略意识。此外,PerfCoder可以生成关于源代码的可解释反馈,当作为更大LLM在规划和优化协作工作流程中的输入时,可以进一步提高结果。具体来说,我们使32B模型和GPT-5在代码优化方面达到新水平,显著超越其原始性能。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。