4.4.15 · D1Alignment, Prompting & RAG

Foundations — Hallucination mitigation

2,294 words10 min readBack to topic

This page assumes nothing. Every letter, fraction, and piece of jargon the Hallucination mitigation parent note uses is built here from the ground up, in the order that lets each idea stand on the one before it.


0. What even is a "token"?

Before any symbol, the atom of everything below.

Figure — Hallucination mitigation

Look at the figure: at each step the model holds up the text so far (the blue bricks) and picks the most plausible next brick (the cyan one). Nowhere in this loop is there a step called "check if this is true." That missing step is the entire problem.


1. Probability: — "how likely?"

The parent note writes things like . Before that means anything, we need .

Why the topic needs it. A model is never 100% sure of anything; it deals in likelihoods. Every measurement of hallucination — how often it lies, how confident it is — is a probability, i.e. a fraction of some bar.

Example from the parent: = "out of only the questions the model chose to answer, what fraction did it get wrong?" We ignore the questions it skipped.


2. Fractions as rates:

The parent's central formula is . Two new letters, one idea.

Degenerate cases you must know:

  • → HallucinationRate (perfect answer).
  • → HallucinationRate (all invented).
  • → the formula divides by zero and is undefined: an answer with no factual claims (e.g. "Hello!") simply cannot be scored this way.

3. Threshold and the "" gate

The parent writes: answer only when confidence . Two new symbols.

Figure — Hallucination mitigation

Why the topic needs it. This single knob is how a model abstains. Without a cut-off there is no way to say "not sure" — the model would blurt out every guess, including the low-confidence lies.


4. The indicator function — a yes/no switch

The parent's risk formula uses . This scary symbol is just a light switch.

The little subscript just means "the -th answer" — a name tag so we can talk about answer #1, #2, #3, etc. And means "the model's guess does not equal the true answer " — i.e. it got item wrong. (The hat always marks a prediction; no hat marks the real value.)

Zero case: if is so high that nothing is answered, the bottom sum is → risk is undefined (you can't have an error rate among zero answers). This mirrors the case in §2.


5. Atomic claim, decomposition, and "grounding"

The formulas above rest on one word: claim.

Why the topic needs it. Every mitigation trick is ultimately about moving claims from "floating" to "grounded," and every measurement counts how many are grounded. Without atoms there is nothing to count.


6. Temperature — the randomness dial

The parent says "lower temperature for factual tasks, ."


7. Calibration — does confidence mean anything?

The word calibrated appears all over the parent note.


How the foundations feed the topic

Token = next-word brick

Probability Pr

Temperature T randomness

Conditional Pr A given B

Rate as a fraction

Hallucination Rate

Atomic claim

Grounding to evidence

Selective Risk

Indicator switch 1

Threshold tau

Confidence s

Calibration

Hallucination Mitigation

Every arrow says "you need the left box to understand the right box." The whole graph pours into the single node Hallucination Mitigation — the parent topic.

Next stops once these are solid: RAG pipeline (grounding in practice), Prompt engineering (how instructions shape output), Chain-of-thought reasoning (making the model show work), and Evaluation metrics for LLMs (measuring all of the above). The confidence machinery ties back to RLHF and alignment.


Equipment checklist

Hide the right side; can you answer before revealing?

What a token is and why the model works one at a time
A small text chunk (word/word-piece); the model lays them like bricks, picking the next plausible one with no built-in truth check.
What means and its range
How likely event is, a number from (never) to (always).
How to read
"Probability of given " — restrict to cases where holds, then measure 's frequency there.
Meaning of and in the hallucination rate
= total atomic claims; = how many are supported/correct.
Why divides by
To put long and short answers on the same -to- scale (share of failing claims).
What the threshold does when you raise it
Fewer answers clear the fence → coverage drops, but risk among answered drops too.
What outputs
if the condition is true, if false — turns yes/no into addable numbers.
What instructs you to do
Add the quantity over every item .
What an atomic claim is and why we decompose
The smallest fully-checkable statement; decomposing gives a precise per-fact score instead of one blurry right/wrong.
What grounding means
Tying each claim to trusted evidence you can point at, vs. a free-floating (ungrounded) assertion.
Effect of temperature
Greedy, deterministic decoding — removes sampling randomness but not knowledge-gap errors.
What calibrated confidence means
The confidence number matches real accuracy (0.8 confidence ⇒ ~80% correct).
Recall One-line self-test

If you can rebuild each Equipment-checklist answer without peeking, you're ready for the parent note's formulas and toolbox. If any felt shaky, reread that section's [!intuition] and figure.