用进化树管理代码优化历史,让大模型高效迭代改进科学计算代码。
Large Language Model-Powered Evolutionary Code Optimization on a Phylogenetic Tree
- 将代码优化建模为上下文强化学习,利用历史修改轨迹提升效率。
- 在多个科学计算任务上实现运行时间、内存和正确率的稳定提升。
- 适合需要长期优化复杂算法的研究者和高性能计算团队。
针对现代GPU优化科学计算算法是一项耗时且迭代的过程,涉及反复的代码修改、基准测试与调优。现有基于大语言模型(LLM)的进化方法主要依赖结果导向的选择与随机突变,未能充分利用优化过程中的轨迹信息。本文提出PhyloEvolve,一个将GPU算法优化重构为上下文强化学习(ICRL)问题的LLM代理系统,实现无需重训练即可复用优化经验。该系统整合算法提炼与基于提示的决策变压器,将算法修改序列与性能反馈作为核心学习信号。为组织优化历史,引入系统发育树表示法,捕捉算法变体间的继承、分化与重组,支持回溯、跨谱系迁移与可复现性。系统结合精英轨迹池、多岛并行探索与容器化执行,在异构硬件上平衡探索与利用。在偏微分方程求解器、流形学习与谱图算法等科学计算负载上评估,均显著优于基线与传统进化方法,在运行时间、内存效率与正确率方面持续提升。代码已公开于:https://github.com/annihi1ation/phylo_evolve
原文摘要 · Abstract (English)
Optimizing scientific computing algorithms for modern GPUs is a labor-intensive and iterative process involving repeated code modification, benchmarking, and tuning across complex hardware and software stacks. Recent work has explored large language model (LLM)-assisted evolutionary methods for automated code optimization, but these approaches primarily rely on outcome-based selection and random mutation, underutilizing the rich trajectory information generated during iterative optimization. We propose PhyloEvolve, an LLM-agent system that reframes GPU-oriented algorithm optimization as an In-Context Reinforcement Learning (ICRL) problem. This formulation enables trajectory-conditioned reuse of optimization experience without model retraining. PhyloEvolve integrates Algorithm Distillation and prompt-based Decision Transformers into an iterative workflow, treating sequences of algorithm modifications and performance feedback as first-class learning signals. To organize optimization history, we introduce a phylogenetic tree representation that captures inheritance, divergence, and recombination among algorithm variants, enabling backtracking, cross-lineage transfer, and reproducibility. The system combines elite trajectory pooling, multi-island parallel exploration, and containerized execution to balance exploration and exploitation across heterogeneous hardware. We evaluate PhyloEvolve on scientific computing workloads including PDE solvers, manifold learning, and spectral graph algorithms, demonstrating consistent improvements in runtime, memory efficiency, and correctness over baseline and evolutionary methods. Code is published at: https://github.com/annihi1ation/phylo_evolve
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。