Prompt wording alone cut energy use of generated code by up to 25% in Python and 17% in C++ across 10 models. You can apply these strategies to coding agents without changing models.
Key takeaways · AI-distilled
The authors screened 21 prompting strategies for energy-efficient code, then tested 8 of them across 10 open weightsA model whose trained parameters are published for anyone to download and run — unlike API-only models you can access but never possess.Full definition → and proprietary LLMs on Python and C++ against a baseline prompt.
Across models, the selected prompts cut energy use of the generated code by up to 25% for Python and up to 17% for C++, measured relative to the baseline prompt.
Effects vary sharply by model and language: Python reductions reached 50% for Granite-4.0-H-Small and 39% for Claude 4.5 Haiku, while the best C++ result for Qwen3-Coder-480B was only 7%, so no single prompt is a universal fix.
Terms in this piece · Glossary
LLM — A large language model — the neural network behind tools like Claude and ChatGPT, trained on huge amounts of text to predict what comes next.
open weights — A model whose trained parameters are published for anyone to download and run — unlike API-only models you can access but never possess.