Source-linked AI summary

Energy Considerations of Large Language Model Inference and Efficiency Optimizations

Jared Fernandez, Clara Na, Vashisth Tiwari, Yonatan Bisk, Sasha Luccioni, Emma Strubell

arXiv:2504.17674v1cs.CLcs.LG

TL;DR

LLM inference energy is difficult to characterize because prior benchmarks often emphasize latency in simplified workloads, despite growing deployment demands. The paper models variable-length, batched workloads and evaluates inference optimizations across software, decoding, hardware, and serving configurations. It finds that proper application of these optimizations can reduce total energy use by up to 73% from unoptimized baselines, with effectiveness varying by workload and system configuration.

  • Problem

    Prior inference benchmarks emphasize latency in simplified settings, leaving a gap in understanding energy costs across diverse workloads and jointly applied optimizations.

  • Method

    The paper profiles inference across workload dimensions, decoding strategies, software frameworks, GPU platforms, model parallelism, and architectures, then models variable-length offline workloads using token-length bins and batch variations.

  • Results

    The effectiveness of inference optimizations is highly sensitive to workload shape, hardware architecture, and software framework, while proper application reduces total energy use by up to 73% from unoptimized baselines.

  • Takeaways & Limitations

    Inference optimizations cannot be applied uniformly; energy-efficient deployment requires matching them to workload geometry, software stack, and hardware accelerators.

  • Takeaways & Limitations

    The evaluation measures GPU power but excludes CPU, memory, storage, and other accelerator architectures, and leaves several optimization settings outside its scope.

Abstract

from arXiv · show

As large language models (LLMs) scale in size and adoption, their computational and environmental costs continue to rise. Prior benchmarking efforts have primarily focused on latency reduction in idealized settings, often overlooking the diverse real-world inference workloads that shape energy use. In this work, we systematically analyze the energy implications of common inference efficiency optimizations across diverse Natural Language Processing (NLP) and generative Artificial Intelligence (AI) workloads, including conversational AI and code generation. We introduce a modeling approach that approximates real-world LLM workflows through a binning strategy for input-output token distributions and batch size variations. Our empirical analysis spans software frameworks, decoding strategies, GPU architectures, online and offline serving settings, and model parallelism configurations. We show that the effectiveness of inference optimizations is highly sensitive to workload geometry, software stack, and hardware accelerators, demonstrating that naive energy estimates based on FLOPs or theoretical GPU utilization significantly underestimate real-world energy consumption. Our findings reveal that the proper application of relevant inference efficiency optimizations can reduce total energy use by up to 73% from unoptimized baselines. These insights provide a foundation for sustainable LLM deployment and inform energy-efficient design strategies for future AI infrastructure.

1 Introduction

LLM growth is increasing energy demand, while existing inference benchmarks often emphasize speed in simplified settings. This paper analyzes inference energy across diverse workloads and optimization dimensions, finding that idealized estimates can substantially understate real energy use.

  • LLM advances have driven large investments in computing hardware and energy infrastructure.
  • Inference efficiency matters because models are served repeatedly at scale and can constitute a large share of AI and ML energy consumption.Reported shares include up to 70% of Meta’s AI power consumption, 60% of Google’s ML energy, and 80–90% of AWS ML cloud computing demand.
  • Existing optimizations primarily target latency and are often evaluated in constrained settings that do not capture diverse real-world NLP and generative workloads.
  • The paper analyzes how data dimensionality, decoding, software, compilation, hardware, model parallelism, and architecture affect LLM inference energy.
  • The modeling approach approximates variable-length, batched offline inference between naive unoptimized and theoretical optimized energy bounds.

2 Methodology

