一句话:实证比较LLM生成、人类与绿色软件专家编写的Python代码能耗,专家代码始终更节能。
该研究评估大语言模型(LLM)生成 Python 代码的能效。作者在 EvoEval 基准的 9 个编程问题上,用 6 个主流 LLM 和 4 种提示技术生成 363 个解法,并与普通人类开发者及绿色软件专家的代码对比。能耗在服务器、PC 和 Raspberry Pi 三类硬件上测量,总计约 881 小时。结果显示:人类解法在服务器和 Raspberry Pi 上分别比 LLM 节能 16% 和 3%,而在 PC 上 LLM 比人类开发者节能 25%;提示技术未稳定节能,最节能提示因硬件而异;绿色软件专家代码在所有平台均比所有 LLM 至少节能 17% 至 30%。结论是 LLM 生成的代码尚不如人类专家节能,开发高能效 Python 代码仍需人类专业知识。
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.
@inproceedings{abs-2509-10099,
title = {Generating Energy-Efficient Code via Large-Language Models - Where are we now?},
author = {Radu Apsan and Vincenzo Stoico and Michel Albonico and Rudra Dhar and Karthik Vaidhyanathan and Ivano Malavolta},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3764522}
}