The unreasonable effectiveness of few-shot learning for machine translation

Xavier Garcia, Yamini Bansal, Colin Cherry, George Foster, Maxim Krikun, Fangxiaoyu Feng, Melvin Johnson, Orhan Firat

TL;DR

This paper demonstrates that an 8-billion parameter decoder-only Transformer, trained purely on monolingual data, can match or even outperform state-of-the-art supervised translation systems when provided with just five high-quality examples at inference time. By leveraging few-shot prompting and Minimum Bayes Risk (MBR) decoding, this relatively compact model eliminates the need for massive parallel datasets or complex back-translation pipelines while offering unprecedented control over translation style, dialect, and formality.

What Problem Does This Paper Address?

State-of-the-art machine translation (MT) systems typically rely on massive parallel corpora mined from the web. This dependency introduces several critical flaws: parallel data is incredibly scarce for the vast majority of the world's languages, web-mined data is highly susceptible to poisoning attacks and low-quality memorization, and models often inherit systemic biases toward over-represented language registers.

While unsupervised machine translation avoids parallel data by training solely on monolingual text, it usually requires a fragile "bag of tricks" (like iterative back-translation) or massive, computationally expensive Large Language Models (LLMs) exceeding 100 billion parameters. The authors bridge this gap by exploring whether a moderately sized language model (8B parameters) can achieve competitive, controllable translation performance using the few-shot learning paradigm.

Methods

The authors utilize a Transformer decoder-only architecture scaled to 8 billion parameters, incorporating architectural modifications from Google's PaLM (such as multi-query attention).

Instead of standard causal language modeling alone, they train the model using a specialized variant of the Unified Language Learner (UL2) objective tailored for decoder-only models. This objective mixes three distinct tasks during pre-training:

  1. Causal Language Modeling (60%): Standard next-token prediction.
  2. Prefix Language Modeling (20%): Predicting a target sequence given a fully visible prefix.
  3. Span Corruption (20%): Predicting missing spans of text masked out of the input.

At inference time, the model is evaluated using 5-shot prompting, where five high-quality translation pairs are prepended to the source text. Crucially, instead of standard beam search, the authors employ Minimum Bayes Risk (MBR) decoding. MBR generates 64 candidate translations via ancestral sampling and uses the neural metric BLEURT to select the candidate that has the highest expected utility (i.e., the least risk) relative to the others.

Datasets

  • Training Data: High-quality monolingual web crawls, Wikipedia, and books for English, German, Chinese, and Icelandic.
  • Evaluation Data: Recent test sets from the WMT’21 news translation task (English–German, English–Chinese, English–Icelandic) to minimize train-test overlap from older web scrapes.
  • Stylistic Evaluation: The FRMT benchmark for evaluating Mandarin regional varieties (Mainland vs. Taiwanese) and the IWSLT’22 Special Task dataset for formality control in English–German translation.

Key Insights and Ideas

  • Data Quality Over Model Size: An 8B parameter model trained on clean monolingual data can outperform a 540B parameter model (like PaLM) on translation tasks simply because it has processed a larger volume of high-quality, non-English monolingual text.
  • The Exemplar Quality Penalty: The performance of few-shot translation is highly sensitive to prompt quality. By using Contrastive Data Selection (CDS) scores as a proxy for translation quality, the authors proved that lower-quality exemplars directly degrade the model's translation capabilities.
BLEURT scores degrade significantly as the few-shot demonstration quality decreases (CDS Buckets 1 to 3).
  • Inference-Time Controllability: Instead of fine-tuning a model to alter its style, users can steer the translation's regional dialect or formality level purely by selecting five exemplars that exhibit the desired style.
  • Comprehension Precedes Generation: When training on low-resource languages like Icelandic, multi-epoch training reveals that the model learns to extract meaning from the source language much faster than it learns to generate fluent text in the target language.

Key Results

  • High-Resource Translation: In English-to-XX translation directions, the 8B few-shot models using MBR decoding excelled. Notably, the trilingual model achieved a BLEURT score of 68.3 on English-to-Chinese, outperforming the top-ranked supervised WMT’21 submission.
  • Low-Resource Translation: For English–Icelandic, warm-starting the model from an English–German checkpoint and training it over multiple epochs yielded highly competitive results, outperforming Google Translate in the Icelandic-to-English direction (72.0 vs 71.1 BLEURT).
Figure 1. BLEURT scores on the WMT’21 English−Icelandic and Icelandic−English task after several epochs over the Ice- landic monolingual data. We remark that while the Icelandic- English direction converges fairly quickly (after two epoch), the English-Icelandic direction benefits from further training.
  • Dialect and Formality Control: On the FRMT Mandarin dialect benchmark, matching the few-shot examples to the target dialect boosted lexical accuracy from 13.8% (mismatched) to 86.2% (matched), establishing a new state-of-the-art. Similarly, for IWSLT’22, matching the prompt's formality achieved an accuracy of ~85%, matching or beating specialized, fully fine-tuned models.

Limitations and Future Work

  • Model Size: Although significantly smaller than giant LLMs, an 8B parameter model is still an order of magnitude larger than traditional production machine translation models (which typically use hundreds of millions of parameters). Scaled-down experiments at 1B parameters yielded poor results.
  • The Curse of Multilinguality: While expanding from bilingual to trilingual models improved performance, the authors note that adding too many languages typically triggers a performance drop per language.
  • Decoding Bottleneck: The reliance on MBR decoding (sampling 64 paths and scoring them with BLEURT) is computationally expensive and significantly slower than standard beam search, posing a challenge for real-time production deployment.

Summary updated

BibTeX
@inproceedings{garcia2023unreasonable,
  author = {Xavier Garcia and Yamini Bansal and Colin Cherry and George Foster and Maxim Krikun and Fangxiaoyu Feng and Melvin Johnson and Orhan Firat},
  title = {{The unreasonable effectiveness of few-shot learning for machine translation}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=zvCSNsoyKW},
}
Figure