The methodology evaluates LLM inference across workload geometries, decoding and serving optimizations, model architectures, and heterogeneous GPU configurations. Controlled sequence-length studies and broad task workloads characterize how inference stages and optimization choices shape energy use.

  • Model Architectures: Experiments cover 1B–32B language models, primarily Llama-3.1-8B variants, with Qwen-1.5-32B and sparse OLMoE architectural comparisons.
  • Data Dimensionality: Workloads vary input length, output length, and batch size across classification, summarization, translation, and open-ended generation.Batch sizes range from 1 to task-dependent maxima of up to 1024, while controlled sweeps reach 32k input and 4k output tokens.
  • Data Dimensionality: Inference is analyzed as compute-bound prefilling followed by memory-bound autoregressive decoding, whose bottlenecks shift with input-output lengths.Batching can be limited by long inputs and inefficient with variable output lengths because sequences finish at different times.
  • Controlled Studies: Figure 2 decomposes energy into prefill and decode components while sweeping sequence lengths and batch sizes on A6000 GPUs with vLLM.Figure 3 separately examines speculative decoding across batch sizes for latency and energy effects.
  • Decoding Strategies: The evaluation compares greedy, beam, temperature, top-p, and speculative decoding strategies across batch sizes.Speculative decoding uses a lightweight draft model to predict multiple tokens that the target model verifies in parallel.
  • Software Optimizations: Software comparisons include native PyTorch with HuggingFace Transformers, TorchInductor, CUDA Graphs, and vLLM with continuous batching.Experiments use bfloat16 precision and assess optimized kernel implementations and computational graph management.
  • Hardware Platforms: Hardware experiments span Ampere and Ada Lovelace GPUs, with up to four GPUs used for tensor-parallel inference in groups of two and four.The evaluated accelerators include A6000, A100 80GB PCIe, and A6000 Ada systems.
  • Performance Measures: The study measures latency, throughput, GPU energy, and GPU power for inference over 1,024 examples.Energy and power are measured with NVML through CodeCarbon after warmup batches for memory allocation, CUDA graph capture, and JIT compilation.

3 Results

Inference energy depends strongly on workload geometry, decoding strategy, model architecture, software optimizations, serving regime, and hardware. Across these dimensions, optimizations can improve efficiency, but their benefits and trade-offs vary with batch size, accelerator, and model configuration.

  • Data Dimensionality: Prefill energy increases with input sequence length beyond 128 tokens, while shorter sequences and smaller batches can undersaturate the accelerator.The convergence point is also observed when generation length is fixed at 8 rather than 64 tokens.
  • Data Dimensionality: Decoding energy generally dominates total inference energy except for workloads with the shortest generation lengths.Classification and short-form summarization are notable exceptions.
  • Algorithmic Optimizations: Speculative decoding reduces energy at batch sizes ≤16 but requires 25.65% more energy than autoregressive decoding at batch size 128.Draft-model speculation and additional verification overhead become costly when large batches already saturate the GPU.
  • Model Architecture: MoE inference uses up to 54.24% more energy than dense OLMo-1B despite comparable active parameter counts.The higher cost is attributed to fused expert-layer kernels that are 19.70% slower at batch size 1 and 63% slower at batch size 8 than corresponding dense GEMM operations.
  • Software Optimizations: vLLM improves memory efficiency and supports larger batch sizes, while torch.compile and CUDA graph serialization improve throughput without additional energy cost.CUDA graph benefits are more apparent at lower batch sizes because kernel-launch overhead is relatively larger there.
  • Serving Strategies: Continuous batching requires less energy than online static serving at larger batch sizes, but scheduling overhead outweighs its benefits at smaller batch sizes.The measured benefit is likely understated because samples drawn from one dataset reduce input-output length variance.
  • Hardware Design Choices: Tensor parallelism lowers latency but increases total energy use: two and four GPUs reduce latency by 40.16% and 61.34% while increasing energy by 29.3% and 55.23%.The added energy results from using more accelerators, despite lower per-device power utilization.
  • Hardware Effects: Software optimizations have greater relative impact on faster accelerators, with compilation improving performance by 29.90% on A100 versus 1.96% on A6000.vLLM eager-mode optimization similarly improves performance by 25.47% on A100 versus 2.97% on A6000.

4 The Impact of Optimizations on Inference Energy Use

The study models offline LLM inference energy using real workload distributions, ceiling-based token-length bins, and hardware-constrained batching, then evaluates software and hardware optimizations across NLP and real-world workloads. Proper optimization reduces energy substantially, with savings varying by workload.

  • 4.1 Modeling Energy Requirements Using Offline Serving: Binned token-length distributions approximate empirical Azure conversation input and output distributions for computationally efficient energy estimation.Figure 7 compares real and approximated cumulative distributions for both input and output lengths.
  • 4.1 Modeling Energy Requirements Using Offline Serving: The modeling pipeline maps requests with variable input and output lengths into discrete bins and estimates energy from measured batch execution.Requests are grouped by ceiling bins and processed using the maximum batch size supported by the hardware and backend.
  • 4.2 Idealized Baseline: The naive baseline assumes ideal hardware utilization, manufacturer-rated FLOPS, maximum power draw, and theoretical inference FLOPs.This baseline uses RTX A6000 specifications and treats floating-point throughput and power draw as maximally efficient.
  • 4.3 Evaluations: The evaluation spans classical NLP tasks, real-world conversations and code completion, PyTorch and vLLM, and optimized versus unoptimized inference settings.Experiments include classification, translation, summarization, text generation, BurstGPT, and Azure traces.
  • 4.3 Evaluations: 73.00%, 37.58%, and 72.18% energy savings are observed on BurstGPT, Azure Code, and Azure Conversation, respectively.The reported reductions compare optimized inference with the corresponding unoptimized baselines.

