mlsanityData to 14 Oct 2026

Improving the Energy-Efficiency of the Code Generated by LLMs through Effective Prompting

arXiv 2610.02571 ↗First posted 1 Oct 2026cs.SE cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

As AI-assisted programming becomes increasingly mainstream, the environmental impact of AI-generated software has emerged as an important consideration. This motivates evaluating LLM-generated code beyond functional correctness by considering execution efficiency and energy consumption. However, despite substantial advances in code generation, frontier LLMs are rarely evaluated based on the energy efficiency of the code they produce. In this work, we conduct a comprehensive evaluation of 21 prompting strategies for energy-efficient code generation and identify 8 strategies for evaluation across 10 widely used open-weight and proprietary LLMs. We evaluate their effectiveness for both Python and C++ code generation relative to a baseline prompt. Across the evaluated models, the selected prompting strategies achieved energy reductions of up to 25% for Python and 17% for C++ code generation. At the model level, Python energy reductions reached up to 50% for Granite-4.0-H-Small, 39% for Claude 4.5 Haiku, and 28% for MiniMax M3, while C++ reductions reached up to 56% for Granite-4.0-H-Small and 7% for Qwen3-Coder-480B-A35B-Instruct. These results demonstrate that prompting strategies can substantially influence the energy consumption of LLM-generated code, although their effectiveness varies across models and programming languages. Our findings highlight the importance of incorporating energy efficiency into the evaluation and optimization of LLM-based code generation and provide practical insights into designing prompts for more sustainable AI-assisted programming.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 20 of its 42 references that are in the map. First posted on arXiv 1 Oct 2026.

Builds on

20 of 42 references.

References · 20

  1. 2025gpt-oss-120b & gpt-oss-20b Model Cardcited by 1,386
  2. 2019Energy and Policy Considerations for Deep Learning in NLPcited by 1,254
  3. 2019Green AIcited by 627
  4. 2020Towards the Systematic Reporting of the Energy and Carbon Footprints of Machine Learningcited by 249
  5. 2023Learning Performance-Improving Code Editscited by 106
  6. 2025LeetCodeDataset: A Temporal Dataset for Robust Evaluation and Efficient Training of Code LLMscited by 70
  7. 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 64
  8. 2024Mercury: A Code Efficiency Benchmark for Code Large Language Modelscited by 35
  9. 2024EffiLearner: Enhancing Efficiency of Generated Code via Self-Optimizationcited by 30
  10. 2024PerfCodeGen: Improving Performance of LLM Generated Code with Execution Feedbackcited by 24
  11. 2024On Evaluating the Efficiency of Source Code Generated by LLMscited by 21
  12. 2025Who is using AI to code? Global diffusion and impact of generative AIcited by 18
8 more
  1. 2024A Controlled Experiment on the Energy Efficiency of the Source Code Generated by Code Llamacited by 8
  2. 2025Generating Energy-Efficient Code via Large-Language Models -- Where are we now?cited by 6
  3. 2024Generating Energy-efficient code with LLMscited by 4
  4. 2025Evaluating the Energy-Efficiency of the Code Generated by LLMscited by 4
  5. 2025Energy-Aware Code Generation with LLMs: Benchmarking Small vs. Large Language Models for Sustainable AI Programmingcited by 2
  6. 2025Toward Green Code: Prompting Small Language Models for Energy-Efficient Code Generationcited by 2
  7. 2025ECO: Enhanced Code Optimization via Performance-Aware Prompting for Code-LLMscited by 2
  8. 2025Energy Consumption of Dataframe Libraries for End-to-End Deep Learning Pipelines:A Comparative Analysiscited by 1

Built on by

Not cited yet.