Papers › EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization

EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimization

24 May 2024arXiv:2405.15189archive 2025-07-28

Dong Huang, Jianbo Dai, Han Weng, Puzhen Wu, Yuhao QING, Heming Cui, Zhijiang Guo, Jie M. Zhang

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

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2405.15189")

Code

Syntology Ran 12 of 17 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · our draft was wrong; 10 ran with no contract checked.

By repository: official repository: 17 samples from 1 repository, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

huangd1999/effilearner officialmentioned in paperMIT report
huangd1999/soap officialmentioned in paperpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 12 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · our draft was wrong
10ran
5unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from huangd1999/EffiLearner. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

calculate_memory_usage huangd1999/EffiLearner/src/calculate_memory_usage.py official repository ran MIT (permissive) · d55a48418c812b09 · report
calculate_memory_usage huangd1999/EffiLearner/src/code_efficiency_calculator.py official repository ran MIT (permissive) · f21888a0452d23f3 · report
calculate_runtime huangd1999/EffiLearner/src/calculate_memory_usage.py official repository ran MIT (permissive) · 6cf2449e22e03c59 · report
calculate_runtime huangd1999/EffiLearner/src/code_efficiency_calculator.py official repository ran MIT (permissive) · 952b9c9886c64735 · report
fetch_completion huangd1999/EffiLearner/src/gpt_EffiLearner.py official repository ran MIT (permissive) · 1cf1dc440f14d987 · report
fetch_completion huangd1999/EffiLearner/src/gpt_generation.py official repository ran MIT (permissive) · a025fbf6131456dc · report
filter_line_profiler_results huangd1999/EffiLearner/src/run_source_code_five_times.py official repository ran fingerprinted MIT (permissive) · 2c1a50ab9452b4aa · report
filter_memory_profiler_results huangd1999/EffiLearner/src/run_source_code_five_times.py official repository ran fingerprinted MIT (permissive) · b1ff21f11875705f · report
prompt_construction huangd1999/effilearner/src/EffiLearner.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 4468d1d9afee5b05 · report
prompt_construction huangd1999/effilearner/src/gpt_EffiLearner.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 09a23c4ef21bd633 · report
report_max_memory_usage huangd1999/EffiLearner/src/calculate_memory_usage.py official repository ran MIT (permissive) · 1e930421d6b5e3e8 · report
report_max_memory_usage huangd1999/EffiLearner/src/code_efficiency_calculator.py official repository ran MIT (permissive) · 41e149764f34c485 · report
construct_prompt_template huangd1999/effilearner/src/open_llm_generation.py official repository unverified MIT (permissive) · 2878904bfb0b29f6 · report
construct_prompt_template huangd1999/effilearner/src/EffiLearner.py official repository unverified MIT (permissive) · 59ed4ee229411304 · report
fetch_completion huangd1999/effilearner/src/EffiLearner.py official repository unverified MIT (permissive) · 71b8326ce231d069 · report
fetch_completion huangd1999/effilearner/src/open_llm_generation.py official repository unverified MIT (permissive) · 30c53b3e7b5e16e4 · report
fetch_completion huangd1999/effilearner/src/EffiLearner.py official repository unverified MIT (permissive) · 87352e224fad7dbd · report

Tasks

Code GenerationHumanEval

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections