TL;DR
The Weighted Transformer improves upon the original Transformer architecture by replacing standard multi-head attention with a "branched" mechanism that learns to weight the importance of different attention paths during training. This modification allows the model to converge 15–40% faster while achieving state-of-the-art results, effectively matching the performance of much larger baseline models with only a fraction of the parameters.
What Problem Does This Paper Address?
Since the landmark "Attention is All You Need" paper, the Transformer has become the gold standard for Neural Machine Translation (NMT), replacing recurrent (RNN) and convolutional (CNN) models. However, the standard Transformer has two main drawbacks: it requires a massive number of parameters to reach peak performance and takes a significant amount of time to converge.
Furthermore, the original multi-head attention mechanism treats all "heads" as equally important, simply concatenating their outputs. The authors argue that this uniform treatment might not be optimal for optimization or representational power. They sought a way to make the architecture more efficient and better at learning long-range dependencies without the computational overhead of just "making the model bigger."
Methods
The core innovation is the Weighted Transformer. In a standard Transformer, multi-head attention splits the input into $h$ heads, processes them in parallel, and concatenates the results. The Weighted Transformer replaces this with a branched structure:
- Branched Attention: Instead of simple concatenation, the model uses multiple self-attention branches. Each branch includes its own attention mechanism followed by its own Feed-Forward Network (FFN).
- Learned Weighting: The authors introduce two sets of learned scalar parameters:
- $\kappa$ (kappa): A learned "concatenation weight" that scales the contribution of branches before they are combined.
- $\alpha$ (alpha): A learned "addition weight" used to sum the FFN outputs of the branches.
- Optimization: These weights are learned during the training process, allowing the model to dynamically prioritize specific branches. To ensure stability, the authors "freeze" these weights during the final 10k iterations of training.
Datasets
The model was benchmarked on two standard large-scale translation tasks:
- WMT 2014 English-to-German (EN-DE): 4.5 million sentence pairs.
- WMT 2014 English-to-French (EN-FR): 36 million sentence pairs.
- newstest2013: Used as a development set for sensitivity analysis and weight convergence studies.
Key Insights and Ideas
- Dynamic Prioritization: Unlike the baseline Transformer, which weighs all heads equally, the Weighted Transformer learns which branches are most useful for the task. This eases the optimization process by prioritizing gradients for the most important branches.
- Regularization Effect: The authors found that the branched structure acts as a natural regularizer. For a given training loss, the Weighted Transformer consistently achieves a lower testing loss than the baseline, suggesting it generalizes better to unseen data.
- Branch Decorrelation: By learning weights, the branches are encouraged to learn decorrelated input-output mappings. This reduces "co-adaptation" (where neurons become overly dependent on each other), a common problem in deep networks.
- Weight Dynamics: Interestingly, the relative importance of branches changes throughout training. The model doesn't just pick one "winner" and ignore the rest; instead, it utilizes the full representational capacity of the branches in a non-trivial way.
Key Results
- Performance Boost: The Weighted Transformer improved BLEU scores by 0.5 points on EN-DE and 0.4 points on EN-FR for the "large" model variant.
- Faster Convergence: The model reached optimal performance 15–40% faster than the baseline Transformer.
- Parameter Efficiency: A "small" Weighted Transformer (approx. 65M parameters) achieved a BLEU score of 28.4 on EN-DE, matching the performance of the "large" baseline Transformer which has 213M parameters. This means the proposed architecture can match state-of-the-art results using only ~30% of the parameters.
Limitations and Future Work
- Gating vs. Weighting: The authors experimented with "hard" gating (selecting only the top-$k$ branches) similar to Mixture-of-Experts models but found it performed worse than their weighted summation approach. They hypothesize this is because the number of branches (typically 8 or 16) is too low for sparse gating to be effective.
- Hyperparameter Sensitivity: While increasing layers ($N$) generally helps, the authors noted that performance degrades if $N$ is pushed too high (e.g., to 8). Similarly, increasing the number of heads/branches beyond 16 did not yield further gains in their preliminary tests.
- Future Directions: The authors suggest exploring this architecture with a much larger number of branches combined with sparse gating mechanisms to see if further efficiency gains are possible.
Summary updated