TY - GEN
T1 - Evaluating the Energy-Efficiency of the Code Generated by LLMs
AU - Islam, Md Arman
AU - Jonnala, Devi Varaprasad
AU - Rekhi, Ritika
AU - Pokharel, Pratik
AU - Cilamkoti, Siddharth
AU - Imran, Asif
AU - Kosar, Tevfik
AU - Turkkan, Bekir
N1 - Publisher Copyright:
© 2025 IEEE.
PY - 2025
Y1 - 2025
N2 - 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 code, whereas Grok-2 and Gemini-1.5-Pro are among the least energy-efficient models. On average, human-generated canonical solutions are approximately 1.17 times more energy efficient than DeepSeek-v3, 1.21 times more energy efficient than GPT-4o, and over 2 times more energy efficient than Grok-2 and Gemini-1.5-Pro. For specific algorithmic groups such as dynamic programming, backtracking, and bit manipulation, LLM-generated code can consume up to 450 times more energy than human-generated canonical solutions.
AB - 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 code, whereas Grok-2 and Gemini-1.5-Pro are among the least energy-efficient models. On average, human-generated canonical solutions are approximately 1.17 times more energy efficient than DeepSeek-v3, 1.21 times more energy efficient than GPT-4o, and over 2 times more energy efficient than Grok-2 and Gemini-1.5-Pro. For specific algorithmic groups such as dynamic programming, backtracking, and bit manipulation, LLM-generated code can consume up to 450 times more energy than human-generated canonical solutions.
KW - LLMs
KW - Sustainable computing
KW - energy efficiency
UR - https://www.scopus.com/pages/publications/105035829203
U2 - 10.1109/FLLM67465.2025.11391172
DO - 10.1109/FLLM67465.2025.11391172
M3 - Conference contribution
AN - SCOPUS:105035829203
T3 - 2025 3rd International Conference on Foundation and Large Language Models, FLLM 2025
SP - 289
EP - 300
BT - 2025 3rd International Conference on Foundation and Large Language Models, FLLM 2025
A2 - Erenli, Kai
A2 - Guetl, Christian
A2 - Jararweh, Yaser
A2 - Jansen, Jim
PB - Institute of Electrical and Electronics Engineers Inc.
T2 - 2025 3rd International Conference on Foundation and Large Language Models, FLLM 2025
Y2 - 25 November 2025 through 28 November 2025
ER -