█

AI/TLDR

LLM-as-a-Verifier

Fine-grained agent feedback read from the logprob distribution, not a single score token

Evaluation & Red-TeamingOpen source
Language
Python
License
MIT
$pip install llm-verifier

Overview

LLM-as-a-Verifier is a general-purpose framework for getting fine-grained feedback out of a judge model. The usual LLM-as-a-judge setup asks for a score and reads back whichever token the model sampled, which throws away almost everything the model knew. This project keeps that information: it uses a fine-grained scoring granularity, takes the expectation over the full logprob distribution of the score tokens rather than the argmax, and scales quality by repeating the evaluation and decomposing the rubric into separate criteria.

Overview diagram of LLM-as-a-Verifier: an LLM scores an agent's trajectory to produce fine-grained feedback
How LLM-as-a-Verifier sits around an agent runLLM-as-a-Verifier README ↗

What comes out is a continuous reward rather than a verdict, which makes it usable in three places at once: test-time scaling (pick the best of N candidate answers or trajectories), progress tracking (watch a long-horizon agent's trajectory score move), and reinforcement learning (use the verifier's output as the reward signal). The API is deliberately small — `select` picks the best candidate given a problem and a criteria dict, and `compare` exposes the raw pairwise rewards underneath it.

The project reports state-of-the-art results across agentic benchmarks including Terminal-Bench, SWE-Bench Verified, MedAgentBench and RoboRewardBench, and documents the method in an accompanying paper. Version 0.2.0 added a prefix-cache optimisation the project measures at roughly 3.4× fewer uncached input tokens on trajectory-heavy benchmarks, a `deepseek-v4-flash` verifier backend, a Terminal-Bench 2.1 self-verification benchmark and token accounting. It runs against a hosted API or any OpenAI-compatible server that returns logprobs, including a local vLLM.

What it does

Diagram of the Probabilistic Pivot Tournament that picks the best of N candidate trajectories
Probabilistic Pivot Tournament for best-of-N selectionLLM-as-a-Verifier README ↗
  • Scores taken as the expectation over the full logprob distribution of score tokens, not the sampled token
  • Criteria decomposition and repeated evaluation to scale feedback quality
  • Best-of-N candidate selection via select(), with the underlying pairwise rewards exposed through compare()
  • Works as a reward signal for reinforcement learning as well as for test-time scaling and progress tracking
  • Modality-agnostic and agent-agnostic — one verification framework across benchmarks rather than a per-task harness
  • Runs against hosted APIs or any OpenAI-compatible logprob-returning server, including a local vLLM

Getting started

Install the package and point it at a model that returns logprobs — either a hosted key in .env, or a local OpenAI-compatible server.

Install

Published on PyPI as llm-verifier; an editable install from a clone works for development.

bashbash
pip install llm-verifier

# or, from a clone:
pip install -e .

Point it at a model

Set DEEPSEEK_API_KEY or VERTEX_API_KEY in .env, or serve a local model that returns logprobs and set the base URL.

bashbash
vllm serve Qwen/Qwen3.5-9B
export OPENAI_BASE_URL=http://localhost:8000/v1

Run a best-of-N selection

select() takes the problem, the candidate answers and a criteria dict, and returns the winning index alongside continuous scores for every candidate.

pythonpython
import llm_verifier

problem = "Write a function that reverses a string."
candidates = [
    "def rev(s): return s[::-1]", "def rev(s): return s", "def rev(s): return ''.join(sorted(s))",
]

result = llm_verifier.select(
    problem=problem,
    candidates=candidates,
    criteria={"Correctness": "Does the code actually reverse the string?"},
)
print(result.index)   # index of the best candidate: 0
print(result.scores)  # candidate scores: [0.73104, 0.38446, 0.38449]

Get raw pairwise rewards

select() is built on a pairwise reward model; compare() returns the fine-grained rewards for a single comparison directly.

pythonpython
reward_a, reward_b = llm_verifier.compare(...)
Progress curves for two pytorch-model-cli runs scored by the verifier
What the progress script plots: verifier scores over two pytorch-model-cli runsLLM-as-a-Verifier README ↗

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Reach for it when a binary pass/fail judge is too coarse to rank near-identical agent trajectories
  • Reach for it to add test-time scaling: sample N candidate answers and pick the one the verifier scores highest
  • Reach for it as the reward model in an RL loop, where a continuous signal trains better than a thresholded one
  • Reach for it to track whether a long-horizon agent is actually making progress rather than only whether it finished

How LLM-as-a-Verifier compares

LLM-as-a-Verifier alongside other open-source evaluation & red-teaming tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Strix★ 72.3kStrix runs autonomous AI agents that act like hackers, dynamically running your code to find vulnerabilities and validate them with real proof-of-concepts.
iFixAi★ 35.9kAn agent auditor that runs up to 60 inspections across fabrication, manipulation, deception, unpredictability and opacity, and returns an A–F grade judged by a model from a different vendor.
promptfoo★ 26.5kA developer-first CLI and library for testing and comparing prompts and models, with red-teaming probes for prompt injection, PII leaks, and other vulnerabilities.
OpenAI Evals★ 19.7kA framework and open registry for building and running evaluations of LLMs and LLM-based systems, including prompt chains and tool-using agents.
DeepEval★ 19.1kAn open-source Python framework that tests LLM apps like unit tests, with 50+ metrics for RAG, agents, chatbots, and safety, and a Pytest integration for CI/CD.
Ragas★ 16.2kAn evaluation toolkit focused on retrieval-augmented generation that scores answer faithfulness, context precision/recall, and relevancy, often without needing ground-truth labels.
Arize Phoenix★ 12kAn open-source observability and evaluation tool for tracing LLM and agent behavior, running evals on traces, and troubleshooting issues in development and production.
LLM-as-a-Verifier★ 3.3kFine-grained agent feedback read from the logprob distribution, not a single score token