CS 8803-LLM · Session 21

Knowing What the Model Knows

Every answer an LLM gives arrives dressed the same way — fluent, complete, delivered without a flicker of hesitation — whether the model is certain or is essentially guessing. Two different failures hide behind that uniform confidence: the model may not know that it does not know, and it may not know what you actually meant. Fixing both starts from the same question — what would it take for the model to tell you, honestly, before you find out the hard way?

Prerequisites: a language model's output layer is a softmax over the vocabulary, so every prediction already comes with a probability attached + entropy H[p] = −∑ p·log(p) measures how spread out, i.e. how uncertain, a probability distribution is, in bits. Everything else is built here.
10
Chapters
4
Simulations
0
Assumed Knowledge

Chapter 0: The Cost of Confident Wrongness

You deploy an assistant to answer questions about your company's policies. Someone types: “What's our refund policy for a locked account?” The assistant answers immediately, in a clean, confident paragraph, citing a specific number of days and a specific process. It sounds exactly like every other answer it has ever given you. There is just one problem: no such policy exists. The model has not looked anything up — it has pattern-matched “refund policy question” to the shape of a thousand refund policies it saw during training and produced a plausible-sounding one. Nothing about its tone, its fluency, or its formatting gives this away. A fabricated answer and a correct one are, to the reader, visually identical.

Now a second scenario, a different failure. A developer types: “Clean up this script.” The assistant reformats the whitespace, renames two variables, and returns the file. The developer actually meant “remove the three functions we no longer call and add error handling around the file I/O.” The model did not misunderstand out of incompetence — “clean up” genuinely admits several readings, and the model silently picked one, the same way it would pick any other token: by probability mass, not by asking. It did not fabricate anything. It solved a task. Just not the task the developer had in mind.

Two failures, one shared shape

Look at what these two scenarios have in common, because it is easy to file them under different bug reports and miss the connection. In both cases, the system had more than one thing it could have done — state a policy or say “I don't actually know our refund policy,” interpret “clean up” one way or ask which way — and it silently committed to a single confident-looking output rather than surfacing the choice. The fabricated-policy case is a problem of calibration: the model's internal sense of how likely its own answer is to be correct does not track reality. The ambiguous-request case is a problem of disambiguation: the model had no way to know which of several equally legitimate interpretations of the request was the one that mattered, and never asked.

These are not the same bug, and this session treats them as genuinely separate problems with separate mathematics — Chapters 1–2 dig into calibration, Chapters 3–5 into disambiguation. But they converge on the same operational question, which is why one session covers both: given that a model can be wrong, or can be right about the wrong thing, when should a deployed system answer immediately, when should it ask a clarifying question first, and when should it refuse to answer at all and hand the problem to something more capable? Chapters 6–8 build the machinery that answers that question, and it needs both halves of this chapter to work.

Why this isn't a rare edge case

It is tempting to think of hallucination and ambiguity as things that happen occasionally, at the margins, to unusually tricky prompts. The two papers this session is built on argue the opposite: both are treating this as the default condition of real deployment, not an exception to it. The paper behind Chapters 3–5, Active Task Disambiguation with LLMs (Kobalczyk, Astorga, Liu, and van der Schaar, University of Cambridge, submitted February 2025), opens by naming the specific settings where getting this wrong is expensive: “such behaviors may be especially harmful in safety-critical applications, such as medical diagnosis or treatment decisions, where erroneous answers pose significant risks.” The paper behind Chapters 6–7, Learning to Route LLMs with Confidence Tokens (Chuang, Sarma, Gopalan, Boccio, Bolouki, Hu, and Zhou, Rice University and Apple, first posted October 2024), opens from the deployment side of the same coin: “as LLMs are given more agency in settings of increasing consequence, it becomes crucial to know when an output is reliable.”

Put those two sentences together and you get this session's actual thesis. A model that is occasionally wrong is manageable, as long as it knows when. A model that is occasionally asked something ambiguous is manageable, as long as it knows to check. The failure mode that actually hurts people is not being wrong — it is being wrong, or answering the wrong question, with full apparent confidence, leaving the human on the other end with no signal that anything needs a second look.

A hypothetical, worked through, to feel the stakes

