Abstract
Few-shot machine translation (MT) typically relies on a library of human-annotated examples to guide Large Language Models (LLMs). However, for low-resource languages, such demonstration pools are often unavailable. This paper presents Demonstration Augmentation for Translation (DAT), a self-contained framework that enables LLMs to generate their own relevant in-context examples on the fly. By leveraging internal knowledge to synthesize query-specific demonstrations, DAT significantly improves translation quality in low-resource settings without requiring external data or human intervention.
Introduction
In-context learning (ICL) has transformed machine translation by allowing models to perform tasks using only a few demonstrations in the prompt, bypassing the need for extensive fine-tuning. While effective for high-resource languages, this approach faces a significant bottleneck for low-resource languages like Nepali or Zulu: the lack of high-quality, human-translated demonstration pools.
Existing strategies to mitigate this often rely on external resources, such as monolingual corpora or bilingual dictionaries. This research explores a more autonomous alternative: Can an LLM improve its own translation performance by "hallucinating" its own examples? The resulting method, Demonstration Augmentation for Translation (DAT), demonstrates that an LLM's internal knowledge is a potent, untapped resource for self-improvement in translation tasks.
The DAT Framework
The DAT pipeline consists of four distinct stages designed to create a "custom-tailored" tutorial for every translation query:
- Source-side Generation: Given a source query (e.g., an English sentence), the LLM is prompted to generate $m$ similar sentences. The prompt emphasizes relevance to the query and diversity among the generated examples to provide a broad linguistic context.
- Filtering via Maximal Marginal Relevance (MMR): To optimize the demonstration set, the system applies the MMR algorithm. This selects $k$ sentences that maximize relevance to the user's query while minimizing redundancy among the examples, ensuring the model receives distinct linguistic "clues."
- Target-side Generation: The LLM translates these $k$ synthetic source sentences into the target language using a simple zero-shot prompt.
- Few-shot Translation: Finally, these self-generated pairs are used as in-context examples. The model translates the original user query guided by the synthetic demonstrations it just created.
Experimental Setup
The researchers evaluated DAT using the Flores dataset, a standard benchmark for multilingual translation, focusing on five low-resource languages: Nepali, Khmer, Pashto, Zulu, and Swahili. The primary engines for both example generation and translation were Llama-3.1 (8B and 70B variants). Performance was measured against zero-shot baselines and traditional few-shot methods using fixed human-annotated pairs.
Key Findings
Relevance Over "Gold" Quality
A pivotal insight from the study is that the relevance of a demonstration to the specific query is often more important than the absolute grammatical perfection of the example. Even if the LLM's self-generated translations contain minor errors, the structural and lexical similarities to the query provide enough context to guide the final translation effectively.
The Risk of Static Examples
The study identified a "backfire" effect when using fixed human-annotated pairs. For instance, using static examples with Llama-3.1-70B for Khmer translation resulted in a 21.6-point drop in COMET score compared to a zero-shot approach. In these cases, irrelevant examples distracted the model, leading to repetitive or abnormally long outputs. DAT avoids this by dynamically generating examples that are always contextually aligned with the input.
Performance Gains
DAT consistently outperformed zero-shot baselines across the tested languages. In English-to-Nepali translation, DAT improved COMET scores by 2.8 points for the 8B model and 1.3 points for the 70B model. Notably, in nearly all languages except Zulu, DAT's synthetic examples outperformed traditional few-shot methods that utilized fixed human data.
Qualitative analysis further showed that DAT enhances lexical precision. In Swahili, for example, DAT correctly identified specific terminology like "kundi la simba" (pride of lions), whereas zero-shot models often defaulted to more generic or incorrect terms.
Limitations and Future Directions
While promising, DAT has several limitations:
- Directionality: The method is currently most effective when translating from a high-resource language (English) into a low-resource language. Generating high-quality source sentences in low-resource languages remains a challenge due to the models' limited internal knowledge of those languages.
- Computational Overhead: Generating new examples for every query increases latency and computational cost.
- The Accumulation Gap: Efforts to save and reuse generated pairs (DAT-accumulation) have shown promise but currently do not match the performance of "on-the-fly" dynamic generation.
Future research will likely focus on optimizing the retrieval and storage of synthetic examples to reduce costs while maintaining the high performance of dynamic generation.
Summary updated