TL;DR
This paper introduces Blockwise Parallel Decoding, a method to accelerate inference in deep autoregressive models like the Transformer. By using auxiliary model heads to predict multiple future tokens in parallel and then verifying them simultaneously with the base model, the authors achieve up to a 4x wall-clock speedup with minimal to no loss in output quality.
The Autoregressive Bottleneck
State-of-the-art sequence-to-sequence models, such as Transformers, are inherently "autoregressive." This means they generate text or images strictly one token at a time. While these models are highly parallelizable during training, inference remains a massive bottleneck: generating a sequence of length $N$ requires $N$ sequential model passes.
This sequential nature is a major hurdle for real-time applications like machine translation or high-resolution image generation. The authors aim to break this "one-token-at-a-time" constraint by exploiting a key feature of Transformers: their ability to score an entire sequence of tokens in a single parallel pass.
Methods: Predict, Verify, Accept
The core innovation is a "predict-then-verify" loop consisting of three distinct steps:
- Predict: Instead of just predicting the next token, the model uses $k$ auxiliary "proposal" heads to independently guess the next $k$ tokens in parallel.
- Verify: The base autoregressive model scores all $k$ predictions simultaneously. Because the base model is a Transformer, it can check if these guesses match what it would have generated greedily in a single computational step.
- Accept: The system finds the longest prefix of predictions that the base model agrees with. If the first 3 guesses were correct, the model jumps forward 3 steps in one iteration.
Key Optimizations
- Combined Model: To avoid doubling the computation, the authors integrate the proposal heads directly into the base Transformer as a multi-output feedforward layer.
- Approximate Inference: For tasks like image generation, they relax the "exact match" requirement. If a predicted pixel intensity is "close enough" (within a small distance $\epsilon$) to the base model's prediction, it is accepted.
- Knowledge Distillation: They train on "distilled" data (outputs from another model), which tends to be more predictable and easier for the proposal heads to guess correctly.
Key Insights
- Parallelism is Underutilized at Inference: The "aha moment" of this paper is realizing that while we cannot generate in parallel easily, we can verify in parallel for free (computationally speaking) on modern hardware.
- The "Back-off" Mechanism: By always backing off to the longest validated prefix, the algorithm is mathematically guaranteed to produce the exact same output as standard greedy decoding (unless approximate matching is explicitly turned on).
- Predictability Matters: The success of the method depends heavily on the proposal heads' ability to guess the future. Knowledge distillation acts as a "force multiplier" here because it simplifies the data distribution, making the future more predictable for the auxiliary heads.
Evaluation and Results
The authors evaluated their approach on two distinct tasks: Machine Translation (WMT 2014 English-German) and Image Super-Resolution (CelebA).
- Translation Speed: On the WMT dataset, the method achieved a 2x speedup with zero loss in BLEU score. By allowing a slight decrease in quality, they reached a 3.3x wall-clock speedup.
- Image Generation: For image super-resolution, the model achieved a 4x wall-clock speedup. In the best-case scenarios, the number of decoding iterations was reduced by up to 7x.
- Human Evaluation: In side-by-side tests on CelebA, human evaluators could not distinguish between images generated by the fast parallel decoder and the standard sequential one.
Limitations and Future Work
- Diminishing Returns: As the block size $k$ increases, the probability of the entire block being correct drops significantly. Furthermore, larger $k$ increases the computational overhead per step, eventually negating the benefits of skipping iterations.
- Hardware Constraints: The speedups rely on having enough memory and parallel processing power (GPUs/TPUs) to handle the increased dimensionality of the multi-output heads.
- Future Directions: The authors suggest combining this technique with other "orthogonal" acceleration methods, such as latent variable models, to push inference speeds even further.
Summary updated