Prompting Large Language Models with Human Error Markings for Self-Correcting Machine Translation

Nathaniel Berger, Stefan Riezler, Miriam Exel, Matthias HuckarXiv 2024

TL;DR

While Large Language Models (LLMs) excel at general translation, they frequently stumble on specialized technical terminology. This paper introduces a lightweight, interactive approach where human translators simply flag incorrect tokens using <bad> tags, guiding the LLM to accurately self-correct via few-shot prompting. This targeted feedback loop yields consistent improvements over both standard machine translation and automatic post-editing.

What Problem Does This Paper Address?

In enterprise and technical translation (e.g., software documentation), consistency and domain-specific terminology are critical. Standard Machine Translation (MT) systems often fail to select the exact technical terms required by a specific company or domain.

To fix this, companies rely on human post-editing (PE) to correct the text, which generates a database of source sentences, raw translations, and human corrections (a Translation Memory, or PE-TM). However, full human post-editing is time-consuming and expensive. The authors ask a compelling question: Can we lighten the human workload? Instead of rewriting the translation, what if a human simply points out the mistakes, and lets an LLM handle the actual correction by looking at similar examples from the translation memory?

Methods

The authors propose a lightweight, two-step interactive translation workflow:

  1. Initial Translation & Human Marking: A generic MT system or LLM generates a translation hypothesis. A human reviewer quickly clicks on incorrect tokens (such as mistranslated technical terms). These errors are wrapped in inline XML-style tags: <bad>erroneous token</bad>.
  2. Retrieval-Augmented Correction: Using sentence embeddings (all-MiniLM-L6-v2), the system searches the PE-TM for the most similar source sentences that also contain human error markings and corrections. These are compiled into a few-shot prompt to instruct the LLM on how to fix the current sentence.

The authors evaluated this method using Llama 13B and GPT-3.5, comparing three scenarios:

  • MT: Translating from scratch.
  • APE (Automatic Post-Editing): Asking the LLM to correct the translation without any error tags.
  • MRK (Marked): Asking the LLM to correct the translation using the human-provided <bad> tags.
Figure 1: Example of a 1-shot prompt for English-to-German Translation. Error markings are inside bold faced tags <bad> </bad>. The demonstration example consists of a source segment in English (in green), a translation hypothesis in German (in blue), and a correction (in red). The test example shows a correction of the translation of ”environment variable” from ”Umweltvariable” into ”Umgebungsvariable” learned by the LLM (in bold-faced red).

Datasets

The authors compiled an English-German parallel dataset from open-source software documentation available on OPUS (including GNOME, KDE4, PHP, and Ubuntu). After filtering for length and quality, they selected a subset of 1,500 examples.

They hired three professional translators with IT domain expertise to annotate the machine-translated hypotheses. The final clean dataset consisted of 982 examples, split into 492 sentences for the in-context example pool (the PE-TM) and 490 sentences for testing.

Key Insights and Ideas

  • LLMs are stubborn about their own outputs: When using Llama 13B for standard automatic post-editing (APE), the model is highly conservative—it assumes its initial translation is acceptable and only edits 7.3% of the tokens that humans considered incorrect.
  • Explicit constraints unlock self-correction: Injecting the <bad> tags acts as an explicit oracle constraint. It forces the model to acknowledge its mistakes, doubling Llama's editing rate on those specific tokens to 14.76%.
  • Error markings prevent "over-editing": For larger models like GPT-3.5, which are already highly prone to editing, the error markings serve as a boundary. It significantly reduces unmarking edits (unnecessary changes to words that were already correct), keeping the model focused purely on fixing the actual errors.

Key Results

The inclusion of human error markings (MRK) consistently outperformed standard MT and blind automatic post-editing (APE) across BLEU and TER metrics.

Main results across translation scenarios
  • Translation Quality: For Llama 13B, the MRK condition achieved the highest BLEU score (30.09) compared to the original hypotheses (28.92). For GPT-3.5, MRK pushed the BLEU score up to 39.31 (compared to 38.61 for MT from scratch).
  • Edit Accuracy: A rigorous human evaluation of 100 sentences revealed that Llama 13B's edits were correct 67% of the time when guided by error markings (MRK), compared to a meager 32% accuracy in the blind APE scenario.

Limitations and Future Work

As a pilot study, the dataset size (under 1,000 examples) and the pool of human annotators were relatively small. Additionally, while marking errors is faster than rewriting sentences, it still requires a human in the loop at inference time.

To scale this approach, the authors point to a promising future direction: training automated error pinpointing models to predict and place the <bad> tags automatically. This would eliminate the need for human intervention during test time while preserving the LLM's enhanced ability to self-correct under constraints.

Summary updated

BibTeX
@misc{berger2024prompting,
  author = {Nathaniel Berger and Stefan Riezler and Miriam Exel and Matthias Huck},
  title = {{Prompting Large Language Models with Human Error Markings for Self-Correcting Machine Translation}},
  year = {2024},
  eprint = {2406.02267},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.02267},
}
Figure