Training Language Models on the Knowledge Graph: Insights on Hallucinations and Their Detectability

Jiri Hron, Laura A Culp, Gamaleldin Fathy Elsayed, Rosanne Liu, Jasper Snoek, Simon Kornblith, Alex Rizkowsky, Isabelle Simpson, Jascha Sohl-Dickstein, Noah Fiedel, Aaron T Parisi, Alexander A Alemi, Azade Nova, Ben Adlam, Bernd Bohnet, Gaurav Mishra, Hanie Sedghi, Izzeddin Gur, Jaehoon Lee, John D Co-Reyes, Kathleen Kenealy, Kelvin Xu, Kevin Swersky, Igor Mordatch, Lechao Xiao, Maxwell Bileschi, Peter J Liu, Roman Novak, Sharad Vikram, Tris Warkentin, Jeffrey Pennington

TL;DR

This paper investigates how language model (LM) scale affects hallucinations, particularly when trained on a controlled knowledge graph (KG) dataset. They discover that while larger LMs hallucinate less on seen data, eliminating hallucinations requires significantly more compute than previously thought, and detecting these remaining hallucinations becomes harder for larger models.

What Problem Does This Paper Address?

Large Language Models (LLMs) are known to "hallucinate," meaning they generate text that is factually incorrect or not supported by their training data. Understanding and mitigating hallucinations is crucial for deploying LLMs reliably. However, studying hallucinations is challenging because it's difficult to precisely know what information an LLM was exposed to during training, making it hard to distinguish between genuine errors and simply lacking knowledge. This paper aims to address this by controlling the training data and investigating how model scale impacts both the occurrence and detectability of hallucinations.

Methods

The researchers tackle this problem by:

  • Constructing a Knowledge Graph (KG) Dataset: They convert a KG into structured triplets (subject, predicate, object) and use these as training data. This provides precise control over the factual information the LMs are exposed to.
  • Training Autoregressive LMs: They train decoder-only transformer LMs of varying sizes from scratch on this KG dataset using a standard next-token prediction objective.
  • Defining Hallucinations: A hallucination is defined as a generated fact that does not match any existing object for a given subject-predicate pair in the training set.
  • Developing Hallucination Detectors: They train specialized detector models to identify hallucinations in the output of the trained LMs. Two main detection tasks are explored: "sentence" (judging the entire predicted object) and "token" (judging individual tokens within the object). Detectors are implemented as either adding a new "head" to the LM or "full" fine-tuning the LM.

Datasets

The primary dataset used is derived from a Knowledge Graph (KG). The paper introduces several variations of this dataset based on "visibility" and "scale":

  • Fully Visible Set (FVS): Used for training both LMs and detectors.
  • Partially Visible Set (PVS): Used for training LMs only.
  • Invisible Set (IVS): A held-out test set for evaluation.

These sets are further divided into subsets representing 1%, 10%, and 100% of the full KG data.

Key Insights and Ideas

  • KG as a Controlled Environment: Using a KG is a powerful way to isolate and study hallucinations, as it removes the ambiguity of natural language and provides a clear ground truth.
  • Memorization is Key (and Costly): To avoid hallucinations on seen data, LMs need to effectively "memorize" the training facts. This requires significantly more training epochs (20+) and much larger models than typically considered optimal for standard text training.
  • Scale vs. Hallucination Rate (Complex Relationship): While larger models hallucinate less on seen data, increasing the dataset size for a fixed training budget can paradoxically increase the hallucination rate. This suggests that learning more facts requires more capacity or longer training.
  • The Detectability Paradox: As LMs become larger and hallucinate less, detecting their remaining hallucinations becomes harder. This is a critical finding, as it implies that simply making models "better" at not hallucinating might make it more difficult to identify when they do err.
  • Trade-offs Abound: There's a clear trade-off between reducing hallucinations on seen data and maintaining generalization to unseen data. Lowering generation temperature can reduce hallucinations but also limits the diversity of generated outputs.

Key Results

  • Compute Cost: Achieving a hallucination rate of ≤5% on seen data requires an order of magnitude more compute than previously estimated as optimal.
  • Training Epochs: Minimizing hallucination rates on seen data necessitates training for 20+ epochs, a significant departure from current practices.
  • Inverse Detectability: The study found an inverse relationship between LM scale and hallucination detectability. Larger LMs, which hallucinate less, are harder to detect hallucinations from. Specifically, the Area Under the Precision-Recall Curve (AUC-PR) for detectors decreases as LM size increases.
  • Detector Performance: "Full" detectors (fine-tuning the entire LM) generally outperform "head" detectors (adding a new output layer). The "sentence" task formulation for detectors also shows superior AUC-PR compared to the "token" task.

Limitations and Future Work

  • KG vs. Natural Language: The KG dataset lacks the repetition and semantic ambiguity present in natural language corpora. This might mean the observed hallucination patterns don't perfectly translate to real-world LLMs.
  • Model Size: The LMs trained are smaller than state-of-the-art models. The authors acknowledge that emergent capabilities in larger models could alter these findings.
  • Type of Hallucination: The study focuses on verbatim hallucinations (where the correct answer exists in the training data). Other types of hallucinations (e.g., inferential errors) are not covered.
  • Detector Methods: The paper explores a subset of detector methods. It's possible that other, more advanced techniques could yield different results.

Future work could explore these limitations by training larger models, using more naturalistic datasets, and investigating a wider range of hallucination types and detection methods. The findings also suggest that retrieval-augmented generation or methods for expressing uncertainty might be more practical alternatives to solely relying on large-scale memorization for hallucination reduction.

Summary updated

BibTeX
@inproceedings{hron2024training,
  author = {Jiri Hron and Laura A Culp and Gamaleldin Fathy Elsayed and Rosanne Liu and Jasper Snoek and Simon Kornblith and Alex Rizkowsky and Isabelle Simpson and Jascha Sohl-Dickstein and Noah Fiedel and Aaron T Parisi and Alexander A Alemi and Azade Nova and Ben Adlam and Bernd Bohnet and Gaurav Mishra and Hanie Sedghi and Izzeddin Gur and Jaehoon Lee and John D Co-Reyes and Kathleen Kenealy and Kelvin Xu and Kevin Swersky and Igor Mordatch and Lechao Xiao and Maxwell Bileschi and Peter J Liu and Roman Novak and Sharad Vikram and Tris Warkentin and Jeffrey Pennington},
  title = {{Training Language Models on the Knowledge Graph: Insights on Hallucinations and Their Detectability}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=Zt1dwG8xrK},
}
Figure