AIForum.

How to Test Local AI Answers for Hallucinations and Accuracy

On this page

THE SHORT ANSWER

A local model can check its own answers for hallucinations only when you give it a source to read. This guide covers the grounded-versus-open-world split, a five-step claim-by-claim test protocol, a local NLI metric you can run offline, and the limits that decide whether your numbers mean anything.
Quick facts

You can test a local model’s answer for hallucinations cheaply and automatically — but only when there is a source to check it against. A small local model can read an output alongside the source text and answer, statement by statement, whether the source supports it. That covers summaries, RAG answers, extracted fields, and support replies built from a policy. What it cannot do is tell you whether a statement is true about the world when no source is given, because a small model does not hold enough reliable knowledge for that job. The useful question is therefore not “can it detect hallucinations?” but “do I have the source?” (jev wiki, hallucination detection with a local LLM).

This guide is written for practitioners running models locally who want a repeatable accuracy test rather than a general impression. It assumes you already produce text from a local model — a summary, a RAG answer, an extracted record — and that you want to know how often that text is wrong, and which kind of wrong it is. The protocol below is a design, not a benchmark result: it describes what to measure and how, so that any numbers you produce are yours and are reproducible.

Grounded versus open-world: the split that decides your test design

Two kinds of hallucination look identical in a chat window and require completely different tooling. A grounded hallucination contradicts or invents something relative to a source you supplied. An open-world hallucination is a false claim about reality, with no source in hand.

Grounded (against a source)Open-world (against reality)
ExampleA summary says the meeting moved to Friday; the email says ThursdayAn answer says a law was passed in 2019
What the checker needsThe output and the sourceKnowledge of the world, or a search
A small local modelYes: it is a reading questionNo: it would be guessing
Typical fixRegenerate, or send for reviewRetrieval, a larger model, a human

The distinction matters because a grounded check asks what a text says, while an open-world check asks what is true. The jev wiki reports that the first is the top of every accuracy table it has measured: on 999 test questions, the first jevos was right 0.954 of the time on facts stated in the text. Per-kind numbers for jevos-v4 are not published, so that figure should be read as one model’s result on one dataset, not a general accuracy rate for local models. Open-world checking does not appear in those tables because it is not the job the model is built for — jevos is designed to answer questions about the text it is given, not from memory.

What you need before you start

  • The output to test. A single generated answer, not a whole conversation.
  • The source that should support it. Retrieved chunks, the policy document, the email thread, the record you extracted from. Keep the exact text, not a paraphrase.
  • A way to split the output into atomic claims. One fact per check.
  • A checker. Either a local model with a strict two-label prompt, or a local natural language inference (NLI) model.
  • A threshold and a routing rule. What happens when a claim fails: regenerate, flag for review, or block.

If you intend to compare models or versions, also record the model name, quantization, context length, prompt, sampling settings, and the date. Without those, two runs are not comparable.

Step 1 — Split the answer into atomic claims

A single yes/no judgment over a whole paragraph hides which sentence failed. Take this faithful-looking response from the Future AGI documentation example:

You can cancel your Pro plan anytime from Account Settings > Billing. Cancellation takes effect at the end of your current billing cycle, and you won’t get a refund for the unused time.

That is at least three separate claims: cancellation is available from a named settings path; it takes effect at the end of the billing cycle; no refund is issued for unused time. Each can be supported or unsupported independently. Splitting can be done with a local model prompt, a sentence splitter plus a merge rule, or manually for small regression sets. Manual splitting is the right choice when you are building the first version of the test, because it shows you where your automatic splitter will get it wrong.

Step 2 — Pair each claim with its source

Every check needs an explicit claim-plus-source pair. In a RAG pipeline you already have the retrieved chunks; pass the same chunk that was available to the generator, not a re-retrieved one, or you are testing retrieval twice and generation never. For summaries and extraction tasks, the source is the document section the claim came from.

Log the pair. A failure report that says “claim 3 unsupported” is not actionable; a report that shows the claim next to the passage that should have supported it tells you whether the model invented content, the retriever missed the passage, or the splitter mangled the sentence.

