[论文解读] From Words to Watts: Benchmarking the Energy Costs of Large Language Model Inference
本论文在多节点 GPU 部署、数据集和硬件条件下对 LLaMA 模型(7B、13B、65B)的推理计算与能耗进行基准测试,以理解吞吐量-能耗权衡及资源共享机会。
Large language models (LLMs) have exploded in popularity due to their new generative capabilities that go far beyond prior state-of-the-art. These technologies are increasingly being leveraged in various domains such as law, finance, and medicine. However, these models carry significant computational challenges, especially the compute and energy costs required for inference. Inference energy costs already receive less attention than the energy costs of training LLMs -- despite how often these large models are called on to conduct inference in reality (e.g., ChatGPT). As these state-of-the-art LLMs see increasing usage and deployment in various domains, a better understanding of their resource utilization is crucial for cost-savings, scaling performance, efficient hardware usage, and optimal inference strategies. In this paper, we describe experiments conducted to study the computational and energy utilization of inference with LLMs. We benchmark and conduct a preliminary analysis of the inference performance and inference energy costs of different sizes of LLaMA -- a recent state-of-the-art LLM -- developed by Meta AI on two generations of popular GPUs (NVIDIA V100 \& A100) and two datasets (Alpaca and GSM8K) to reflect the diverse set of tasks/benchmarks for LLMs in research and practice. We present the results of multi-node, multi-GPU inference using model sharding across up to 32 GPUs. To our knowledge, our work is the one of the first to study LLM inference performance from the perspective of computational and energy resources at this scale.
研究动机与目标
- 表征带分片的 LLaMA 65B 在多 GPU 与多节点上的推理性能与能耗。
- 在最小硬件条件下,比较较小的 LLaMA 变体(7B、13B)的推理吞吐量与能耗。
- 评估数据集类型(Alpaca 与 GSM8K)在推理过程中的计算-能量动态。
- 探讨批量大小、分片数量与生成长度对能耗(每秒、每个 token、每个响应)之影响。
- 讨论在 HPC/数据中心环境中对 GPU 功率限制与资源共享的影响。
提出的方法
- 使用开源的 LLaMA 65B 实现,结合 FairScale 的模型分片,在多 GPU、跨多节点环境下运行推理。
- 在两个数据集上进行评估(Alpaca 指令跟随;GSM8K 数学问题),每个数据集包含 4,096 个输入。
- 使用 nvidia-smi 与 DCGM 测量吞吐量(每秒单词/令牌/响应)与能量,定义每秒/每个 token/每个响应的能量。
- 在 V100(32 GB)和 A100(80 GB)GPU 上,以及分片数高达 32 的配置下进行基准。
- 基线分析 LLaMA 7B、13B,以说明最小硬件条件下的权衡。
- 报告功率上限对推理时间和能量的影响。
- 提供分布式推理下 SM、内存的利用笔记。

实验结果
研究问题
- RQ1在多 GPU/多节点分片时,LLaMA 65B 的推理吞吐量特性为何?
- RQ2在最小硬件条件下,较小的 LLaMA 变体(7B、13B)的吞吐量与能耗表现如何?
- RQ3批量大小、分片数量与最大生成长度如何影响每秒、每个 token、每个响应的能量?
- RQ4数据集类型(Alpaca 与 GSM8K)如何影响推理过程中的计算-能量动态?
- RQ5在 LLM 推理中,功率上限是否能在不造成不可接受延迟的情况下显著降低能耗?
主要发现
- 推理吞吐量与能量随模型规模和硬件而变化;A100 相较于 V100 提供更高的吞吐量,但每秒能量也可能更高。
- 65B LLaMA 推理在可行性方面需要显著的多 GPU/分片配置(约八个 V100 或四个 A100),并伴随显著的能耗与延迟影响。
- 每秒、每个 token、每个响应的能量通常随分片增多而上升;更长的生成长度往往增加每秒能量,且对数据集有依赖影响。
- 对于 65B,分片从 4 增至 32 时,能耗大致从数百瓦到约千瓦,随着分片数增加吞吐提升趋于边际效应。
- 功率上限能在一定的时延和吞吐度折中下降低能耗;中等上限(如 175W)在时间增加约 6-7% 的情况下可实现约 23% 的总能量降低。
- 在分片配置符合内存要求时,GPU 的利用率保持在较高水平(A100 上 SM 利用率约 95%;V100 上约 94-95%),提示同一 GPU 上可能并行部署多模型的潜力。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。