Long-form factuality assessor for large language models
Repo IBM/FactReasoner, read from GitHub 23 h ago. IBM has not joined Take My Repo.
IBM/FactReasoner is a public repo on GitHub by IBM. Long-form factuality assessor for large language models. It declares the Apache-2.0 license on GitHub. It is written mainly in Python, has 45 stars and last changed on 2026-11-23. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-23.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
A probabilistic factuality assessment framework for Large Language Models (LLMs). FactReasoner provides fine-grained factuality evaluation by decomposing LLM responses into atomic claims and verifying them against external knowledge sources using probabilistic reasoning.
Large Language Models (LLMs) have demonstrated remarkable capabilities in generating human-like text, yet they frequently produce factually incorrect information—a phenomenon known as "hallucination." Assessing the factuality of long-form text generations is particularly challenging because these responses may contain numerous informative statements, and validating each piece of information against reliable sources is time-consuming, costly, and error-prone.
FactReasoner is a novel factuality assessment framework that leverages probabilistic reasoning to evaluate the factual correctness of LLM-generated responses. Unlike traditional binary classification approaches, FactReasoner provides calibrated probability estimates for each claim, enabling nuanced uncertainty quantification.
Given a long-form text y generated by an LLM in response to a query x, we assume that y consists of n atomic units (or atoms) that can be either true or false, denoted as A_y = {a_1, a_2, ..., a_n}. An atomic unit is defined as a short sentence conveying one piece of information.
Given an external knowledge source C (e.g., Wikipedia, the Web, or a document collection), an atomic unit a_i is considered supported if there exists at least one piece of information (a context) in C that undeniably supports a_i. Otherwise, the atomic unit is not supported.
FactReasoner computes several factuality metrics:
Factual Precision - The proportion of supported atoms in the response:
Precision(y) = S(y) / |A_y|
where S(y) is the number of supported atomic units.
Factual Recall at K - Measures recall up to K supported atoms:
R_K(y) = min(S(y) / K, 1)
F1@K Score - Combines precision and recall:
F1@K(y) = 2 * Precision(y) * R_K(y) / (Precision(y) + R_K(y))
Entropy-based Measure - A novel metric leveraging posterior probabilities:
E(y) = (1/n) * Σ -P(a_i) * log(P(a_i))
When all atoms have posterior probability P(a_i) = 0.5 (undecided), E(y) ≈ 0.15. When all atoms are true with certainty (P(a_i) = 1), E(y) = 0. Lower entropy indicates higher factual confidence.
FactReasoner addresses hallucination detection through a principled five-stage pipeline:
Atomic Decomposition (Atomizer): The LLM response is decomposed into minimal, verifiable claims (atoms) using few-shot prompting. Each atom represents a single piece of information that can be independently verified.
Decontextualization (Reviser): Atoms are revised to be standalone by resolving pronouns (e.g., "he", "she", "it"), demonstrative references (e.g., "this", "that"), unknown entities, and incomplete names. This ensures each atom can be verified without additional context.
Steps 1 and 2 can instead run as one call to a fine-tuned atomizer-reviser LoRA adapter for granite-4.2-8b, which returns the response's atoms already decontextualized (see LoRA adapters).
Context Retrieval (SourceRetriever): For each atom, relevant evidence is gathered from external knowledge sources. FactReasoner supports multiple retrieval backends:
NLI-based Verification (NLI Extractor): Natural Language Inference (NLI) is used to determine the relationship between each atom and its retrieved contexts:
Each relationship carries a probability that becomes the strength of the corresponding edge in the Markov Network. Two methods are available for estimating it (--nli-method):
logprobs (default): derived from the token logprobs of the generated label. Requires a logprobs-capable backend (RITS / vLLM / OpenAI / Ollama).simbauq: estimated via SIMBA-UQ self-consistency (sampling across temperatures and scoring by consensus). Backend-agnostic — required for Claude via Anthropic's OpenAI-compatible endpoint, which does not expose logprobs. No extra install needed.Two prompts are available for the base model (--nli-prompt):
few_shot (default): the model reasons step by step before giving its label. Most accurate; the reasoning is most of an NLI call's latency.label_only: the same label definitions and examples, but the model answers with the label alone (capped at 16 tokens). About 3× faster end to end, for a small accuracy cost — see Performance.The relations can also be predicted by a fine-tuned NLI LoRA adapter for granite-4.2-8b in place of either prompt; both probability methods work with it unchanged (see LoRA adapters).
Or by a decision model such as kev, served by Ollama, which scores each relation directly instead of generating text (see Decision models).
The number of NLI calls is the dominant cost of a run; --nli-mode fast (the default) reduces it — see NLI cost control.
Probabilistic Reasoning (Evaluator): A Markov Network (undirected graphical model) is constructed where:
The Merlin inference engine performs belief propagation to compute posterior marginal probabilities P(a_i) for each atom, determining whether it is supported by the retrieved evidence.
FactReasoner supports three graph configurations, based on how atom-context
relationships are modeled, each selected with --pipeline-version:
| Version | Flag | Relationships | Description |
|---|---|---|---|
| FR1 | v1 |
Atom ↔ Own Contexts | Each atom is connected only to its k retrieved contexts. Simplest model with localized reasoning. |
| FR2 | v2 (default) |
Atom ↔ All Contexts | Duplicate contexts are removed, and each atom is connected to all m unique contexts. Enables cross-atom evidence sharing. |
| FR3 | v3 |
FR2 + Context ↔ Context | Adds context-to-context relationships, allowing the model to reason about consistency between different evidence sources. |
The version fixes the graph shape. How many NLI candidate pairs are scored
within that shape is an independent axis, chosen by
--nli-mode — so any version can be run cheaply
without changing the network structure.
Traditional factuality methods (like FactScore) make independent binary decisions for each atom. FactReasoner's probabilistic approach offers several advantages:
"openai" backend kind, with no provider-specific SDKgranite-4.2-8b adapters for one-shot atomization + decontextualization and for NLI, served by vLLM next to the base modeluv pip install fact_reasoner
The default install is self-contained: the Ollama backend (via mellea), the
Google / Wikipedia retrievers, SIMBA-UQ NLI uncertainty estimation, and the embedding
similarity gate behind --nli-mode fast. The only optional extra is telemetry:
uv pip install "fact_reasoner[telemetry]" # OpenTelemetry exporters (see Telemetry)
Note on vLLM. There is no
vllmextra. The local vLLM server is launched as an externalvllm serveprocess and never imported, sovllmis not a dependency of this project: declaring it pinned its whole dependency tree intouv.lock, and every vllm release capssetuptools < 81, below the fix for CVE-2026-59890. On the GPU node, install it yourself:pip install "vllm>=0.28" # 0.28.0 patches vllm's own known advisories
Note on ChromaDB. The
--service-type chromadbbackend is still supported, butchromadbis not a dependency of this project and there is nochromaextra. Every release up to and including 1.5.9 — the latest on PyPI — carries unpatched critical advisories: CVE-2026-45829 (pre-authentication code injection) and CVE-2026-45833 (code injection). No patched release exists, and an optional extra would not help:uv lockpins every extra, so declaring it at all writes a vulnerable version intouv.lock.The other retrievers (
wikipedia,ntrs) need no extra install. If you do want the ChromaDB backend, install it yourself and accept that risk:pip install chromadb
--service-type chromadbraises anImportErrornaming these CVEs if it is missing.
git clone https://github.com/IBM/FactReasoner
cd FactReasoner
uv sync
. .venv/bin/activate # To activate the virtual environment
The RITS backends need mellea-ibm, an IBM-internal package that is not published
to PyPI and is deliberately not a dependency or extra of this project (that would
make uv lock require access to github.ibm.com). Install it separately from its
git source (requires access):
pip install "git+ssh://git@github.ibm.com/generative-computing/mellea-ibm.git"
| Backend / feature | Install | Notes |
|---|---|---|
| Ollama (local) | default | Works out of the box via mellea. |
| vLLM client | default | OpenAI-compatible client via mellea; needs a running server. |
| vLLM local server | pip install "vllm>=0.28" on the GPU node |
Started via fact-reasoner --backend vllm --model ...; vllm runs as an external process. |
| OpenAI / Claude | default | Hosted frontier models via mellea's OpenAIBackend. No extra dependency — Claude is reached over Anthropic's OpenAI-compatible endpoint, so the anthropic SDK is not required. Needs OPENAI_API_KEY. |
| RITS (IBM) | mellea-ibm git install (see Internal IBM Usage) |
IBM internal. |
| Atomizer / NLI LoRA adapters | vLLM --enable-lora |
Fine-tuned granite-4.2-8b stages; see LoRA adapters. |
| Telemetry | [telemetry] |
OpenTelemetry traces and metrics; see Telemetry. |
FactReasoner requires:
Merlin - C++ probabilistic inference engine (must be compiled locally)IBM/FactReasoner is a public repo on GitHub by IBM. Long-form factuality assessor for large language models.
It declares the Apache-2.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-23. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run FactReasoner. What is known comes from GitHub. It declares the Apache-2.0 license on GitHub. Its last change was on 2026-11-23. It has 45 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.