Code for reproducing semantic uncertainty research paper experiments
Top 80.8% on sourcepulse
This repository provides code to reproduce experiments on detecting hallucinations in Large Language Models (LLMs) using semantic entropy. It targets researchers and practitioners working with LLMs who need to evaluate and mitigate model-generated inaccuracies. The primary benefit is a reproducible framework for quantifying and identifying LLM hallucinations.
How It Works
The project implements a semantic entropy metric to measure uncertainty in LLM outputs. It samples responses and their likelihoods/hidden states from various LLMs across different datasets. Uncertainty measures are then computed from these outputs, followed by an analysis of aggregate performance metrics. This approach allows for a quantitative assessment of an LLM's tendency to "hallucinate" or generate factually incorrect information.
Quick Start & Requirements
conda env update -f environment.yaml
followed by conda activate semantic_uncertainty
.float16
or int8
precision can reduce memory needs.Highlighted Details
Maintenance & Community
The repository builds upon a previous, now deprecated, codebase. No specific community channels or active maintenance signals are mentioned in the README.
Licensing & Compatibility
The repository's license is not explicitly stated in the README. Compatibility with commercial or closed-source projects is not discussed.
Limitations & Caveats
The project relies heavily on specific versions of Python and PyTorch, and the README advises against using the exact environment export. Reproducing sentence-length experiments requires using the OpenAI API, incurring costs. Manual data download is required for the BioASQ dataset.
1 year ago
Inactive