Beyond Decoder-only: Large Language Models Can be Good Encoders for Machine Translation

Yingfeng Luo, Tong Zheng, Yongyu Mu, Bei Li, Qinghong Zhang, Yongqi Gao, Ziqiang Xu, Peinan Feng, Xiaoqian Liu, Tong Xiao, JingBo Zhu

Abstract

Large Language Models (LLMs) have traditionally been utilized as decoder-only models for machine translation via prompting. However, this approach is computationally expensive and prone to misalignment. This paper introduces LaMaTE, a hybrid architecture that repurposes a pre-trained LLM as a powerful unidirectional encoder paired with a lightweight NMT decoder. By utilizing cross-attention and a multi-layer adaptor, LaMaTE matches the translation quality of massive decoder-only models while achieving up to a 6.5x inference speedup and a 75% reduction in memory footprint.

Introduction

In the current era of NLP, decoder-only models like GPT-4 or Llama dominate. While these models can translate text via prompting, they are computationally expensive. Because they generate text token-by-token using a single attention mechanism, they require massive "KV caches" and often struggle with "misalignment"—where the translation drifts away from the source meaning.

Traditional Neural Machine Translation (NMT) uses an encoder-decoder architecture. These are fast and efficient but often lack the deep, "universal" linguistic understanding that LLMs gain from trillions of tokens of pre-training. LaMaTE seeks to combine the best of both worlds: using a massive LLM to understand the source text as an encoder and a small, specialized model to generate the translation as a decoder.

Comparison of translation architectures: (a) Standard NMT, (b) Decoder-only LLM, and (c) the proposed LLM-as-Encoder approach.

Methods

The authors introduce LaMaTE (Large Language Models as Machine Translation Encoders). The architecture consists of three main parts:

  1. The LLM Encoder: A pre-trained LLM (like Llama-3-8B) processes the source text. Interestingly, even though these models are "decoder-only," they function as unidirectional encoders in this framework.
  2. The Adaptor: Since an 8B parameter LLM has a much larger internal "hidden size" than a typical NMT decoder, an adaptor is needed to fuse information from multiple layers of the LLM and learn bidirectional context via a small "EncStack."
  3. The NMT Decoder: A much smaller, standard Transformer decoder (e.g., 8 layers) that uses cross-attention to look back at the LLM's representations.
Detailed LaMaTE architecture showing the LLM encoder, the multi-layer fusion adaptor, and the NMT decoder.

Training Strategy: To make training feasible, a two-stage process is used. First, the LLM is frozen while the Adaptor and Decoder are trained on translation data. In the second stage, the entire system is fine-tuned on a variety of specialized tasks.

Key Results

The study utilizes several major benchmarks, including WMT2023, OPUS-100, and a new ComMT (Comprehensive Machine Translation) benchmark covering document-level, domain-specific, and terminology-constrained tasks.

  • Efficiency: LaMaTE achieved a 2.4x to 6.5x speedup in inference compared to decoder-only baselines.
  • Memory: It reduced the KV cache memory footprint by 75%, allowing for much larger batch sizes on the same hardware.
  • Quality: On the ComMT benchmark, LaMaTE matched or surpassed specialized models like ALMA-7B and TowerInstruct-7B in translation quality (measured by COMET and BLEU scores).
  • Cross-Attention Benefits: Unlike decoder-only LLMs that use a single attention mechanism, LaMaTE’s use of cross-attention allows for a more direct "token-to-token" interaction, significantly reducing translation hallucinations.

Conclusion

LaMaTE demonstrates that the unidirectional representations from an LLM are rich enough to outperform traditional NMT encoders when paired with a dedicated decoder. While the NMT decoder currently requires a "cold start" with significant bilingual data, the efficiency gains in speed and memory make this a promising direction for scalable, high-quality translation. Future work will investigate Mixture-of-Experts (MoE) for the decoder to further increase capacity without sacrificing inference speed.

Summary updated

BibTeX
@inproceedings{luo2025beyond,
  author = {Yingfeng Luo and Tong Zheng and Yongyu Mu and Bei Li and Qinghong Zhang and Yongqi Gao and Ziqiang Xu and Peinan Feng and Xiaoqian Liu and Tong Xiao and JingBo Zhu},
  title = {{Beyond Decoder-only: Large Language Models Can be Good Encoders for Machine Translation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure