LLM 推理能耗的 SIMPLE 定律
研究论文 · 2026/11/06
生成式AI按token计费,但token的成本并不相同。每个token进入KV缓存并增加后续token的成本,因此能量消耗随序列非线性增长。目前没有解析模型说明token的成本,最先进的模型是拟合而非定律,需要针对每个LLM进行拟合。我们推导了LLM推理的计算和内存访问复杂度的闭式表达式,涵盖MHA和GQA,并比较了一系列粒度递增的解析模型。由此得到SIMPLE推理模型(SIMPLE),这是一个四参数定律,将预填充与解码分开,并将解码分为KV缓存成本和下一token计算。在NVIDIA H100 GPU上对六个系列13个密集LLM的跟踪中,它达到了R2=0.969和11.97%的MAPE,比SOTA低3.1-3.5倍,且无需针对每个LLM校准。SIMPLE定律既能解释也能预测:预填充能量随隐藏维度二次增长,因此更大的LLM受长输入影响最大;更激进的GQA KV分组相对于标准MHA可将每token能量降低多达3倍。增加推理token预算会使输出长度超过解析推导的能量最小值,导致超线性能量增长;尽管准确率随预算增加,但能量增长更快,因此每焦耳智能在中间预算处达到峰值,并在4.0倍推理预算范围内下降多达3.14倍。代理服务相对于非代理服务将每请求能量提高13.0倍,这是由预填充和KV缓存项随输入长度增长驱动的;虽然前缀缓存消除了大部分预填充成本(-93%),但KV缓存项不受影响,因此即使缓存后的代理请求成本也高出4.8倍。
该研究提出了一个无需逐模型校准的解析定律,能准确预测LLM推理能耗,并揭示了架构和推理预算对能耗的影响,对优化LLM部署的能效具有重要指导意义。
Generative AI is billed per token, yet tokens are not equally expensive. Each token enters the KV-cache and raises the cost of those that follow, so energy grows non-linearly along a sequence whose tokens look identical. No analytical model states what a token costs, and the most accurate SOTA model is a fit, not a law: it absorbs architecture into fitted coefficients, requiring per-LLM fitting. We derive closed-form expressions of the computational and memory-access complexity of LLM inference in terms of architectural hyperparameters, covering MHA and GQA, and compare a family of analytical models of increasing granularity. From these, we obtain the SIMPLE Inference Model to Predict LLMs Energy (SIMPLE), a four-parameter law that separates prefill from decode, and decode into KV-cache cost and next-token computation. Over traces of 13 dense LLMs from six families on NVIDIA H100 GPUs, it attains R2 = 0.969 and 11.97% MAPE, 3.1-3.5x below the SOTA, without per-LLM calibration. The SIMPLE law explains as well as predicts: prefill energy grows quadratically with the hidden dimension, so larger LLMs suffer most from long inputs; and more aggressive GQA KV grouping reduces the per-token energy by up to 3x relative to standard MHA. Increasing the reasoning token budget pushes output length beyond the analytically derived energy minimum, driving super-linear energy growth; although accuracy grows with the budget, energy grows faster, so Intelligence per Joule peaks at an intermediate budget and falls by up to 3.14x across a 4.0x reasoning-budget range. Agentic serving raises energy per request by 13.0x relative to non-agentic ones, driven by the growth of both the prefill and the KV-cache terms with input length; while prefix caching removes most of the prefill cost (-93%), the KV-cache term is unaffected, so even a cached agentic request costs 4.8x more.