NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Probing Word Translations in the Transformer and Trading Decoder for Encoder Layers

Hongfei Xu, Josef van Genabith, Qiuhui Liu, Deyi Xiong

Abstract

Conventional Neural Machine Translation (NMT) architectures typically employ a balanced number of encoder and decoder layers. However, recent research demonstrates that the Transformer model begins the translation process much earlier than previously assumed, starting at the source embeddings. By mapping this progressive evolution of translation, we show that slow, sequential decoder layers can be "traded" for fast, parallelizable encoder layers. This architectural shift results in models that are not only more accurate but also up to 2.3x faster during inference.

Introduction

In standard NMT, the Transformer is viewed as a two-part system: an Encoder for source language understanding and a Decoder for target language generation. While a balanced split (e.g., 6 layers each) is common, the specific location where a source token transforms into a target token has remained opaque.

Because the decoder generates words autoregressively (one by one), it represents the primary bottleneck for inference speed. If the encoder already performs significant translation work, current architectures are likely inefficient. This study maps the evolution of translation across every layer to optimize this balance, aiming to offload work from the sequential decoder to the parallel encoder.

Probing the Translation Process

To investigate what specific layers "know" about translation, the authors employ a technique called Probing. This method allows for the inspection of internal representations without altering the underlying model.

  1. Model Freezing: A fully trained Transformer model is frozen to preserve its learned weights.
  2. Representation Extraction: Hidden vectors are extracted from specific layers (e.g., Encoder Layer 3).
  3. Linear Projection: These vectors are projected via a simple linear "probe" layer.
  4. Classification: The projected representations are fed into the original model's final classifier to measure how accurately the intermediate layer predicts the correct target word.
The probing framework used to evaluate translation accuracy at different layers of the Transformer.

To handle the "length mismatch" between source and target sentences in the encoder, the researchers used a weighted ensemble of the model's own cross-attention alignment matrices to map source states to target positions.

Key Insights: The Progressive Nature of Translation

The probing results revealed several surprising characteristics of the Transformer's internal logic:

  • Early Translation: Translation accuracy improves steadily layer-by-layer, beginning at the very first encoder layer.
  • Information-Rich Embeddings: Raw source word embeddings (Layer 0) contain enough information to achieve over 40% translation accuracy on the WMT 14 English-to-German benchmark.
  • The "Lazy" Decoder: Lower decoder layers contribute less to translation accuracy than deep encoder layers. A representation from the 4th encoder layer is often more "translated" than one from the 1st decoder layer.

Trading Decoder Layers for Encoder Layers

Leveraging the insight that encoder layers are highly effective at translation and—crucially—can process all words in a sentence simultaneously, the authors experimented with asymmetric architectures.

Comparison of different Encoder-Decoder depth configurations, showing improvements in BLEU score and significant speedups.

As shown in the results, a model with 10 encoder layers and 2 decoder layers (10-2) achieved a 2.32x speedup over the 6-6 baseline while slightly improving the BLEU score. Even more aggressive configurations, such as an 18-4 setup, boosted translation quality by +1.42 BLEU while remaining 1.4x faster than the standard model. These findings were consistent across multiple benchmarks, including English-to-French and Czech-to-English.

Limitations and Future Directions

While the "deep encoder, shallow decoder" strategy offers clear advantages, some limitations remain. The probing method currently requires alignment matrices for supervision, suggesting a need for future unsupervised probing techniques. Additionally, while highly effective for NMT, it is yet to be determined if this logic applies to tasks requiring more complex synthesis, such as abstractive summarization. Finally, further hardware-specific optimizations for deep encoder stacks could yield even greater performance gains.

Summary updated

BibTeX
@inproceedings{xu2021probing,
  author = {Hongfei Xu and Josef van Genabith and Qiuhui Liu and Deyi Xiong},
  title = {{Probing Word Translations in the Transformer and Trading Decoder for Encoder Layers}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.naacl-main.7},
}
Figure