On-the-Fly Fusion of Large Language Models and Machine Translation

Hieu Hoang, Huda Khayrallah, Marcin Junczys-Dowmunt · DOI

Abstract

Traditional Neural Machine Translation (NMT) models are precise but often rigid, while Large Language Models (LLMs) offer superior fluency and context-awareness but are prone to hallucinations. This paper explores a token-level fusion approach to ensemble these two architectures. By combining their probability distributions during decoding, we achieve a system that leverages the strengths of both. Results across multiple language pairs demonstrate that even a "weaker" LLM can significantly enhance a specialized NMT model, particularly in maintaining document-level consistency.

Introduction

Machine translation currently relies on two distinct paradigms: specialized NMT models trained on massive parallel corpora and general-purpose LLMs trained on vast monolingual data. While NMT models excel at accuracy, LLMs provide a level of linguistic diversity and instruction-following capability that specialized models lack. We propose an "on-the-fly" fusion method that requires no retraining, allowing these models to act as "sidekicks" to one another.

Methodology: Token-Level Fusion

The core of our approach is a simple linear interpolation of the next-token probability distributions from both models. At each step of the decoding process, the ensemble calculates the probability of the next token as follows:

$$p_{ensemble} = \lambda p_{MT} + (1 - \lambda) p_{LLM}$$

The mixing parameter $\lambda$ (lambda) determines the relative weight given to each model. For instance, a $\lambda$ of 0.7 relies 70% on the NMT model and 30% on the LLM. This fusion happens dynamically during inference, making it highly flexible.

Figure 2: Impact of the mixing ratio $\lambda$ and the necessity of a translation prompt on ensemble performance (COMET-22).

As shown in Figure 2, the choice of $\lambda$ is critical. Furthermore, the LLM must be appropriately prompted to act as a translator; without a prompt, the ensemble's performance degrades significantly unless the LLM's contribution is minimized.

Experimental Setup

We evaluated this method across four language pairs representing different resource levels:

  • High Resource: German (de) and Russian (ru) to/from English.
  • Medium Resource: Turkish (tr) to/from English.
  • Low Resource: Hausa (ha) to/from English.

Evaluation was conducted using the COMET-22 metric on standard benchmarks (WMT21/22) and specialized test suites like TED-100, ParaPat, and CTXPro to assess document-level phenomena.

Key Insights

Diversity Over Raw Strength

A surprising finding was that ensembling an NMT model with a weaker LLM often outperformed an ensemble of two strong NMT models. The LLM's general world knowledge and fluency appear to be complementary to the NMT's translation-specific training, providing a "diversity boost" that similar architectures cannot achieve.

Contextual Awareness

LLMs excel at handling long-range dependencies. By including previous translated sentences in the LLM's prompt, the ensemble significantly improved its performance on document-level tasks, such as maintaining consistent gender and formality—areas where traditional NMT models frequently struggle.

Key Results

The ensemble method consistently outperformed individual models across most benchmarks.

Figure 5: Translation performance (COMET-22) across different languages and model sizes (Llama 2 7B and 13B).

As detailed in Figure 5, for German-to-English (de-en), the NMT baseline of 83.5 was improved to 83.9 when ensembled with a 7B LLM, and further to 84.1 with a 13B LLM. While the gains are most pronounced in high-resource languages, the ensemble maintains or improves performance even in medium-resource settings like Turkish. However, in extremely low-resource scenarios like Hausa, the benefits are limited by the baseline competence of the underlying models.

Conclusion and Future Work

On-the-fly fusion provides a computationally efficient way to combine the precision of NMT with the fluency of LLMs without the need for expensive retraining. Future research will focus on dynamic ensembling, where the mixing ratio $\lambda$ is adjusted word-by-word based on model confidence, and exploring the scalability of this method with larger, state-of-the-art LLMs.

Summary updated

BibTeX
@inproceedings{hoang2024fly,
  author = {Hieu Hoang and Huda Khayrallah and Marcin Junczys-Dowmunt},
  title = {{On-the-Fly Fusion of Large Language Models and Machine Translation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-naacl.35},
}
Figure