Detecting and Mitigating Hallucinations in Machine Translation: Model Internal Workings Alone Do Well, Sentence Similarity Even Better

David Dale, Elena Voita, Loïc Barrault, Marta R. Costa-jussà

Overview

Neural Machine Translation (NMT) systems occasionally suffer from "hallucinations"—pathological failures where the model generates fluent but completely unrelated text. This research demonstrates that these errors can be detected with high precision by analyzing internal model attributions and external cross-lingual sentence similarity. By implementing a "detect-then-rewrite" strategy, the authors achieved a significant reduction in these errors.

Defining the Problem: A Taxonomy of Errors

Hallucinations are distinct from standard translation errors because they are "detached" from the source sentence. While rare, they severely undermine user trust. The researchers categorize translations into three main groups: Correct, Errors (not detached), and Hallucinations (detached).

Taxonomy of translation outputs, distinguishing hallucinations from standard errors.

Detection Methods

The study explores two primary avenues for identifying hallucinations:

1. Internal Measures (ALTI+)

Instead of relying on output probability, the authors use ALTI+ to calculate the "percentage of source contribution." If internal Transformer layers show that source tokens contribute very little to the final output, the model is likely hallucinating.

2. External Measures (Sentence Similarity)

The authors also employ external "referees" to validate translations:

  • LaBSE: Measures semantic cosine similarity between source and target using cross-lingual embeddings.
  • XNLI: Uses a Natural Language Inference model to determine if the source sentence entails the translation.

Key Insights: Metric Distributions

The effectiveness of these metrics is visible in their score distributions across different translation categories.

Score distributions for internal and external detection methods across different translation categories.
  • Internal Workings are Informative: ALTI+ is twice as accurate as standard sequence log-probability for detecting severe hallucinations.
  • Similarity vs. Quality Estimation: Semantic similarity models (LaBSE) and entailment models (XNLI) outperform standard Quality Estimation (QE) models like COMET-QE. QE models are often tuned for "soft" errors, whereas hallucinations require a "hard" semantic check.
  • The Bimodal Nature of XNLI: As shown in the distributions, XNLI is highly "peaky"—it tends to view a translation as either a perfect entailment or completely unrelated, making it an excellent binary alarm.

Mitigation: Detect-then-Rewrite

To fix detected hallucinations, the researchers propose a framework that:

  1. Generates alternative hypotheses using Monte Carlo (MC) dropout.
  2. Reranks these alternatives using the proposed detection metrics (ALTI+, LaBSE, or XNLI) to select the most faithful translation.

Key Results and Performance

  • Detection Precision: For "fully detached" hallucinations, ALTI+ achieved 67.4% precision (at 90% recall), compared to 31.0% for the log-probability baseline.
  • State-of-the-Art: External models LaBSE and XNLI reached ~70% and ~60% precision, respectively.
  • Impact: The "detect-then-rewrite" setup reduced the hallucination rate by a factor of 2.5 to 3 in human evaluations.

Limitations

While effective, these methods have trade-offs. External encoders like LaBSE add computational overhead. Furthermore, detection is currently sentence-level; future work aims for token-level granularity to identify partial hallucinations more effectively.

Summary updated

BibTeX
@inproceedings{dale2023detecting,
  author = {David Dale and Elena Voita and Loïc Barrault and Marta R. Costa-jussà},
  title = {{Detecting and Mitigating Hallucinations in Machine Translation: Model Internal Workings Alone Do Well, Sentence Similarity Even Better}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.3},
}
Figure