arXiv:2605.04677cs.SEcs.AI2026-05

用大模型+进化算法自动优化多语言代码性能,效果显著且保正确性。

CodeEvolve: LLM-Driven Evolutionary Optimization with Runtime-Enriched Target Selection for Multi-Language Code Enhancement

论文配图:CodeEvolve: LLM-Driven Evolutionary Optimization with Runtime-Enriched Target Selection for Multi-Language Code Enhancement
图 1 · 摘自论文原文
  • 结合运行时数据与大模型生成候选代码,动态选优化目标。
  • 在真实企业代码库中实现平均15.22倍加速,7个热点函数中有5个超越单次优化。
  • 适合需要自动化性能调优的开发者和研发团队使用。

我们提出CodeEvolve,一种基于大语言模型(LLM)的进化式代码优化框架,用于提升程序性能与代码质量。该框架在OpenEvolve基础上引入运行时引导的目标选择、蒙特卡洛树搜索(MCTS)、自动化代码精炼及针对Java和Salesforce Apex的语言特定评估流程。系统利用Java Flight Recorder(JFR)分析结果构建加权组件图,识别主要执行开销点,减少对人工瓶颈定位的依赖。针对每个优化目标,CodeEvolve生成候选修改,通过构建验证、单元测试、性能检查、静态分析及大模型评审进行评估,仅保留功能正确的变体。在真实世界优化任务中,CodeEvolve在保持正确性的前提下提升性能与代码指标。在一个大型企业级Java代码库上,其在7个热点函数上实现平均15.22×加速,并在其中5个函数上优于单次大模型优化。对Apex优化的消融实验表明,完整配置的MCTS方法平均产出19.5个有效程序(共20个),证明搜索、过滤与精炼各环节均贡献于更可靠的优化。

原文摘要 · Abstract (English)

We present CodeEvolve, an evolutionary framework for improving program performance and code quality with Large Language Models (LLMs). CodeEvolve extends OpenEvolve with runtime-guided target selection, Monte Carlo Tree Search (MCTS), automated code refinement, and language-specific evaluation pipelines for Java and Salesforce Apex. The system uses Java Flight Recorder (JFR) profiles to build weighted component graphs and select optimization targets that account for most execution cost, reducing reliance on manual bottleneck identification. For each target, CodeEvolve generates candidate edits, evaluates them through build validation, unit tests, performance checks, static analysis, and LLM-based review, and retains only variants that preserve functional correctness. Across real-world optimization tasks, CodeEvolve improves performance and code metrics while maintaining correctness. On a large enterprise Java codebase, it achieves an average speedup of 15.22$\times$ across seven hotspot functions and outperforms single-pass LLM optimization on five of them. An ablation study on Apex optimization shows that the full MCTS-augmented configuration produces 19.5 valid programs out of 20 on average, indicating that search, filtering, and refinement each contribute to more reliable optimization.

代码优化大模型性能提升自动化

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