paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Search-Based LLMs for Code Optimization

面向代码优化的基于搜索的大语言模型
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 4/10 · 论文将LLM与进化搜索结合用于代码优化/编译优化,属于PL与AI交叉的代码生成与优化方向,但与用户核心关注的LLM/Agent改进静态分析、形式化验证、浮点程序分析或贝叶斯程序分析并无直接关联。其“搜索式LLM”思路有一定工具借鉴意义,但任务本身不是Agentic程序分析或静态分析。引用 15 inbox
Shuzheng Gao, Cuiyun Gao, Wenchao Gu, Michael R. Lyu
crossref: 2026-09-12

AI 速览

一句话:提出 SBLLM,将 LLM 与进化搜索结合,通过迭代精化与优化模式检索自动提升代码执行效率。

代码优化中,规则方法覆盖面低,LLM 一步生成难以处理组合式优化并注入所需知识,常产生欠优化代码。本文将任务建模为搜索问题,提出搜索式 LLM 框架 SBLLM,将 LLM 与进化搜索协同:执行制代表性样本选择评估候选适应度并优先选择有潜力代码;自适应优化模式检索注入针对性模式引导迭代修正;遗传算子启发的思维链提示帮助 LLM 组合并生成更优优化方法。在 Python 与 C++ 数据集上,SBLLM 最高提升执行效率 209.59%,top-5 加速率以不同 LLM 持续优于基线,分别高出 8.75%–28.06% 与 1.15%–9.56%。

问题
现有代码优化方法覆盖有限,LLM 一步生成范式难以捕捉组合式优化并精确注入优化知识,导致优化不足。
方法
将代码优化视为搜索问题,提出 SBLLM,融合 LLM 与进化搜索,包括基于执行的样本选择、自适应优化模式检索与遗传算子启发的思维链提示。
评估
在 Python 和 C++ 数据集上评估,SBLLM 最高提升执行效率 209.59%,并在 top-5 加速率上以不同 LLM 持续优于多个基线。
原文摘要(Abstract)

The code written by developers usually suffers from efficiency problems and contain various performance bugs. These inefficiencies necessitate the research of automated refactoring methods for code optimization. Early research in code optimization employs rule-based methods and focuses on specific inefficiency issues, which are labor-intensive and suffer from the low coverage issue. Recent work regards the task as a sequence generation problem, and resorts to deep learning (DL) techniques such as large language models (LLMs). These methods typically prompt LLMs to directly generate optimized code. Although these methods show state-of-the-art performance, such one-step generation paradigm is hard to achieve an optimal solution. First, complex optimization methods such as combinatorial ones are hard to be captured by LLMs. Second, the one-step generation paradigm poses challenge in precisely infusing the knowledge required for effective code optimization within LLMs, resulting in under-optimized code. To address these problems, we propose to model this task from the search perspective, and propose a search-based LLMs framework named SBLLM that enables iterative refinement and discovery of improved optimization methods. SBLLM synergistically integrate LLMs with evolutionary search and consists of three key components: 1) an execution-based representative sample selection part that evaluates the fitness of each existing optimized code and prioritizes promising ones to pilot the generation of improved code; 2) an adaptive optimization pattern retrieval part that infuses targeted optimization patterns into the model for guiding LLMs towards rectifying and progressively enhancing their optimization methods; and 3) a genetic operatorinspired chain-of-thought prompting part that aids LLMs in combining different optimization methods and generating improved optimization methods. Our evaluation of SBLLM on a dataset of Python and C++ code demonstrates its effectiveness in improving code efficiency. Specifically, the results indicate that SBLLM can improve program execution efficiency by up to 209.59 % and consistently outperform all baseline methods by$8.75 \% \sim 28.06 {\%}$and$1.15 \% \sim 9.56 {\%}$with different LLMs in terms of top-5 speedup rate on Python and C++, respectively.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8733,
  title = {Search-Based LLMs for Code Optimization},
  author = {Shuzheng Gao and Cuiyun Gao and Wenchao Gu and Michael R. Lyu},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00021}
}