TIM: Teaching Large Language Models to Translate with Comparison

Jiali Zeng, Fandong Meng, Yongjing Yin, Jie Zhou · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable versatility across a wide range of natural language tasks. However, when applied to machine translation (MT), they often encounter significant hurdles. Unlike general text generation, high-quality translation requires adherence to strict linguistic constraints and contextual nuances. Standard instruction tuning, which relies on simple imitation of ground-truth references, often fails to provide the deep task understanding necessary to avoid hallucinations or subtle errors, particularly in smaller models (e.g., 1B to 3B parameters).

This paper introduces TIM (Teaching language models to learn translation wIth examples in coMparison), a novel framework designed to bridge this gap. By shifting the training paradigm from simple imitation to comparative learning, TIM teaches models not just what a correct translation looks like, but also how to distinguish it from various types of incorrect or suboptimal outputs.

Methodology: Comparative Learning

The TIM framework employs two primary strategies to enhance translation quality: Output Comparison and Preference Comparison.

Output Comparison via Specialized Data

To improve the model's comprehension of translation instructions and linguistic dependencies, the authors developed three specialized data types for fine-tuning:

  • Order-guided Data: This teaches the model to generate translations in non-standard orders (e.g., reverse order) when prompted. This exercise forces the model to capture diverse linguistic dependencies beyond simple left-to-right prediction.
  • Dictionary-guided Data: By providing word-level alignments from bilingual dictionaries within the prompt, the model learns to ground its translations in specific, accurate vocabulary.
  • Error-guided Data: This data includes explicit annotations that label translations as "correct" or highlight specific mistakes, such as locale convention or name format errors. This helps the model internalize the boundaries of high-quality translation.
Examples of specialized data types used in TIM: Order-guided, Dictionary-guided, and Error-guided data.

Preference Comparison and Loss Functions

Beyond showing the model different data formats, TIM explicitly trains the model to avoid errors through a preference learning objective. The training process pairs a standard "Good Output" (ground truth) with a "Bad Output" (either a noisy version of the reference or an output from a weaker model).

The framework utilizes a dual-loss approach. In addition to the standard language modeling loss ($L_{lm}$), it introduces a token-level preference loss ($L_{pl}$). This loss function penalizes the model more heavily for tokens that lead toward the "bad" translation compared to those that lead toward the "good" one, effectively teaching the model to steer away from common translation pitfalls.

The overall TIM framework architecture, showing how training prompts are paired with both good and bad outputs to optimize the model using a combined language modeling and preference loss.

Evaluation and Key Insights

The researchers evaluated TIM using standard benchmarks, including WMT22 and FLORES-200, across multiple language pairs such as English⇔German and English⇔Chinese.

Key Results

  • Performance Gains: TIM consistently outperformed standard instruction-tuning baselines (like Alpaca) across BLEU and COMET metrics.
  • Impact on Scale: The most significant improvements were observed in smaller models. While large models have inherent capacity, smaller models (1B-3B) benefited immensely from the explicit comparative signals, which provided the necessary guidance to follow complex translation instructions.
  • LLMs as Quality Estimators: A notable emergent property of TIM is that the model implicitly learns to be a reward model. A TIM-tuned LLaMA-2-13B model achieved top-tier results in reference-free quality estimation (QE), even outperforming specialized systems designed solely for that task.
  • Zero-Shot Robustness: The model demonstrated improved zero-shot performance on unseen language pairs (e.g., Japanese-to-English), suggesting that the comparative training helps the model learn a more generalized concept of the translation task.

Limitations and Future Work

While effective, the framework is not without limitations. The authors found that dictionary-guided data could sometimes introduce noise if the dictionary terms were too common or misaligned with the reference style. Future work will focus on refining dictionary selection and exploring more diverse types of "Bad Outputs" to further sharpen the model's discriminative abilities. Additionally, developing more advanced preference learning objectives could help models better self-correct during the generation process.

Summary updated

BibTeX
@misc{zeng2023tim,
  author = {Jiali Zeng and Fandong Meng and Yongjing Yin and Jie Zhou},
  title = {{TIM: Teaching Large Language Models to Translate with Comparison}},
  year = {2023},
  eprint = {2307.04408},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.04408},
}
Figure