用可复用的代码优化技能提升大模型的效率改进能力
EffiSkill: Agent Skill Based Automated Code Efficiency Optimization
- 将常见慢代码转快代码模式提炼为可复用的智能体技能
- 在多个语言和模型上比最强基线提升3.69至12.52个百分点
- 无需运行程序即可诊断、检索、组合技能,适合自动化优化场景
代码效率是软件质量的核心,但如何利用大语言模型(LLMs)优化程序仍具挑战。现有方法多依赖单次重写、示例检索或提示搜索,未显式提炼可复用的优化知识,限制了泛化能力。本文提出EffiSkill框架,构建面向LLM智能体的可移植优化工具箱。核心思想是将重复出现的慢代码到快代码转换建模为可复用的智能体技能,包含具体变换机制与高层优化策略。EffiSkill采用两阶段设计:第一阶段从大规模慢/快程序对中挖掘操作技能(Operator Skills)和元技能(Meta Skills),构建技能库;第二阶段通过无执行诊断、技能检索、计划组合与候选生成,在不依赖运行时反馈的情况下优化未知程序。在EffiBench-X上的结果表明,EffiSkill优化成功率更高,相比最强基线提升3.69至12.52个百分点,覆盖多种模型与编程语言。研究证明,机制级技能复用为无执行代码优化提供了有效基础,所生成的技能库亦可作为通用智能体工作流资源。
原文摘要 · Abstract (English)
Code efficiency is a fundamental aspect of software quality, yet how to harness large language models (LLMs) to optimize programs remains challenging. Prior approaches have sought for one-shot rewriting, retrieved exemplars, or prompt-based search, but they do not explicitly distill reusable optimization knowledge, which limits generalization beyond individual instances. In this paper, we present EffiSkill, a framework for code-efficiency optimization that builds a portable optimization toolbox for LLM-based agents. The key idea is to model recurring slow-to-fast transformations as reusable agent skills that capture both concrete transformation mechanisms and higher-level optimization strategies. EffiSkill adopts a two-stage design: Stage I mines Operator and Meta Skills from large-scale slow/fast program pairs to build a skill library; Stage II applies this library to unseen programs through execution-free diagnosis, skill retrieval, plan composition, and candidate generation, without runtime feedback. Results on EffiBench-X show that EffiSkill achieves higher optimization success rates, improving over the strongest baseline by 3.69 to 12.52 percentage points across model and language settings. These findings suggest that mechanism-level skill reuse provides a useful foundation for execution-free code optimization, and that the resulting skill library can serve as a reusable resource for broader agent workflows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。