Skip to main navigation Skip to search Skip to main content

AI-Powered, But Power-Hungry? Energy Efficiency of LLM-Generated Code

  • Lola Solovyeva*
  • , Sophie Weidmann
  • , Fernando Castor
  • *Corresponding author for this work

Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

72 Downloads (Pure)

Abstract

Large language models (LLMs) are used in software development to assist in various tasks, e.g., code generation and code completion, but empirical evaluations of the quality of the results produced by these models focus on correctness and ignore other relevant aspects, such as their performance and energy efficiency. Studying the performance of LLM-produced programs is essential to understand how well LLMs can support the construction of performance- and energy-critical software, such as operating systems, servers, and mobile applications. This paper presents the first study analyzing the energy efficiency and performance of LLM-generated code for three programming languages Python, Java, and C++, on two platforms, a Mac and a PC, leveraging three frontier LLMs, Github Copilot, GPT-4o, and the recently-released OpenAI o1-mini, and targeting "hard"programming problems from LeetCode. Our results show that the models are much more successful in generating Python and Java than C++ code. Also, LLM-generated code sometimes surpasses an efficient human-written solution, although that is language-dependent and the language with the best results, Python, is the one where application performance and energy consumption tend to matter the least in practice. Furthermore, the performance of generated code is highly correlated across the two platforms, hinting at potential for results to be portable across platforms.

Original languageEnglish
Title of host publicationProceedings - 2025 IEEE/ACM 2nd International Conference on AI Foundation Models and Software Engineering, FORGE 2025
PublisherIEEE
Pages49-60
Number of pages12
ISBN (Electronic)9798331502119
DOIs
Publication statusPublished - 2 Jul 2025
Event2nd IEEE/ACM International Conference on AI Foundation Models and Software Engineering, FORGE 2025 - Ottawa, Canada
Duration: 27 Apr 202528 Apr 2025
Conference number: 2

Conference

Conference2nd IEEE/ACM International Conference on AI Foundation Models and Software Engineering, FORGE 2025
Abbreviated titleFORGE 2025
Country/TerritoryCanada
CityOttawa
Period27/04/2528/04/25

UN SDGs

This output contributes to the following UN Sustainable Development Goals (SDGs)

  1. SDG 7 - Affordable and Clean Energy
    SDG 7 Affordable and Clean Energy

Keywords

  • 2026 OA procedure

Fingerprint

Dive into the research topics of 'AI-Powered, But Power-Hungry? Energy Efficiency of LLM-Generated Code'. Together they form a unique fingerprint.

Cite this