TecnoStack
Start a projectالعربية
One claim in an answer is traced to the passage it cites, with support still to be checked.
AI engineering

To evaluate LLM hallucinations, test your application on real questions with agreed reference answers, check each claim against its sources, score retrieval and answers separately, and read the results slice by slice.

In this article

Silent video with on-screen text. The transcript below repeats every screen and describes what it shows.

Watch on the video page

  1. 0:00–0:06

    Start from a real question • Support ticket • Test set • Case A

    Case A sits in a fixed badge that never moves through the film. A blank ticket card sits in the Support ticket source. A cyan route draws to an empty slot in the Test set frame, the ticket travels along it into the slot, and the slot is outlined: Case A has joined the test set. No answer is shown.

  2. 0:06–0:12

    Agree what it should do • Reference answer agreed • Case A • Real questions • Required passage • Should answer • Should decline

    The answer-or-decline figure shows Real questions: one leads to a Required passage and the tag Should answer, the other to an empty dashed document and the tag Should decline. A small cyan marker rides the answer lane from the first question into the document, where the required passage is outlined, then stops beside Should answer, which is outlined. The decline lane stays visible as the alternative. Reference answer agreed appears: an expectation written before any run, not a result.

  3. 0:12–0:18

    Label it twice, separately • Reviewer 1 • Reviewer 2 • Labelling guide • Case A

    Reviewer 1 and Reviewer 2 slide in from opposite sides, and each draws a line to its own empty label slot. A dashed route then runs from the gap between the two slots back to the Labelling guide. Both slots stay empty; no label value appears.

  4. 0:18–0:24

    Check retrieval and the claim apart • Two separate checks • Case A • Retrieval • Generation • Passage found? • Claim supported?

    The figure shows Retrieval feeding Generation, each with its own open ring: Passage found? and Claim supported?. A cyan trace runs from Retrieval to the Passage found? ring, which is outlined; a second trace then runs from Generation to the Claim supported? ring. Neither ring fills and no score appears. Two separate checks appears.

  5. 0:24–0:30

    Read it in its slice • Arabic numeric questions • Count beside each rate • Case A

    A slice column headed Arabic numeric questions slides in under the Case A badge beside a second, unlabelled column, and its outline turns cyan. Each column holds an empty rate slot with an empty count slot beside it. Count beside each rate appears and both count slots are outlined; no numbers, rates or bars appear. The final state holds to the end.

To evaluate LLM hallucinations, run your application on real user questions whose correct, source-backed answers your reviewers agreed in advance. Check every claim against the passage it cites, score retrieval and answer generation separately, and report each result by language, question type and user role. A single average hides the failures that hurt particular users.

This guide covers the measuring side: what to label, how to build and label a test set, which metrics to compute and how far to trust a model grader. Release decisions, alerts and rollback are a separate job, covered in our guide to monitoring hallucinations in production.

A hallucination is any content your system states as fact without evidence to back it. NIST's Generative AI Profile (NIST AI 600-1, July 2024) calls the risk confabulation: confidently stated but erroneous or false content. For an assistant that answers from your documents, split that risk into labels a reviewer can apply to one answer at a time:

LabelWhat the reviewer seesWhere to look first
Unsupported claimThe answer says something its cited passages do not say, even if it happens to be trueInstructions, context order, model
Wrong answerThe answer contradicts the reference answer or the sourceRetrieval, then generation
Misattributed citationThe claim may be right, but the cited passage does not support itCitation handling, chunking
Answered instead of decliningNo passage the user may see covers the question, yet the system answersDecline instructions, access filters

The last column is our usual starting point for diagnosis; your system may fail somewhere else.

Correct and supported are separate properties. A model can repeat a true fact from its training data that your approved documents never mention. In a policy assistant that is still a failure, because nobody on your team can trace the statement or update it when the policy changes. Write the labels down, with an example for each, before anyone scores an answer.

Build the LLM evaluation test set from questions people will ask. Search logs, support tickets, emails to the team that owns the documents and short interviews with future users all work; prompts your developers invent are a poor substitute. Remove personal data before a case enters the set.

Ordinary traffic underrepresents the cases that break assistants, so add them on purpose:

  • questions no available document answers, where the right behaviour is to decline;
  • answers that sit in a table, a scanned PDF or across two documents;
  • the same question from users with different permissions, to test restricted content;
  • spelling variants, abbreviations and questions that mix Arabic and English.

Write the questions in each language the way a native speaker types them, instead of translating one set. Include an Arabic question whose answer lives in an English document, and check the citation in that case too. Our guide to how RAG cites its sources explains why cross-language retrieval needs cases of its own.

No set size suits every team. You need enough cases in each slice you care about to notice a difference that would change a decision. Start with a modest set labelled with care and add a case for every failure you find. Give the set a version number, record which document version each reference answer came from, and hold back a portion that nobody tunes prompts against.

Two real questions: one leads to a required passage and should be answered; the other has no covering document and should be declined.

Each test case records in advance whether the system should answer from a required passage or decline because no available document covers the question. The questions are illustrative, and no answer has been scored.

A written labelling guide is what makes two careful reviewers reach the same verdict on the same answer. For each test case, record:

  1. the question, the user's role and the language;
  2. the reference answer and acceptable variations;
  3. the passages a correct answer must rely on, with document versions;
  4. whether the system should answer or decline;
  5. any wording that would be harmful even if accurate.

