Memory Bandwidth Bottlenecks and Output-Speed Optimization in LLM Inference
This article explains why output speed is a core metric for LLM serving, how memory bandwidth constrains autoregressive decoding, and which optimizations reduce memory access pressure: speculative decoding, weight quantization, KV cache management, kernel fusion, and hardware selection. It also covers how to diagnose speed changes, the relationship between pricing and cost per token, and common pitfalls.
1. Why Output Speed Is a Core Metric
The experience and cost of LLM serving are largely determined by two metrics: time to first token (TTFT) and the number of tokens generated per second during the generation phase. For end users, output speed determines how long they wait for an answer. For service providers, the number of tokens that can be emitted per unit time directly determines how many requests a single accelerator card can support, and therefore the cost per token.
As a result, when pricing or speed of a model changes noticeably, engineering teams should first determine whether the change comes from hardware, algorithms, or scheduling policy before drawing conclusions. Relying on experience alone can easily misattribute a transient load fluctuation to technical progress, or mistake a genuine architectural improvement for a change in user volume.
2. The Mechanics of the Memory Bandwidth Bottleneck
2.1 Computational Characteristics of Autoregressive Decoding
In the decoding phase, only one new token is generated per step. The matrix operations in a single forward pass are small, and compute units spend most of their time waiting for data. For each token generated, the model’s parameters must be read almost entirely from GPU memory. At this point, arithmetic intensity—the amount of computation per byte of memory access—is low, and performance is limited mainly by memory bandwidth rather than peak compute.
2.2 Estimating the Bandwidth Upper Bound
Single-stream decode speed has a theoretical upper bound determined by both hardware and model size. It can be roughly estimated as follows:
Theoretical upper bound (tokens/s) ≈ effective memory bandwidth ÷ bytes read per token.
For example, consider a 70B-parameter model with weights stored in 16-bit floating point. Each token requires reading about 140 GB of weights, ignoring the KV cache and intermediate results. Assuming an effective bandwidth of 3 TB/s, the theoretical upper bound is about 21 tokens/s. This number is only for order-of-magnitude illustration; actual speed is affected by implementation efficiency, communication overhead, and scheduling policy, and is usually below the bound.
If weights are quantized to 8 bits, the bytes read per token are halved, and the theoretical upper bound doubles. This shows a direct quantitative relationship between quantization and bandwidth, not an empirical tuning trick.
2.3 Why Higher Concurrency Does Not Equal Faster Single-Stream Speed
During batching, multiple requests in the same batch share a single weight read, so total throughput can grow roughly with concurrency, but per-stream speed does not increase accordingly. The lower bound on single-stream latency is still determined by the time to read all weights.
Therefore, even when the machine serves only one request, single-stream output speed can hardly exceed the bandwidth upper bound. This can be used as a basis for determining the source of a speed change. If single-stream speed improves substantially, check whether effective bandwidth has actually changed, or whether an algorithm that reduces effective memory accesses has been enabled. Concurrency gains or load changes alone usually cannot explain an order-of-magnitude change in single-stream speed.
3. Common Optimization Paths
3.1 Speculative Decoding
Speculative decoding first uses a smaller, faster draft model to propose several candidate tokens at once, and then the target model verifies them in parallel. During verification, multiple positions can be processed in one forward pass, so the target model’s weight reads are amortized across multiple tokens. The higher the acceptance rate, the more noticeable the speedup.
The gain depends on three factors: the quality of the draft model, the task type (code and templated text often have higher acceptance rates), and verification overhead. Introducing speculative decoding requires extra draft-model memory and scheduling logic, and it must ensure that the output distribution matches the original model; otherwise, results will deviate from the target model’s behavior.
Below is pseudocode for the speculative decoding flow:
def speculative_decode(target, draft, prompt, k=4):tokens = promptwhile not finished(tokens):candidates = draft.propose(tokens, num=k) # Draft model proposes k candidatesaccepted = target.verify(tokens, candidates) # Target model verifies in parallel in one passtokens = tokens + accepted # Accept the prefix that passes verificationif len(accepted) < k:tokens = tokens + [target.sample(tokens)] # Target model samples one token at the rejection positionreturn tokens
3.2 Weight Quantization
Weight quantization reduces the storage bit width per parameter, directly reducing the number of bytes read per token. Common approaches include 8-bit integer quantization and 4-bit group quantization. When evaluating a quantization scheme, focus on three metrics: accuracy loss, whether the hardware supports the corresponding low-precision computation, and the extra overhead introduced by dequantization.
The benefit of quantization should not be judged only by theoretical values. Run regression tests on the evaluation set for the target workload to confirm that key metrics have not dropped noticeably before considering deployment.
3.3 KV Cache Management and Batch Scheduling
In long-context scenarios, the memory occupied by the KV cache and the amount read per step may exceed the model weights themselves. Common optimization techniques include paged memory management, reusing shared prefixes, and continuous batching (immediately filling in new requests as others complete). These techniques improve memory utilization and overall throughput.
Scheduling policy requires a trade-off between TTFT and overall throughput. Larger batches increase throughput, but the queuing time for individual requests may become longer. If the workload is sensitive to interactive latency, limit the maximum batch size rather than pursuing throughput alone.
3.4 Operator Fusion and Kernel Optimization
Fusing multiple small operators into a single compute kernel can reduce the number of times intermediate results are written back to GPU memory. This type of optimization is especially effective in the decoding phase, because intermediate tensors are small and the extra memory access and kernel launch overhead account for a larger share of total time.
3.5 Hardware Selection and Memory Hierarchy
Higher-bandwidth memory, larger on-chip caches, and more efficient device interconnects all directly raise the bandwidth upper bound. When selecting hardware, use cost per token as the metric rather than looking only at per-card peak compute. Hardware with high peak compute but insufficient bandwidth may not have an advantage in decoding scenarios.
4. How to Determine the Cause of a Speed Change
When the output speed of the same model changes noticeably, investigate in the following order:
- Confirm the measurement methodology. Distinguish TTFT, single-stream output speed, and overall throughput, and rule out the effects of statistical windows and load differences.
- Compare single-stream and concurrent data. If single-stream speed increases substantially while concurrency gains remain unchanged, focus on whether effective bandwidth or the number of memory accesses has changed.
- Check whether speculative decoding, quantization, or kernel updates have been enabled, and retest with the same inputs.
- Verify the hardware generation and driver version to distinguish the contributions of hardware upgrades and software optimizations.
Below is example code for measuring decode speed:
import timedef measure_decode_speed(generate, prompt, runs=5):speeds = []for _ in range(runs):start = time.perf_counter()output_tokens = generate(prompt) # Returns the list of generated tokenselapsed = time.perf_counter() - startspeeds.append(len(output_tokens) / elapsed)speeds.sort()return speeds[len(speeds) // 2] # Use the median to reduce jitter
When measuring, fix the input length, output length, and sampling parameters, and take the median over multiple runs. Otherwise, occasional fluctuations caused by queuing and cache state may be misread as performance changes.
5. Pricing and Cost per Token
Service pricing is usually tied to cost per token. Cost per token can be roughly expressed as:
Cost per token ≈ cost per GPU per hour ÷ tokens output per GPU per hour.
When output speed improves or hardware costs change, the cost model changes accordingly, and price adjustments are often the result of changes in the cost structure. This formula ignores idle rate, differences between peak and average values, and the compute cost of input tokens. In actual accounting, these factors need to be included in the model.
6. Common Pitfalls
- Attributing an increase in single-stream speed entirely to a decrease in the number of users. Load reduction affects queuing time but can hardly explain an order-of-magnitude change in single-stream decoding speed.
- Evaluating decode performance using peak compute. Decoding is usually bandwidth-bound, and peak compute does not reflect actual speed.
- Ignoring accuracy regression. If output quality drops after acceleration, practical usability may decrease.
- Relying only on a single test. Without repeated experiments and statistical testing, conclusions are unreliable.
7. Summary
The main constraint on LLM decoding speed is memory bandwidth, and single-stream speed has a theoretical upper bound determined by the bytes read per token. Speculative decoding, weight quantization, KV cache management, and kernel optimization reduce memory access pressure from different dimensions, and hardware selection and scheduling should target cost per token. When judging speed changes, start by confirming the measurement methodology and comparing single-stream and concurrent data before attributing the change to hardware, algorithms, or scheduling.
