Abstract
Due to its effectiveness and performance, the Transformer translation model has attracted wide attention, most recently in terms of probing-based approaches. Previous work focuses on using or probing source linguistic features in the encoder. To date, the way word translation evolves in Transformer layers has not yet been investigated. Naively, one might assume that encoder layers capture source information while decoder layers translate. In this work, we show that this is not quite the case: translation already happens progressively in encoder layers and even in the input embeddings. More surprisingly, we find that some of the lower decoder layers do not actually do that much decoding. Our findings motivate and explain a Transformer configuration change: if translation already happens in the encoder layers, perhaps we can increase the number of encoder layers, while decreasing the number of decoder layers, boosting decoding speed, without loss in translation quality? Our experiments show that this is indeed the case: we can increase speed by up to a factor 2.3 with small gains in translation quality, while an 18-4 deep encoder configuration boosts translation quality by +1.42 BLEU (En-De) at a speed-up of 1.4.
Introduction
In Neural Machine Translation (NMT), the Transformer architecture is the reigning champion. However, it remains a "black box" regarding how it actually transforms a source word (e.g., "Hund") into a target word (e.g., "dog"). Conventional wisdom suggests that the encoder "understands" the source language while the decoder "translates" it into the target. This lack of understanding has practical consequences: the decoder is the primary bottleneck of NMT because it is autoregressive—it must generate words one by one, waiting for the previous word to finish before starting the next. If the encoder (which processes everything in parallel) is doing more work than previously assumed, we could potentially optimize the model for significant speed gains.
Probing the Translation Process
To investigate where translation occurs, the authors use a technique called probing. They take a fully trained, "frozen" Transformer model and analyze the internal representations produced by every layer.
As shown in the architecture above, the researchers add a minimally invasive linear projection layer to the output of intermediate layers. For encoder layers, they use a weighted ensemble of the model's own attention matrices to align source words with their target positions. These projected features are then fed into the original model’s final frozen classifier. If the classifier can correctly predict the target word using only the information from that specific intermediate layer, it demonstrates that "translation" has already occurred at that stage.
Key Insights: The Encoder as a Translator
The study revealed several surprising insights across major benchmarks like WMT 14 English-to-German (En-De), WMT 15 Czech-to-English (Cs-En), and WMT 14 English-to-French (En-Fr):
- Translation starts at Layer 0: Surprisingly, even the source word embeddings (Layer 0) contain enough information to achieve over 40% word translation accuracy. The model "knows" the target equivalent before it even begins processing context.
- Progressive Encoder Translation: Translation accuracy improves steadily through the encoder layers. By the time the signal reaches the decoder, much of the translation work is already complete.
- "Lazy" Decoder Layers: The lower layers of the decoder contribute relatively little to the translation process compared to the high-performing encoder layers.
Architectural Optimization and Results
Since encoder layers can be computed in parallel and decoder layers cannot, the authors proposed "trading" decoder layers for encoder layers. Moving from a balanced 6-6 split to a deep-encoder/shallow-decoder configuration yields massive efficiency gains.
The results of this architectural shift were impressive:
- Better Quality: An 18-4 configuration (18 encoder, 4 decoder layers) boosted translation quality by +1.42 BLEU points on the En-De task compared to the standard 6-6 baseline.
- Massive Speedup: A 10-2 configuration achieved a 2.32x speedup in decoding time while maintaining slightly higher translation quality than the baseline.
- Robustness: These gains were consistent across multiple language pairs, proving that the "deep encoder, shallow decoder" strategy is a robust architectural improvement for NMT.
Conclusion and Future Work
This work flips the script on Transformer internals, proving that translation begins as early as the source word embeddings. By shifting computational depth from the slow, step-by-step decoder to the fast, parallelizable encoder, we can achieve significant speedups with no loss in quality. Future research may explore how these findings apply to Non-Autoregressive Translation (NAT) models or investigate if different alignment strategies reveal even more hidden information within the layers.
Summary updated