Settle the awkward cases before labelling starts: whether a partial answer passes, whether a missing citation fails an otherwise correct answer, and what to do with an answer that is right but too long to use. Then ask two reviewers to label the same sample independently and compare. Each disagreement points to an ambiguity in the guide, the source document or the domain knowledge required. Resolve it with a domain expert, tighten the rule and relabel where needed. Someone from finance should own the expense-policy cases; a lawyer should own the contract clauses.

Track retrieval and answer quality as separate RAG evaluation metrics, because a hallucination can start in either stage or in the source document itself. The Ragas paper (Es et al., September 2023) draws the same line: it scores whether retrieval finds relevant passages and whether the model uses them faithfully. Define the denominator of every metric before you report it:

MetricQuestion it answersHow to compute it
Retrieval coverageDid the required passages reach the model?Required passages returned ÷ all required passages, answerable cases only
Supported-claim rateIs each factual claim backed by a cited passage?Supported claims ÷ all factual claims checked
Fully supported answersHow many answers can a user trust whole?Answers with every claim supported ÷ answers checked
Citation accuracyDoes each citation support the sentence it is attached to?Supporting citations ÷ all citations
CorrectnessDoes the answer agree with the reference?Answers matching the reference ÷ answerable cases
Decline accuracyDoes the system decline when it should and answer when it can?Report unanswerable and answerable cases separately

Report the supported-claim rate next to the share of fully supported answers. A high claim-level rate can coexist with many answers that are partly unsupported.

Read the metrics together to locate the fault. If retrieval missed the passage, no prompt change will produce the missing evidence: review query construction, chunking, metadata, access filters and search settings. If retrieval found it and the answer still drifted, look at the instructions, the order of the context or the model. Keep cheap automatic checks wherever they apply: cited passage IDs exist, the output matches the expected format, and quoted numbers and units match the source.

These metrics assume your application records, on every run, the retrieved passage IDs, the prompt version and the model version. If you are still designing that layer, start from a reference architecture for adding an LLM to a legacy app.

Retrieval and generation each have their own open checkpoint: whether the passage was found, and whether the claim is supported.

Score retrieval and generation at separate points. A missing passage points to retrieval; a drifting claim with the passage present points to the instructions, the context order or the model. Both checks here are open and show no scores.

A model grader can speed up scoring once you have measured its errors against your human labels. In the MT-Bench and Chatbot Arena study (Zheng et al., NeurIPS 2023), strong judge models agreed with human preferences more than 80% of the time on open-ended chat questions, and the authors documented position, verbosity and self-enhancement biases. That result comes from a general chat benchmark. It tells you nothing yet about how well a grader judges support in Arabic answers about your company's policies.

Calibrate the grader on your own data:

  • Run it on cases your reviewers have already labelled, and compare verdicts label by label and language by language.
  • Read every disagreement. A grader that matches your reviewers in English may not match them in Arabic.
  • Version the grader's prompt and model like any other component, and recheck them on the labelled sample whenever either changes.

Skip that recheck and you cannot tell whether a score moved because the system changed or because the ruler did.

Report each metric per slice, with the case count beside each rate. Useful slices include language (Arabic, English and mixed), question type (lookup, comparison, multi-step and numeric), document format, user role and how recently the source changed. A system can look acceptable overall and still fail numeric questions in Arabic, which may be the slice your finance team relies on most. NIST's Generative AI Profile lists performance disparities between languages and sub-groups among generative AI risks, one more reason to report each language on its own.

Small slices are noisy. When a difference rests on a handful of cases, add cases before you conclude anything. When comparing models, keep the test set and grader fixed and change one thing at a time. We apply the same discipline when we work out which Arabic model fits which job.

NIST describes its AI Risk Management Framework as guidance for voluntary use. It carries no certification and no legal force. It organises risk work into four functions: Govern, Map, Measure and Manage. The method above is mostly Measure work, and it depends on Map, because you can choose failure labels and slices only once you understand the system's context, users and possible harms.

NIST released AI RMF 1.0 in January 2023 and the Generative AI Profile (NIST AI 600-1) on 26 July 2024. As of October 2026, NIST's framework page says AI RMF 1.0 is being revised, so check the current version before you map your controls to it. Neither document certifies a system as safe or free of false content. The recommendations in this guide are TecnoStack's practical advice, not NIST requirements.

  1. The failure labels are written down, each with an example.
  2. The test set comes from real questions, includes cases to decline and covers each language natively.
  3. Every case records its reference answer, required passages and document versions.
  4. Two reviewers labelled a shared sample, and their disagreements changed the guide.
  5. Retrieval and answer metrics are reported separately, each with a stated denominator.
  6. Any model grader was checked against human labels in each language.
  7. Every rate appears per slice with its case count.
  8. Each run records the versions of the test set, grader, prompt and model.

If you are planning an assistant, a search tool or an agent and want the labels, metrics and slices defined before launch, talk to us about building AI into your product.

All sources were accessed on 21 October 2026.

Discuss your website, store, app or AI project in Arabic or English. We agree the scope before work starts.

Book a free scoping callCompare services and prices