Introduction
Non-autoregressive Transformers (NATs) offer significant speed advantages over traditional autoregressive models by generating entire sequences simultaneously. However, they frequently suffer from the "multi-modality problem," where the model attempts to combine multiple valid output paths, resulting in incoherent or repetitive text. This paper introduces CODAT (Contrastive Directed Acyclic Transformer), a framework that leverages contrastive learning to guide NATs toward high-quality, single-mode outputs.
The Multi-Modality Problem
Standard NAT training typically uses Maximum Likelihood Estimation (MLE), which minimizes the forward KL divergence between the data distribution and the model distribution. In tasks with multiple valid outputs (e.g., translation), MLE forces the model to cover all possible "modes" of the data. Because NATs lack the step-by-step dependencies of autoregressive models, they often "mix" these modes, producing garbled results.
The CODAT Framework
CODAT addresses this by shifting the objective toward a ranking-based contrastive loss. Instead of trying to match the entire data distribution, the model is trained to prefer its own high-reward generated samples.
- Reverse KL Divergence: By optimizing a "reverse" objective, the model is encouraged to focus on a single, high-probability mode rather than averaging across all valid outputs.
- Contrastive Ranking: The model generates multiple candidate sequences (hypotheses) for a given input. These are ranked using a reward function, such as BLEU. The contrastive loss then penalizes the model if it assigns lower probability to a higher-ranked candidate.
- Integration with DA-Transformer: The authors apply this method to the Directed Acyclic Transformer (DAT), which uses dynamic programming to manage word alignments efficiently.
Key Results
CODAT achieves state-of-the-art performance for non-autoregressive models across several benchmarks:
- Machine Translation: On WMT14 En-De, CODAT reached 27.40 BLEU, coming within 0.4 points of top autoregressive models while maintaining a 10.2x speedup.
- Text Summarization: The model outperformed autoregressive baselines on the XSum and Gigaword datasets, demonstrating its ability to handle complex, long-form generation.
- Robustness: Unlike many NATs, CODAT performs well even when trained on raw data rather than distilled data from a teacher model.
Conclusion
By reframing NAT training as a contrastive ranking problem, CODAT effectively mitigates the multi-modality issue. This allows for the deployment of models that combine the speed of non-autoregressive generation with the linguistic quality previously reserved for slower, autoregressive architectures.
Summary updated