Evaluating the Energy-Efficiency of the Code Generated by LLMs
Md Arman Islam, Devi Varaprasad Jonnala, Ritika Rekhi, Pratik Pokharel, Siddharth Cilamkoti, Asif Imran, Tevfik Kosar, Bekir Turkkan

TL;DR
This study evaluates the energy efficiency of code generated by 20 large language models across diverse programming problems, revealing that human solutions are generally more energy-efficient than LLM-generated code, with significant variability among models.
Contribution
It provides the first comprehensive comparison of energy efficiency between LLM-generated code and human solutions across multiple algorithms and models.
Findings
LLMs often produce less energy-efficient code than humans.
DeepSeek-v3 and GPT-4o are the most energy-efficient models.
Grok-2 and Gemini-1.5-Pro are among the least energy-efficient.
Abstract
As the quality of code generated by Large Language Models (LLMs) improves, their adoption in the software industry for automated code generation continues to grow. Researchers primarily focus on enhancing the functional correctness of the generated code while commonly overlooking its energy efficiency and environmental impact. This paper investigates the energy efficiency of the code generated by 20 popular LLMs for 878 programming problems of varying difficulty levels and diverse algorithmic categories selected from the LeetCode platform by comparing them against canonical human-written solutions. Although LLMs can produce functionally correct results in most cases, our findings show that the performance and energy efficiency of LLM-produced solutions are often far below those of human-written solutions. Among the studied LLMs, DeepSeek-v3 and GPT-4o generate the most energy-efficient…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsEnergy Efficiency and Management · Modeling, Simulation, and Optimization · Industrial Engineering and Technologies
MethodsFocus
