Automated Code Efficiency Optimization via Agent Skill Mining
Zimu Wang, Yuling Shi, Mengfan Li, Zijun Liu, Jie M. Zhang, Chengcheng Wan, Xiaodong Gu
原文摘要
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.
cs.SE · cs.CL