5 Related Work

Related work has increasingly measured machine-learning energy and emissions, but inference remains difficult to characterize because workloads vary across requests, sequence lengths, batching, hardware, and serving systems. Existing evaluations often use simplified deployment settings, while speed-focused optimization does not necessarily reveal energy use.

  • Efficient Methods for LLM Inference: Serving optimizations commonly target latency and time-to-first-token through continuous batching, model parallelism, and speculative decoding.These methods are designed to meet service-level objectives in deployment settings.
  • Efficient Methods for LLM Inference: Speed optimization alone does not characterize inference energy or carbon emissions because added computation and weak correlations with efficiency indicators can occur.The related work motivates evaluating energy directly rather than inferring it from latency or throughput.
  • Energy Estimations and Measurement: Inference energy varies with request frequency, batching, sequence lengths, hardware platforms, and changing power profiles.This variability makes inference distinct from the large but comparatively singular costs often emphasized for training.
  • Energy Estimations and Measurement: Prior inference-energy studies examine tasks, model sizes, hardware settings, sequence lengths, and batching, but often use limited architectures and serving frameworks.The paper positions its broader evaluation against these simplified deployment settings.

6 Conclusion

The paper finds that inference optimizations do not reduce energy uniformly: their effectiveness depends on workload shape, hardware architecture, and software implementation. Across classical and real-world workloads, properly applying the studied optimizations can reduce total energy substantially.

  • 6 Conclusion: Optimization effectiveness is highly sensitive to input-data shape, hardware architecture, and software framework implementation, so optimizations cannot be applied uniformly.The conclusion emphasizes that latency-oriented methods have workload- and system-dependent energy effects.
  • 6 Conclusion: Up to 73% lower total energy use is reported for the BurstGPT chat dataset when inference optimizations are properly applied.The case study covers classical NLP tasks and real-world LLM inference workloads.

Limitations and Risks

The study’s energy analysis is limited to GPU operational power for inference and excludes several hardware, optimization, training, and embodied-cost dimensions. The authors also note a possible Jevons Paradox risk if lower pretraining costs encourage more large-model pretraining.

  • Scope boundaries: GPU power approximates inference energy, but CPU, memory, and disk energy are excluded.The study also does not estimate TPU, NPU, or other accelerator energy requirements.
  • Scope boundaries: Other potentially relevant optimizations, including mixed precision, GPU-frequency adjustment, additional model parallelism, and workload scheduling, are not evaluated.
  • Scope boundaries: Embodied inference costs and machine-learning training costs remain outside the study’s scope.
  • Risks: Lower pretraining costs could encourage more organizations to pursue large-model pretraining, creating a possible Jevons Paradox.

A Hardware Details

The paper provides additional details on the hardware configurations used in its benchmarking experiments.

  • Hardware configurations: Table 5 documents the node hardware specifications for the benchmarking experiments.

D Additional Optimzations: Continuous Batching

Additional results examine vLLM continuous batching for online inference, particularly at large batch sizes.

  • Continuous batching: At large batch sizes, vLLM continuous batching yields reductions in online-inference energy use.

E Additional Sequence Length Results

The additional results examine how sequence lengths, batch sizes, serving modes, and hardware configurations relate to inference energy. They include controlled sweeps with PyTorch and vLLM, classical NLP workloads, and online–offline comparisons across GPUs.

  • Hardware details: Table 5 provides node hardware specifications associated with the benchmarking experiments.
  • Serving-mode comparison: Figure 9 compares energy reduction between online and offline serving across different GPUs.The caption states that optimizations for online serving save up to 5% energy at an incomplete condition.
  • PyTorch sequence-length sweeps: Controlled sweeps vary input and output sequence lengths on A6000 GPUs using vanilla PyTorch.
  • vLLM sequence-length sweeps: vLLM offline inference results compare fixed sequence-length sizes while sweeping batch size and the other sequence-length dimension.
  • Classical NLP workloads: Classical NLP energy-intensity results with vLLM compare batch sizes of 1, 8, and 128.
Loading 2504.17674v1…