Step 3 — Run the grounded check

The check itself is a reading-comprehension question with a forced two-label answer. A minimal local prompt:

You are checking one statement against one source.

Source:
<<SOURCE>>

Statement:
<<STATEMENT>>

Does the source support the statement?
Answer only "supported" or "not supported".
If the source does not state it, answer "not supported".

Three practical notes. First, force the label and forbid explanation, then parse the raw output yourself — free-text rationales are harder to score reliably. Second, use deterministic sampling settings so repeated runs on the same pair agree. Third, keep the raw model output in your log, because a checker that fails to follow the format is a different problem from a claim that is genuinely unsupported.

Expect two error directions, and decide which one you care about. A false “supported” is a missed hallucination. A false “not supported” is over-flagging, which is common when a claim is a legitimate paraphrase, an arithmetic step, or a date conversion that the source implies but does not spell out. If your use case needs strict verbatim support, say so in the prompt; if it needs entailment, say that instead. The two produce different scores on the same data.

Step 4 — Add a cheap deterministic check for names and numbers

Numbers, dates, prices, identifiers, and proper names are the highest-risk tokens in a generated answer and the cheapest to verify. A regular-expression or string-match pass against the source catches invented figures and renamed entities without any model call at all. The jev wiki treats this as a companion to the grounded model check: a cheap check for invented names and numbers, run alongside the per-statement support question. It will not catch a plausible but wrong causal claim, and the model check will not reliably catch a transposed digit. Running both is more useful than tuning either one.

Step 5 — Score, threshold, and route failures

Define one number you can track over time. The simplest is the supported-claim rate: supported claims divided by total claims, per output. Report it alongside the false-flag rate on a set of known-good outputs, otherwise you can improve the score by making the checker stricter and simply rejecting more correct answers.

Then decide the routing rule before you look at the results. A common pattern is three tiers: all claims supported goes straight through; one or two unsupported claims triggers regeneration with the failing claim highlighted; anything below the threshold goes to a human. The routing rule is where accuracy work turns into an operational decision, so write it down explicitly.

Using an off-the-shelf local metric: faithfulness

If you would rather not maintain your own checker prompt, Future AGI’s ai-evaluation package exposes a metric that does the same job. Its documentation describes faithfulness as checking whether a response is consistent with its retrieved context, with no contradictions allowed, and states that it runs entirely on a local NLI model with no API key required. Install it with the NLI extra:

pip install 'ai-evaluation[nli]'

The [nli] extra installs the local NLI model that faithfulness runs on. Without it, the metric falls back to a less accurate word-overlap heuristic — a fallback that will pass paraphrases and fail on reordered wording, so check which path you are actually on. The documented example, abbreviated:

from fi.evals import evaluate

context = (
    "Pro plan subscriptions can be canceled anytime from Account Settings > Billing. "
    "Cancellation takes effect at the end of the current billing cycle, and no partial "
    "refunds are issued for unused time. Annual plans can be downgraded to monthly "
    "only at renewal, not mid-cycle."
)

result = evaluate(
    "faithfulness",
    output=response,
    context=context,
    input=question,
)
print(f"Faithfulness score : {result.score:.2f}")

Note the division of labour between the two metrics in that documentation. Faithfulness is an NLI-style consistency check: it catches contradictions between the response and the context. Groundedness, which the docs attribute to a Turing model, catches unsourced claims — statements the context never made but also never contradicted. They are complementary, because a response can avoid contradicting the context entirely and still add a fact that was never in it. The quickstart lists account API keys as prerequisites and requires Python 3.11+, while stating that the faithfulness metric itself runs locally without a key; the groundedness metric is the hosted part. Plan your deployment around that split rather than assuming the whole evaluation stack is offline.

Build a small regression set instead of eyeballing outputs

Twenty to a hundred real questions from your own use case, each with the correct source text and a known-good answer, will tell you more than a week of spot-checking. For each run, record the model, quantization, context length, prompt, sampling settings, and date, and report the supported-claim rate plus the false-flag rate. Treat published figures as context, not as a target: the jev wiki’s 0.954 result for the first jevos comes from its own 999-question set on facts stated in the text, and per-kind numbers for jevos-v4 are not published. Your documents, your prompts, and your retrieval will move the number, so the only figure that means anything for your deployment is the one you measured on your own data.

