Energy-Aware Code Generation with LLMs: Benchmarking Small vs. Large Language Models for Sustainable AI Programming
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) are widely used for code generation. However, commercial models like ChatGPT require significant computing power, which leads to high energy use and carbon emissions. This has raised concerns about their environmental impact. In this study, we evaluate open-source Small Language Models (SLMs) trained explicitly for code generation and compare their performance and energy efficiency against large LLMs and efficient human-written Python code. The goal is to investigate whether SLMs can match the performance of LLMs on certain types of programming problems while producing more energy-efficient code. We evaluate 150 coding problems from LeetCode, evenly distributed across three difficulty levels: easy, medium, and hard. Our comparison includes three small open-source models, StableCode-3B, StarCoderBase-3B, and Qwen2.5-Coder-3B-Instruct, and two large commercial models, GPT-4.0 and DeepSeek-Reasoner. The generated code is evaluated using four key metrics: run-time, memory usage, energy consumption, and correctness. We use human-written solutions as a baseline to assess the quality and efficiency of the model-generated code. Results indicate that LLMs achieve the highest correctness across all difficulty levels, but SLMs are often more energy-efficient when their outputs are correct. In over 52% of the evaluated problems, SLMs consumed the same or less energy than LLMs.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 20 of its 26 references that are in the map. First posted on arXiv 10 Aug 2025.
Builds on
20 of 26 references.
References · 20
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 103
- 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 64
- 2021Compute and Energy Consumption Trends in Deep Learning Inferencecited by 61
- 2024How Efficient is LLM-Generated Code? A Rigorous & High-Standard Benchmarkcited by 43
- 2024What is the Role of Small Models in the LLM Era: A Surveycited by 41
- 2024Mercury: A Code Efficiency Benchmark for Code Large Language Modelscited by 35
- 2025Holistically Evaluating the Environmental Impact of Creating Language Modelscited by 26
- 2024On Evaluating the Efficiency of Source Code Generated by LLMscited by 21
- 2024A Controlled Experiment on the Energy Efficiency of the Source Code Generated by Code Llamacited by 8
- 2025AI-Powered, But Power-Hungry? Energy Efficiency of LLM-Generated Codecited by 8
- 2024Learn to Code Sustainably: An Empirical Study on LLM-based Green Code Generationcited by 7
8 more
- 2024Green My LLM: Studying the key factors affecting the energy consumption of code assistantscited by 6
- 2024Generating Energy-efficient code with LLMscited by 4
- 2025Carbon Footprint Evaluation of Code Generation through LLM as a Servicecited by 4
- 2025Comparative Analysis of Carbon Footprint in Manual vs. LLM-Assisted Code Developmentcited by 4
- 2025Evaluating the Energy-Efficiency of the Code Generated by LLMscited by 4
- 2025Sustainability via LLM Right-sizingcited by 3
- 2024Large Language Models for Energy-Efficient Code: Emerging Results and Future Directionscited by 2
- 2025Can We Make Code Green? Understanding Trade-Offs in LLMs vs. Human Code Optimizationscited by 1
Built on by
Citing papers per year: 2026: 2.
2 papers.