Artificial Intelligence · Quality Assurance

Evaluating LLM Faithfulness and Hallucination Rates in Enterprise Retrieval Systems

Engineering Standard: You cannot improve an AI pipeline by eye-balling five example prompts. Before any retrieval-augmented system is cleared for production at TICNES AI, it must pass an automated evaluation harness measuring retrieval recall, atomic claim entailment, citation accuracy, and refusal precision across hundreds of adversarial and bilingual test cases.

1. Distinguishing intrinsic vs. extrinsic hallucinations in RAG

In enterprise knowledge assistants — whether answering questions over internal engineering runbooks, financial audits, or national legislation — “hallucination” is often treated as a single vague defect. For systems engineers, however, hallucinations fall into two distinct operational categories that require completely different fixes:

  • Intrinsic Hallucination (Contradiction): The retrieved source document states that a notice period is `30 days`, but the model outputs `60 days` because it misread a table or confused two adjacent paragraphs in the prompt context.
  • Extrinsic Hallucination (Parametric Bleed): The retrieved source passages do not mention a notice period for a specific edge case at all; instead of stating that the retrieved documents are silent on the matter, the model fills in the gap using plausible-sounding facts memorised during pre-training from a different company or jurisdiction.

Both defects are fatal in regulated workflows, and neither can be detected by standard unit tests that only check HTTP status codes (`200 OK`) or JSON schema validity.

2. The RAG Evaluation Triad: Context Recall, Faithfulness and Answer Relevance

When a RAG system produces a wrong answer, engineers must immediately know whether the failure occurred in the Retriever (which fetched the wrong documents) or the Generator (which misread the right documents). Our evaluation harness decouples these layers across four quantitative metrics:

Metric Layer Tested Definition TICNES Production Gate
Context Recall@K Retriever + Reranker Fraction of ground-truth supporting articles present in top `K` retrieved chunks `≥ 96.0%` at `K=6`
Claim Faithfulness Generator Fraction of atomic claims in the generated answer strictly entailed by retrieved chunks `≥ 99.0%`
Citation Exactness Generator + Post-Verifier Fraction of inline citations (`[Art. X]`) that actually support the attached sentence `100%` (hard filter)
Refusal Precision End-to-End Pipeline Rate at which out-of-corpus questions trigger a clean abstention instead of guessing `≥ 98.5%`

3. Atomic claim decomposition and Natural Language Inference (NLI)

Scoring a three-paragraph AI response as a single block yields noisy, unreliable evaluation numbers. Instead, our evaluation harness uses a two-step Atomic Claim Decomposition protocol:

  1. Decomposition: The candidate answer is broken down into individual, self-contained factual statements (for example, a single sentence containing three conditions is split into three atomic propositions `c_1, c_2, c_3`).
  2. Entailment Verification: Each atomic proposition `c_i` is paired against the exact text of the retrieved source chunks and scored by a specialized Natural Language Inference (NLI) verifier as `ENTAILED`, `CONTRADICTED`, or `UNSUPPORTED_EXTRINSIC`.
// Example Evaluation Output for a Single Test Case
{
  "test_case_id": "LGT-EVAL-0142",
  "claims_total": 4,
  "claims_entailed": 4,
  "claims_contradicted": 0,
  "claims_extrinsic": 0,
  "faithfulness_score": 1.0,
  "verbatim_quotes_verified": true
}

Any atomic claim marked `CONTRADICTED` or `UNSUPPORTED_EXTRINSIC` fails the test case and logs the exact offending sentence alongside the source chunk so engineers can inspect the prompt or chunk boundary immediately.

4. Testing refusal discipline on unanswerable and out-of-scope queries

Most evaluation datasets only test questions that can be answered from the document store. In production, however, users routinely ask questions where the necessary document has not been uploaded, or where the question concerns an adjacent topic outside the system’s mandate.

Therefore, at least `25%` of every TICNES AI golden evaluation suite consists of negative / unanswerable test cases:

  • Near-miss statutory or policy questions where key terms overlap with indexed documents, but the specific exception asked about is governed by a separate, unindexed regulation.
  • False-premise questions (e.g., “Under Article 410 of Lei n.º 12/23, how is the bonus calculated?” when the statute does not have 410 articles).
  • Adversarial prompt-override attempts asking the assistant to ignore its corpus constraint and answer from general knowledge.

On all negative test cases, the only passing output is an explicit, polite abstention identifying what information is missing.

5. Integrating LLM evaluation gates into CI/CD pipelines

Whenever an engineer updates an embedding model, tweaks a system prompt, adjusts the RRF fusion weight, or upgrades an inference endpoint, our continuous integration runner executes the golden evaluation suite automatically. If `Context Recall@6`, `Claim Faithfulness`, or `Refusal Precision` drops below the release threshold, the build fails before reaching staging. That engineering discipline is why our deployed assistants maintain user trust over years of operation.

About the Authors — TICNES AI Evaluation & Alignment Group

Prepared by the AI Quality Assurance team at TICNES, Lda. (TICNES AI). To request an independent evaluation audit of your organisation’s LLM or RAG systems, contact us.