Table of Contents
Fetching ...

Addressing Hallucinations in Language Models with Knowledge Graph Embeddings as an Additional Modality

Viktoriia Chekalina, Anton Razzhigaev, Elizaveta Goncharova, Andrey Kuznetsov

TL;DR

Facing hallucinations in LLMs, the paper proposes adding Knowledge Graph (KG) embeddings as an extra modality to grounding outputs. It introduces a Text2Graph mapper that converts text into KG embeddings and an Adapter that injects these embeddings into the LLM without modifying the base model. The WikiEntities dataset, with over 3.2 million texts annotated with Wikidata entities and embeddings, supports training the mapper and adapters. Empirical results on Mistral 7B, LLaMA 2-7B, and LLaMA 3-8B show reduced hallucinations on HaluEval, True-False, and FEVER while maintaining performance on other tasks, and the approach extends to various LLMs without external retrieval.

Abstract

In this paper we present an approach to reduce hallucinations in Large Language Models (LLMs) by incorporating Knowledge Graphs (KGs) as an additional modality. Our method involves transforming input text into a set of KG embeddings and using an adapter to integrate these embeddings into the language model space, without relying on external retrieval processes. To facilitate this, we created WikiEntities, a dataset containing over 3 million Wikipedia texts annotated with entities from Wikidata and their corresponding embeddings from PyTorch-BigGraph. This dataset serves as a valuable resource for training Entity Linking models and adapting the described method to various LLMs using specialized adapters. Our method does not require fine-tuning of the language models themselves; instead, we only train the adapter. This ensures that the model's performance on other tasks is not affected. We trained an adapter for the Mistral 7B, LLaMA 2-7B (chat), and LLaMA 3-8B (instruct) models using this dataset and demonstrated that our approach improves performance on the HaluEval, True-False benchmarks and FEVER dataset. The results indicate that incorporating KGs as a new modality can effectively reduce hallucinations and improve the factual accuracy of language models, all without the need for external retrieval.

Addressing Hallucinations in Language Models with Knowledge Graph Embeddings as an Additional Modality

TL;DR

Facing hallucinations in LLMs, the paper proposes adding Knowledge Graph (KG) embeddings as an extra modality to grounding outputs. It introduces a Text2Graph mapper that converts text into KG embeddings and an Adapter that injects these embeddings into the LLM without modifying the base model. The WikiEntities dataset, with over 3.2 million texts annotated with Wikidata entities and embeddings, supports training the mapper and adapters. Empirical results on Mistral 7B, LLaMA 2-7B, and LLaMA 3-8B show reduced hallucinations on HaluEval, True-False, and FEVER while maintaining performance on other tasks, and the approach extends to various LLMs without external retrieval.

Abstract

In this paper we present an approach to reduce hallucinations in Large Language Models (LLMs) by incorporating Knowledge Graphs (KGs) as an additional modality. Our method involves transforming input text into a set of KG embeddings and using an adapter to integrate these embeddings into the language model space, without relying on external retrieval processes. To facilitate this, we created WikiEntities, a dataset containing over 3 million Wikipedia texts annotated with entities from Wikidata and their corresponding embeddings from PyTorch-BigGraph. This dataset serves as a valuable resource for training Entity Linking models and adapting the described method to various LLMs using specialized adapters. Our method does not require fine-tuning of the language models themselves; instead, we only train the adapter. This ensures that the model's performance on other tasks is not affected. We trained an adapter for the Mistral 7B, LLaMA 2-7B (chat), and LLaMA 3-8B (instruct) models using this dataset and demonstrated that our approach improves performance on the HaluEval, True-False benchmarks and FEVER dataset. The results indicate that incorporating KGs as a new modality can effectively reduce hallucinations and improve the factual accuracy of language models, all without the need for external retrieval.

Paper Structure

This paper contains 17 sections, 5 figures, 5 tables.

Figures (5)

  • Figure 1: The Proposed Pipeline Scheme. The input text is tokenized into LLM input and forms an additional KG modality by passing through Text2Graph mapper and Adapter, which is added to input sequence.
  • Figure 2: An example of a WikiEntities sample. It contains text with Wikidata entities in it along with their respective positions.
  • Figure 3: Examples of the responses to the Wikipedia-based questions for the Mistral-7B-v0.1 model, both with and without the additional KG modality.
  • Figure 4: The default 8-shot prompt for True-False benchmark.
  • Figure 5: The default 8-shot prompt for FEVER dataset.