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.


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:

{
  "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.4.tar.gz (12.0 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.4-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: verifastscore-0.1.4.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for verifastscore-0.1.4.tar.gz
Algorithm Hash digest
SHA256 314139cff18fe7e780565b19bcf9d7e77890229715ea7a1b3b30ae263c2fe502
MD5 cb9a2870f9f4d1159ab0d35d80daaeec
BLAKE2b-256 5624bca5f5550286d2801ba9efee46bfa0619609665935e8218210dcfed415a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: verifastscore-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for verifastscore-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 79f75733f22b9719a44f96a90f3c676302e9a4739c86f08be08e76368ac1319e
MD5 399e4578688dcf3ace0d07302a9dcddb
BLAKE2b-256 9877a8ee8da79c341e71a456a53823f51b8d9cff3ea60779fbadd01fa7f6d707

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