Skip to main content

An Open-source Factuality Evaluation Demo for LLMs

Project description

OpenFactCheck Logo

An Open-source Factuality Evaluation Demo for LLMs


Release Docs
License: Apache-2.0 Python Version PyPI Latest Release arXiv DOI


OverviewInstallationUsageHuggingFace DemoDocumentation

Overview

OpenFactCheck is an open-source repository designed to facilitate the evaluation and enhancement of factuality in responses generated by large language models (LLMs). This project aims to integrate various fact-checking tools into a unified framework and provide comprehensive evaluation pipelines.

Installation

You can install the package from PyPI using pip:

pip install openfactcheck

Usage

First, you need to initialize the OpenFactCheckConfig object and then the OpenFactCheck object.

from openfactcheck import OpenFactCheck, OpenFactCheckConfig

# Initialize the OpenFactCheck object
config = OpenFactCheckConfig()
ofc = OpenFactCheck(config)

Response Evaluation

You can evaluate a response using the ResponseEvaluator class.

# Evaluate a response
result = ofc.ResponseEvaluator.evaluate(response: str)

LLM Evaluation

We provide FactQA, a dataset of 6480 questions for evaluating LLMs. Onc you have the responses from the LLM, you can evaluate them using the LLMEvaluator class.

# Evaluate an LLM
result = ofc.LLMEvaluator.evaluate(model_name: str,
                                   input_path: str)

Checker Evaluation

We provide FactBench, a dataset of 4507 claims for evaluating fact-checkers. Once you have the responses from the fact-checker, you can evaluate them using the CheckerEvaluator class.

# Evaluate a fact-checker
result = ofc.CheckerEvaluator.evaluate(checker_name: str,
                                       input_path: str)

Cite

If you use OpenFactCheck in your research, please cite the following:

@article{wang2024openfactcheck,
  title        = {OpenFactCheck: A Unified Framework for Factuality Evaluation of LLMs},
  author       = {Wang, Yuxia and Wang, Minghan and Iqbal, Hasan and Georgiev, Georgi and Geng, Jiahui and Nakov, Preslav},
  journal      = {arXiv preprint arXiv:2405.05583},
  year         = {2024}
}

@article{iqbal2024openfactcheck,
  title        = {OpenFactCheck: A Unified Framework for Factuality Evaluation of LLMs},
  author       = {Iqbal, Hasan and Wang, Yuxia and Wang, Minghan and Georgiev, Georgi and Geng, Jiahui and Gurevych, Iryna and Nakov, Preslav},
  journal      = {arXiv preprint arXiv:2408.11832},
  year         = {2024}
}

@software{hasan_iqbal_2024_13358665,
  author       = {Hasan Iqbal},
  title        = {hasaniqbal777/OpenFactCheck: v0.3.0},
  month        = {aug},
  year         = {2024},
  publisher    = {Zenodo},
  version      = {v0.3.0},
  doi          = {10.5281/zenodo.13358665},
  url          = {https://doi.org/10.5281/zenodo.13358665}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openfactcheck-0.3.10rc2.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

openfactcheck-0.3.10rc2-py3-none-any.whl (6.1 MB view details)

Uploaded Python 3

File details

Details for the file openfactcheck-0.3.10rc2.tar.gz.

File metadata

  • Download URL: openfactcheck-0.3.10rc2.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for openfactcheck-0.3.10rc2.tar.gz
Algorithm Hash digest
SHA256 293f33f257205d7964e4d871ed26c85aaa789fe8711cb72586ada443d2da37f8
MD5 ebb4b1b993fa8bc2c11aa5079ace4fc0
BLAKE2b-256 b803d848b974b025e9a6ebd948a5763cd4f6e5df68335d0fc43c5ba3c0b0c559

See more details on using hashes here.

File details

Details for the file openfactcheck-0.3.10rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for openfactcheck-0.3.10rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 e36d6450ba6e7e5608edb470710e698321d36b40cd628dee37fd631d2927df7f
MD5 8584aef33e2892524b126c11dd0301a1
BLAKE2b-256 9b3bdad3bb886e056df4be05db76ef1c0ac616b810ecbf92d8612c102c12ff2c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page