4.4.15 · D3Alignment, Prompting & RAG

Worked examples — Hallucination mitigation

2,374 words11 min readBack to topic

This page is a drill hall. The parent note Hallucination mitigation gave you the formulas; here we throw every kind of input at them so you never meet a case you haven't already solved by hand.

Before we compute anything, let us name the two number-machines we will use, in plain words, so no symbol appears unearned.

The symbol means "greater than or equal to". later means "probability of". That is the entire vocabulary; everything below is built from it.


The scenario matrix

Every worked example below is tagged with which cell it fills. The matrix is the promise: no cell is left un-shown.

Cell What makes it tricky Example
A. Ordinary case some claims wrong, some right Ex 1
B. Zero numerator () nothing wrong → rate must be Ex 2
C. Full numerator () everything wrong → rate must be Ex 2
D. Degenerate input () no claims at all → division by zero! Ex 3
E. Threshold sweep move across every data point Ex 4
F. Limiting so low nothing is filtered / so high nothing answers Ex 5
G. Ties at the boundary a point sits exactly at Ex 5
H. Voting / self-consistency majority vote, incl. a tie Ex 6
I. Real-world word problem medical cost-of-error picks Ex 7
J. Exam twist faithfulness vs factuality trap Ex 8

Machine 1 examples (HallucinationRate)


Machine 2 examples (Risk & Coverage)

We reuse one dataset for the threshold examples. Study the figure — it is the whole story on one number line.

Figure — Hallucination mitigation

The hard cases: word problem & exam twist


Recall

Recall Every cell in one breath

What does HallucinationRate return when every claim is right? ::: (numerator ). What does it return when every claim is wrong? ::: (). What happens at ? ::: Undefined (); treat an abstention as not-a-hallucination. As , what are Coverage and Risk? ::: Coverage ; Risk raw error rate. As above every , what is Risk? ::: Undefined — nothing answered, no denominator. A point sits exactly at with rule "" — kept or dropped? ::: Kept. A 2–2 vote in self-consistency means? ::: No majority → abstain / sample more. What decides the operating threshold in the medical problem? ::: The cost ratio wrong:abstention, not the risk–coverage curve alone.

Prerequisite threads: RAG pipeline, Model calibration, Chain-of-thought reasoning, Evaluation metrics for LLMs.