arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.27850cs.SEcs.CL
收藏

EffiSkill:基于代理技能的自动代码效率优化

Automated Code Efficiency Optimization via Agent Skill Mining

Shanghai Jiao Tong University(上海交通大学);University of California, Berkeley(加州大学伯克利分校);Columbia University(哥伦比亚大学);King's College London(伦敦国王学院);East China Normal University(华东师范大学);Shanghai Innovation Institute(上海创新研究院)

Zimu Wang, Yuling Shi, Mengfan Li, Zijun Liu, Jie M. Zhang, Chengcheng Wan, Xiaodong Gu

AI总结:

EffiSkill通过构建可移植的优化工具箱,利用代码效率优化机制,实现无运行反馈的代码优化,提升了优化成功率。

摘要:

代码效率是软件质量的一个基本方面,但如何利用大语言模型(LLMs)来优化程序仍具挑战性。先前的方法寻求一次性重写、检索示例或基于提示的搜索,但它们并未明确提炼可重用的优化知识,这限制了在个别实例之外的泛化能力。在本文中,我们提出了EffiSkill,一个用于代码效率优化的框架,它为基于LLM的代理构建了一个可移植的优化工具箱。核心思想是将反复出现的慢到快的转换建模为可重用的代理技能,这些技能既捕捉了具体的转换机制,也捕捉了更高层次的优化策略。EffiSkill采用两阶段设计:阶段I从大规模的慢/快程序对中挖掘操作符和元技能,以构建技能库;阶段II通过无运行反馈的诊断、技能检索、计划组合和候选生成,将此库应用于未见过的程序。在EffiBench-X上的结果表明,EffiSkill实现了更高的优化成功率,在模型和语言设置上,比最强的基线提高了3.69到12.52个百分点。这些发现表明,机制层面的技能重用为无运行反馈的代码优化提供了一个有用的基石,而由此产生的技能库可以作为更广泛代理工作流的可重用资源。

英文摘要:

Code efficiency is a fundamental aspect of software quality, yet how to use large language models (LLMs) to optimize correct programs remains challenging. Prior approaches rely on one-shot rewriting, retrieved exemplars or instructions, fine-tuning, or candidate search. In this paper, we present EffiSkill, a two-stage framework that models recurring slow-to-fast transformations as Operator Skills: persistent cards that record a transformation's intent, applicability, procedure, expected effect, and risks. Stage I distills frozen, language-specific skill libraries from slow/fast program pairs. Stage II diagnoses a new program, retrieves relevant skills, composes alternative plans, and generates up to eight candidates. These steps finish without candidate-execution feedback; public tests then filter and rank candidates, and held-out private tests determine reported correctness and speedup. Across 623 EffiBench-X tasks per language, two backbones, and separate Python and C++ evaluations, EffiSkill achieves the highest observed OPT@1 and OPT@8 among the compared methods in all four settings. Its OPT@8 margins over the strongest baselines range from 4.98 to 12.52 percentage points. These results support broader successful optimization coverage for the complete skill-guided pipeline under a shared output budget.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