Abstract
Generative Large Language Models (LLMs) based on the Transformer architecture have recently emerged as a dominant foundation model for a wide range of Natural Language Processing tasks. Nevertheless, their application in real-time scenarios has been highly restricted due to the significant inference latency associated with these models. This is particularly pronounced due to the autoregressive nature of generative LLM inference, where tokens are generated sequentially since each token depends on all previous output tokens. It is therefore challenging to achieve any token-level parallelism, making inference extremely memory-bound. In this work, we propose SPEED, which improves inference efficiency by speculatively executing multiple future tokens in parallel with the current token using predicted values based on early-layer hidden states. For Transformer decoders that employ parameter sharing, the memory operations for the tokens executing in parallel can be amortized, which allows us to accelerate generative LLM inference. We demonstrate the efficiency of our method in terms of latency reduction relative to model accuracy and demonstrate how speculation allows for training deeper decoders with parameter sharing with minimal runtime overhead.
Introduction: The Memory Bandwidth Bottleneck
The primary obstacle to real-time performance in modern Large Language Models (LLMs) is not computational capacity, but memory bandwidth. Due to the autoregressive nature of Transformer decoders, tokens must be generated sequentially. For every single token produced, the system must transfer billions of parameters from DRAM to the processor. This results in a "memory-bound" regime where the processor remains idle for a significant portion of the execution time, waiting for weight data.
While existing techniques like speculative decoding use a smaller "draft" model to predict tokens for a larger "target" model, they introduce the complexity of managing two distinct models. SPEED (Speculative Pipelined Execution for Efficient Decoding) addresses this by enabling parallelism within a single, unified architecture.
The SPEED Architecture
The SPEED framework rests on two primary architectural innovations: Cyclic Parameter Sharing and Speculative Pipelining.
Cyclic Parameter Sharing and Training
Instead of a standard stack of unique layers, SPEED utilizes a group of unique layers that are repeated multiple times (e.g., a "4x3" configuration where 3 unique layers are cycled 4 times). This reduces the total parameter count while maintaining a deep computational path. To ensure high prediction accuracy at early exit points, the model is trained with a weighted loss function that encourages the shared classifier to produce accurate results at every intermediate cycle.
Speculative Pipelining and Memory Amortization
SPEED leverages the output of an early cycle to predict the next token. It then begins processing this speculative next token in parallel with the current token's subsequent cycles. Crucially, parameter sharing allows for memory amortization: the weights required for a late stage of Token $N$ are identical to those needed for an early stage of Token $N+1$. This allows the system to load weights once and use them for multiple tokens simultaneously.
As illustrated above, without parameter sharing (b), pipelining would require loading different weights for different tokens, failing to alleviate the memory bottleneck. SPEED (c) solves this by using the same shared parameters across the pipeline stages.
Key Results
The authors evaluated SPEED using models pre-trained on the C4 corpus and fine-tuned on tasks including CNN/DailyMail, WikiLingua, and WMT English-to-German.
- Latency vs. Accuracy: SPEED configurations achieved significantly higher accuracy than shallow baseline models while maintaining nearly identical low latency. A 12-layer model configured as 4x3 performed almost as fast as a standard 4-layer model but with superior language understanding.
- High Confidence Predictions: The method's success is supported by the observation that 83% to 94% of token predictions remain unchanged after the first layer group, allowing the pipeline to remain full most of the time.
- Mathematical Correctness: SPEED maintains 100% correctness. If a later, more "mature" layer determines that an earlier speculative prediction was incorrect, the pipeline is flushed and restarted from the point of error.
Conclusion
SPEED effectively "hides" the latency cost of deeper decoding. By combining parameter sharing with speculative pipelining, it allows for the deployment of deeper, more capable models with minimal runtime overhead. While the benefits are most pronounced on longer sequences, SPEED represents a significant step toward solving the memory-bound nature of LLM inference.
Summary updated