Abstract
Hallucinations in Large Language Models (LLMs) are frequently attributed to "garbage" within the training data. However, locating specific errors in massive datasets is a significant challenge. This paper introduces Contrastive Error Attribution (CEA), a method designed to identify low-quality training examples by analyzing how they influence a model to produce a hallucination versus a corrected version of the same text. By removing the identified errors, we demonstrate a 70% reduction in entity hallucinations on the NYT dataset and a 55% reduction in semantic errors on the E2E dataset.
Introduction
Natural Language Generation (NLG) models—like those used for summarization—frequently "hallucinate" information that isn't in the source text. While noisy or misannotated training data is a primary culprit, identifying which specific training rows are causing a model to lie is incredibly difficult. Existing techniques, known as influence functions, try to trace a model's output back to specific training instances. However, these methods were mostly designed for simple classification tasks. In the complex world of text generation, where there are infinite ways to be "wrong," standard influence measures are brittle and often perform worse than simple keyword searches like BM25. This work proposes a robust framework for "debugging" training sets for generative models.
Methodology
The proposed Contrastive Error Attribution (CEA) framework integrates three novel techniques to overcome the limitations of traditional influence functions:
- Contrastive Influence: Instead of just asking, "Which training examples made the model generate this error?", CEA asks, "Which examples made the model prefer the error over the correct version?" By providing a human-corrected "contrast" example, the search for bad data becomes much more targeted. In simple classification, decreasing the probability of one class naturally increases another; in text generation, there are millions of wrong ways to finish a sentence, making a "correct" anchor essential.
- Gradient-Descent Based Influence: Standard methods use mathematical shortcuts (Taylor approximations) to estimate influence, which often fail in high-dimensional deep learning models. CEA instead takes actual gradient descent steps on the error and the correction separately, then measures the difference in loss. While more computationally intensive, this direct loss comparison is far more accurate.
- Distillation: Influence scores can be noisy. To mitigate this, the authors take the top-ranked "bad" examples and the bottom-ranked "good" examples and use them to train a separate neural network classifier. This classifier learns the general "vibe" or characteristics of a data error, allowing it to find even more problematic instances across the entire dataset.
Experimental Setup
The researchers evaluated CEA across three distinct scenarios to test its versatility:
- Synthetic Hallucinations (XSum): A "controlled" environment was created by intentionally injecting errors (e.g., swapping "England" for "China") into the XSum summarization dataset to see if CEA could reliably detect them.
- Extrinsic Hallucinations (NYT): Using the New York Times dataset, the method targeted real-world "PERSON" entity hallucinations where the model generates names not found in the source article.
- Semantic Errors (E2E): A data-to-text benchmark where models often omit information or add "ghost" attributes not present in the input data.
Results
CEA significantly outperformed all existing baselines, including TracIn, BartScore, and BM25, across all evaluated tasks.
Synthetic Task Performance
In the controlled environment of synthetic hallucinations, CEA achieved a Mean Average Precision (mAP) of 93.15% (0.93). This is a massive improvement over the next best baseline, BM25, which only managed 12.91% (0.13). The method showed consistent performance across various entity-swap pairs, such as England-China and London-Belfast.
Real-World Impact on Model Faithfulness
- NYT Summarization: After removing 50,000 examples identified by CEA, entity hallucinations dropped by 70%. For comparison, an "Oracle" method (using ground-truth knowledge of errors) only achieved a 60% reduction, suggesting CEA finds more impactful noise than simple error labels.
- E2E Dataset: CEA reduced semantic errors by 55%, whereas the strongest baseline (TracIn) only managed a 16% reduction. This demonstrates that removing just a small percentage of identified "bad" data can lead to massive improvements in model faithfulness.
Discussion and Conclusion
The success of CEA highlights that data cleaning is often more effective than building models that are "robust" to noise. By using a contrastive anchor and avoiding inaccurate Hessian-based approximations, CEA provides a reliable way to "debug" large-scale NLG datasets.
However, the method has limitations. It requires a small set of "error-correction" pairs (as few as 5 to 20) to start the process, which involves manual effort. Furthermore, it assumes hallucinations stem from data noise rather than a lack of model capacity. Future work could involve automating the "contrast" generation using other LLMs, potentially creating a fully self-cleaning training pipeline for next-generation language models.
Summary updated