arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.05712cs.SEcs.AI
收藏

迈向绿色AI:解码LLM推理中的能耗在软件开发中

Towards Green AI: Decoding the Energy of LLM Inference in Software Development

University of Twente(特文特大学)

Lola Solovyeva, Fernando Castor

AI总结:

本研究分析了LLM推理能耗,发现prefill阶段影响解码能耗,通过抑制babbling行为可实现高达89%的能耗节省。

摘要:

背景:随着AI辅助工具越来越多地融入软件开发工作流程中,但其对大型语言模型(LLMs)的依赖引入了显著的计算和能耗成本。因此,理解并减少LLM推理的能耗对于可持续的软件开发至关重要。目标:在本研究中,我们对LLM推理能耗进行了阶段级分析,区分了(1)prefill阶段,模型处理输入并构建内部表示,以及(2)decoding阶段,生成输出令牌使用存储的状态。方法:我们研究了六个6B-7B和四个3B-4B的transformer模型,在代码导向的基准测试HumanEval(代码生成)和LongBench(代码理解)上进行评估。结果:我们的发现表明,在两个参数组中,模型在不同阶段表现出不同的能耗模式。此外,我们观察到prefill成本的增加会放大解码阶段的每token能耗成本,放大率从1.3%到51.8%不等,具体取决于模型。最后,有三个模型表现出babbling行为,生成过多内容,导致不必要的能耗增加。我们实现了对代码生成的babbling抑制,实现了44%到89%的能耗节省,而不会影响生成准确性。结论:这些发现表明,prefill成本影响解码,解码主导能耗消耗,并且babbling抑制可以产生高达89%的能耗节省。因此,减少推理能耗需要同时减轻babbling行为和限制prefill对解码的影响。

英文摘要:

Context: AI-assisted tools are increasingly integrated into software development workflows, but their reliance on large language models (LLMs) introduces substantial computational and energy costs. Understanding and reducing the energy footprint of LLM inference is therefore essential for sustainable software development. Objective: In this study, we conduct a phase-level analysis of LLM inference energy consumption, distinguishing between the (1) prefill, where the model processes the input and builds internal representations, and (2) decoding, where output tokens are generated using the stored state. Method: We investigate six 6B-7B and four 3B-4B transformer-based models, evaluating them on code-centric benchmarks HumanEval for code generation and LongBench for code understanding. Results: Our findings show that, within both parameter groups, models exhibit distinct energy patterns across phases. Furthermore, we observed that increases in prefill cost amplify the energy cost per token during decoding, with amplifications ranging from 1.3% to 51.8% depending on the model. Lastly, three out of ten models demonstrate babbling behavior, adding excessive content to the output that unnecessarily inflates energy consumption. We implemented babbling suppression for code generation, achieving energy savings ranging from 44% to 89% without affecting generation accuracy. Conclusion: These findings show that prefill costs influence decoding, which dominates energy consumption, and that babbling suppression can yield up to 89% energy savings. Reducing inference energy therefore requires both mitigating babbling behavior and limiting impact of prefill on decoding.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