Skip to content

Repository files navigation

Detecting Hallucinations

This repository is part of my thesis, titled "Investigating Hallucinations in AI Text Generation Using Semantic Tools", where is presented a refined framework for detecting hallucinations in language models.

Project Description

The project focuses on enhancing the framework for hallucination detection by introducing modifications in the entailment step. Specifically, we replace the Entailment LLM with a fine-tuned Transformer model for Natural Language Inference (NLI). This adjustment aims to improve the accuracy and reliability of hallucination detection in language models.

A diagram showing the steps of the refined framework. Step 2 is highlighted in which we change the LLM Entailment with Transformer Entailmnet.

Installation and Usage

We recommend using a virtual environment, like Conda, to install the necessary packages. We use Python 3.12.5 and Pytorch 12.4.

  1. Clone the repository:

    git clone https://github.com/tassos37000/dah.git
    cd dah
  2. Install Pytorch following the instructions from the official website.

  3. Install the required Python packages:

    pip install -r requirements.txt
  4. Open and execute the notebook:

    jupyter notebook

To use the code, simply run the notebook.

License

This project is licensed under the GPL v3 License.

About

This repository contains the code for my MSc thesis on detecting hallucinations in LLMs by leveraging a semantic entropy framework and optimizing entailment evaluation using lightweight Transformer models. This approach enhances efficiency and scalability while maintaining high accuracy in identifying factually incorrect AI-generated outputs.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages