LLM Single-Stream Inference Optimization: Boosting Generation Speed to 75 Tokens/s
This article explains how to increase single-stream inference speed for large language models from single-digit tokens per second to 75 tokens/s. It breaks down three progressive optimization layers—speculative decoding, drafter depth tuning, and 4-bit quantization—and explains why each technique only works within a specific bottleneck range. It also covers prefix caching trade-offs, parameter coupling for capacity planning, and a practical tuning methodology for interactive AI workloads.
1. Background: Why Single-Stream Inference Becomes a Bottleneck
In real-world LLM deployments, inference quality is typically measured by two metrics: single-stream latency for interactive scenarios, which is the speed of generating tokens one by one for a single request, and total system throughput for batch processing. These two often trade off against each other. However, for interactive workloads such as code completion, intelligent Q&A, and long-document summarization, single-stream speed directly determines the user’s perceived fluency.
A public experiment provides a representative data point: on a model with roughly 27 billion parameters and FP8 native weights, the unoptimized single-stream generation speed was only single-digit tokens per second. This is far below human reading speed and nearly unusable. After three progressive layers of optimization, single-stream speed was pushed to around 75 tokens per second—nearly a tenfold improvement. This article uses that experiment as a thread to unpack the engineering logic behind it.
Note that this article does not benchmark any specific hardware, platform, or product. All discussion stays at the level of general technical principles, and the configuration snippets are illustrative, used to explain the coupling between parameters.
2. Layer 1: Speculative Decoding Turns “Serial” into “Semi-Parallel”
The essence of autoregressive generation is serial dependency: token N cannot start until token N-1 has finished computing. This makes memory bandwidth, rather than compute, the primary bottleneck—every token generated requires moving all weights from memory into the compute units once, leaving compute largely idle.
Speculative Decoding introduces a lightweight drafter that guesses several future tokens at once, then the target model performs a single parallel verification. Accepted tokens are adopted directly; at the first mismatch, the sequence is truncated and resampled. Since verification is a single forward pass, accepting 3 to 5 tokens costs almost the same as accepting 1 token, effectively compressing multiple serial memory accesses into one.
In the experiment, switching to speculative decoding alone raised the speed from single digits to 46.8 tokens per second. One critical property must be clarified here: speculative decoding does not change the output distribution (assuming the sampling method matches). It only changes the computation path, so it causes no quality regression. This is the fundamental reason it outperforms “switching to a smaller model” or “trading precision for speed.”
3. Drafter Depth: The Overlooked Second Knob
After the first round of tuning, returns began to diminish and the bottleneck shifted to the drafter itself. There are two typical designs:
- Multi-token prediction drafter heads: each position requires a projection mapping, and the linearly growing cost with depth makes it inefficient at high acceptance lengths;
- Multi-layer stacked drafter design: a five-layer structure that generates 7 candidate tokens per batch, amortizing the projection overhead.
After deepening the drafter in the experiment, speed rose from 46.8 to 58.5 tokens per second. The engineering implication is that the benefit of speculative decoding depends not only on the acceptance rate but also on the ratio of drafter cost to acceptance length. Too shallow a drafter yields a low acceptance rate; too deep a drafter lets the single-pass drafter overhead eat up the time saved by parallel verification. When tuning, treat the number of drafter layers and the number of speculative tokens per pass (commonly 5–7) as a group of coupled parameters to sweep, rather than adjusting them individually.
Illustrative configuration logic (replace the model path and drafter model path with actual values):
# Illustrative: core fields for enabling speculative decoding--speculative-config '{"method": "<drafter-method>","model": "<drafter-model-path>","num_speculative_tokens": 7,"draft_sample_method": "probabilistic"}'
4. Layer 3: Why 4-bit Quantization Only Helps Single-Stream
Quantizing weights further to 4-bit raised single-stream speed to 75 tokens per second. The reason is straightforward: single-stream scenarios are memory-bound, and cutting weight size by more than half reduces data movement time proportionally.
But at 16 concurrency, total throughput reached around 256 tokens per second, and the improvement from quantization was only 0.2%. This is not quantization failing—it is the bottleneck shifting. Under high concurrency, tokens from multiple requests are batched together, the matrix size grows, and the system transitions from memory-bound to compute-bound. At that point, reducing weight bytes barely affects the main cost.
This yields a general conclusion: every optimization technique has an effective range. Determining whether a workload is memory-bound or compute-bound is the prerequisite for choosing quantization, speculative decoding, or a batching strategy. The higher the concurrency, the more you should focus on scheduling, batching, and memory capacity rather than continuing to compress precision.
5. Prefix Caching: A Bet Between High Returns and Capacity Cost
Prefix caching is disabled by default. When enabled, it can deliver a 14–22x performance improvement in scenarios with long shared prefixes (unified system prompts, long code context, fixed knowledge snippets), because it avoids repeating the full attention computation for the same prefix. The cost is KV Cache capacity consumption, which may reduce available concurrency or maximum context length.
Practical guidance: enable it when multiple tenants share a fixed prefix; disable it when prefixes are highly fragmented and request contexts do not overlap, to avoid the double loss of “extremely low cache hit rate but memory consumed.”
6. Parameter Coupling and Capacity Planning
The above parameters are not independent: --max-model-len sets the KV Cache upper bound per request, --gpu-memory-utilization determines the total memory available for weights and cache, and --max-num-batched-tokens sets the token budget per batch. These three compete for the same memory alongside the extra drafter overhead from speculative decoding and prefix caching usage. The recommended tuning order is: first determine the context length and concurrency targets, then allocate memory, and finally sweep drafter depth and speculative token count.
# Illustrative: capacity and scheduling parameters--max-model-len 262144 \--gpu-memory-utilization 0.85 \--max-num-batched-tokens 16384 \--enable-prefix-caching
7. Implementation Methodology Summary
- Measure the baseline first, and identify whether you are memory-bound or compute-bound;
- For single-stream, prioritize speculative decoding, then tune drafter depth and speculative token count;
- Use quantization only as a single-stream limit-pushing technique; do not expect gains under high concurrency;
- Decide prefix caching on/off based on prefix reuse rate;
- Keep output distribution unchanged as the bottom line for all optimizations—performance gains must not come at the cost of quality.
When implementing in the cloud, you can use container platforms for environment delivery, and monitoring, alerting, and logging services to observe token rate, acceptance rate, and memory levels, forming a “measure—tune—re-measure” loop. This methodology transfers across different parameter scales and precision formats, making it a general path for accelerating interactive LLM services.