Limits and tradeoffs worth writing down

  • No source, no grounded check. Without a source, a small local model would be guessing, and a confident “supported” verdict would be worthless.
  • Claim splitting is the usual failure point. Compound sentences, pronouns, and implicit references produce claims that cannot be checked in isolation.
  • NLI models are sensitive to paraphrase and negation. The word-overlap fallback is explicitly less accurate, so verify which one is running.
  • Truncation creates false failures. If the evidence for a claim fell outside the context window, the checker will correctly report that the source it saw does not support the claim.
  • Checks cost latency and compute. A yes/no pass per statement is cheap enough to run on every output, but it is not free, and it scales with answer length.
  • Grounded checks do not catch omissions. A summary can be fully supported and still leave out the one detail that mattered.
  • Open-world facts are out of scope. A claim about a law passed in 2019 needs retrieval, a search-capable model, or a person — not a small local checker.

What to do when there is no source

There are three honest options, and the choice is a risk decision rather than a technical one. Add retrieval so that a source exists and the grounded check becomes possible. Use a large model with search, accepting that you have moved the problem to a different system with different failure modes. Or route the question to a person. The jev wiki frames the same choice the same way: retrieval plus a grounded check, a large model with search, or a human. What you should not do is ask a small local model to judge truth from memory and treat the answer as evidence.

A concrete next step

Pick one output type you already generate locally. Collect twenty source/output pairs, split the outputs into atomic claims by hand, and run the two-label grounded check plus the name-and-number pass. Log every failure with the claim and the source passage side by side. That log will usually tell you within an hour whether your accuracy problem lives in the model, in retrieval, or in the prompt — and it gives you the baseline that any later change has to beat. If you run it, share your setup and your failure patterns in the community so others can compare against their own documents instead of against a published number.

FAQ

Can a small local model detect hallucinations on its own?

Only grounded ones. It can read an output and a source and decide whether the source supports each statement, which covers summaries, RAG answers, extracted fields, and policy-based replies. It cannot judge whether a statement is true about the world when no source is provided, because a small model does not hold enough reliable knowledge for that.

Is a per-statement check expensive to run?

The jev wiki describes a yes/no check per statement as cheap enough to run on every output, provided you have the source. Cost still scales with answer length and adds latency, so it is not free, but it is far cheaper than human review of every response.

Does faithfulness catch every kind of hallucination?

No. Per the Future AGI documentation, faithfulness is a local NLI check that catches contradictions with the retrieved context, while groundedness catches unsourced claims. A response can avoid contradicting the context and still introduce a fact the context never contained, which is why the docs recommend combining both metrics.

What should I do if my pipeline has no source text?

Choose one of three options rather than trusting model memory: add retrieval so a source exists and a grounded check becomes possible, use a large model with search, or route the question to a person. The jev wiki frames the same three options.

References

  1. https://github.com/feder-cr/jev/wiki/hallucination-detection-with-a-local-llm
  2. https://docs.futureagi.com/docs/cookbook/quickstart/hallucination-detection/

Related terms

Grounded hallucination
A statement in a model output that contradicts or is unsupported by a source text supplied with the task, such as a summary that changes a meeting day.
Open-world hallucination
A false statement about reality made without any source to check it against, such as claiming a law was passed in a particular year.
Faithfulness
A metric that checks whether a response is consistent with its retrieved context, with no contradictions allowed; Future AGI's implementation runs on a local NLI model.
Groundedness
A complementary metric that catches unsourced claims — statements the context never made, even if it never contradicted them.
NLI (natural language inference)
A model task that classifies whether one text entails, contradicts, or is neutral toward another; used locally to score faithfulness.
Atomic claim
A single checkable fact extracted from a longer answer so that it can be judged supported or unsupported on its own.

Leave a Reply

Your email address will not be published. Required fields are marked *