TL;DR
This paper introduces the Multi-branch Attentive Transformer (MAT), a novel architecture that enhances the standard Transformer by employing multiple parallel attention branches. By combining this multi-branch approach with regularization techniques like "drop branch" and "proximal initialization," MAT achieves significant performance improvements across various natural language processing tasks, including machine translation, code generation, and natural language understanding.
What Problem Does This Paper Address?
The Transformer architecture has revolutionized sequence learning tasks, but its core components, particularly the attention mechanism, have largely remained single-path. While multi-branch architectures have proven highly effective in computer vision, their application and exploration in natural language processing, especially for sequence learning, have been limited. This paper aims to bridge this gap by investigating how to effectively integrate multi-branch structures into the Transformer, specifically within its attention layers, to boost performance. The challenge lies in effectively training these more complex multi-branch models without sacrificing efficiency or introducing instability.
Methods
The core innovation is the Multi-branch Attentive Transformer (MAT). Instead of a single multi-head attention layer, MAT uses multiple identical multi-head attention layers in parallel. The outputs of these parallel branches are then averaged. This creates a "multi-branch attention layer."
To address the training challenges associated with this increased complexity, two key techniques are introduced:
- Drop Branch: During training, individual attention branches are randomly dropped with a certain probability. This acts as a regularization technique, preventing co-adaptation between branches and improving generalization. During inference, all branches are used.
- Proximal Initialization: MAT models are initialized by first training a standard Transformer and then duplicating its parameters to initialize the multiple branches of the MAT model. This "warm-start" approach helps to stabilize training and improve performance compared to training from scratch.
The paper also explores a variant of applying multi-branching to feed-forward layers, though this is found to slightly hurt performance.
Datasets
The paper evaluates MAT on a variety of datasets across different tasks:
- Machine Translation:
- IWSLT'14 German→English, Spanish↔English, French↔English
- WMT'14 English↔German
- WMT'19 German↔French
- Code Generation:
- A Java dataset (from [29])
- A Python dataset (from [27])
- Natural Language Understanding (NLU):
- MNLI-m, MPRC, QNLI, and SST-2 (from the GLUE benchmark)
Key Insights and Ideas
- Multi-branching is beneficial for NLP sequence models: Contrary to the observation in computer vision, where multi-branching is common, this paper demonstrates its effectiveness in NLP, particularly within the attention mechanism of Transformers.
- Averaging parallel attention branches works: The simple strategy of averaging outputs from multiple identical attention branches leads to performance gains.
- Regularization is crucial for multi-branch Transformers: The "drop branch" technique is essential for training MAT models effectively, preventing overfitting and improving robustness.
- Warm-starting with a standard Transformer is effective: Proximal initialization significantly boosts performance, suggesting that leveraging pre-trained single-branch models is a good strategy for initializing multi-branch architectures.
- Multi-head attention within branches is still important: Even with multi-branching, using multiple heads within each branch (as in standard multi-head attention) is more effective than using a single head per branch.
Key Results
- Machine Translation: MAT consistently outperforms standard Transformer baselines across various IWSLT and WMT tasks, achieving improvements of up to 1.74 BLEU points on IWSLT tasks and setting new state-of-the-art results on WMT'14 En→De with a multi-bleu score of 30.8.
- Code Generation: MAT achieves significant improvements in both BLEU scores and percentage of valid code (PoV) compared to standard Transformer and LSTM-based models. For example, on the Java dataset, MAT achieves a 4.2 BLEU score improvement and a 5.8% PoV improvement.
- Natural Language Understanding: MAT improves accuracy on GLUE benchmark tasks (MNLI-m, MPRC, QNLI, SST-2) by up to 1.0 score compared to vanilla RoBERTa.
- Hyperparameter Tuning: The paper explores the impact of the number of branches ($N_a$), hidden dimension ($d_h$), and drop branch rate ($\rho$). They find that $N_a=2$ or $3$ and a larger $d_h$ are generally beneficial. The optimal $\rho$ varies by task but is crucial for performance.
Limitations and Future Work
- Multi-branch FFNs: Applying multi-branching to feed-forward layers was explored but found to slightly hurt performance, suggesting that the benefits are primarily in the attention layers.
- Randomly dropping heads vs. dropping branches: While exploring variants of drop branch, randomly dropping individual heads within branches was found to be slightly worse than dropping entire branches.
- Future Work: The authors suggest applying MAT to more sequence learning tasks and combining it with neural architecture search to discover even better multi-branch models for sequence learning.
Summary updated