Suppose — purely as an illustrative exercise, not a number from either paper — a support assistant handles 10,000 tickets a week, and 4% of its confidently-delivered answers are actually wrong (a plausible enough miscalibration rate; Chapter 1 will show you how such a rate gets measured, and Chapter 2's real data will show baseline LLM confidence scores that are considerably worse-calibrated than this). If a wrong, confidently-delivered answer takes a human 20 minutes to notice, diagnose, and fix — because nothing flagged it as suspicious — the weekly cost is:

10,000 × 4% × 20 min = 400 tickets × 20 min = 8,000 minutes ≈ 133 hours/week of unflagged rework

Compare that to a system that knows which 4% it is unsure about and flags them for review before a human ever sees the answer. The review itself still costs time, but it costs far less than silent, undetected failure, because a flagged answer gets checked before it causes downstream damage rather than after. The entire value of calibration and disambiguation, in one sentence: it is not about making the model right more often, it is about making the model's confidence trustworthy enough that wrongness stops being invisible.

The misconception worth killing early. “Just use a better model.” A more capable model lowers the wrong-answer rate, which helps — but it does not, by itself, make the model tell you which answers to double-check. A very capable model that is also uniformly, unwaveringly confident is arguably more dangerous than a weaker one, because people trust it more and verify it less. Capability and calibration are different axes, and this session is entirely about the second one.

How that cost scales as the miscalibration rate changes

Push the same illustrative arithmetic one step further, because the relationship between miscalibration rate and rework cost is not an intuition you should take on faith — it is a straight multiplication, and it is worth seeing scale. Hold everything else from the hypothetical fixed — 10,000 tickets a week, 20 minutes of unflagged rework per silently-wrong answer — and vary only the fraction of confidently-delivered answers that turn out to be wrong:

Miscalibration rateWrong, unflagged tickets/weekRework hours/week
2%200200×20÷60 ≈ 67 hours
4% (the case above)400400×20÷60 ≈ 133 hours
10%1,0001,000×20÷60 ≈ 333 hours

Nothing exotic here — the relationship is exactly linear, because every wrong ticket costs the same fixed 20 minutes regardless of how many other tickets are also wrong. The point worth taking away is a comparison, not the arithmetic itself: Chapter 2 will show real, measured miscalibration numbers for off-the-shelf confidence signals sitting well above 10% — meaning the 333-hour row, not the 67-hour row, is closer to the realistic baseline a naive deployment would actually see before any of this session's fixes are applied.

What this session builds, in order

Four stops, each building on the last. First, calibration from the ground up: what it means for a probability to be trustworthy, and how to measure — by hand, on a toy example — exactly how untrustworthy a model's stated confidence currently is (Chapters 1–2). Second, the ambiguity problem, formalized: what it precisely means for a request to admit more than one valid answer, and how to reason about which follow-up question best resolves that (Chapters 3–5). Third, a mechanism that trains a model to emit a genuine, learned confidence signal instead of relying on its raw, poorly-calibrated output probabilities (Chapters 6–7). Fourth, the payoff: fusing all of it into one decision rule that a real deployed system can run on every incoming request — answer, ask, or defer (Chapter 8).

1 · Calibration
is the model's confidence trustworthy? (Ch 1–2)
2 · Disambiguation
which question best narrows the task? (Ch 3–5)
3 · Confidence tokens
train a real, learned confidence signal (Ch 6–7)
4 · The full loop
answer, ask, or defer — on every request (Ch 8)

One framing to hold onto for the rest of this session, because it resurfaces constantly: these two problems are not solved by the same lever. You cannot fix ambiguity by making the model more confident, and you cannot fix miscalibration by asking more clarifying questions. A model can be perfectly calibrated about an ambiguous task — genuinely 50/50 unsure which of two readings you meant, and honestly reporting exactly that — and a model can be badly miscalibrated about a completely unambiguous task, stating 95% confidence in a wrong arithmetic answer to a question with only one correct reading. Chapter 3 makes this distinction precise; keep it in the back of your mind starting now.

Three deployment postures, compared

It helps to name the alternatives explicitly before building the machinery that beats them, because “just answer everything confidently” is not the only naive baseline worth ruling out.

PostureWhat it does on every requestWhere it fails
Always answerCommits to one output immediately, every time, at whatever confidence the model happens to feelConfidently wrong answers (Chapter 0's refund-policy case) and confidently mis-interpreted ambiguous requests (the clean-up-this-script case) both slip through completely unflagged
Always ask firstRequires a clarifying round-trip before attempting any request, regardless of whether one is neededFrustrates users on the large majority of requests that were never actually ambiguous, and provides no defense against a confidently wrong answer to a request that was already fully specified
Adaptive (this session)Checks ambiguity and calibrated confidence per request, and answers, asks, or defers accordinglyRequires building and maintaining both the calibration machinery (Ch. 1–2, 6–7) and the disambiguation machinery (Ch. 3–5) — genuinely more engineering than either naive posture

The third row's failure column is honest on purpose: the adaptive posture is not free. It costs real engineering effort to build, and Chapter 7 will show it costs real, measurable inference budget to operate (routing a nonzero fraction of queries onward, asking a nonzero number of clarifying questions). The claim this session defends is narrower than “the adaptive posture is free and strictly better” — it is that the adaptive posture's costs are visible, measurable, and tunable via explicit thresholds, where the two naive postures' costs (silent wrongness, or blanket user friction) are not.

A third domain, worked through

Two domains are named in this chapter's opening paragraphs — support tickets and code review. A third is worth a moment, because it is where the stakes described earlier (“safety-critical applications, such as medical diagnosis”) stop being abstract. A clinical-decision-support assistant is asked: “Patient reports chest pain and shortness of breath — what should we check first?” This request is both possibly ambiguous (does “check first” mean the first diagnostic test to order, or the first question to ask the patient, or the first vital sign to monitor?) and a place where a confidently wrong answer — recommending the wrong initial workup with no hedge in its tone — has a materially different cost than a wrong answer to a code-cleanup request. Nothing about the mathematics in this session changes for this domain; what changes is the threshold a responsible deployment would set for tconf and tEIG in Chapter 8's decision rule. A system fielding this kind of request would reasonably set a much higher confidence bar before answering directly, and a much lower EIG bar before asking a clarifying question — erring hard toward asking or deferring, because the cost of a silent wrong answer in this domain dwarfs the cost of one extra round of clarification. The machinery is domain-agnostic; where you set its dials is not, and should not be.

The other side of the ledger: the cost of over-flagging

Every worked cost estimate so far in this chapter has counted the price of a silently wrong answer. That is one side of a real tradeoff, and stopping there would be misleading — a system that flags everything for review pays no silent-wrongness cost at all, while paying an enormous cost of a different kind: the human time spent reviewing answers that were already fine. Extend the illustrative 10,000-tickets-a-week scenario one step further. Suppose a human review of a flagged (but actually correct) answer takes 3 minutes — far less than the 20 minutes an undetected wrong answer costs, since confirming a right answer is faster than diagnosing and fixing a wrong one, but still not free. A policy that flags 50% of all tickets for review, regardless of whether they needed it, would cost:

10,000 × 50% × 3 min = 5,000 × 3 = 15,000 minutes ≈ 250 hours/week, mostly spent confirming answers that were already right

Compare that to the 133-hour figure from the 4%-miscalibration, zero-flagging baseline earlier in this chapter — over-flagging at 50% is actually more expensive than doing no flagging at all, in this illustrative accounting, purely because review time gets paid on a huge number of tickets that never needed it. This is precisely why this session never treats “ask more questions” or “defer more often” as costless safety improvements — both directions of Chapter 8's threshold dials have a real cost attached, and the entire point of building calibration and disambiguation machinery, rather than just cranking up caution everywhere, is to spend that review budget on the specific tickets that actually need it instead of paying it indiscriminately across everything.

What an informed flagging policy changes

The 50%-blind-flagging number above deliberately isolated one cost in isolation — review overhead alone — to make a narrow point: that overhead is not negligible, and treating “just review more” as a costless safety margin is already wrong before accounting for anything else. Contrast that blind policy against an informed one, flagging based on an actual signal (this session's Chapters 1–8) rather than at random. An informed policy flagging only the roughly 4% of tickets a well-calibrated confidence score actually identifies as risky pays review cost on a far smaller slice of the 10,000-ticket week — 10,000×4%×3 min = 1,200 minutes, or 20 hours/week — while catching close to the same wrong answers the blind 50% policy would only catch half the time (since half its flags are wasted on already-correct tickets, and half of the true problem tickets sit unflagged among the other, unreviewed 50%). This is the entire economic case for calibration in one comparison: an uninformed flagging policy has to flag a huge fraction of traffic to have good odds of catching the tickets that matter, paying review overhead on everything else along the way; an informed one flags a small, targeted fraction and spends its review budget almost entirely on tickets that were actually worth reviewing.

A short glossary, for the vocabulary this session commits to

Five terms recur constantly from here forward, worth defining once, precisely, before the chapters that build each one in full:

TermWhat it means in this sessionBuilt in
CalibrationWhether a model's stated confidence matches its actual, observed accuracy across many predictionsChapter 1
AmbiguityA property of a request: whether more than one genuinely distinct output would satisfy everything explicitly statedChapter 3
Expected Information Gain (EIG)How much a candidate clarifying question is expected to shrink the space of remaining valid interpretations, in bitsChapter 4
Confidence tokenA special, fine-tuned vocabulary token whose probability is trained to track whether the model's own answer was correctChapter 6
DeferralRouting a query to a more capable model, or abstaining entirely, instead of returning the current model's own answerChapter 7

Notice the last column's ordering does not match the order these terms just appeared in — calibration (Ch. 1) and ambiguity (Ch. 3) are built in parallel tracks that do not depend on each other, while EIG (Ch. 4) depends on ambiguity already being defined, and deferral (Ch. 7) depends on confidence tokens (Ch. 6) already existing. That dependency structure is exactly the flow diagram from earlier in this chapter, restated now in terms of the vocabulary rather than the chapter numbers.

Where this sits in the course so far

This is not the first session in this course to touch either half of this problem, and it is worth naming that up front rather than pretending calibration and disambiguation appear from nowhere. Session 05's BIRD framework already asked how to get a trustworthy probability estimate out of an LLM, by decomposing a claim into explicit factors rather than trusting a single raw number — a different problem than this session's (BIRD estimates the probability of a claim; this session estimates confidence in an answer and ambiguity in a request), but the same underlying discomfort with trusting an LLM's single, ungrounded number without first decomposing the problem. Session 06's alignment methods (RLHF, DPO) already surfaced the tension between optimizing for an average population's preferences and serving any one individual's actual, possibly atypical intent — exactly the “preference optimization versus iterative elicitation” framing Chapter 3 of this session builds directly on. Neither prior session solved the problem this one tackles; both left visible seams that this session's two papers each, independently, picked up and closed.

What do the refund-policy and clean-up-this-script failures in this chapter have in common?

Chapter 1: Calibration From Zero

Chapter 0 used the word “confidence” loosely. Time to make it precise. When a language model predicts the next token, its output layer is a softmax over the entire vocabulary — every possible next token gets a probability, and they all sum to 1. In a multiple-choice setting, this collapses to something even simpler: the model assigns a probability to each answer choice, and whichever one has the highest probability is the one it outputs. That highest probability — call it 0.82, or 0.55, or 0.99 — is a number the model already hands you, for free, on every single prediction. The question this chapter answers is: does that number mean anything?

The definition, stated plainly

A model is calibrated if, among all the times it says “I am 80% confident,” it is actually correct about 80% of the time — not 95% of the time (underconfident) and not 55% of the time (overconfident). Calibration says nothing about how often the model is right; a model that is right 60% of the time and honestly says “60% confident” every time is perfectly calibrated, while a model that is right 90% of the time but always claims “99% confident” is badly miscalibrated, despite being the more accurate model. Accuracy and calibration are two different properties of the same system, and a system can have either without the other.

The analogy to hold onto. A well-calibrated weather forecaster is not one who is always right about whether it rains. It is one whose “70% chance of rain” days really do rain about 70% of the time, averaged over many such days. You cannot check calibration from a single prediction — you need to look at a whole batch of predictions that were all made with roughly the same stated confidence, and see how often they actually came true. That is exactly the machinery this chapter builds.

The reliability diagram

To check calibration across a batch of predictions, first sort them into buckets by their stated confidence — say, everything the model said between 50% and 70% confident goes in one bucket, 70–90% in another, 90–100% in a third. Within each bucket, compute two numbers: the average stated confidence (just average the confidence values in that bucket) and the observed accuracy (what fraction of predictions in that bucket were actually correct). Plot observed accuracy against average confidence, one point per bucket. If the model were perfectly calibrated, every point would land exactly on the diagonal line accuracy = confidence. This plot is called a reliability diagram, and the vertical distance of each bucket's point from that diagonal is a direct, visual measure of how wrong the model's stated confidence is, in that confidence range.

A toy dataset, worked by hand

Numbers make this concrete faster than any more diagram can. Suppose a model answers 10 multiple-choice questions. For each one, record its stated confidence (the softmax probability of the answer it picked) and whether that answer was actually correct:

QuestionStated confidenceCorrect?
Q10.95✗ wrong
Q20.92✓ correct
Q30.88✓ correct
Q40.85✗ wrong
Q50.82✓ correct
Q60.78✓ correct
Q70.75✗ wrong
Q80.68✓ correct
Q90.60✗ wrong
Q100.55✓ correct

Sort these into three confidence buckets — [0.5, 0.7), [0.7, 0.9), and [0.9, 1.0] — and work each bucket by hand.

Bucket [0.5, 0.7): Q8, Q9, Q10.

average confidence = (0.68 + 0.60 + 0.55) ÷ 3 = 1.83 ÷ 3 = 0.610
accuracy = 2 correct out of 3 (Q8, Q10 right; Q9 wrong) = 0.667
gap = |0.667 − 0.610| = 0.057

Bucket [0.7, 0.9): Q3, Q4, Q5, Q6, Q7.

average confidence = (0.88 + 0.85 + 0.82 + 0.78 + 0.75) ÷ 5 = 4.08 ÷ 5 = 0.816
accuracy = 3 correct out of 5 (Q3, Q5, Q6 right; Q4, Q7 wrong) = 0.600
gap = |0.600 − 0.816| = 0.216

Bucket [0.9, 1.0]: Q1, Q2.

average confidence = (0.95 + 0.92) ÷ 2 = 1.87 ÷ 2 = 0.935
accuracy = 1 correct out of 2 (Q2 right; Q1 wrong) = 0.500
gap = |0.500 − 0.935| = 0.435

Read that last bucket again. On the ten questions this model claimed to be most sure about — 92% and 95% confident — it was right only half the time. Stated confidence and actual reliability have almost nothing to do with each other in exactly the range where trusting the model unquestioningly would be most tempting.

Combining the buckets: Expected Calibration Error

A single number that summarizes all three gaps, weighted by how many questions fell in each bucket, is called Expected Calibration Error, or ECE. The formula is a weighted average of the per-bucket gaps, where each bucket's weight is the fraction of all predictions that landed in it:

ECE = ∑m (nm ÷ N) · |accuracym − confidencem|

Where m ranges over buckets, nm is how many predictions fell in bucket m, and N is the total number of predictions (here, 10). Plug in the three buckets above:

ECE = (3÷10)·0.057 + (5÷10)·0.216 + (2÷10)·0.435
= 0.3×0.057 + 0.5×0.216 + 0.2×0.435 = 0.0171 + 0.1080 + 0.0870 = 0.212

An ECE of 0.212 means this model's stated confidence is, on average, off by about 21 percentage points from reality. That is a large, actionable number — it tells you this model's raw softmax probabilities are not safe to hand to a downstream decision (like “only show this answer to the user if confidence > 90%”) without first fixing the calibration.

Why bin at all? The naive average can hide the problem

It is tempting to skip the binning and just compare the overall average confidence to overall accuracy directly. For this dataset: average confidence across all 10 questions is (1.83+4.08+1.87)÷10 = 7.78÷10 = 0.778, and overall accuracy is 6÷10 = 0.600. The naive gap is |0.778 − 0.600| = 0.178 — noticeably smaller than the binned ECE of 0.212.

Concept → realization. The naive, unbinned gap understates the true miscalibration here, because overconfidence in one confidence range and underconfidence in another can partially cancel out in a single global average — exactly the way the sub-3-hour and sub-8-hour honest-vs-optimistic KV-cache estimates in earlier sessions diverge once you stop averaging away the structure in the problem. Binning first, then averaging the per-bucket gaps, is what stops the cancellation and reveals how badly miscalibrated any one confidence range actually is. This is precisely why ECE bins before averaging, and it is the detail that a one-line “just compare the averages” shortcut would silently get wrong.

Does the number of bins matter? A sensitivity check

Three bins was a choice, not a law of nature — so recompute ECE on the same 10 questions with a coarser split: merge the two lower buckets from before into one wide bin, [0.5, 0.9), and leave [0.9, 1.0] on its own.

Bucket [0.5, 0.9): Q3–Q10, eight questions.

average confidence = (0.88+0.85+0.82+0.78+0.75+0.68+0.60+0.55)÷8 = 5.91÷8 = 0.739
accuracy = 5 correct out of 8 (Q3, Q5, Q6, Q8, Q10 right; Q4, Q7, Q9 wrong) = 0.625  ·  gap = |0.625−0.739| = 0.114

Bucket [0.9, 1.0]: Q1, Q2 — unchanged from before, gap = 0.435.

ECE2-bin = (8÷10)×0.114 + (2÷10)×0.435 = 0.091 + 0.087 = 0.178

Coarser binning (0.178) reports a smaller ECE than the finer three-bin version (0.212) on the exact same underlying data — a real, well-documented property of ECE, not a mistake in either calculation. The mechanism is worth naming precisely, because it is not just “fewer bins are noisier.” The two buckets that got merged here happened to be miscalibrated in the same direction — both overconfident, accuracy below confidence — so their gaps mostly add rather than cancel when merged, and yet the combined bucket's own gap (0.114) is still smaller than the weighted sum of the two separate gaps it replaced (0.108+0.087=0.195, contributing 0.5×0.216+0.2×0.435 to the original ECE), because widening a bucket's confidence range pulls its average confidence toward the middle of that wider range, narrowing the apparent gap even while genuine miscalibration inside the bucket goes on hiding. If instead you merged two buckets miscalibrated in opposite directions — one under-, one over-confident — the cancellation would be even more dramatic, potentially masking a real problem in either half almost entirely. This is why published ECE numbers should always be read alongside their bin count and bin-width scheme — the confidence-tokens paper's Table 2 numbers in Chapter 2 use one fixed, standard binning scheme across every method precisely so the comparison between methods stays fair, even though the absolute ECE values would shift if the bin count changed.

A second calibration metric: the Brier Score

ECE is not the only way to score calibration, and the confidence-tokens paper reports a second metric, Brier Score (BS), alongside it in every result table. Where ECE bins first and averages gaps second, Brier Score skips binning entirely and averages a per-example squared error directly:

BS = (1÷N) · ∑i (confidencei − correcti

where correcti is 1 if that prediction was right and 0 if wrong — so each term measures how far a single prediction's stated confidence sat from the binary outcome it should have matched. Compute it on the same 10 toy questions:

(0.95−0)²+(0.92−1)²+(0.88−1)²+(0.85−0)²+(0.82−1)²+(0.78−1)²+(0.75−0)²+(0.68−1)²+(0.60−0)²+(0.55−1)²
= 0.9025+0.0064+0.0144+0.7225+0.0324+0.0484+0.5625+0.1024+0.3600+0.2025 = 2.954
BS = 2.954 ÷ 10 = 0.295

Unlike ECE, Brier Score never needs a binning choice — it is unambiguous, at the cost of mixing together two different things ECE keeps separate: how accurate the model is, and how calibrated it is. A perfectly accurate but always-underconfident model (always right, but only ever claims 60% confidence) still racks up Brier Score penalty from every (0.6−1)² term, even though nothing about its calibration is dishonest in the ECE sense. This is exactly why Chapter 2's evidence table reports both ECE and BS side by side, rather than picking just one — each metric is blind to a different kind of failure the other one catches.

Now the contrast: a well-calibrated version of the same 10 questions

Everything computed so far described one specific, overconfident model. It is worth seeing the exact same 10-question setup produce a healthy ECE, to confirm the metric actually rewards honesty rather than just punishing everything. Keep every stated confidence identical to the original table, and change only which answers were actually correct: flip Q1 (0.95 confidence) from wrong to correct, and flip Q4 (0.85 confidence) from wrong to correct, leaving Q7 and Q9 as the only two wrong answers.

Bucket [0.5, 0.7): unchanged. Same three questions, same result: accuracy 0.667, confidence 0.610, gap = 0.057.

Bucket [0.7, 0.9): Q3, Q4, Q5, Q6, Q7 — now 4 correct, 1 wrong.

accuracy = 4÷5 = 0.800  ·  confidence = 0.816 (unchanged)  ·  gap = |0.800−0.816| = 0.016

Bucket [0.9, 1.0]: Q1, Q2 — now both correct.

accuracy = 2÷2 = 1.000  ·  confidence = 0.935 (unchanged)  ·  gap = |1.000−0.935| = 0.065
ECEwell-calibrated = 0.3×0.057 + 0.5×0.016 + 0.2×0.065 = 0.0171+0.008+0.013 = 0.038

Same ten stated confidence values, same three bins, and ECE drops from 0.212 down to 0.038 — nearly a 6× improvement — purely because the same confidence numbers now line up with reality. Notice this model is also now more accurate overall (80% versus the original 60%), which raises a fair question: is the lower ECE just a byproduct of higher accuracy, rather than genuine calibration improvement? Compare bucket 3 directly: confidence stayed fixed at 0.935 in both versions, but accuracy jumped from 0.5 to 1.0 — the gap shrank because accuracy moved toward the stated confidence, not because the stated confidence itself changed. That is exactly what “better calibrated” means: the honesty of the stated number, checked against what actually happened, independent of whether the underlying accuracy is high or low. This slider-driven simulation below interpolates continuously between exactly these two endpoints.

The reliability diagram, live

The dashed diagonal is perfect calibration (accuracy = confidence). Each bar pair shows one bucket's average confidence (teal marker) against its actual accuracy (warm bar). Drag the slider from a perfectly calibrated version of this toy model up to the fully overconfident version worked out above, and watch ECE move.

overconfidence knob100%

In code, so the formula is undeniable

python
def expected_calibration_error(confidences, corrects, n_bins=3, edges=(0.5,0.7,0.9,1.0)):
    # confidences: list of stated confidences, e.g. softmax max-probs
    # corrects: list of 0/1, whether that prediction was right
    N = len(confidences)
    ece = 0.0
    for lo, hi in zip(edges[:-1], edges[1:]):
        idx = [i for i, c in enumerate(confidences) if lo <= c < hi or (hi==1.0 and c==1.0)]
        if not idx: continue
        bucket_conf = sum(confidences[i] for i in idx) / len(idx)
        bucket_acc  = sum(corrects[i]     for i in idx) / len(idx)
        ece += (len(idx) / N) * abs(bucket_acc - bucket_conf)
    return ece

# the ten toy questions from this chapter, in order Q1..Q10
conf = [0.95,0.92,0.88,0.85,0.82,0.78,0.75,0.68,0.60,0.55]
ok   = [0,1,1,0,1,1,0,1,0,1]
print(expected_calibration_error(conf, ok))   # 0.212 -- matches the hand derivation exactly
What ECE does not tell you. A low ECE means the model's confidence numbers are trustworthy on average, within each confidence range. It does not mean the model is accurate — a model that is right only 50% of the time, but always honestly says “50% confident,” has an ECE of exactly 0. Calibration and accuracy are orthogonal, and a deployed system usually needs to track both.

Verifying the zero-ECE claim, by hand

That callout's claim — a model right exactly 50% of the time, always stating 50% confidence, has an ECE of exactly 0 — is worth confirming rather than taking on faith, since it is the clearest possible illustration of calibration and accuracy being genuinely different axes. With every single prediction carrying identical confidence (0.50), the entire dataset falls into one bin: [0.5, 0.7), say, using this chapter's own bin edges. Average confidence in that bin is trivially 0.50, since every value in it is 0.50. Accuracy in that bin, by the stated setup, is also 50% correct — exactly 0.50. The gap is |0.50−0.50| = 0, and since there is only one bin, ECE (a weighted average of a single zero) is exactly 0, regardless of how large N is or how the specific right/wrong predictions are distributed within that bin. Contrast this directly against the 80%-accurate, 0.935-confidence bucket 3 from the well-calibrated worked example earlier in this chapter, which still posted a nonzero 0.065 gap despite being far more accurate in absolute terms — a stark reminder that ECE rewards honesty about one's own reliability, not the reliability itself. A weather forecaster who is right half the time and always says “50% chance” is boring, not especially skillful, and perfectly calibrated, all three at once — and telling those three properties apart is the entire reason this chapter built ECE as a separate measurement from accuracy in the first place, rather than treating a high-accuracy model as automatically trustworthy.

Why does Expected Calibration Error bin predictions by confidence range before averaging, instead of just comparing overall average confidence to overall accuracy directly?

Chapter 2: Why Models Are Overconfident

Chapter 1 gave you a way to measure miscalibration. This chapter asks the more useful question: where does it come from, and can you trust any of the obvious quick fixes? The short answer, grounded in what Learning to Route LLMs with Confidence Tokens reports, is that the obvious approaches — reading off the model's raw softmax probability, or just asking it to state a confidence number — are both measurably unreliable, and the paper has the numbers to prove it.

The training objective never asks for calibration

LLMs are trained with cross-entropy loss, which pushes the model to put more probability mass on the correct next token, every single step, for millions of steps. Nowhere in that objective is there a term that says “and also, make sure that when you say 90% confident, you are right 90% of the time.” Cross-entropy only cares about the probability assigned to the one correct token; it has no mechanism for comparing that probability against a track record across many predictions, because at training time there is no such track record to compare against — each example is one gradient step, evaluated in isolation.

The practical consequence, stated directly in the confidence-tokens paper's introduction: “since LLMs are typically trained using a cross-entropy loss, they can overfit on accuracy rather than calibration, often leading to overconfidence and misalignment with real-world distributions.” Pushing probability mass toward the correct token, repeated at massive scale, is a fundamentally different optimization target than making that probability an honest estimate of correctness — and nothing in ordinary pretraining or instruction-tuning closes that gap for free.

Concept → realization. This is not a bug someone forgot to fix — it is a direct, structural consequence of what cross-entropy loss optimizes. A model can push its probability on the correct token from 60% to 95% purely by getting more confident on the examples it already tends to get right, without becoming right on any new examples. That move lowers training loss and raises the model's average stated confidence, with zero improvement in actual accuracy — which is exactly the overconfidence pattern Chapter 1's reliability diagram exposed.

Two quick fixes, and why both underperform

Given that raw softmax probabilities are suspect, two intuitive workarounds come up constantly in practice. Both are tested as baselines in the confidence-tokens paper, against real models on real benchmarks — so this is not speculation, it is measured.

Fix 1: just read off the logits. Take the model's own softmax probability for the token it actually generated (in a free-text answer, average this across the generated tokens) and use that number directly as the confidence score. This is the “Zero-shot Logits” baseline in the paper. The problem is exactly what Chapter 1 demonstrated by hand: nothing forces that raw probability to track real-world correctness, because as just established, nothing in training optimized for that.

Fix 2: just ask the model to state its confidence. Prompt the model with something like “on a scale of 0 to 1, how confident are you in that answer?” and read off the number it types — this is verbalized confidence, and it feels like it should work, since you are asking the exact question you want answered. The paper's introduction is blunt about why this underperforms too: verbalized confidence results “may be subject to the dataset and prompt engineering, often leading to unstable or unreliable results.” The model is generating a plausible-sounding number, using the same next-token machinery it uses for everything else — there is no guarantee that machinery has learned to introspect honestly about its own correctness, as opposed to producing whatever confidence-sounding digit best continues the conversational pattern.

How each baseline actually turns a prompt into a number

It helps to see the exact mechanics behind each of the four baselines the paper measures, because the failure mode is different for each one, even though the end symptom — a high ECE — looks the same.

Verbalizing Yes/No Token. Prompt: “Are you confident this answer is correct? Answer Yes or No.” Read off the model's own softmax probabilities for the literal tokens Yes and No at that position, then normalize:

confidence = P(Yes) ÷ (P(Yes) + P(No))

This is structurally the same normalization formula Chapter 6 uses for confidence tokens — the difference is entirely in whether the tokens being measured were ever specifically trained to track correctness. Yes and No are ordinary vocabulary tokens the model has used in a million unrelated contexts; nothing points their probabilities at this specific query's correctness the way Chapter 6's purpose-built <CN>/<UN> tokens are trained to.

Zero-shot Logits. No extra prompt at all — just take the softmax probability the model already assigned to the token(s) it generated as its answer. For a single-token multiple-choice answer, that is one number, straight from the forward pass that produced the answer. For a free-text answer spanning several tokens, average the per-token probabilities. This is the cheapest possible confidence signal — zero extra inference cost — and, per the table below, one of the least reliable.

Fine-tuned Logits. Identical mechanics to Zero-shot Logits, but computed from a model that has been fine-tuned on the target task first (ordinary supervised fine-tuning for accuracy, not for calibration specifically). This is the strongest baseline in the table — fine-tuning for accuracy happens to improve calibration somewhat as a side effect — but it is still measurably behind Self-REF, because improving accuracy and improving calibration are, as Chapter 1 established, different objectives that happen to be loosely correlated rather than the same thing.

Why free-text averaging is itself a rough approximation

One detail buried inside the Zero-shot Logits and Fine-tuned Logits mechanics deserves its own look: for a free-text answer spanning several tokens, both baselines average the per-token probabilities to get one confidence number. It is worth seeing why that averaging step is itself a source of distortion, not just a convenient summary. Suppose a three-token answer has per-token probabilities 0.99, 0.99, and 0.40 — the model is nearly certain about the first two tokens and genuinely unsure about the third:

simple average = (0.99+0.99+0.40)÷3 = 2.38÷3 = 0.793

79.3% confidence, reported as one number for the whole answer. But the sequence is only as correct as its weakest link — if that third token is wrong, the whole free-text answer is almost certainly wrong too, regardless of how confident the model was about the first two, easy tokens. The joint probability of the entire sequence being exactly right is closer to the product of the per-token probabilities, not their average:

joint probability ≈ 0.99×0.99×0.40 = 0.392

0.392 versus the averaged 0.793 — roughly half. A single easy-but-irrelevant token sitting next to one genuinely uncertain token can drag a simple average well above what the sequence's true joint correctness probability actually is, especially as answers get longer and the gap between “average per-token confidence” and “probability the whole thing is exactly right” widens further. This is one more concrete reason, on top of everything else this chapter has shown, that raw logit-derived confidence scores for free-text generation need to be treated with real skepticism before being trusted as-is — the very act of collapsing several token probabilities into one summary number can quietly inflate the result.

The measured gap, in real numbers

Table 2 of the confidence-tokens paper reports ECE (exactly the metric derived by hand in Chapter 1) for four baseline confidence-estimation methods, measured on Llama3-8B-Instruct answering MMLU questions. Lower is better — a perfectly calibrated model scores 0.

MethodECE on MMLU (Llama3-8B-Instruct)
Verbalizing Yes/No Token0.466
Zero-shot Logits0.347
Verbalizing Uncertainty (0–1 score)0.217
Fine-tuned Logits0.081
Self-REF (confidence tokens, Chapter 6)0.040

Read the top row against the toy example from Chapter 1: an ECE of 0.466 means the “confident” Yes/No verbalization on real MMLU questions, with a real model, is more miscalibrated than the toy overconfident dataset you just hand-computed (ECE 0.212). This is not a contrived worst case — it is a standard confidence-elicitation technique, measured on a standard benchmark, coming out badly miscalibrated. Even the raw logits — the number that feels like it should be the most “honest” signal, straight from the model's own math — land at 0.347, still far worse than what Chapter 6 will show is achievable by actually training for calibration on purpose.

The misconception this rules out. “The model's own probability is the ground truth about its confidence — why would you need anything fancier?” Because that probability was shaped entirely by a training objective that never once compared it against a track record of right and wrong answers. It is a byproduct of next-token prediction, not a calibrated estimate, and the measured 0.347 ECE above is the direct evidence.

What would actually fix it

Notice the pattern in that table: “Fine-tuned Logits” (0.081) beats both zero-shot approaches by a wide margin, and Self-REF's confidence tokens (0.040, Chapter 6) beat that too. The common thread is fine-tuning specifically for calibration, rather than trusting whatever confidence signal falls out of ordinary training or clever prompting. That is the single idea Chapter 6 builds out in full: instead of hoping the model's existing probabilities happen to be honest, or hoping a prompt can talk it into introspecting correctly, train it — on purpose, with a loss that directly rewards getting the confident/unconfident label right — to emit a genuinely learned confidence signal.

A third quick fix, and why it measures a different thing entirely

A third technique comes up often enough to be worth naming, even though the confidence-tokens paper does not include it as one of its four head-to-head baselines: self-consistency, where you sample the model's answer multiple times (at nonzero temperature) and treat how often the samples agree with each other as a confidence proxy — if the model gives the same answer 9 times out of 10 resamples, that agreement rate becomes the confidence score. This has real appeal: it needs no fine-tuning and no special tokens, just extra sampling at inference time. The paper's related-work discussion is explicit about why this is a fundamentally different measurement than what Self-REF targets, noting its own confidence notion is “aligned against correctness rather than the consistency of responses after re-sampling.” The distinction matters because a model can be highly self-consistent while being consistently wrong — if the same misconception or the same missing piece of knowledge drives every resample toward the same incorrect answer, agreement across samples is high and self-consistency reports high confidence, even though the answer is false every single time. Consistency measures whether the model's distribution is peaked; it does not measure whether that peak sits on the correct answer. Self-REF's confidence tokens, by construction (Chapter 6's annotation step explicitly labels against ground-truth correctness, not against resampled agreement), do not have this blind spot.

Temperature scaling: a classical fix for a related, narrower problem

One more established calibration technique worth placing on the map: temperature scaling (Guo et al., 2017, cited directly in the confidence-tokens paper's related work), which divides a model's logits by a single learned scalar T before the softmax, then re-normalizes. Raising T > 1 flattens the whole probability distribution — every prediction becomes less peaked, which pulls an overconfident model's average stated probability down toward its true accuracy without changing which answer it predicts at all (dividing every logit by the same constant does not change their relative ranking). This is a genuinely useful, cheap post-hoc fix for one specific symptom — a model that is uniformly too sharp across the board. It does not help with the deeper problem Chapter 2's Table 2 is measuring: a model whose relative confidence ranking is itself unreliable — sometimes very confident and right, sometimes very confident and wrong, in ways a single global rescaling constant T cannot separate, because T only stretches or compresses the existing distribution, it cannot reorder which specific predictions get flagged as risky. Self-REF's fine-tuned <CN>/<UN> tokens attack that deeper, per-example problem directly, rather than applying one blanket correction to every prediction alike.

A worked example of what T actually does

Take a toy 3-way multiple-choice prediction with raw logits [4.0, 1.0, 0.5] for options A, B, C. Softmax with T=1 (no scaling) gives:

exp(4.0)=54.60, exp(1.0)=2.72, exp(0.5)=1.65    sum=58.97
P(A)=54.60÷58.97=0.926, P(B)=2.72÷58.97=0.046, P(C)=1.65÷58.97=0.028

92.6% confidence in A. Now apply temperature scaling with T=2 — divide every logit by 2 before the softmax, giving [2.0, 0.5, 0.25]:

exp(2.0)=7.39, exp(0.5)=1.65, exp(0.25)=1.28    sum=10.32
P(A)=7.39÷10.32=0.716, P(B)=1.65÷10.32=0.160, P(C)=1.28÷10.32=0.124

A now sits at 71.6% instead of 92.6% — a substantially less overconfident number — while remaining, by a wide margin, still the model's top pick; B and C both grew, but their relative order (B above C) never changed either. This is the entire mechanism in one worked example: T rescales the sharpness of the whole distribution uniformly, and the single scalar T is typically fit on a held-out validation set to make the model's average confidence across many predictions match its average accuracy — it has no way to selectively soften only the predictions that happen to be wrong, because it never looks at correctness at the level of an individual example, only at the aggregate.

What a bad ECE actually breaks, downstream

It is worth making concrete what goes wrong operationally when a deployment thresholds a poorly-calibrated score, since that is precisely how Chapter 7's routing mechanism and Chapter 8's decision policy both plan to use whatever confidence signal this session builds. Suppose a system sets tconf = 90%, intending to answer directly only on the roughly-top-10%-most-confident predictions, using Zero-shot Logits (ECE 0.347 on MMLU) as the confidence source. Nothing in that raw logit score guarantees the predictions clearing a 90% threshold are actually right 90% of the time — Chapter 1's toy dataset already demonstrated a case where the model's own 90–100%-confidence bucket was only 50% accurate. Set the same 90% threshold against Self-REF's confidence tokens (ECE 0.040) instead, and the predictions clearing that bar are, by construction of what a low ECE means, much closer to actually being right 90% of the time. The threshold number typed into the code — 0.90 — is identical in both cases; what changes entirely is what that number is actually worth trusting, which is exactly why Chapter 2 insists on measuring ECE before picking any downstream threshold, rather than assuming any confidence signal's numbers mean what they claim to mean.

Why a more accurate model still needs this chapter

A natural objection at this point: if a lab simply ships a more accurate model next quarter, does any of this chapter's calibration work become unnecessary? No — and it is worth being precise about why, since accuracy and calibration were established earlier in this chapter as different axes, not two names for the same property. A more accurate model is right more often, which is unambiguously good on its own terms. But nothing about raising accuracy from, say, 78% to 92% guarantees that the model's stated confidence on its remaining wrong answers becomes any more honest. A model could climb from 78% to 92% accuracy while its confidence on the 8% it still gets wrong stays just as inflated as before — genuinely better at the task, and just as dangerous to trust blindly on the smaller sliver of cases it still misses. This is precisely the scenario Chapter 0's opening framing warned about: a more capable model that is also uniformly overconfident is arguably riskier to deploy without calibration machinery than a less capable one, because people extend it more trust exactly where that trust has not been earned by anything in the training process. Capability improvements and calibration improvements are both worth pursuing, and shipping one is never a substitute for the other.

Before all this, though, Chapters 3–5 have to build the other half of this session's picture: even a perfectly calibrated model can be perfectly, honestly confident in the wrong task, if the request it received admitted more than one reading and it silently picked one. Calibration alone does not solve ambiguity — the next three chapters build the machinery for that separately.

Why doesn't ordinary cross-entropy training on its own produce a well-calibrated model?

Chapter 3: The Ambiguity Problem

Set calibration aside for a moment — imagine a model that is perfectly, honestly calibrated. It still has a problem Chapter 0's “clean up this script” example exposed: some requests genuinely admit more than one correct answer, and no amount of confidence-checking on a single guessed answer fixes that, because the model guessed the wrong question. This chapter, grounded in Active Task Disambiguation with LLMs, builds a precise, formal definition of what “ambiguous” actually means — precise enough that Chapters 4–5 can compute with it.

Decomposing a problem statement

The paper defines a problem statement S as a natural-language instruction that decomposes into two parts: R, the requirements — the concrete, checkable constraints any acceptable solution must satisfy — and C, additional context that shapes preference among solutions that already satisfy R, without itself being a hard constraint. For “clean up this script,” R might be as thin as “output valid Python that still runs correctly” — almost any reasonable edit satisfies that. Everything that actually distinguishes “the developer wanted dead code removed” from “the developer wanted whitespace reformatted” lives in C, and C, in this example, was never stated.

Let H denote the set of all solutions h that satisfy R — every h such that h ⊢ R (h entails, or satisfies, the requirements). Let H* denote the true, narrower set of solutions that would actually satisfy the person who asked, given everything they had in mind but did not write down. The paper's formal definition of ambiguity is now a single, clean statement:

S is ambiguous if H is a proper superset of H*, i.e. H ⊃ H*

In words: a problem is ambiguous exactly when there exist solutions that technically satisfy everything explicitly stated, but that the requester would not actually accept. “Clean up this script” is ambiguous because H (any edit that still runs) is much larger than H* (the specific set of edits — dead-code removal, error handling — the developer actually wanted).

The full likelihood decomposition, unpacked

The paper states the ambiguity definition through one more piece of machinery worth unpacking, because it makes precise exactly which part of a request is objective fact and which part is a matter of preference. Let p*(h|S) denote the true likelihood that solution h is the one the requester actually wants, given the full problem statement S. The paper decomposes this as:

p*(h|S) = 𝟙{h ⊢ R} · p̃*(h|R, C)

Read the two factors separately. 𝟙{h ⊢ R} is an indicator function — exactly 1 if h satisfies the stated requirements, exactly 0 otherwise — and it is, in the paper's own words, “objective in the sense that it represents an unquestionable truth about a sample solution h.” Whether a given spreadsheet-merge output actually contains every row from both files is a checkable fact, not a matter of taste. p̃*(h|R, C), by contrast, is “context dependent and subjective” — it is the preference weighting among the solutions that already cleared the objective bar, and different requesters, given the identical stated R and C, can genuinely disagree about it. Applied to the running spreadsheet example: the indicator term rules out anything that isn't a merge of some kind at all (garbage output, a solution that ignores one file entirely); the subjective term is what actually decides between the eight structurally-valid candidate merges from Chapter 5, and it is precisely the part of p* that no amount of staring at R alone will ever recover, because by construction it depends on C — the part of the requester's intent that was never written down.

This decomposition is also exactly why Chapter 5's active-disambiguation method restricts itself to “requirement querying” — treating every clarifying question's answer as a new addition to R, never as an attempt to directly interrogate the subjective p̃* term. The paper is explicit about why: R is where both the true p* and the model's own pφh can be trusted to agree, since the indicator function 𝟙{h ⊢ R} is a shared, objective ground truth both distributions factor through, giving the two distributions “a source of common grounding” even when the model's raw subjective preferences are biased or unreliable. A clarifying question that only asked about subjective taste, with no way to check the answer against anything objective, would not have this grounding property.

Model uncertainty is not the same thing as task ambiguity

This distinction is easy to blur and important to keep sharp, because Chapters 6–8 build a system that needs both signals separately and would give wrong answers if it confused them. The paper is explicit about the split: task ambiguity is an objective property of the problem statement S — whether H properly contains H* is true or false independent of which model you ask, or how that model feels about it. Model uncertainty, by contrast, is a property of the model's own generative distribution pφ(h|S) — how spread out the model's guesses are.

These can diverge in both directions. A model can have high uncertainty on a task that is not actually ambiguous at all — a hard arithmetic problem with exactly one correct answer, where the model is simply struggling, spreading its guesses across several wrong numbers. That is a capability problem, not an ambiguity problem, and asking a clarifying question would not help, because there is nothing left to clarify — the task was already fully specified. Conversely, a model can have low uncertainty on a task that genuinely is ambiguous, if the model happens to be strongly biased toward one particular reading and never considers the others — confidently producing one answer to “clean up this script” without any internal hint that other, equally valid readings existed. Confident does not mean unambiguous, and uncertain does not mean ambiguous.

Task is NOT ambiguous (H = H*)Task IS ambiguous (H ⊃ H*)
Model has low uncertaintyThe healthy case — confident and correctly soDangerous: confidently committed to one of several valid readings, with no signal anything was missed
Model has high uncertaintyA capability gap — a clarifying question will not help; the task was already fully specifiedThe case where asking a clarifying question genuinely helps
Concept → realization. This table is the reason a real system needs two separate signals, not one. A single “confidence score” cannot distinguish the top-right cell (confidently wrong interpretation of an ambiguous request — the dangerous case) from the top-left cell (confidently right). Detecting ambiguity requires reasoning about the space of requirements the request is compatible with, not just reading off how sure the model feels about the one answer it happens to have produced. That is precisely what Chapters 4–5 build: a way to reason about H directly, instead of just pφ(h|S).

Where the risk of misalignment comes from

The paper frames the danger in terms of two competing strategies for handling S = (R, C) when C is underspecified. The first is preference optimization — techniques like RLHF or DPO (covered in Session 06 of this course) that try to align the model's generative distribution pφ(·|S) with the preferences of the average population, so that it concentrates around H* most of the time. This works well when a given user's actual intent resembles the population average. It fails, systematically, exactly when it doesn't: “if the intentions of an individual user deviate from that of the average population, the agent is at risk of proposing solutions not belonging to H*.” A model tuned to the median developer's idea of “clean up” will misfire on anyone whose intent is unusual, no matter how well the tuning worked on average.

The second strategy is iterative task elicitation — engaging the user in a short dialogue, asking a clarifying question, and using the answer to shrink H toward H* before committing to a solution. This is the approach the rest of this session builds out, precisely because it does not depend on any individual user resembling the training population — it works by directly narrowing the actual solution space for this request, from this user, regardless of how typical or atypical their intent is.

A second example, to see the definition apply outside of code

“Clean up this script” makes the H versus H* gap easy to see because code has an obvious space of distinct edits. The same structure shows up just as clearly outside programming. Take a request handed to a data-analysis assistant: “Summarize this quarter's sales numbers.” The requirement R is thin — produce some kind of summary of the sales data — but H, the set of everything that technically satisfies R, spans wildly different documents: a one-paragraph executive summary; a table broken out by region; a table broken out by product line; a chart of month-over-month trend; a comparison against last quarter's numbers; a flag-only summary that lists just the categories that missed target. Every one of these is a legitimate “summary,” and R alone rules out essentially none of them. Whatever the requester actually had in mind — H* — is almost certainly one specific item from that list, or some particular combination, and the sentence as given contains no information that says which.

Notice what stays constant across both examples: the size of H is not really about the length or vagueness of the sentence — “clean up this script” and “summarize this quarter's sales numbers” are both perfectly ordinary, short, unremarkable requests, the kind a person types without a second thought. Ambiguity is a property of how many genuinely different outputs satisfy the stated requirement, not a property of how the sentence sounds. A request can read as completely clear to the person who wrote it — they know exactly what they meant — while still being formally ambiguous to anyone, human or model, who only has the sentence itself and lacks the context inside the requester's head.

A rough sense of the two strategies' relative risk

To feel the preference-optimization-versus-elicitation tradeoff numerically, not just qualitatively, suppose — purely as an illustrative exercise — a model tuned by preference optimization nails the population -average interpretation on 75% of ambiguous requests it receives (a plausible-sounding number for a well-tuned assistant handling fairly typical requests), and is silently wrong the other 25% of the time, with no signal to the user that anything was uncertain. Compare that against the iterative-elicitation approach: it asks one clarifying question first, at some interaction cost, and — per the EIG machinery Chapters 4–5 build — a well-chosen question can resolve a meaningful fraction of that remaining ambiguity in a single round. The 25% failure rate under pure preference optimization is not a number either paper reports; it is a placeholder to make the shape of the tradeoff concrete: a system that only optimizes for the average case pays that failure rate on every atypical user, forever, with no way to detect which specific interactions are the atypical ones. A system that asks pays a small, bounded interaction cost on every ambiguous request, but drives the same failure rate down, deliberately, for exactly the users the average-case approach would have silently failed.

A gap this chapter deliberately does not close

Everything built so far in this chapter assumes you already know a request is ambiguous, and are only trying to formalize what that means. A harder, separate question sits one level up: given an arbitrary incoming request, how do you decide whether it is ambiguous at all, before spending any effort figuring out which question would best resolve it? This is not a question the disambiguation paper's main method answers — its own discussion section points instead to prior zero-shot-prompting work (Kuhn et al., 2022) as a partial answer, treating ambiguity detection as a genuinely separate problem from ambiguity resolution.

It is worth sitting with why detection is hard in its own right, independent of resolution. Given a request, an LLM would need to reason about the full space of solutions compatible with what was stated, and check whether that space is a proper superset of what a reasonable person would actually accept — but this is exactly the same kind of implicit, meta-cognitive reasoning-about-a-space-you-cannot-directly-see that Chapter 5 argued LLMs are bad at when generating clarifying questions directly. There is a real, unresolved circularity here: Chapter 5's method needs to know a request is ambiguous before it is worth spending the extra sampling and scoring effort, but confidently deciding whether a request is ambiguous is close to being the same hard, meta-cognitive judgment that motivated moving to explicit solution-sampling in the first place. This session's Chapter 8 sidesteps the circularity pragmatically — it always computes EIG for the best available question and compares it against a fixed threshold, treating “EIG below threshold” as an operational stand-in for “not ambiguous enough to bother asking” — rather than solving ambiguity detection as a standalone problem the way a more complete system eventually would need to.

A running example, set up for Chapters 4–5

Take a concrete ambiguous request that Chapters 4 and 5 will work through numerically end to end: “Combine these two spreadsheets.” The requirements R are thin — produce something that in some sense merges the two files — but that single sentence is compatible with a large number of genuinely different, all individually reasonable, outcomes. Should the rows be stacked into one table, or should the files stay as separate reference tabs? Should every row from both files be kept (a union), or only rows that appear in both (an intersection)? Should matching rows be found by a shared ID column, or by simple row position? Three independent yes/no choices, each changing the actual output substantially, none of them settled by the sentence as stated. That is H properly containing H*, made concrete — and it is exactly the running example Chapters 4 and 5 use to compute, by hand, which clarifying question is actually worth asking.

Applying the definition: three requests, classified

Before moving on, practice the formal definition directly — H ⊃ H* — against three short requests, deciding for each whether it is ambiguous by Chapter 3's definition.

RequestH (everything satisfying the literal requirement)Ambiguous?
“What is 17 × 24?”Exactly one number satisfies “the product of 17 and 24” — H = {408} = H*No — H = H*, a single correct answer
“Sort this list.”Ascending, descending, alphabetical if strings, by a custom key — many distinct valid orderings all satisfy “a sorted version of the list”Yes — H properly contains whichever one ordering the requester actually wanted
“Translate this sentence into French, preserving formal register.”“Formal register” narrows the space substantially, but multiple grammatically distinct French sentences can still all be equally faithful, formal translationsYes, but narrower — H still properly contains H*, just a much smaller H than the sorting example

The third row is worth lingering on, because it demonstrates that ambiguity is not binary in how much it matters, even though the formal definition (H ⊃ H*, true or false) is binary in name. “Preserving formal register” is exactly the kind of additional context C that shrinks H without fully collapsing it to H* — the request is measurably less ambiguous than the bare “translate this sentence” would have been, but Chapter 3's definition still classifies it as ambiguous, because more than one distinct output still technically qualifies. This is precisely why EIG (Chapter 4) matters as a continuous quantity layered on top of the binary ambiguous/not-ambiguous classification: two requests can both be, technically, ambiguous, while having very different amounts of remaining uncertainty worth resolving — and it is EIG, not the bare definition, that tells you whether asking a follow-up question is actually worth the interaction cost for either one.

What this looks like in ordinary prompt engineering

This formal machinery maps onto a piece of everyday practice anyone who has written prompts already recognizes: adding detail to a prompt is, in this chapter's vocabulary, an attempt to shrink H by hand, ahead of time, without needing to ask a clarifying question at all. “Sort this list” leaves H enormous. “Sort this list in ascending numeric order” collapses it dramatically, to nearly H = H*, by folding what would have been C directly into R up front. This is exactly why experienced prompt writers instinctively add qualifiers, constraints, and examples — they are manually performing the same H-shrinking operation Chapters 4–5 automate through a dialogue instead of through a longer initial prompt. The two approaches are not competitors so much as two different points on the same spectrum: a sufficiently detailed initial prompt can make R alone fully pin down H* with zero rounds of clarification needed, while a terse prompt pushes more of that narrowing work onto the interactive elicitation loop this session builds. Neither is strictly better in general — a prompt author who tries to anticipate every possible ambiguity up front, for every request, pays a real authoring-time cost on the (common) requests that were never actually ambiguous to begin with, which is the same over-flagging tradeoff Chapter 0 priced out for review policies, now showing up one level earlier, at prompt-writing time instead of at review time.

Why C so often stays unwritten

It is worth asking directly why context C gets left out of a request as often as it does, since the entire disambiguation problem exists only because it does. The honest answer is not carelessness — it is that C lives inside the requester's head as something they never had to make explicit to themselves, let alone to anyone else. A developer typing “clean up this script” is not withholding information; in the moment of typing, they are not consciously distinguishing “remove dead code” from “reformat whitespace” as two separate possible meanings at all — to them, in that moment, there is only the one thing they mean, and language is a lossy compression of that one thing into a short sentence, optimized for speed, not for ruling out every reading a listener without their context might construct. This is precisely why “write clearer prompts” is useful advice but not a complete fix: it asks the requester to first notice, then articulate, distinctions that were never conscious choices for them to begin with. A system that can ask a targeted clarifying question is doing something a static prompt-writing guideline cannot — it is externalizing the exact dimension of ambiguity that the requester's own head never flagged as worth writing down, by showing them, concretely, that more than one reading exists at all.

Why can't a single confidence score, on its own, reliably distinguish a well-handled unambiguous request from a confidently-wrong interpretation of an ambiguous one?

Chapter 4: What Makes a Question Informative

Chapter 3 established that resolving ambiguity means shrinking H, the set of solutions compatible with what has been stated so far, toward H*, the set the requester actually wants. Asking a clarifying question is how that shrinking happens — but not every question shrinks H equally well. This chapter builds the mathematical tool for comparing candidate questions and picking the best one, borrowed from a field with a much older name than LLMs: Bayesian Experimental Design (BED).

Entropy, one more time, applied to hypotheses

The prerequisite for this session was entropy, H[p] = −∑ p·log(p) — a number, in bits, that measures how spread out a probability distribution is. Earlier sessions used entropy to measure how spread out a model's next-token distribution is. This chapter applies the exact same formula to a different distribution: p*(h|S), the distribution over which solution h is the one the requester actually wants, given everything stated in S so far. If H contains 8 equally plausible candidate solutions and nothing distinguishes them yet, that distribution is uniform over 8 outcomes, and its entropy is:

H[p*(h|S)] = log2(8) = 3 bits

Three bits of genuine uncertainty about which of the 8 solutions is the right one. A clarifying question, once answered, updates S to S ∪ (q, a) — the problem statement now includes the question q and its answer a as an extra requirement — and shrinks H down to whichever subset remains compatible with that answer. The entropy of the new, narrower distribution is lower. The drop in entropy is exactly how much that question was worth.

Information gain, and why you have to take an expectation

Define the information gain of a specific question-and-answer pair as the entropy before minus the entropy after:

IG(q, a) := H[p*(h|S)] − H[p*(h|S ∪ (q,a))]

There is an immediate problem with using IG directly to pick a question: it depends on a, the answer — and you do not know the answer until after you have asked the question and the user has replied. You cannot maximize something that depends on information you do not have yet. The fix is to take an expectation over every answer the question could plausibly receive, weighted by how likely each answer is, producing the Expected Information Gain, or EIG:

EIG(q) := Ep*(a|q,S)[IG(q, a)] = H[p*(h|S)] − Ep*(a|q,S) H[p*(h|S ∪ (q,a))]

Since the first term does not depend on q at all, maximizing EIG(q) over candidate questions is the same as minimizing the expected remaining entropy after asking q — find the question whose answer, whatever it turns out to be, is most likely to shrink H the most.

The partition view: what a question actually does to H

Here is the mechanical picture that makes EIG computable. Assume, reasonably, that every plausible answer to question q is truthful, and that each solution h in H gives one unambiguous answer to q. Then q partitions H into disjoint groups, one group per possible answer — H(q,a) is the subset of H compatible with answer a. If you assume p*(h|S) is uniform over H (the paper's stated simplifying assumption, motivated by the fact that p* is unknown and any bias in the model's own guessing distribution pφ should not be trusted as a proxy for it), the expected posterior entropy works out to a clean formula:

Ep*(a|q,S) H[p*(h|S∪(q,a))] = (1 ÷ |H|) · ∑a |H(q,a)| · log2(|H(q,a)|)

This says: for each possible answer a, weight the entropy of that answer's remaining hypothesis set by how many solutions land in it, then average. The paper proves a clean and useful fact about this formula:

Corollary 1 (from the paper, worked through here). This expected posterior entropy is minimized — and so EIG is maximized — exactly when the possible answers to q partition H into equally-sized groups. An unbalanced question, where one answer leaves a huge remaining pile of candidates and another leaves almost none, wastes most of its informativeness on the unlikely branch.

Deriving the maximum, by hand, for a balanced binary question

Take |H| = 8, and a question with exactly 2 possible answers (n = 2) that splits H perfectly evenly, into two groups of 4:

E[Hafter] = (1÷8)·[4·log2(4) + 4·log2(4)] = (1÷8)·[4·2 + 4·2] = (1÷8)·16 = 2 bits
EIG = Hbefore − E[Hafter] = 3 − 2 = 1 bit

Now do the same derivation in general, for any |H| and any perfectly balanced n-ary question (n possible answers, each compatible with exactly |H|/n of the hypotheses):

E[Hafter] = (1÷|H|) · n · (|H|÷n) · log2(|H|÷n) = log2(|H|÷n)
EIGmax = log2(|H|) − log2(|H|÷n) = log2(n)

A clean, checkable result: the best possible balanced question with n answer options is worth exactly log2(n) bits. For a yes/no question (n=2), that ceiling is 1 bit — matching the worked derivation above exactly. For a question with 4 well-balanced answer options, the ceiling doubles to 2 bits. This is also why, taken to its extreme, the single most informative possible question is one that enumerates every hypothesis individually (n = |H|, each answer pointing at exactly one h) — it fully resolves the ambiguity in one step, worth the entire log2(|H|) bits of starting uncertainty. The paper is candid about why nobody actually asks that question: it requires the user to personally examine and rule out every candidate solution by name, which is neither a natural nor a user-friendly thing to ask of anyone.

The real tradeoff. More answer options per question raise the theoretical ceiling on how much a single question can teach you — but only if you can find a way to categorize the hypotheses that actually splits them evenly, and only at the cost of a harder question for the human to answer. A good clarifying question strikes a balance: few enough options to stay easy to answer, but categorized well enough to come close to an even split. This tension between B-type (binary) and O-type (open) questions resurfaces with real accuracy numbers in Chapter 5.

What an unbalanced question costs you, concretely

To feel why balance matters, not just why the algebra says it does, compare the 4/4 split above to an unbalanced one: same |H| = 8, same n = 2 (still a yes/no question), but this time one answer leaves 7 candidates standing and the other leaves only 1:

E[Hafter] = (1÷8)·[7·log2(7) + 1·log2(1)] = (1÷8)·[7×2.807 + 0] = (1÷8)×19.65 = 2.456 bits
EIG = 3 − 2.456 = 0.544 bits

Same number of hypotheses, same number of answer options, but roughly half the information gain (0.544 bits versus the balanced question's 1 bit) — purely because the split was lopsided. Both questions have exactly one yes/no answer, and both are perfectly legitimate questions to ask; only one of them is doing its job well. Chapter 5 puts these exact two numbers — 1 bit and 0.544 bits — back into the running spreadsheet example from Chapter 3, alongside a third candidate question, and shows the full worked comparison.

Checking the log₂(n) formula across several question sizes

Chapter 4 derived EIGmax = log2(n) for a perfectly balanced n-ary question, on a fixed |H| = 8. It is worth checking that formula holds as a genuine identity, not just a coincidence of the |H|=8, n=2 case already worked by hand — recompute E[Hafter] and EIG directly from Chapter 4's partition formula for several values of n, still on |H|=8, always assuming the best-case perfectly even split:

n (answer options)Group size (|H|÷n)E[Hafter] = log2(|H|÷n)EIGmax = 3 − E[Hafter]log2(n), for comparison
18log2(8) = 3.0000.000log2(1) = 0.000
24log2(4) = 2.0001.000log2(2) = 1.000
42log2(2) = 1.0002.000log2(4) = 2.000
81log2(1) = 0.0003.000log2(8) = 3.000

Every row matches its own log2(n) column exactly, confirming the identity algebraically rather than just for the one n=2 case already worked by hand. The n=1 row is worth a second look: a “question” with only one possible answer is not really a question at all — asking it teaches you nothing, because you already know what the answer will be before you ask, and the formula agrees, reporting exactly 0 bits of expected gain. The n=8 row is the “enumerate every hypothesis by name” extreme flagged earlier — it recovers the entire 3 bits of starting uncertainty in one step, at the cost of being the least natural question to actually pose to a person.

Bringing the cost term back in: is the fancier question worth asking?

Chapter 5's utility function was U(q) = EIG(q) − c(q) — EIG alone is not the whole story once asking a question has a real cost, whether that cost is measured in extra user friction, extra LLM calls to prepare the question, or extra time before the task can proceed. Suppose, illustratively, that a simple yes/no question costs 0.1 units of interaction friction (c = 0.1) while a three-way question, being harder for a person to parse and answer, costs twice as much (c = 0.2). Compare QA (the balanced binary question, EIG = 1.000) and a hypothetical balanced three-way question at its theoretical ceiling (EIG = log2(3) ≈ 1.585, from the table's implied pattern):

U(QA) = 1.000 − 0.1 = 0.900      U(Q3-way) = 1.585 − 0.2 = 1.385

Even after paying double the friction cost, the three-way question still wins on net utility — but the margin (1.385 vs. 0.900) is narrower than the raw EIG gap alone would suggest (1.585 vs. 1.000), and if the friction cost of the harder question kept climbing — say, to 0.5, reflecting a question genuinely unpleasant for a user to answer — the ranking could flip entirely (U3-way = 1.585−0.5 = 1.085, still narrowly ahead, but a cost of 0.7 would flip it: 1.585−0.7 = 0.885 < 0.900). This is exactly why step 5 of the algorithm in Chapter 5 maximizes U(q), not EIG(q) directly — a question's raw information content is only half of what determines whether it is worth actually asking.

Where c(q) comes from, in a real deployment

The paper itself keeps c(q) simple — a constant, for tractability in its experiments — but flags that a real system has real options for what to measure there, and the choice matters. Three natural candidates:

Question length. A one-clause yes/no question costs less of the user's attention than a paragraph explaining a subtle distinction between two technical readings. Penalizing longer questions pushes the algorithm toward the same kind of concise, easy-to-answer question a thoughtful person would ask by instinct.
Expected answer length. A question that invites a one-word reply (“union or intersection?”) costs the user less than one that invites an open-ended paragraph. This is exactly the B-type-versus-O-type tension Chapter 5's code-generation experiment surfaced: O-type questions carry higher EIG ceilings (more possible answers, per Chapter 4's log2(n) relationship) but a c(q) that accounts for answer effort would rightly discount that ceiling for a human answerer, even though it costs nothing extra for an automated oracle like the one Chapter 5's code-generation experiment actually used.

The general point survives the specific choice: c(q) is where a system encodes everything about the human side of asking a question that EIG, by construction, cannot see — EIG only ever looks at how much the hypothesis space would shrink, never at how much friction the person on the other end would feel answering it. A production system tuning U(q) = EIG(q) − c(q) is really tuning how much it is willing to spend of a scarce, non-monetary resource — a real person's patience — per bit of ambiguity resolved.

A quick unit check: bits versus nats

Every EIG number in this chapter has been in bits — entropy computed with log2. Some papers, including parts of the disambiguation paper's own appendix, report entropy in nats instead, using the natural logarithm ln instead of log2. The conversion is a single constant factor, worth confirming by hand so a nats-reported number never gets silently misread as a bits number three times too small: ln(2) ≈ 0.6931, so

1 bit = ln(2) nats ≈ 0.6931 nats      1 nat = 1÷ln(2) bits ≈ 1.4427 bits

Sanity-check against this chapter's own headline number: the balanced binary question's EIG of exactly 1 bit, converted, should read as 0.6931 nats. Confirm directly from the definition: 1 bit = log2(2), and in nats that same quantity is ln(2) ≈ 0.693 — matching the conversion constant exactly, which is the whole point of a units cross-check: if it hadn't matched, that would have been a sign of an arithmetic slip somewhere upstream, not a sign the conversion constant itself needed adjusting.

A flag for later: what if the prior over H isn't actually uniform?

Every derivation in this chapter leaned on one simplifying assumption, stated back in the partition-view section: p*(h|S) is uniform over H. That assumption is doing real work — it is what let the messy, unknown true distribution collapse into the clean, computable partition formula this chapter built everything on top of. It is worth flagging, briefly, what happens if it doesn't hold, since Chapter 5 runs directly into a consequence of this. If some hypotheses are genuinely, objectively more likely than others — not because of any model's bias, but because they really are more probable interpretations of the request — then the uniform-prior EIG formula is an approximation, not an exact calculation, and the true EIG could rank candidate questions differently than this chapter's formula does. The paper's own stance, and this chapter's, is that uniformity is the right default assumption precisely because the true prior is unknown and any model-supplied alternative risks importing exactly the kind of unreliable bias Chapter 2 spent an entire chapter warning about. Chapter 5 makes this concrete: it tests exactly this question empirically, comparing the uniform assumption against weighting hypotheses by the model's own stated log-probabilities, and reports which one actually works better on real data.

Chapter 4 recap, before Chapter 5 puts it to work

Four ideas, in the order this chapter built them, worth holding onto as a single chain before Chapter 5 runs the full algorithm end to end: entropy H[p] measures how uncertain a distribution over candidate solutions is; information gain IG(q,a) is how much a specific question-and-answer pair reduces that uncertainty; expected information gain EIG(q) averages IG over every plausible answer, since the real answer isn't known in advance; and, under a uniform prior, EIG collapses to a clean partition-counting formula that is maximized exactly when a question splits the hypothesis space as evenly as possible. Every one of Chapter 5's worked numbers — 1.000 bit, 0.544 bits, 1.561 bits, the log2(n) ceiling — is that same four-step chain, applied once per candidate question, with nothing hidden inside it that this chapter hasn't already derived from Shannon entropy alone.

The same idea, stated one more way

If the formulas still feel abstract, one more restatement, in plainer terms, before moving to Chapter 5's full worked walkthrough: asking a good clarifying question is a search problem, and EIG is the search heuristic. Among every candidate question the model could ask, the goal is to find the one whose answer — whatever it turns out to be — is most likely to rule out the largest chunk of currently-plausible interpretations. A question that only ever rules out a sliver of the space, no matter which answer comes back, is a weak move; a question that is guaranteed to cut the space roughly in half, regardless of the answer, is a strong one. This is precisely the intuition behind classic binary-search algorithms — splitting a search space as evenly as possible at every step minimizes the expected number of steps needed to find the target — applied here not to a sorted array, but to the space of things a person might have meant.

Why does a yes/no clarifying question that splits the hypothesis space into 4-and-4 have higher expected information gain than one that splits it into 7-and-1, even though both have exactly two possible answers?

Chapter 5: Active Task Disambiguation, Worked

Chapter 4 built the scoring function. This chapter builds the algorithm that actually uses it — the paper's full method, called Active Task Disambiguation — and then runs it, by hand, end to end, on the spreadsheet example from Chapter 3.

Why not just ask the model to generate a good question directly?

The obvious approach is implicit reasoning: prompt the LLM with the ambiguous request and ask it to generate a clarifying question. The paper's central empirical claim is that this obvious approach underperforms, and it has a specific hypothesis for why: generating a genuinely discriminating question requires a form of meta-cognitive reasoning — the model has to reason about the shape of its own uncertainty across an entire space of possible solutions, all inside one forward pass, without ever writing any of those solutions down. That is a much harder ask than generating one solution, which is a skill LLMs already have plenty of practice at from pretraining. As the paper puts it, this “may be caused by a relatively small number of clarifying questions present in their pre-training corpus” — the internet is full of solved problems, and comparatively thin on someone visibly reasoning through which follow-up question to ask before solving one.

The fix is to stop asking the model to reason about questions in the abstract, and instead give it something concrete to reason about: actual candidate solutions. This is the paper's core move, stated plainly in its own words — the method “shifts the load from implicit to explicit reasoning about the space of viable solutions.” Sample some solutions, sample some candidate questions, and score each question by how well it would have discriminated among the solutions you already sampled, using the EIG formula from Chapter 4.

The algorithm, step by step

At each round of the conversation, given the current problem statement St:

1 · Sample N solutions
{hit} ∼ pφh(·|St), diverse and representative
2 · Sample M questions
{qjt} ∼ pφq(·|St), candidate clarifying questions
3 · Pseudo-answer each pair
for every (qj, hi): what would hi answer to qj?
4 · Estimate EIG(qj)
from the distribution of pseudo-answers, via Chapter 4's formula
5 · Pick q* = argmax U(q)
U(q) = EIG(q) − c(q), the cost-adjusted utility
6 · Ask, get real answer a*
St+1 = St ∪ (q*, a*) — repeat

Step 4's EIG estimate does not need to know the true, unknown p*(h|S) at all — it only needs the sample of N candidate solutions the model already generated in step 1, and the pseudo-answers from step 3. The paper's Algorithm 1 makes this concrete:

python
def estimate_EIG(question, pseudo_answers):
    # pseudo_answers: list of N answers, one per sampled candidate solution h_i,
    # describing how h_i would answer `question`
    unique = set(pseudo_answers)
    n = len(pseudo_answers)
    ig = 0.0
    for a in unique:
        n_k = pseudo_answers.count(a)
        p_k = n_k / n
        ig -= p_k * math.log2(p_k)      # Shannon entropy of the answer distribution
    return ig   # this IS the EIG estimate -- entropy of pseudo-answers approximates EIG

Notice this is the same underlying identity as Chapter 4's partition formula, just computed empirically from a sample instead of algebraically from exact group sizes: the entropy of the distribution of pseudo-answers is the EIG estimate, because a question that splits your N sampled solutions evenly across its possible answers has high answer-entropy, and a question where all N samples give the same answer (uninformative — it does not discriminate among your candidates at all) has zero answer-entropy.

Why N=20 and M=5, specifically?

The paper's own 20-questions experiment samples N=20 candidate solutions and M=5 candidate questions at every round — specific numbers worth understanding, not just copying. N, the number of sampled solutions, trades off estimation quality against cost: too small an N and the pseudo-answer distribution in Algorithm 1 is noisy (exactly the kind of sampling error the N=5 worked example below will make concrete), producing an unreliable EIG estimate; too large an N multiplies the number of pseudo-answering calls in step 3 (N solutions times M questions, all needing an answer) without much further improvement, since Study 1's validation against a 500-animal reference list found N=20 already tracked the larger ground-truth estimate well. M, the number of candidate questions, trades off differently: it does not affect estimation noise the way N does, since each question's EIG is estimated independently — a small M simply means fewer candidate questions are compared before picking the best one, risking that the single best possible question in principle was never actually generated as a candidate to begin with. M=5 is a compute-budget choice as much as a statistical one: five separate solution-samplings, once per candidate question, sets the total inference cost of one round of the algorithm at roughly N + M×N pseudo-answering calls (sample N solutions once, then pseudo-answer all N against each of the M candidates) — a cost Chapter 9's discussion of the method's own limitations returns to directly.

Pseudo-answering by hand, on a small sample

To see step 3 and step 4 actually run, shrink the running spreadsheet example down to N=5 sampled candidate solutions (rather than the full population of 8) — this is closer to how the algorithm really operates in practice, since it never has direct access to the full H, only to a finite sample drawn from pφh. Suppose the model samples these five candidate solutions for “combine these two spreadsheets”: h2 (single table, union, by ID), h3 (single table, union, by position), h4 (single table, intersection, by position), h6 (separate tabs, union, by position), h8 (separate tabs, intersection, by position). Now pseudo-answer question QA (“single table or separate tabs?”) against each of the five:

Sampled hiPseudo-answer to QA
h2“single table”
h3“single table”
h4“single table”
h6“separate tabs”
h8“separate tabs”

Three of five pseudo-answers say “single table,” two say “separate tabs” — a 3/5 split rather than the population's true 4/4, simply because this particular sample of 5 happened not to mirror the full population exactly (a real, expected effect of sampling only 5 out of 8, not an error). Run estimate_EIG on this pseudo-answer distribution by hand:

psingle = 3÷5 = 0.6,   pseparate = 2÷5 = 0.4
EIG-estimate = −[0.6·log2(0.6) + 0.4·log2(0.4)] = −[0.6×(−0.737) + 0.4×(−1.322)] = 0.442+0.529 = 0.971 bits

0.971 bits — close to, but not exactly, the true population value of 1.000 bit computed from the full partition in Chapter 4. That gap (0.029 bits) is exactly what “estimated from a sample” means in practice: the paper's own Study 1 (below) checks precisely this kind of estimation error, at a larger scale, by comparing EIG estimated from N=20 samples against a “ground truth” EIG computed from a much larger reference list, and reports that the small-sample estimate tracks the larger one well enough to be a useful proxy — not perfect, but good enough to reliably rank candidate questions against each other, which is all step 5 of the algorithm actually needs it to do.

The worked example: three candidate questions, one ambiguous request

Return to Chapter 3's request — “combine these two spreadsheets” — and the eight solutions it identified, built from three independent yes/no choices: structure (single table vs. separate tabs), row policy (keep all rows/union vs. only matching rows/intersection), and alignment (match by shared ID column vs. match by row order). Two choices each, three independent axes, 2×2×2 = 8 distinct candidate solutions h1…h8, and with no information yet distinguishing any of them, Hbefore = log2(8) = 3 bits, exactly as set up in Chapter 4.

Three candidate clarifying questions, each corresponding to a different partition of those 8 hypotheses:

Candidate questionWhat it asks aboutPartition of HEIG
QA“Should the result be one combined table, or should the files stay as separate tabs?”4 / 4 (structure axis, perfectly balanced)1.000 bits
QB“Is this a one-time export, or an ongoing weekly report?”7 / 1 (only affects one edge-case reading)0.544 bits
QC“Should rows be matched by ID, by position, or should nothing be matched at all (kept separate)?”3 / 3 / 2 (three-way, nearly balanced)1.561 bits

QA's and QB's EIG values are the exact two numbers derived by hand in Chapter 4. QC is new: a three-way question (n=3), with sampled solutions splitting 3/3/2 across its three answers — as close to even as 8 objects can get split three ways.

E[Hafter, QC] = (1÷8)·[3·log23 + 3·log23 + 2·log22] = (1÷8)·[3(1.585) + 3(1.585) + 2(1)] = (1÷8)×11.51 = 1.439 bits
EIG(QC) = 3 − 1.439 = 1.561 bits

QC beats QA — more answer options (n=3 vs. n=2), close to evenly split, land close to that option's theoretical ceiling of log2(3) ≈ 1.585 bits (Chapter 4's formula). This is the “more answer options can mean more information, at the cost of a harder question” tradeoff made concrete: QC teaches more per question, but asks the user to choose among three options instead of two. Under the utility function U(q) = EIG(q) − c(q), whether QC is actually worth asking depends on how much heavier its cost c(q) is versus QA's — the algorithm from Chapter 5's flow diagram would compute U for all three and let that comparison decide, rather than assuming more options is always better.

Partitioning the hypothesis space

All 8 spreadsheet-merging hypotheses, colored by which answer-group each candidate question sorts them into. Switch questions and watch the partition — and the resulting EIG — change.

candidate question

Does this actually work on real LLMs? The paper's own experiments

The worked example above is this lesson's own construction, built to make the arithmetic transparent — but the paper runs the identical idea against real models on two real tasks, and the results are the paper's central evidence.

Experiment 1: the 20 Questions game. One LLM (simulated with GPT-4o-mini) thinks of an animal; another LLM tries to guess it within 10 rounds of yes/no-style questions, across 15 different ground-truth animals and 5 seeds each. Four question-generating strategies are compared: implicit (generate one question directly), implicit-ToT (sample 5 candidate questions, then ask the LLM to pick the best one from that set — a Tree-of-Thought-style strategy), EIG-uniform (sample 5 candidate questions, score each by estimated EIG assuming a uniform prior over sampled solutions — exactly the recipe in this chapter), and EIG-logprobs (same, but weighting solutions by the LLM's own log-probabilities instead of assuming uniformity). EIG-uniform “outperforms the remaining strategies by a significant margin” — beating both implicit and implicit-ToT confirms that shifting the reasoning load from questions to solutions genuinely helps, and EIG-uniform beating EIG-logprobs confirms something else important: the model's own raw generative distribution over solutions is not a trustworthy stand-in for the true distribution p*(h|S) — exactly the “uniformity of the unknown” assumption Chapter 4 built on, now empirically justified.

Why weighting by the model's own confidence backfires, illustrated

It is worth seeing why EIG-logprobs underperforms, not just that it does. Return to the eight-hypothesis spreadsheet example. EIG-uniform treats all eight candidate solutions as equally likely when estimating EIG — exactly Chapter 4's assumption. EIG-logprobs instead weights each sampled solution by the model's own stated probability for it. Suppose the model is (wrongly) quite confident that a “single table, union, by ID” interpretation (h2) is the intended one, assigning it 40% of its own probability mass, while spreading the remaining 60% across the other seven hypotheses roughly evenly (≈8.6% each):

Hbefore (logprobs-weighted) = −[0.40·log2(0.40) + 7×0.0857·log2(0.0857)] ≈ −[0.40×(−1.322) + 7×0.0857×(−3.544)] ≈ 0.529+2.127 = 2.656 bits

Already lower than the true uniform prior's 3.000 bits, purely because the model's own (potentially wrong) confidence in h2 makes the starting distribution look less uncertain than it genuinely is. If the model's bias toward h2 happens to be mistaken — if the requester actually wanted something else entirely — every downstream EIG estimate computed relative to this artificially-shrunk 2.656-bit baseline inherits that same mistake, systematically undervaluing questions that would have helped distinguish away from the model's own favored (and possibly wrong) guess. EIG-uniform never makes this mistake, because by design it refuses to let the model's own generative bias influence the entropy calculation at all — every hypothesis starts on equal footing, regardless of how strongly or weakly the model itself favors any one of them. This is the concrete mechanism behind the paper's own explanation for the result: trusting pφh as a stand-in for p* imports whatever bias pφh already has, and Chapter 2 spent an entire chapter establishing that an LLM's raw, unexamined confidence is exactly the kind of number not sitting there worth trusting uncritically.

Experiment 2: active code generation. Starting from an ambiguous function stub (imports, header, a short docstring — following the CodeT benchmark setup), the model asks clarifying “questions” that are really either binary test-case assertions (B-type: true/false) or concrete input→output examples (O-type: run this input, tell me the expected output) — both automatically, noiselessly answered by running the ground-truth program, exactly the kind of external, hallucination-free oracle Chapter 3 flagged as ideal for grounding p̃*. Tested on HumanEval and a harder, competition-level benchmark called APPS (filtered to 48 genuinely non-trivial tasks), EIG-based question selection reaches higher accuracy after eliciting just 4 requirements than zero-shot question generation does — and O-type (open, more answer options) questions prove more informative than B-type (binary) ones, exactly matching Chapter 4's log2(n) prediction that more answer options raise the ceiling on information gain, at the cost of a harder question to answer.

One more grounded number, for scale. GPT-4o-mini's zero-shot accuracy (no clarifying questions at all) sits around 70% on HumanEval but only around 35% on APPS — confirming APPS really is the harder, more underspecified benchmark of the two, and giving a sense of how much headroom active disambiguation has to work with on a benchmark where the model is already struggling for reasons beyond ambiguity alone.

Two supporting studies: why the method's assumptions actually hold

Two of the assumptions this chapter leaned on — that sampled solutions can be made close to uniformly diverse, and that filtering out hallucinated pseudo-answers matters — are not just asserted in the paper. Both get their own dedicated ablation.

Study 2: does the “diverse and representative” prompt instruction actually work? Step 1 of the algorithm needs sampled solutions {hi} to approximate a roughly uniform draw over H, not a draw concentrated on whatever single answer the model would give greedily. The paper tests this directly by adding the instruction “generate a carefully selected, diverse, and representative set of animals” to the solution-sampling prompt in the 20-questions experiment, and measuring a diversity score (conditional mutual information between sampled solutions and their pseudo-answers — higher means the samples are covering the hypothesis space more evenly) across 330 real questions collected from the main experiment:

Samples drawn (N)With “diverse” instructionWithout (vanilla prompt)
100.570.46
200.580.54
300.600.58

The diversifying instruction measurably raises the diversity score at every sample size tested, and the gap is largest exactly where it matters most — at the smallest, cheapest sample size (N=10: 0.57 vs. 0.46), where an unlucky, narrow sample would do the most damage to the EIG estimate's accuracy. As N grows, both columns climb and the gap narrows (by N=30, 0.60 vs. 0.58) — more samples partially compensate for a less diversity-encouraging prompt on their own, simply by averaging out unlucky draws, which is exactly the kind of relationship you would expect between prompt engineering and sample size as two different levers on the same underlying problem.

Study 3: does filtering out hallucinated pseudo-answers matter? Step 3 asks the model to self-critically check whether each sampled solution actually still satisfies every requirement collected so far, rejecting and resampling any that don't — a defense against hallucinated candidates polluting the EIG estimate. The paper tests 0, 1, and 2 rounds of this filtering, and reports that as the number of accumulated requirements grows across the conversation (more rounds of clarification means more constraints a hallucinating model can silently violate), the gap between 0 filtering rounds and 1–2 rounds widens — more filtering keeps paying off precisely as the task gets more constrained, which is exactly when an unfiltered sample would be most likely to include solutions that only look valid.

The two experiments, side by side

It is worth naming exactly what differs between the paper's two evaluations, because the differences are not incidental — they were chosen specifically to test the hypotheses in H2a and H2b from Chapter 5's own framing (whether the LLM can sample diverse solutions, and whether pseudo-answers are noise-free).

Experiment 1: 20 QuestionsExperiment 2: Active code generation
Ground-truth H*Singleton — one specific animalPrograms passing hidden test cases; many valid h can exist
Who answers questionsAn LLM (GPT-4o-mini), simulating a humanAn external Python interpreter, running the ground-truth program
Answer noisePresent — the answering LLM can itself be wrong or inconsistentNear zero — code execution is deterministic and checkable
Question types testedYes/no onlyBinary (B) and open input→output (O)
What it isolatesH1 — does explicit reasoning over solutions beat implicit question generationH2b — does the method still win when pseudo-answering is (almost) noise-free

The pairing matters for how much to trust the overall conclusion. Experiment 1 tests the core hypothesis under realistic, noisy conditions — an LLM oracle that can itself make mistakes, closer to what a real deployment answering real clarifying questions from real humans would look like. Experiment 2 strips that noise out almost entirely, isolating whether the EIG-based method's advantage survives even in the best-case scenario where pseudo-answering is essentially free of error. Both experiments reaching the same qualitative conclusion — EIG-based selection beats implicit generation — is stronger evidence than either alone, because it rules out the possibility that the result was somehow an artifact of one specific kind of answer-oracle noise rather than a genuine property of the question-selection method itself.

Why does sampling actual candidate solutions first, and scoring questions against those samples, outperform simply asking an LLM to generate a good clarifying question directly?

Chapter 6: Confidence Tokens

Chapter 2 showed that both of the obvious confidence signals — raw logits and verbalized confidence — are measurably unreliable. This chapter builds what the confidence-tokens paper proposes instead: Self-REF (Self-Reflection with Error-based Feedback), a lightweight fine-tuning recipe that teaches a model to emit a genuinely learned, trained-for-the-purpose confidence signal, rather than hoping one falls out of ordinary training for free.

The core idea: two new tokens, trained on correctness

Self-REF adds two special tokens to the model's vocabulary — <CN> (confident) and <UN> (unconfident) — each with its own trainable embedding, initialized as the average of the existing token embeddings. The model is fine-tuned so that, after generating its answer, it also learns to append one of these two tokens: <CN> if that answer turned out to be correct, <UN> if it turned out to be wrong. The recipe has three steps.

Why an internal token, and not an external router model?

An alternative architecture is worth naming before diving into Self-REF's mechanics, because it is the more obvious first idea and the paper explicitly positions itself against it. A large body of prior LLM-routing work trains a separate classifier — a small external router network — that looks only at the incoming query and predicts which model should handle it, before either model has generated anything. The paper's related-work discussion names this pattern directly (citing Ding et al., 2024; Ong et al., 2024; Stripelis et al., 2024, among others) and draws a sharp distinction: those routers “typically rout[e] based on the query alone with an extra router,” deciding before any answer exists, whereas Self-REF's confidence token is “generated end-to-end conditioned on both the prefix query and the answer that the LLM itself generated.”

That difference is not a minor implementation detail. An external, query-only router can only ever learn “how hard does this type of question tend to be for the small model, on average” — it has no access to how the small model's specific attempt at this specific query actually went. Two MMLU questions from the same subject, at the same apparent difficulty, can get very different treatment from Self-REF depending on whether the model's own generated answer, this one time, happened to land somewhere confident or somewhere shaky — a distinction a query-only router structurally cannot see, because it never looks at the answer at all. This is also why Self-REF needs no separate model, no separate training pipeline, and no separate inference call beyond the one the small model was already making: the confidence signal rides along for free inside the same autoregressive pass that produced the answer being judged.

Step 1: Confidence token annotation

Run the base model on the training set to get its own predictions ŷ(i) for every example, then compare each prediction against the true label y(i). Where the model was right, append <CN>; where it was wrong, append <UN>:

python
def annotate_confidence_tokens(model, train_data, alpha=0.5):
    # train_data: list of (x, y) query/true-answer pairs
    confident, unconfident = [], []
    for x, y in train_data:
        y_hat = model.predict(x)
        if y_hat == y:
            confident.append((x, y_hat, '<CN>'))
        else:
            unconfident.append((x, y_hat, '<UN>'))
    # subsample the unconfident set with tunable proportion alpha,
    # to keep the class balance from skewing training toward one label
    unconfident = subsample(unconfident, alpha)
    return confident + unconfident

The alpha subsampling matters in practice: if the base model is already fairly accurate, correct (<CN>) examples will vastly outnumber incorrect (<UN>) ones, and training on that imbalance as-is risks the model learning to always predict <CN> regardless of actual correctness — a shortcut that would score well on raw accuracy of the confidence label while being completely uninformative. Subsampling keeps the model honestly exposed to enough unconfident examples to learn the distinction, not just the class prior.

A worked example of the imbalance alpha corrects for

Ground the abstract concern with numbers. Suppose the base model is 78% accurate on 10,000 training examples — a plausible accuracy for a capable small model on a benchmark like MMLU. Before any subsampling, the raw annotated dataset has:

7,800 confident (<CN>) examples      2,200 unconfident (<UN>) examples

A model trained on this 78/22 split, with no correction, can already achieve 78% training accuracy on the confidence-label task alone by memorizing the class prior — always predicting <CN> — without learning anything at all about which specific queries it should trust. Setting α = 0.5, meaning keep only half of the unconfident examples relative to what would make the classes exactly balanced, targets a roughly 2,200÷0.5 ÷ (7,800+2,200÷0.5) ratio — concretely, subsampling the confident set down to match a 2:1 ratio against the (now smaller) unconfident set forces the model to actually discriminate, rather than coast on the prior. The paper leaves α itself as a tunable hyperparameter precisely because the right balance point depends on how skewed the base model's raw accuracy already is — a much weaker base model, closer to 50% raw accuracy, would need far less correction, since its classes would already be close to balanced on their own.

Step 2: Fine-tuning, with a crucial safeguard

The straightforward version of this fine-tuning step has a subtle trap. If you naively train the model to reproduce the entire augmented sequence — including generating the incorrect answer text itself, followed by <UN> — ordinary cross-entropy fine-tuning would increase the probability of that wrong answer given that query, exactly the opposite of what you want. You would be actively teaching the model to be more likely to reproduce its own mistake next time, purely as a side effect of teaching it to correctly label that mistake as unconfident.

The fix is gradient masking: mask out the gradient contribution from the incorrect-answer tokens themselves in the unconfident examples, so those tokens never get reinforced. What remains flows freely: the model still learns to increase P(<CN> | correct answer, query), to increase P(<UN> | incorrect answer, query), and — through the ordinary confident-example gradient, which is not masked — to increase P(correct answer | query) overall.

Concept → realization. Without gradient masking, Self-REF would be training the model on two contradictory signals at once: “be more likely to say this” (from ordinary cross-entropy on the wrong-answer tokens) and “but also, know that this is wrong” (from the <UN> token). Masking resolves the contradiction by simply never applying the first signal on incorrect examples. The paper's own ablation (Section 5.4) confirms this is not a minor detail: Self-REF fine-tuned with gradient masking consistently beats Self-REF without it on downstream routing accuracy, on both Llama3-8B-Instruct and Mistral-7B-Instruct — exactly the outcome you would expect if masking is preventing the model from learning spurious patterns baked into its own uncertain, incorrect outputs.

Seeing the gradient direction, one token at a time

Make the mechanism fully concrete with a toy cross-entropy update. Suppose an unconfident example's target sequence is the (wrong) answer token W followed by <UN>, and at some point during training the model currently assigns P(W|query)=0.3 and P(<UN>|W,query)=0.4. Ordinary cross-entropy fine-tuning computes a loss term for every token in the target sequence and back -propagates a gradient that increases the probability of each one:

loss = −log P(W|query) − log P(<UN>|W,query) = −log(0.3) − log(0.4) = 1.204 + 0.916 = 2.120

Both terms in that sum push gradients in the same direction: increase the probability of whatever token they attach to. The first term's gradient increases P(W|query) — the wrong answer itself. The second term's gradient increases P(<UN>|W,query) — the honest confidence label. Without gradient masking, the optimizer treats both as equally worth reinforcing, and every training step on this example nudges the model to be a little more likely to output W again next time it sees a similar query — even though W was established, in the very same example, to be wrong.

Gradient masking simply zeroes out the first term's contribution to the backward pass, leaving the loss the optimizer actually acts on as:

lossmasked = −log P(<UN>|W,query) = −log(0.4) = 0.916

Note that P(W|query) still appears in the forward pass — the model still needs to have generated W in order to reach the position where <UN> gets predicted — but no gradient flows back through it during this update. Nothing in this masked version pushes the model toward regenerating W more often; the entire update's signal is now concentrated on one thing: getting better at recognizing, after the fact, that W (or an answer like it) deserves an unconfident label. Extended across an entire training set of unconfident examples, this is the difference between a model that slowly, invisibly, gets nudged toward repeating its own past mistakes, and one that only ever gets better at flagging them.

Step 3: Extracting a continuous confidence score

After fine-tuning, the model does not just output a discrete <CN>/<UN> label — both tokens still have their own softmax probabilities at the position right after the answer, and those two numbers can be turned into a continuous score between 0 and 1:

cM(x, ŷ) = P(<CN>) ÷ (P(<UN>) + P(<CN>))

This normalizes by the sum of just these two tokens' probabilities, ignoring how much probability mass went elsewhere in the vocabulary at that position — which matters, since <CN> and <UN> are competing against every ordinary continuation token too, not just each other.

A worked example

Suppose, at the position right after a generated answer, the fine-tuned model assigns raw softmax probability 0.62 to <CN> and 0.11 to <UN> (with the remaining 0.27 spread across ordinary vocabulary tokens that happen to also be plausible continuations at that position). The confidence score is:

cM = 0.62 ÷ (0.11 + 0.62) = 0.62 ÷ 0.73 = 0.849

An 84.9% confidence score — a genuine number, thresholdable, and (per Table 2 from Chapter 2) considerably more trustworthy than either raw logits or verbalized confidence, because it was produced by a token the model was specifically fine-tuned, with gradient masking, to align against actual correctness.

Two downstream uses of the same score

Once cM(x, ŷ) exists, the paper studies two different things a deployed system can do with it, against a chosen threshold t:

Confidence-based routing. When cM(x, ŷ) < t, send the query to a larger, more capable (and more expensive) model instead of trusting the small model's answer. When cM(x, ŷ) ≥ t, return the small model's own answer directly. This is the mechanism Chapter 7 builds a full cost-coverage analysis around.
Confidence-based rejection. When no larger model is available at all, low confidence instead triggers abstention — the system says “I don't know” rather than guessing. The paper tests this by constructing an evaluation set where half the questions have their correct answer choice removed entirely and relabeled “none of the above”; a well-calibrated model should assign low confidence to any answer it is forced to give on those questions, and the paper reports this abstention signal reliably outperforms the same four baselines from Chapter 2's table, evaluated as an ROC curve (correctly-rejected “none of the above” cases against falsely-rejected valid ones).

Reading a rejection threshold by hand, on a toy batch

To make the ROC framing concrete, work a small toy batch of 20 questions: 10 genuine multiple-choice questions (correct answer choice intact) and 10 “none of the above” questions (correct choice removed). Suppose, at some chosen threshold t, the model abstains (assigns cM < t) on 8 of the 10 “none of the above” questions, and also, unfortunately, on 2 of the 10 genuine questions:

true positive rate (TPR) = correctly-rejected ÷ total should-reject = 8÷10 = 0.80
false positive rate (FPR) = wrongly-rejected ÷ total should-answer = 2÷10 = 0.20

At this threshold, the system catches 80% of the genuinely unanswerable questions, at the cost of also wrongly abstaining on 20% of questions it could have answered correctly. Lowering t (harder to trigger abstention) would move both numbers down together — fewer of the truly bad questions get caught, but fewer good ones get needlessly rejected too; raising t moves both up together. Sweeping t across its whole range and plotting TPR against FPR at each value is exactly what an ROC curve is, and a model whose confidence score genuinely tracks correctness (rather than being noise, which would trace the diagonal TPR=FPR line) rises steeply toward the top-left corner — high TPR, low FPR — well before t reaches its extreme values. The paper reports Self-REF's rejection-learning ROC curve sitting consistently above all four Chapter 2 baselines across this exact tradeoff, on both MMLU and OpenBookQA.

A second point on the curve, and what “better” looks like across two points

One point on an ROC curve, on its own, cannot say whether a confidence signal is good — it only describes one specific operating choice. Add a second, stricter threshold to the same toy batch: raise t so the model now abstains on 9 of the 10 “none of the above” questions, but that stricter bar also catches 4 of the 10 genuine questions this time:

TPR2 = 9÷10 = 0.90      FPR2 = 4÷10 = 0.40

Plot both points on the same TPR-versus-FPR axes: (0.20, 0.80) from the looser threshold, (0.40, 0.90) from the stricter one. Both sit well above the diagonal TPR=FPR line a random, uninformative confidence score would trace — at FPR=0.20, random guessing would only catch 20% of bad questions on average, not 80%. This is the concrete meaning behind “Self-REF's ROC curve sits above the baselines”: at any FPR you are willing to tolerate, tracing straight up from that x-value to Self-REF's curve lands higher (more bad questions correctly caught) than tracing up to any baseline's curve at that same FPR. A confidence signal is not “good” or “bad” at one fixed threshold — it is good or bad as a curve, compared against alternatives across the whole range of tradeoffs a deployment might choose to operate at, which is exactly why the paper reports full ROC curves (Figure 3) rather than a single TPR/FPR pair per method.

Notice what Self-REF does not require. No new loss function, no external judge model, no separate router network trained on top of the LLM. The confidence signal lives inside the same model that produced the answer, generated in the same autoregressive pass, conditioned on the model's own generated output — which is exactly why it can capture something a query-only external router cannot: whether this specific answer, not just this type of question in the abstract, seems trustworthy.

Does the confidence signal transfer to new domains?

One more question worth flagging, since it goes directly to how deployable this technique is: if you fine-tune Self-REF's confidence tokens on one dataset, do they carry any signal on a genuinely different one, or does every new domain need its own dedicated fine-tuning pass from scratch? The paper studies exactly this (Section 5.5, “Transferability of Confidence Token”), evaluating whether confidence tokens trained on one benchmark still carry meaningful signal when applied to a held-out domain the fine-tuning never saw. This matters operationally: a Self-REF pass trained once on a broad, general-knowledge benchmark like MMLU that transfers reasonably well to a narrower domain would be far cheaper to deploy than a bespoke fine-tuning run per downstream task category. Whether or not full transfer holds, the underlying question is the same one Chapter 9 returns to as a genuine limitation of the whole confidence-tokens approach: how much of what Self-REF learns is “this specific model, on this specific benchmark's notion of correctness” versus a more general skill at self-assessment that would carry to an entirely new task category without retraining.

Recap: the full Self-REF pipeline, start to finish

Six chapters' worth of individual pieces, assembled into one sequence:

1 · Annotate
run base model on training data, label <CN>/<UN> by correctness, subsample α
2 · Fine-tune
cross-entropy on the augmented data, gradient-masked on wrong-answer tokens
3 · Extract
cM = P(<CN>) ÷ (P(<CN>)+P(<UN>)) on every new query
4 · Threshold
sweep t against a held-out set to find the routing rate hitting your accuracy target
5 · Deploy
route below t, answer directly at or above t — Chapter 7's cost-coverage curve, live

Every step in that chain is something this chapter derived from first principles rather than asserted — step 1's subsampling rationale, step 2's gradient-masking mechanism worked through one toy loss computation, step 3's normalization formula worked through one concrete probability pair, and steps 4–5 handed off directly to Chapter 7's real, measured numbers. Nothing in this pipeline requires touching the base model's architecture, and nothing requires abandoning whatever the base model already does well — the entire intervention is two new tokens, one careful fine-tuning pass, and a threshold.

Why does Self-REF mask the gradient on the incorrect-answer tokens when fine-tuning on unconfident (<UN>) examples?

Chapter 7: The Cost-Coverage Tradeoff

Chapter 6 built the confidence score. This chapter asks the operational question it exists to answer: given that score, at what threshold should a deployed system actually route queries to the larger, more expensive model — and what does that decision cost, and save?

Setting the threshold: sweeping quantiles

Rather than pick one threshold t by hand, the paper sweeps a whole range: compute the confidence score for every query in a held-out set, then set t at each of 21 quantiles of that distribution (roughly every 5%, from the 0th to the 100th percentile). Each threshold routes a different fraction of queries to the large model — a threshold at the 0th percentile routes nothing (pure small model), a threshold at the 100th percentile routes everything (pure large model). Sweeping the whole range traces out a full accuracy-versus-routing-rate curve, letting you read off, for any accuracy target, the cheapest routing rate that hits it.

The headline result

On MMLU, Self-REF-routed Llama3-8B-Instruct reaches accuracy 0.739 — identical, to three decimal places, to sending every single query to Llama3-70B-Instruct alone — while routing only 39% of queries to the larger model. The other 61% of queries are answered directly by the small model and are already trustworthy enough, by Self-REF's own honest accounting, that sending them onward would not improve the answer. The full picture across all four benchmarks, and both small local models tested:

Small modelDatasetMin. routing rate for full-70B parityAccuracy achievedLatency at that rateSpeedup vs. always-70B
Llama3-8B-InstructMMLU39%0.739 (vs. 0.739)0.145 sec/tok2.03×
OpenBookQA49%0.781 (vs. 0.781)0.172 sec/tok1.69×
GSM8K65%0.816 (vs. 0.819)0.220 sec/tok1.33×
MedQA40%0.619 (vs. 0.622)0.147 sec/tok2.00×
Mistral-7B-InstructMMLU70%0.735 (vs. 0.739)0.234 sec/tok1.25×
OpenBookQA50%0.778 (vs. 0.781)0.147 sec/tok2.00×
GSM8K75%0.815 (vs. 0.819)0.240 sec/tok1.20×
MedQA70%0.621 (vs. 0.622)0.234 sec/tok1.25×

Two patterns worth noticing. First, GSM8K needs by far the highest routing rates (65–75%) — grade -school math word problems are exactly the kind of task where a smaller model's raw capability gap, not miscalibration, is the bottleneck, so more queries genuinely need the larger model's extra capability. Second, Llama3-8B-Instruct routes at a consistently lower rate than Mistral-7B-Instruct across every dataset — Self-REF is a fine-tuning recipe applied to whatever base model you give it, and how well it works is bounded by how much genuine signal the base model's confidence carries in the first place.

Reading the GSM8K gap through Chapter 3's lens

It is worth reconnecting GSM8K's 65% routing rate back to Chapter 3's model-uncertainty-versus-ambiguity split, because it is a clean illustration of a case where confidence-based routing is doing exactly what it should, even though the routing rate looks “worse” than MMLU's. GSM8K questions are unambiguous — each has exactly one numerically correct answer, so H = H* for essentially every question in the benchmark; the requirement side of the problem is fully specified. What varies is whether the small model's arithmetic and multi-step reasoning is actually strong enough to reach that one correct answer. This is squarely the top-left/bottom-left column of Chapter 3's table — unambiguous tasks, where the only question is whether the model's own uncertainty is high or low — not a case where a clarifying question would help at all (there is nothing left to clarify), which is exactly why GSM8K's fix is routing to a more capable model (Chapter 6–7's machinery), not asking a follow-up question (Chapters 4–5's machinery). A 65% routing rate on GSM8K is not evidence that Self-REF's confidence signal is failing on this benchmark — it is evidence that the confidence signal is working exactly as designed, correctly reporting that a large genuine majority of grade-school math problems are hard enough, for this particular small model, that a bigger model really does help.

Two currencies: latency and dollars do not always move together

Table 1 reports both accuracy and per-token latency, and it is tempting to treat “faster” and “cheaper” as interchangeable, but they are measuring genuinely different resources, and a real deployment often has to trade one against the other. Latency (seconds per token) is primarily a function of model size and hardware — a smaller model is faster essentially by definition, since it has fewer parameters to push through on every forward pass. Dollar cost, especially against a hosted API, often follows a different curve entirely: providers price frontier models at a premium well beyond what their extra latency alone would suggest, because the pricing also reflects training cost amortization, demand, and the value of the extra capability, not FLOPs alone. Two consequences worth naming. First, a deployment optimizing purely for user-facing responsiveness (latency) and one optimizing purely for operating budget (dollar cost) can land on different optimal routing rates, even when starting from the identical Self-REF confidence scores — the same threshold sweep produces one accuracy-vs-latency curve and a differently-shaped accuracy-vs-dollar-cost curve, and Chapter 7's canvas widget only plots the latency version. Second, this is exactly why a production system's threshold t is a business decision as much as a statistical one: it requires knowing which resource — user-facing speed, or operating budget, or both jointly — the deployment actually needs to conserve, information that lives entirely outside anything Self-REF's confidence score itself can tell you.

What happens if the base model changes?

Table 1's two small models give a direct, measured answer to a question every deployment eventually faces: how much does the routing-rate cost depend on which base model Self-REF was fine-tuned onto? Compute the ratio of Mistral-7B-Instruct's required routing rate to Llama3-8B-Instruct's, dataset by dataset:

DatasetLlama3-8B routeMistral-7B routeRatio (Mistral ÷ Llama)
MMLU39%70%1.79×
OpenBookQA49%50%1.02×
GSM8K65%75%1.15×
MedQA40%70%1.75×

Averaging those four ratios: (1.79+1.02+1.15+1.75)÷4 ≈ 1.43 — Mistral-7B-Instruct needs, on average across these four benchmarks, roughly 43% more of its traffic routed to the large model to hit the same accuracy-parity bar Llama3-8B-Instruct reaches with less. Since routing rate translates close to linearly into both latency and dollar cost (the linear cost model derived earlier in this chapter), that 43% gap is not just a routing-rate curiosity — it is directly, proportionally, a cost gap between the two base models once Self-REF is applied to each. The lesson generalizes past these two specific models: Self-REF is a fine-tuning recipe, and how cheaply it lets you operate depends on how much genuine, extractable correctness signal the base model already carries in its own generative distribution before Self-REF ever touches it — a better base model is not just more accurate on its own, it can also end up cheaper to deploy under confidence-based routing, because it needs the expensive fallback less often.

Building the cost curve, from two real anchor points

The “All in Llama3-70B-Instruct” row reports 0.292 sec/token, constant across every dataset — sensible, since that number depends only on the large model itself, not on which benchmark is being served. That is the true, reported latency at routing rate r=1 (everything goes to the big model). The MMLU row's 0.145 sec/token is the true, reported latency at r=0.39 (Self-REF's actual operating point on that benchmark). Modeling the blended latency as a simple linear function of the routing rate — a reasonable first approximation, since at any given moment a fraction r of queries pay the large model's cost and a fraction (1−r) pay the small model's — lets you back out what the implied small-model-only latency (r=0) would have to be:

latency(r) = (1−r)·latencysmall + r·latencylarge
0.145 = (1−0.39)·latencysmall + 0.39×0.292 = 0.61·latencysmall + 0.1139
latencysmall = (0.145 − 0.1139) ÷ 0.61 = 0.0311 ÷ 0.61 ≈ 0.051 sec/token

That 0.051 is not a number the paper reports directly — it is an estimate, back-solved from two real reported numbers under the assumption of a simple linear cost blend. It is a useful sanity check, though: the small model alone should cost meaningfully less per token than the blended 0.145 figure, and 0.051 is indeed well under it, in the direction the physics of the problem demands.

Where cost and coverage actually trade off

With that linear model in hand, you can now ask the operational question directly: what happens if you route less than 39% of MMLU queries, to save even more cost? The linear model says latency keeps dropping smoothly — at r=0.20, for instance, predicted latency is 0.8×0.051 + 0.2×0.292 ≈ 0.099 sec/token, nearly 3× faster than always using the large model. But the accuracy side of the tradeoff does not extend that smoothly with any number this session has reported: 39% is the paper's measured minimum routing rate for matching 70B-level accuracy on MMLU specifically; below it, the paper's own language only supports “accuracy is lower than parity,” not any specific number for how much lower. That boundary — the exact routing rate where accuracy-parity starts holding — is precisely what the threshold sweep in Table 1 exists to find, dataset by dataset, rather than something you could derive from cost math alone.

Cost versus coverage, MMLU / Llama3-8B-Instruct

The warm line is the linear latency model just derived; the two solid dots at r=0.39 and r=1.0 are the paper's own reported numbers. The teal band marks where Self-REF's reported accuracy-parity result actually holds — below r=0.39, this session has no measured accuracy curve to show you, which the shaded region is deliberately honest about.

routing rate r39%

An illustrative dollar example

To feel the economics at typical API pricing shapes — purely illustrative unit costs, not figures from either paper — suppose the small model costs $0.20 per 1,000 output tokens and the large model costs $3.00 per 1,000 output tokens (roughly the order-of-magnitude gap between a small open model and a frontier closed one). At MMLU's real r=0.39 operating point:

blended cost = 0.61×$0.20 + 0.39×$3.00 = $0.122 + $1.170 = $1.292 per 1,000 tokens

Against a policy that always uses the large model ($3.00 per 1,000 tokens, for the same 0.739 accuracy), this is a savings of (3.00−1.292)÷3.00 ≈ 57% in cost, for zero measured loss in accuracy on this benchmark — the entire value proposition of confidence-based routing, priced out in one line.

How sensitive is that saving to the actual price gap?

$0.20 versus $3.00 was one particular illustrative price ratio (15×). Real API pricing gaps between a small and a frontier model vary, so it is worth checking how the savings percentage moves as that ratio changes, holding the routing rate fixed at MMLU's real, measured 39%. The blended-cost formula collapses to a clean expression once you factor out the large model's price:

savings % = (1−r) · (1 − csmall÷clarge)    [with r = 0.39, so (1−r) = 0.61]
Price ratio (large÷small)Example pricesSavings at r=0.39
$1.50 vs. $3.000.61×(1−0.5) = 30.5%
$0.60 vs. $3.000.61×(1−0.2) = 48.8%
15× (the example above)$0.20 vs. $3.000.61×(1−0.067) = 56.9%
30×$0.10 vs. $3.000.61×(1−0.033) = 59.0%

The savings percentage climbs with the price gap but flattens out fast — it can never exceed (1−r) = 61% no matter how cheap the small model gets, because 39% of queries are still, by construction, paying the large model's full price regardless of how the small model is priced. This ceiling is a direct, visible consequence of the routing rate itself: halving the small model's cost again, from 30× to 60× the price gap, would buy barely another percentage point of savings, while lowering the routing rate itself (if a future, better-calibrated confidence signal allowed a lower r while still hitting accuracy parity) would move that ceiling directly. Cost savings from routing are gated by how well you can identify which queries need the expensive model, not primarily by how cheap the alternative is.

One more worked example: a mixed real-world traffic estimate

Every worked number so far picked one dataset (MMLU) in isolation. A real deployment does not field only MMLU -style questions — it sees a mix. Suppose, illustratively, a support assistant's incoming traffic splits evenly across query types resembling the four benchmarks in Table 1 (general knowledge like MMLU, reasoning like OpenBookQA, arithmetic like GSM8K, and domain-specific lookups like MedQA), using Llama3-8B-Instruct's four real routing rates:

blended routing rate = (39% + 49% + 65% + 40%) ÷ 4 = 193% ÷ 4 = 48.25%

Apply that blended rate to the same $0.20-versus-$3.00 illustrative pricing from earlier in this chapter:

blended cost = (1−0.4825)×$0.20 + 0.4825×$3.00 = 0.5175×$0.20 + 0.4825×$3.00 = $0.104 + $1.448 = $1.551 per 1,000 tokens
savings vs. always-large = ($3.00−$1.551)÷$3.00 ≈ 48.3%

Lower than MMLU's own 56.9% figure — unsurprising, since the mix now includes GSM8K's much higher 65% routing rate, dragging the blended average up and the blended savings down. This is the honest shape a real enterprise deployment estimate takes: not one dataset's number, quoted as if it applied everywhere, but a traffic-weighted average across whatever mix of query types the deployment actually receives, which in practice means measuring the real traffic distribution first, not assuming it resembles any one published benchmark.

When Chapter 6's rejection path is the only option

Everything in this chapter has assumed a larger model is available to route to. Chapter 6 flagged the other case directly: sometimes it isn't — a small model may be the only model a deployment has access to, whether for cost, latency, data-residency, or air-gapped-deployment reasons. In that setting, this chapter's entire cost-coverage machinery still has something to offer, just aimed at a different action. Instead of sweeping routing thresholds against a large model's accuracy, sweep the same confidence-score thresholds against an abstention policy's tradeoff — the ROC-curve accounting worked through in Chapter 6, true-positive (correctly abstained) rate against false-positive (needlessly abstained) rate. The threshold-sweeping mechanics this chapter built (quantiles of the confidence-score distribution, a fixed evaluation set, comparing an accuracy or safety metric at each candidate cutoff) transfer directly; only the downstream action, and therefore what “good” looks like at the far end of the sweep, changes. A deployment does not need to choose between building routing machinery and building rejection machinery in advance — the confidence score itself is identical either way, and which action a low-confidence query triggers is a downstream policy decision, made per deployment, not baked into how the score itself gets computed.

Why can Self-REF match Llama3-70B-Instruct's full accuracy on MMLU by routing only 39% of queries to it, instead of needing to route 100%?

Chapter 8: Ask, Answer, or Defer

Every piece is now on the table: Chapters 1–2 gave a way to measure and distrust raw confidence. Chapters 3–5 gave a way to detect and quantify ambiguity, independent of confidence. Chapters 6–7 gave a trained, genuinely calibrated confidence signal and a cost-coverage tradeoff for using it. This chapter fuses all three into one decision rule a deployed system can run on every single incoming request.

Why ambiguity has to be checked before confidence

Chapter 3's table made the danger case explicit: a model can be highly confident while having silently picked just one of several equally valid interpretations of an ambiguous request. Confidence, as built in Chapter 6, measures “how likely is this specific answer to be correct, given the interpretation I assumed” — it says nothing about whether that assumed interpretation was the right one to answer in the first place. A 95%-confident answer to the wrong question is not a safe answer; it is a fast, well-produced version of Chapter 0's clean-up-this-script failure. This is why the decision rule below checks ambiguity first: resolving which question you are actually answering has to happen before your confidence in the answer to that question means anything at all.

The three-way policy

Given an incoming request, compute two numbers: the best available clarifying question's EIG (Chapters 4–5 — how ambiguous is this request, and is there a good question that would resolve it?) and the model's confidence score in its own best answer (Chapter 6). Two thresholds, tEIG and tconf, chosen by whoever operates the system, turn those two numbers into one of three actions:

python
def decide(eig_best_question, confidence, t_eig, t_conf):
    if eig_best_question >= t_eig:
        return 'ASK'       # request is ambiguous enough that a question is worth it
    elif confidence >= t_conf:
        return 'ANSWER'    # unambiguous enough, and the answer is trustworthy
    else:
        return 'DEFER'     # unambiguous, but not confident -- route onward (Ch 7) or abstain

Read the branches in order, because the order is the point. ASK fires first: if the best available clarifying question would meaningfully shrink the hypothesis space, ask it, before even looking at confidence — per Chapter 4, EIG only reflects how much a question would narrow H, so this branch is entirely about the shape of the request, not about how the model currently feels about any one answer. Only once ambiguity is ruled out does confidence get consulted: ANSWER if the (now well-posed) request produces a trustworthy-confidence answer, per Chapter 6's genuinely-learned score, not the raw logits Chapter 2 showed cannot be trusted. Otherwise, DEFER — route to a larger model (Chapter 7's cost-coverage machinery) or abstain outright (Chapter 6's rejection-learning use case), rather than emitting a low-confidence guess as if it were a real answer.

Concept → realization. This is the one policy that actually needs all three chapters' machinery working together, and it is worth being explicit about why a simpler, single-signal policy would fail. A confidence-only policy (skip the EIG check) would confidently answer ambiguous requests whenever the model happens to be confidently biased toward one reading — Chapter 3's top-right, most dangerous cell. An EIG-only policy (skip the confidence check) would ask clarifying questions even for well-posed but genuinely hard requests, where no amount of clarification helps because the task was never ambiguous to begin with — wasting the user's time on a question that cannot possibly narrow anything, since H already equals H*. Only checking both, in this order, avoids both failure modes.

The showcase: a live decision engine over a stream of requests

The simulation below plots a stream of toy incoming requests as points on two axes: x is the EIG of the best clarifying question available for that request (in bits, per Chapter 4's formula), and y is the model's confidence in its best single-shot answer (per Chapter 6). Two sliders control tEIG and tconf; moving them redraws the three decision zones live, and every point's color updates to show which action it now falls into. A running readout at the bottom sums an illustrative per-action cost (a small fixed cost for asking a follow-up question, zero for answering directly, and a larger fixed cost for deferring to a bigger model or a human), so you can feel how tightening or loosening either threshold trades safety for cost in real time.

One design choice worth being upfront about: the fourteen points are fixed, hand-placed toy values, not the output of a live model running Chapters 4–6's machinery in real time. That is a deliberate simplification, for the same reason every canvas in this session uses worked or illustrative numbers rather than a live API call — it keeps the simulation deterministic and inspectable, so the exact same fourteen (EIG, confidence) pairs are there every time you load this page, and the hand-worked walkthrough above can check its own math against exactly what the canvas renders. A real deployment's version of this exact plot would instead be populated continuously, in real time, from Chapter 5's EIG estimation running on each incoming request and Chapter 6's confidence-token extraction running on that request's generated answer — the visualization's structure would be identical; only the source of the two coordinates would change, from a fixed array to a live pipeline.

Showcase: ask, answer, or defer

14 toy incoming requests, each with its own (ambiguity, confidence) pair. Drag both thresholds and watch the decision zones — and every point's classification — update live.

EIG threshold (ask if ≥)0.80 bits
confidence threshold (answer if ≥)65%

Walking the decision function by hand, on four of the fourteen points

Before touching either slider, run decide() from the code block above by hand on four of the fourteen toy requests plotted in the simulation, at its starting thresholds: tEIG = 0.80 bits, tconf = 65%.

RequestEIG (bits)ConfidenceBranch 1: EIG ≥ 0.80?Branch 2: conf ≥ 65%?Decision
#11.4088%yes → stop hereASK
#20.1092%noyesANSWER
#30.0555%nonoDEFER
#4 (edge case)0.8040%yes (0.80 ≥ 0.80) → stop hereASK

Request #4 is worth lingering on. Its confidence is only 40% — well under the 65% bar, which in isolation would suggest DEFER — but it never reaches Branch 2 at all, because its EIG lands exactly on the threshold and Branch 1 fires first. This is the ordering argument from earlier made concrete: a low confidence score on a request that is also genuinely ambiguous is not evidence the model needs a bigger model to answer it correctly — it is evidence the model does not yet know which question it is even trying to answer, and no amount of routing to a more capable model fixes that; a bigger model handed the same ambiguous request would face the exact same underspecified H. Running all fourteen points through the same two branches gives 6 ASK, 4 ANSWER, and 4 DEFER, for a total illustrative cost of 6×0.15 + 4×0 + 4×1.0 = 4.90 units — the exact starting numbers the live simulation below reports before you move either slider.

Reading the tradeoff off the simulation

Push tconf up toward 90% and watch the ANSWER zone shrink — fewer points clear the bar, more fall into DEFER, and the running cost readout climbs, because deferring is the most expensive action in this toy accounting. This is exactly the same accuracy-versus-cost tension Chapter 7 measured with real numbers: a higher confidence bar means fewer low-confidence answers slip through unflagged, at the price of routing (and paying for) more queries. Push tEIG down toward 0 instead, and watch the ASK zone swallow almost the entire plot — every request, however mildly underspecified, now triggers a clarifying question, which is safe but would frustrate a real user fielding a question for every message they send. There is no threshold setting that minimizes both cost and risk simultaneously; operating a system like this means choosing where on that curve you are willing to sit, deliberately, rather than leaving it to whatever a model's raw, unexamined confidence happens to produce.

What a confidence-only policy would have missed

Chapter 3 warned, in the abstract, that a confidence-only policy would confidently mishandle ambiguous requests. The fourteen plotted points make that concrete rather than hypothetical. Strip out the EIG branch entirely and imagine a simpler policy — ANSWER if confidence ≥ 65%, DEFER otherwise, with no ambiguity check at all — run against the same fourteen requests. Request #3 from the earlier hand-worked table (eig=1.40, conf=0.88) is the case worth staring at: under the combined policy it correctly triggers ASK, because EIG=1.40 comfortably clears the ambiguity threshold. Under the confidence-only policy, it would sail straight to ANSWER, since 88% clears the confidence bar with room to spare — the exact top-right, most-dangerous cell from Chapter 3's table, produced not as an abstract warning this time but as one specific point on this specific simulation, confidently mishandled by a policy that never checked whether the request was well-posed in the first place. Running the full comparison across all fourteen points, six of them (every point the combined policy sends to ASK) get silently reclassified as either ANSWER or DEFER under the confidence-only policy, purely because that simpler policy has no way to represent “this request itself needs clarification” as an outcome at all — it only ever has two boxes to sort anything into.

Setting the two thresholds in practice

Neither tEIG nor tconf has a universal correct value — Chapter 0's clinical-support example already argued both should sit at different levels depending on the cost of getting something wrong in a given domain. In practice, both are set the same way the routing threshold t was set in Chapter 7: sweep a range of candidate values against a held-out, labeled evaluation set (real requests, with a known ground-truth best action for each), and pick the operating point that hits whatever safety or cost target the deployment actually needs — not a value chosen once by intuition and left untouched. Two practical notes worth carrying forward. First, the two thresholds are not independent: Chapter 8's showcase deliberately checks ambiguity before confidence, so tEIG effectively gates how much of the incoming traffic ever reaches the tconf decision at all — tightening tEIG (asking more often) shrinks the pool of requests where tconf even gets a chance to matter. Second, both thresholds should be revisited whenever the underlying model changes — a newly fine-tuned Self-REF pass (Chapter 6) shifts what a given confidence number actually means, and a different base model's clarifying-question quality shifts what a given EIG number is worth, so a threshold tuned for one model version is not guaranteed to still be well-calibrated for the next one.

Beyond three actions

This chapter's policy has exactly three branches because that is the minimum needed to demonstrate the core idea — check ambiguity, then check confidence — cleanly. A real system can, and often should, subdivide further without changing the underlying logic. ANSWER could split into “answer directly” versus “answer, but visibly flag the confidence level to the user” (useful when tconf is cleared but only barely, say at 66% against a 65% bar — technically above threshold, but close enough to the boundary that surfacing the number itself is more honest than hiding it behind a binary decision). ASK could split by how many rounds of clarification have already happened this conversation, tightening tEIG on each successive round so the system does not ask forever (a crude, practical stand-in for the real stopping rule Chapter 9 flagged as an open problem). DEFER could split into “route to a larger model” versus “abstain and hand off to a human”, using Chapter 6's rejection-versus-routing distinction rather than collapsing both into one action. None of these extensions change the two-signal, ambiguity-then-confidence architecture this chapter built — they refine what happens once each branch has already been chosen.

Where the showcase's illustrative unit costs came from

The simulation's cost accounting — 0.15 for ASK, 0 for ANSWER, 1.0 for DEFER — was chosen to make the relative ordering visually obvious (defer is clearly the most expensive, ask is a modest tax, answer is free), not fit to any measured system. A genuinely useful version of this accounting, for a real deployment, would instead plug in Chapter 7's actual measured numbers: DEFER's cost would be the real blended latency or dollar delta from Table 1 (the 2.03× latency gap on MMLU, or the illustrative $2.71-per-1,000-tokens premium worked out earlier in Chapter 7), ASK's cost would be measured directly from real user studies — how much longer does a conversation take, how often do users abandon it, when a clarifying question is inserted — and ANSWER's cost is not truly zero either, since it is the branch that silently absorbs whatever residual miscalibration Chapters 1–2 measured. Replacing this chapter's illustrative 0.15/0/1.0 with real, measured numbers from a specific deployment is exactly the kind of grounding step that turns this showcase from a teaching tool into an actual operating budget.

Recomputing the showcase's default cost with real Chapter 7 numbers

Take that suggestion literally, for MMLU specifically, and see how the total cost readout would change. Replace DEFER's illustrative 1.0 with the real dollar-cost delta of routing one query to the large model instead of the small one: from Chapter 7's illustrative pricing, $3.00−$0.20 = $2.80 marginal cost per 1,000 tokens routed. Rescale ASK's cost proportionally, say to $0.05 per question (a small fraction of DEFER's cost, reflecting one extra short exchange rather than a full large-model call), and leave ANSWER at $0 (its true cost, Chapter 7's own accounting reminds us, is not actually zero, but no clean per-query dollar figure for latent, undetected miscalibration risk exists to plug in here). Recompute the fourteen-point default total from the hand-worked table earlier in this chapter — 6 ASK, 4 ANSWER, 4 DEFER — under these re-scaled costs:

6×$0.05 + 4×$0 + 4×$2.80 = $0.30 + $0 + $11.20 = $11.50 total, for these 14 requests

Compare the shape of this total against the illustrative 4.90-unit total computed earlier in this chapter: DEFER now dominates the total even more heavily than the toy units suggested (11.20 out of 11.50, or 97%, versus 4.0 out of 4.9, or 82%, in the original illustrative accounting) — because the real measured price gap between a small and large model is about 15× (Chapter 7's own worked ratio), noticeably larger than the toy 1.0-versus-0.15 ratio (about 6.7×) this chapter started with. The qualitative lesson from earlier in this chapter survives the substitution unchanged — DEFER is still by far the most expensive action, ASK is still a modest tax — but the exact magnitude of that gap only becomes trustworthy once real, measured numbers replace illustrative placeholders, which is the entire reason Chapter 7 built the real cost-coverage curve in the first place rather than leaving this chapter's toy units as the final word.

What noisy EIG estimates would do to this decision rule

Chapter 5's pseudo-answering worked example showed EIG estimated from a small sample (0.971 bits, from N=5) can sit noticeably off from the true population value (1.000 bit, from the full |H|=8). It is worth asking what that estimation noise would actually do to the ASK/ANSWER/DEFER classification, since this chapter's x-axis is exactly that estimated EIG. Take request #3 from the hand-worked table (true EIG ≈ 1.40, well clear of the tEIG=0.80 threshold) — a modest sampling error of even ±0.3 bits, plausible at small N, still leaves the estimate comfortably above threshold, so the ASK decision is robust to noise at that magnitude. Now take request #4, the edge case sitting exactly at eig=0.80 — the same ±0.3 bit noise band would straddle the threshold entirely, meaning this specific request's classification could flip between ASK and “continue to the confidence check” depending on which particular sample of candidate solutions the algorithm happened to draw that round. This is not a flaw unique to this chapter's toy simulation; it is a direct, structural consequence of Chapter 5's N=20-sample EIG estimator being an estimator, not an oracle. The practical implication for a deployed tEIG: requests whose true EIG sits close to the threshold are inherently the least reliably classified ones, and a production system's tolerance for that boundary noise — how large a margin to leave around tEIG before trusting a classification — is exactly the kind of calibration-of-the-calibration question that only shows up once you take estimation noise seriously, rather than treating EIG as a number handed down with certainty.

In the three-branch decision policy this chapter builds, why does the ambiguity (EIG) check happen before the confidence check, rather than after?

Chapter 9: Limits & Connections

Both papers this session is built on are candid about what their own methods do not solve. That honesty is worth taking seriously before treating either method as a finished, deployable answer.

What active task disambiguation does not tell you

The disambiguation paper is explicit, in its own discussion section, that it addresses only one piece of a larger problem: given that a task is ambiguous, which question best resolves it. It does not solve two adjacent questions the paper names directly — first, detecting that a given problem statement is ambiguous at all in the first place (the paper points to prior zero-shot-prompting approaches as a partial answer, not something this method itself provides); and second, deciding when to stop asking questions — how many rounds of clarification are enough before the marginal EIG of one more question no longer justifies the interaction cost. Chapter 8's decision rule assumed both of these were already handled upstream (a fixed tEIG substitutes for a real stopping rule); a production system would need to solve them for real.

The paper also flags a real cost the EIG-based strategies pay that the simpler baselines do not: generating M candidate questions, sampling N candidate solutions, and pseudo-answering every combination is meaningfully more LLM calls per turn than a single implicit-question prompt. The paper's own stance, borrowed from the Bayesian Experimental Design convention it builds on, is that this extra computation is worth it as long as it stays cheap relative to the cost of getting a wrong answer to the human on the other end — an assumption the paper expects to hold more often, not less, as token costs keep falling over time.

Put a number on that extra cost, using Chapter 5's own N=20, M=5 hyperparameters. One round of the implicit-question baseline costs exactly 1 LLM call (generate one question). One round of EIG-uniform costs, per the paper's own procedure: N calls to sample solutions, M calls to sample candidate questions, and up to N×M calls to pseudo-answer every solution against every question — 20 + 5 + (20×5) = 20+5+100 = 125 calls, before even counting the extra self-critic filtering passes Study 3 in Chapter 5 added on top. That is a two-orders-of-magnitude gap in raw LLM calls per clarifying question, for one round of one conversation. The paper's BED-inherited stance — that this is worth it as long as it is cheap relative to a wrong answer's downstream cost — is not a claim that 125 calls is free; it is a claim that Chapter 0's “confidently wrong, unflagged, 20 minutes of rework” cost is worse. Whether that comparison actually holds for a given deployment is an empirical question about that deployment's own economics, not something either paper's theory settles in the abstract.

Where these two papers sit relative to prior work

Prior ideaWhat it doesHow this session's methods differ
Kuhn et al., 2022Zero-shot ambiguity detection and clarification via promptingSession's Ch. 3–5 assume detection is solved and focus on which question to ask, via explicit EIG estimation rather than implicit prompting alone
Li et al., 2023Interactive task elicitation outperforms static prompt refinementMotivates the “ask, don't just guess better” strategy this session's Ch. 3 builds on directly
Guo et al., 2017 (temperature scaling)Post-hoc rescaling of softmax outputs for calibrationCh. 2 of this session; a global rescaling, not the per-example, trained signal Ch. 6's confidence tokens provide
External router models (Ding et al. 2024; Ong et al. 2024)Separate classifier decides routing from the query aloneCh. 6 contrasts this directly — Self-REF conditions on the generated answer too, not just the query

What confidence tokens need that not every task has

Self-REF's annotation step (Chapter 6) needs a clean, checkable notion of “correct” to label <CN> versus <UN> in the first place — exactly what MMLU, OpenBookQA, GSM8K, and MedQA all provide, since each has an unambiguous right answer to check predictions against. Open-ended generation — summarization, creative writing, most real chat — does not come with an exact-match correctness signal this cheap to compute, and extending Self-REF's annotation pipeline to those settings would need a substitute for “was this literally right or wrong,” which is a genuinely harder labeling problem than anything this chapter's four benchmarks required.

A third limitation, from this session's own synthesis

One more limitation worth naming, and it belongs to this session's Chapter 8 fusion specifically, not to either paper's own stated limitations: nothing in either paper's evaluation measures whether the ask-answer-or-defer policy, as a combined system, is itself well-calibrated. Chapter 6's ECE numbers measure whether cM is honest; Chapter 5's EIG evaluation measures whether question selection outperforms baseline strategies at narrowing H. Neither paper reports whether the specific downstream decision — the three-way branch itself — achieves, say, a target false-defer rate or a target false-answer rate when both signals are combined with real, jointly-tuned thresholds, on real traffic. That combined evaluation is exactly the kind of thing Metric Design exists to help build, and exactly the kind of gap a team shipping Chapter 8's policy for real would need to close with their own evaluation, rather than assuming that two individually-validated signals automatically compose into a validated combined system.

The two papers, side by side

It is worth stepping back and naming exactly how these two papers relate, since this session treated them as two halves of one problem rather than as one paper extending the other — they are independent works, published roughly eight months apart, that this session deliberately paired because their conclusions turn out to be complementary.

Active Task DisambiguationConfidence-Token Routing (Self-REF)
Problem targetedAmbiguous requests: H properly contains H*Miscalibrated confidence: stated confidence ≠ real accuracy
Core mechanismSample solutions, score candidate questions by estimated EIGFine-tune two new tokens, gradient-masked, aligned to correctness
What it needsA way to sample plausible solutions and pseudo-answer questions about themA labeled dataset with a checkable notion of correct/incorrect
Main evaluation20 Questions (animals) + active code generation (HumanEval, APPS)MMLU, OpenBookQA, GSM8K, MedQA, routing to Llama3-70B-Instruct
Headline resultEIG-uniform beats implicit and implicit-ToT question generation by a significant margin39% routing rate matches 100%-large-model accuracy on MMLU
Does NOT solveDetecting ambiguity in the first place; knowing when to stop askingConfidence for open-ended, non-exact-match generation tasks

Neither paper's method depends on the other's existing. You could deploy Active Task Disambiguation's clarifying -question machinery on a model with no confidence-token fine-tuning at all, and you could deploy Self-REF's routing on a model that never asks a clarifying question. Chapter 8's three-branch policy is this session's own synthesis, not a method either paper proposes directly — it is what naturally falls out of taking both papers' conclusions seriously at once, and it is exactly the kind of fusion a working engineer building a real deployed system would need to construct for themselves, because no single paper in this space currently addresses the full ask-answer-or-defer decision as one unified problem.

One shared trait is worth naming, since it is easy to miss when the two papers are read separately: both methods deliberately avoid touching the base model's weights for the actual reasoning task. Active Task Disambiguation's clarifying questions come from ordinary prompting of an unmodified model; Self-REF's fine-tuning touches only the two new confidence tokens' embeddings and the surrounding gradient flow, not the model's general language-modeling ability. Neither paper asks “can we make the model fundamentally smarter,” which is the harder, more expensive research direction most of this course's other sessions pursue. Both instead ask a narrower, cheaper question: “can we extract more honest, more useful information from a model we already have, without retraining it to be better at the underlying task?” That framing is precisely why both fit naturally into a single deployment session — they are complementary answers to the same kind of question, applied to two different failure modes.

Comparing the whole toolkit

SignalWhat it measuresMeasured reliabilityExtra cost
Raw softmax logitsModel's own next-token probabilityPoor (ECE 0.347, Ch. 2)Free
Verbalized confidenceModel's stated 0–1 self-reportPoor–unstable (ECE 0.217–0.466)One extra prompt
Confidence tokens (Ch. 6)Fine-tuned <CN>/<UN> probabilityBest measured (ECE 0.040)One fine-tuning pass
Implicit clarifying questionsAmbiguity, reasoned about directlyUnderperforms EIG-based selection (Ch. 5)One extra prompt
EIG-based questions (Ch. 4–5)Ambiguity, via sampled-solution partitioningBest measured, both tasks testedN+M extra LLM calls per turn

Read this table as a single, compact answer to the question this whole session opened with: how does a deployed system know what it knows? Not from any one row alone — the top three rows all answer “how much should I trust this specific answer,” and the bottom two answer a completely different question, “does this request even have one right answer to be confident about in the first place.” Chapter 8's combined policy is the claim that both questions have to be asked, in that order, on every single request, and that no single row in this table — however good its own measured reliability — is a substitute for asking the other one too.

Bridges

This session's Bayesian framing of “how much would this piece of evidence actually change my belief” is not new to this course — Session 05's BIRD framework asked almost the same question from a different angle: instead of scoring a clarifying question by how much it would narrow a hypothesis space, BIRD scores a claim's probability by explicitly decomposing it into factors and combining them with a learnable Bayesian aggregator, rather than trusting an LLM's single, ungrounded probability estimate the way Chapter 2 of this session showed you should not trust a raw confidence number either. Both sessions land on the same underlying lesson from two different directions: an LLM's raw, single-shot number — whether it is a claimed probability or a claimed confidence — is not a substitute for actually decomposing the problem and doing the accounting explicitly.

The three-way decision rule in Chapter 8 is also, in miniature, exactly the shape of problem this site's own Lesson Tutor chat has to navigate: a small, locally-served model fielding open-ended questions about lesson content, where a wrong but confidently-delivered answer actively misleads a learner in a way a visible “I'm not sure, here's what I'd check” does not. The specific thresholds any such system should run at are an empirical question this session does not answer for you — but the three-way frame (answer directly, ask a follow-up, or point the learner back to the source material) is the same shape as Chapter 8's policy, applied to a genuinely deployed, everyday system rather than a benchmark.

This session's DEFER branch — refusing to answer, or routing to something more capable, rather than guessing — is one specific instance of a much broader discipline: AI Safety & Guardrails covers the wider space of mechanisms for constraining what a deployed model is allowed to do, of which confidence-based deferral is a narrow, purely statistical slice. And every accuracy, ECE, and routing-rate number reported in Chapters 2, 6, and 7 of this session presupposes a working evaluation harness capable of producing those numbers reliably in the first place — the practical machinery for building one is covered in AI Evaluation and Agent Evaluation, the latter especially relevant once a deferred query triggers a multi-step handoff rather than a single model call.

Finally, everything in this session assumed you already have a trustworthy way to measure whether an answer was actually correct — Self-REF's annotation step needed it, and every accuracy number in Chapters 6–7's tables depended on it. Designing that measurement well, so it survives contact with a real production system and a real, messy distribution of user queries, is its own discipline, covered in Metric Design.

And Chapter 8's DEFER branch, once it fires, has to hand the query off to something — a larger model, a human, or another tool entirely. How that handoff itself gets orchestrated, including deciding which of several available tools or agents a deferred query should actually reach, is the subject of Agents & Tool Use. This session deliberately stopped short of that question — everything here was about deciding whether to defer, not about what happens on the other side of that decision once it is made.

A checklist, for anyone actually shipping this

Collecting the session into an operational checklist, in the order a build would actually need to tackle it:

1 · Ground truth
a checkable notion of correct/incorrect, per query type (Ch. 6, 9)
2 · Confidence tokens
annotate, subsample α, fine-tune with gradient masking (Ch. 6)
3 · Calibration audit
reliability diagram + ECE on a held-out set, before trusting it (Ch. 1–2)
4 · EIG scoring
solution sampling + question sampling + pseudo-answering (Ch. 4–5)
5 · Threshold sweep
tEIG, tconf against a labeled eval set, per domain (Ch. 7–8)
6 · Monitor and re-tune
thresholds drift as the model and traffic change (Ch. 8–9)

Step 6 deserves one closing word, because it is the step most naturally skipped once a system ships and starts working. Every threshold and every fine-tuned weight in this checklist was tuned against a snapshot of a model and a distribution of queries at one point in time. Real deployments drift — the mix of incoming requests shifts, the underlying model gets upgraded, new categories of query show up that the original evaluation set never saw. A calibration audit and a threshold sweep are not one-time setup costs; they are the same kind of ongoing operational discipline as monitoring uptime or latency, and treating them as a launch-day checkbox rather than a recurring practice is exactly how a system that started well-calibrated quietly drifts back into Chapter 0's confident-wrongness failure mode, one small distribution shift at a time.

Every chapter's one idea, in one table

Ch.The one idea
0Confident wrongness, not wrongness itself, is what makes a deployed system dangerous
1Calibration is measurable, by hand, as the weighted gap between binned confidence and binned accuracy (ECE)
2Raw logits and verbalized confidence are both measurably unreliable; only purpose-built training fixes this
3Ambiguity (H ⊃ H*) is an objective property of a request, distinct from a model's own uncertainty
4A clarifying question's value is the expected drop in entropy it causes; balanced partitions maximize it
5Sampling solutions first, then scoring questions against them, beats asking a model to reason about questions directly
6Two fine-tuned tokens, trained with gradient masking against real correctness, beat every zero-shot confidence signal measured
7Routing only the queries a calibrated signal flags as uncertain captures most of a larger model's accuracy at a fraction of its cost
8Ambiguity has to be resolved before confidence in an answer means anything at all

The one idea to leave with

A model that answers every question with the same fluent, unwavering tone is not being helpful by staying consistent — it is discarding the one signal that would let a human know when to double-check it. This session built three separate, independently-necessary pieces of a fix: a way to measure whether stated confidence is honest (Chapters 1–2), a way to detect when a request itself is underspecified, independent of confidence (Chapters 3–5), and a way to train a genuinely trustworthy confidence signal on purpose rather than hope one falls out of ordinary training (Chapters 6–7). None of the three substitutes for the other two. A deployed system that only has one of them is still missing a real failure mode this session showed you, by hand and with real measured numbers, that it will eventually hit.

“The first principle is that you must not fool yourself — and you are the easiest person to fool.” — Richard Feynman, Caltech commencement address, 1974

According to its own stated limitations, what does Active Task Disambiguation NOT solve, even when it successfully picks the highest-EIG clarifying question?