Skip to main content

Fast, end-to-end factuality evaluation for long-form LLM responses.

Project description

🔍⚡ VeriFastScore

VeriFastScore is a fast and efficient factuality evaluation tool that jointly extracts and verifies fine-grained factual claims from long-form LLM-generated responses, conditioned on evidence collated from google search results retrieved using SERPER API.

This repository packages VeriFastScore as a pip-installable Python package with a command-line interface (verifastscore), simplifying usage and deployment.


Coming soon: Dynamic Batching to further imrpove speedups and add support for multi-GPU usage

Important Links


📦 Installation

VeriFastScore supports both CPU and GPU setups. Please follow the appropriate instructions below:

▶️ CPU Installation [Default]

To install VeriFastScore for CPU-only usage:

pip install verifastscore
python3 -m spacy download en_core_web_sm

▶️ GPU Installation (with FlashAttention) [Recommended]

If you want GPU acceleration with FlashAttention, you must install compatible versions of torch and flash-attn manually before installing verifastscore.

# Install CUDA-enabled PyTorch (adjust for your CUDA version)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

# Install flash-attn (manually, requires build tools and matching CUDA)
pip install flash-attn --no-build-isolation

# Then install verifastscore
pip install verifastscore

# Finally, download the spaCy model
python3 -m spacy download en_core_web_sm

▶️ Development install (local)

git clone https://github.com/rishanthrajendhran/verifastscore.git
cd verifastscore
pip install -e .
python3 -m spacy download en_core_web_sm

🔐 Set Your SERPER API Key

VeriFastScore retrieves external evidence using Serper.dev. You'll need to set your API key in the environment:

💻 Linux/macOS

export SERPER_KEY_PRIVATE="your-key-here"

Add to ~/.bashrc or ~/.zshrc for permanence:

echo 'export SERPER_KEY_PRIVATE="your-key-here"' >> ~/.bashrc
source ~/.bashrc

🪟 Windows CMD

set SERPER_KEY_PRIVATE=your-key-here

🧭 Windows PowerShell

$env:SERPER_KEY_PRIVATE="your-key-here"

🚀 How to Run VeriFastScore

Once installed, use the CLI tool:

verifastscore --input_file responses.jsonl

Or with custom arguments:

verifastscore \
  --input_file responses.jsonl \
  --data_dir ./data \
  --output_dir ./outputs \
  --model_name rishanthrajendhran/VeriFastScore \
  --search_res_num 10

📌 Script Arguments

ArgumentTypeDefaultDescription
--input_filestrrequiredInput file (.jsonl) in --data_dir.
--data_dirstr./dataDirectory for input files.
--output_dirstr./dataWhere to write outputs.
--cache_dirstr./data/cacheDirectory to store SERPER search cache.
--model_namestrrishanthrajendhran/VeriFastScoreHugging Face model name or local path. The default value is the path to the trained VeriFastScore model on HuggingFace. Do not change this path unless you want to test your own model.
--search_res_numint10Evidence snippets per sentence.

📥 Input Format

The input must be a .jsonl file with the following structure:

{
  ["id": "Optional_string_ID"]
  "response": "The capital of France is Paris.",
  [...]
}

Place the file in the --data_dir directory.

A sample input file can be found here


📤 Output

  • ./outputs/evidence_*.jsonl – Response with retrieved evidence
  • ./outputs/model_output/decomposition_verification_*.jsonl – Claim-level factuality labels
  • ./outputs/time/verifastscore_time_*.pkl – Timing breakdown

Example output:

"claim_verification_result": [
  {"claim": "Paris is the capital of France.", "verification_result": "supported"},
  {"claim": "France is in South America.", "verification_result": "unsupported"}
]

Console output will include average VeriFastScore, timing per instance, and per stage.


⚙️ Optional Setup Tools

To prepare the Python environment:

  1. Clone the repository and create the conda environment:
    conda env create -f environment.yml
    conda activate verifastscore
  2. Download spaCy English tokenizer:
    python3 -m spacy download en_core_web_sm
  3. Install PyTorch (choose the version that matches your CUDA setup):
    pip install torch torchvision torchaudio
  4. Install FlashAttention:
    pip install flash-attn --no-build-isolation

📖 Citation


@misc{rajendhran2025verifastscorespeedinglongformfactuality,
      title={VeriFastScore: Speeding up long-form factuality evaluation}, 
      author={Rishanth Rajendhran and Amir Zadeh and Matthew Sarte and Chuan Li and Mohit Iyyer},
      year={2025},
      eprint={2505.16973},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.16973}, 
}

📄 License

This project is licensed under the Apache 2.0 License.

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

verifastscore-0.1.5.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

verifastscore-0.1.5-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file verifastscore-0.1.5.tar.gz.

File metadata

  • Download URL: verifastscore-0.1.5.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for verifastscore-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3492f4eee4ba350329cbc9a0294243558869e31b128e14ad5886334726f01fcf
MD5 25d3d5a3111e7518286c9ab0da9262ee
BLAKE2b-256 9ac41533797447f27e4af2277f37c41ce357019fdc31c42a95c045732fdbee34

See more details on using hashes here.

File details

Details for the file verifastscore-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: verifastscore-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for verifastscore-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 46773cc9100823807ca567d035e24c208167f1ef7e9bb4c8e7ae5f8701eba856
MD5 921ef4b46867ecef53103b3a55c5050b
BLAKE2b-256 ff53b5dc661c0a54b0574dc01e22606756d6c772d525be8d43e76cf6bb9e9e55

See more details on using hashes here.

Supported by

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