Generating Energy-Efficient Code via Large-Language Models -- Where are we now?
- URL: http://arxiv.org/abs/2509.10099v1
- Date: Fri, 12 Sep 2025 09:49:46 GMT
- Title: Generating Energy-Efficient Code via Large-Language Models -- Where are we now?
- Abstract summary: Large Language Models (LLMs) have led to their widespread adoption in development pipelines.<n>We empirically assess the energy efficiency of Python code generated by LLMs against human-written code and code developed by a Green software expert.
- Score: 2.561129176520328
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: Context. The rise of Large Language Models (LLMs) has led to their widespread adoption in development pipelines. Goal. We empirically assess the energy efficiency of Python code generated by LLMs against human-written code and code developed by a Green software expert. Method. We test 363 solutions to 9 coding problems from the EvoEval benchmark using 6 widespread LLMs with 4 prompting techniques, and comparing them to human-developed solutions. Energy consumption is measured on three different hardware platforms: a server, a PC, and a Raspberry Pi for a total of ~881h (36.7 days). Results. Human solutions are 16% more energy-efficient on the server and 3% on the Raspberry Pi, while LLMs outperform human developers by 25% on the PC. Prompting does not consistently lead to energy savings, where the most energy-efficient prompts vary by hardware platform. The code developed by a Green software expert is consistently more energy-efficient by at least 17% to 30% against all LLMs on all hardware platforms. Conclusions. Even though LLMs exhibit relatively good code generation capabilities, no LLM-generated code was more energy-efficient than that of an experienced Green software developer, suggesting that as of today there is still a great need of human expertise for developing energy-efficient Python code.
Related papers
- Energy-Aware Code Generation with LLMs: Benchmarking Small vs. Large Language Models for Sustainable AI Programming [2.588812622437082]
We evaluate open-source Small Language Models (SLMs) trained explicitly for code generation against large Large Language Models (LLMs) and efficient human-written Python code.<n>We evaluate 150 coding problems from LeetCode, evenly distributed across three difficulty levels: easy, medium, and hard.<n>LLMs achieve the highest correctness across all difficulty levels, but SLMs are often more energy-efficient when their outputs are correct.
arXiv Detail & Related papers (2025-08-10T14:44:06Z) - Evaluating the Energy-Efficiency of the Code Generated by LLMs [2.1983110147455482]
This paper investigates the energy efficiency of the code generated by 20 popular Large Language Models for 878 programming problems.<n>Among the studied LLMs, DeepSeek-v3 and GPT-4o generate the most energy-efficient code.<n>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.
arXiv Detail & Related papers (2025-05-23T18:13:27Z) - Can We Make Code Green? Understanding Trade-Offs in LLMs vs. Human Code Optimizations [45.243401722182554]
Large language models (LLMs) claim to assist developers in optimizing code for performance and energy efficiency.<n>This work focuses on software written in Matlab-widely used in both academia and industry for scientific and engineering applications.<n>We analyze energy-focused optimization on 400 scripts across 100 top GitHub repositories.
arXiv Detail & Related papers (2025-03-26T00:27:29Z) - AI-Powered, But Power-Hungry? Energy Efficiency of LLM-Generated Code [45.77395425799378]
This paper presents the first study analyzing the energy efficiency and performance of LLM-generated code for three programming languages Python, Java, and C++.<n>Our results show that the models are much more successful in generating Python and Java than C++ code.
arXiv Detail & Related papers (2025-02-04T15:32:34Z) - GREEN-CODE: Learning to Optimize Energy Efficiency in LLM-based Code Generation [1.5749416770494706]
This work proposes a framework for energy-aware code generation in Large Language Models (LLMs)<n>We train a Reinforcement Learning (RL) agent that learns to balance the trade-offs between accuracy, latency, and energy consumption.<n>Results show that our method reduces the energy consumption between 23-50 % on average for code generation tasks without significantly affecting accuracy.
arXiv Detail & Related papers (2025-01-19T10:44:03Z) - PerfCodeGen: Improving Performance of LLM Generated Code with Execution Feedback [78.89596149768458]
Large Language Models (LLMs) are widely adopted for assisting in software development tasks.<n>We propose PerfCodeGen, a training-free framework that enhances the performance of LLM-generated code.
arXiv Detail & Related papers (2024-11-18T06:22:38Z) - Generating Energy-efficient code with LLMs [0.0]
We look at the influence of prompt modification on the energy consumption of the code generated.<n>The large language models used are CodeLlama-70b, CodeLlama-70b-Instruct, CodeLlama-70b-Python, DeepSeek-Coder-33b-base, and DeepSeek-Coder-33b-instruct.
arXiv Detail & Related papers (2024-11-15T21:45:58Z) - A Controlled Experiment on the Energy Efficiency of the Source Code Generated by Code Llama [4.937787069991124]
83% of software developers use Large Language Models (LLMs) to generate code.
This paper assesses the energy efficiency of Code Llama with respect to human-written source code.
arXiv Detail & Related papers (2024-05-06T16:32:29Z) - InfiBench: Evaluating the Question-Answering Capabilities of Code Large Language Models [56.723509505549536]
InfiBench is the first large-scale freeform question-answering (QA) benchmark for code to our knowledge.
It comprises 234 carefully selected high-quality Stack Overflow questions that span across 15 programming languages.
We conduct a systematic evaluation for over 100 latest code LLMs on InfiBench, leading to a series of novel and insightful findings.
arXiv Detail & Related papers (2024-03-11T02:06:30Z) - WizardCoder: Empowering Code Large Language Models with Evol-Instruct [106.77843374640752]
We introduce WizardCoder, which empowers Code LLMs with complex instruction fine-tuning.<n>Our model surpasses all other open-source Code LLMs by a substantial margin.
arXiv Detail & Related papers (2023-06-14T15:18:48Z) - Chameleon: Plug-and-Play Compositional Reasoning with Large Language
Models [187.58051653991686]
Large language models (LLMs) have achieved remarkable progress in solving various natural language processing tasks.
However, they have inherent limitations as they are incapable of accessing up-to-date information.
We present Chameleon, an AI system that augments LLMs with plug-and-play modules for compositional reasoning.
arXiv Detail & Related papers (2023-04-19T17:47:47Z) - Can Large Language Models Transform Computational Social Science? [79.62471267510963]
Large Language Models (LLMs) are capable of performing many language processing tasks zero-shot (without training data)
This work provides a road map for using LLMs as Computational Social Science tools.
arXiv Detail & Related papers (2023-04-12T17:33:28Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.