arXiv cs.AI· Sadra Emami, Benjamin Weigell, Mohammad Reza Mousavi, Gunel Jahangirova, Hugo Araujo, Bernhard Bauer·· 3 小时前AI 评分49
LLM 代码优化是绿色还是高成本?基于迭代式 LLM 代码优化的能耗评估
Green Code or Costly Code? Evaluating the Energy Costs of Iterative LLM-Based Code Optimizations
AI 导读
arXiv 一项 ICSE 2027 录用研究测量了 11 个开源模型在 EffiBench 全部 1,000 道题上进行代码优化的能耗。推理能耗为 0.79 到 8.68 MJ,约相当于 250 到 2800 次 GPT-4.1 查询;44 个配置中 42 个产出的代码比人类参考解更耗能,开销为 +4% 到 +886%。
正文 · 原文
Abstract:Large Language Models (LLMs) are increasingly used to optimize code for performance. This practice often assumes that improvements in execution speed naturally translate into overall lower energy consumption. We challenge this assumption empirically by measuring whether performance-optimized code produced by LLM self-refinement pipelines is also energy-efficient relative to canonical human reference solutions, and whether the energy cost of the optimization process can be offset by subsequent execution-time savings. We evaluate 11 open-source models across four decoding configurations on all 1,000 problems of EffiBench, a state-of-the-art performance benchmark, while collecting per-process, hardware-level energy measurements throughout. Inference energy spans 0.79 to 8.68 MJ across model-variant pairs, which is roughly equivalent to the energy of 250 to 2800 GPT-4.1 queries. Limiting the maximum number of output tokens has the largest impact, reducing energy use by up to 69% compared to the default configuration. On the execution side, 42 of 44 configurations produce code that consumes more energy per problem than the canonical human reference, with overheads ranging from +4% to +886%. The two exceptions achieve only marginal gains, with break-even points on the order of 10^6 to 10^7 executions. Mixture-of-Experts architectures consume substantially less inference energy than equivalently-sized dense models without sacrificing correctness, making architectural choice a more consequential sustainability lever than decoding parameters. Performance optimization and energy efficiency are not always aligned goals: LLM self-refinement consistently produces faster-seeking but energy-heavier code relative to what a human engineer would write. All artifacts are available at this https URL.
| Comments: | Accepted at the 49th IEEE/ACM International Conference on Software Engineering (ICSE 2027) |
| Subjects: | Software Engineering (cs.SE); Artificial Intelligence (cs.AI) |
| Cite as: | arXiv:2610.32891 [cs.SE] |
| (or arXiv:2610.32891v1 [cs.SE] for this version) | |
| https://doi.org/10.48550/arXiv.2610.32891 arXiv-issued DOI via DataCite (pending registration) |
Submission history
From: Sadra Emami [view email]
[v1]
Fri, 23 Oct 2026 16:58:01 UTC (160 KB)
来源:arXiv cs.AI · arxiv.org