Introduction
The current state-of-the-art in machine translation is dominated by autoregressive models, most notably the Transformer. These models generate output sequences token-by-token from left to right. While effective, this sequential nature imposes an $O(N)$ time complexity, where $N$ is the sequence length. This creates a significant computational bottleneck, especially as hardware becomes increasingly parallel.
Non-autoregressive translation (NAT) models have been proposed to generate all tokens simultaneously. However, they frequently struggle with the multi-modality problem. Because tokens are predicted independently, the model may fail to coordinate between different valid translation paths, leading to ungrammatical repetitions (e.g., "The cat cat is on the mat"). This paper presents Mask-Predict, a novel decoding algorithm that leverages Conditional Masked Language Models (CMLMs) to bridge the gap between the speed of parallel generation and the coherence of sequential models.
Methodology
The Mask-Predict framework introduces a bidirectional approach to decoding through two primary components.
Conditional Masked Language Models (CMLMs)
Standard Transformer decoders are causal, meaning they can only attend to previously generated tokens. In contrast, a CMLM decoder is bidirectional. During training, it is tasked with predicting a random subset of masked target tokens by attending to both the source sentence and the surrounding unmasked target tokens. This architecture is reminiscent of BERT but is conditioned on a source sequence, allowing it to learn complex dependencies across the entire target sequence.
The Mask-Predict Algorithm
At inference time, the target sequence is unknown. The Mask-Predict algorithm operates over a constant number of iterations $T$, independent of the sequence length $N$.
- Initialization: The model first predicts the target sequence length $N$ using a dedicated
LENGTHtoken at the encoder. It then initializes a sequence of $N$MASKtokens. - Parallel Prediction: In each iteration, the model predicts all currently masked tokens in parallel, conditioned on the source and the unmasked tokens from the previous step.
- Iterative Re-masking: The algorithm identifies the $n$ tokens with the lowest probability scores (confidence) and replaces them with
MASKfor the next round. The number of masked tokens $n$ decreases linearly over the $T$ iterations.
By conditioning on high-confidence "anchor" words from previous iterations, the model effectively "collapses" the multi-modal distribution, allowing it to fix its own mistakes using bidirectional context.
Evaluation and Results
The authors evaluated Mask-Predict on three major benchmarks: WMT’14 English-German (EN-DE), WMT’16 English-Romanian (EN-RO), and WMT’17 English-Chinese (EN-ZH). To optimize performance, the CMLMs were trained using sequence-level knowledge distillation from a standard Transformer teacher model.
Performance vs. Speed
Mask-Predict achieves a remarkable balance between translation quality and decoding efficiency. With $T=10$ iterations, the model reaches within 0.5–1.2 BLEU points of a well-tuned autoregressive Transformer base model.
As illustrated in Figure 1, Mask-Predict provides up to a 3x speedup in wall-clock time compared to a standard Transformer using beam search ($b=5$). Even with fewer iterations (e.g., $T=4$), the model maintains high quality while significantly outperforming previous non-autoregressive approaches by approximately 4 BLEU points on average.
Reducing Repetitions
A key success of the iterative approach is the drastic reduction in token repetitions. Qualitative analysis reveals that repetitions drop from roughly 16% in a single-pass ($T=1$) model to less than 1% after just five iterations. This confirms that bidirectional context is highly effective at resolving the independence issues inherent in parallel decoding.
Discussion and Limitations
While Mask-Predict represents a significant leap forward, several challenges remain. The model's performance is sensitive to the initial length prediction; if the predicted $N$ is incorrect, the final translation quality suffers. The authors mitigated this by decoding multiple length candidates in parallel, though this increases computational cost.
Furthermore, like most NAT models, CMLMs rely heavily on knowledge distillation. When trained on raw, noisy data without a teacher model, performance degrades significantly. There also remains a small "independence penalty"—a slight gap in quality compared to the absolute best autoregressive systems—suggesting that while bidirectional context helps, it does not perfectly replicate the global coordination of sequential generation.
Conclusion
Mask-Predict demonstrates that constant-time machine translation is not only possible but can compete with state-of-the-art sequential models. By treating decoding as an iterative refinement process within a bidirectional framework, the authors have provided a scalable solution to the sequential bottleneck in modern NLP pipelines.
Summary updated