Inference Scaling

Inference Scaling refers to the strategies and architectural optimizations employed to increase the throughput, reduce latency, and improve resource efficiency of Large Language Model (LLM) inference. Unlike training scaling, which focuses on model capacity and data volume, inference scaling addresses the computational bottlenecks of serving models to users, particularly regarding vram constraints and Token Generation speed.

Core Challenges

  • Memory Bandwidth Bound: Inference is often limited by the speed at which weights and activations can be moved from HBM (High Bandwidth Memory) to the compute units, rather than raw FLOPS.
  • Variable Sequence Lengths: Dynamic input and output lengths lead to irregular memory access patterns and inefficient batching.
  • KV Cache Growth: The Key-Value cache grows linearly with sequence length, consuming significant vram and limiting batch sizes.

Optimization Strategies

Memory Management & Caching

Compute Efficiency

Serving Architecture

  • Continuous Batching: Dynamically adding new requests to the batch as soon as previous requests finish, rather than waiting for the entire batch to complete.
  • Tensor Parallelism: Distributing model layers across multiple GPUs to handle models that exceed single-device memory capacity.

References