EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization

Dong Huang, Jianbo Dai, Han Weng, Puzhen Wu, Yuhao Qing +3 more
2/3/2026

No official code found. Best implementation: huangd1999/EffiLearner (14 stars, MIT, last commit 2025-05-10).

Abstract

Large language models (LLMs) have shown remarkable progress in code generation, but their generated code often suffers from inefficiency, resulting in longer execution times and higher memory consumption. To address this issue, we propose \textbf{EffiLearner}, a self-optimization framework that utilizes execution overhead profiles to improve the efficiency of LLM-generated code. EffiLearner first generates code using an LLM, then executes it locally to capture execution time and memory usage profiles. These profiles are fed back to the LLM, which then revises the code to reduce overhead. To evaluate the effectiveness of EffiLearner, we conduct extensive experiments on the EffiBench, HumanEval, and MBPP with 16 open-source and 6 closed-source models. Our evaluation results demonstrate that through iterative self-optimization, EffiLearner significantly enhances the efficiency of LLM-generated code. For example, the execution time (ET) of StarCoder2-15B for the EffiBench decreases from 0.93 (s) to 0.12 (s) which reduces 87.1% the execution time requirement compared with the initial code. The total memory usage (TMU) of StarCoder2-15B also decreases from 22.02 (Mb*s) to 2.03 (Mb*s), which decreases 90.8% of total memory consumption during the execution process. The source code of EffiLearner was released in https://github.com/huangd1999/EffiLearner

View on arXivView PDF

Code Implementations(1)

MIT

[NeurIPS 2024] Self-Optimization Improves the Efficiency of Code Generation

141Shell, PythonMay 20, 20241 years agoMIT

Similar Papers

Cite this paper

@article{huang2026effilearner,
  title  = {EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization},
  author = {Dong Huang and Jianbo Dai and Han Weng and Puzhen Wu and Yuhao Qing and Jie M.Zhang and Heming Cui and Zhijiang Guo},
  year   = {2026},
  eprint = {2405.15189},
  archivePrefix = {arXiv},
  doi    = {10.52202/079017-2684},
  url    = {https://arxiv.org/abs/2405.15189},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.15189.svg)](https://codeofpaper.com/paper/2405.15189)

Discussion