An assistant sounds equally sure when it is right, when it is wrong, and when it answers a question you did not ask. On twelve toy requests, answering everything ships 8 wrong answers. Asking first, then deferring the unsure ones, ships 1.
Pick a policy and watch each request get answered, asked about, or deferred, with the minutes it costs. Then we build, piece by piece, a confidence you can trust and a question worth asking.
You need a little Python and what a probability is. We build the rest from zero.
Session 21 of Georgia Tech CS 8803, LLM seminar. It rests on two papers: Kobalczyk, Astorga, Liu and van der Schaar, Active Task Disambiguation with LLMs (ICLR 2025), and Chuang, Sarma, Gopalan, Boccio, Bolouki, Hu and Zhou, Learning to Route LLMs with Confidence Tokens (ICML 2025). Every idea is re-taught here in our own words and devices.
Toy requests and toy costs: a question costs the user 1 minute, a deferral 3 minutes of expert time, a wrong answer 20 minutes to find and fix. Thresholds: ask when the expected information gain is at least 0.5 bits; answer when confidence is at least 0.6. Chapter 9 lets you move both.
Chapter 0
See why a wrong answer costs most when nothing flags it
A user asks a support assistant: "What is our refund policy for a locked account?" The assistant answers at once: 30 days, and a three-step process. No such policy exists. The answer reads exactly like a right one.
A developer types: "Clean up this script." The assistant fixes the spacing and renames two variables. The developer wanted dead code removed. The model solved a task, but not the one in the developer's head.
These are two different faults. The first is a fault of calibration: the model's stated confidence does not match how often it is right. The second is a fault of ambiguity: the request allows more than one valid answer, and the model picked one without asking. Both end the same way. A wrong output arrives with no warning.
10,000 tickets a week; 400 answers are wrong. Set the share of tickets a person reviews, and choose where the flags come from.
Toy numbers: 4% wrong, 3 minutes to review a ticket, 20 minutes to find and fix a wrong answer nobody flagged. The calibrated score here is ideal: it ranks every wrong answer first. Real scores are worse, which is what Chapters 1 to 3 measure.
Work the three corners. With no flags, 400 × 20 = 8,000 minutes, about 133 hours of rework. Flag a random half: review costs 5,000 × 3 = 15,000 minutes, and the 200 wrong answers you missed still cost 4,000. The total is about 317 hours, worse than doing nothing. Flag the 4% a good score ranks lowest: 400 × 3 = 1,200 minutes, or 20 hours.
Failure. The symptom: the team reviews more and more tickets and the mistakes still get through. Measure how many of the flagged tickets were wrong. If that share is near the base rate (4%), the flags are random. Fix: rank by a score whose numbers mean something. That is calibration.
Chapter 1
Check whether "80% sure" means right 80% of the time
On a multiple-choice question, the model's output layer gives each option a probability. The model picks the option with the largest one. That largest probability is its stated confidence. Does it mean anything?
A model is calibrated if, among all the answers it gives at 80% confidence, about 80% are right. A weather forecaster is calibrated when it rains on about 70% of the "70% chance of rain" days. You cannot check this on one prediction. You need a batch.
Here is a batch of ten. Sort the answers into confidence ranges, called bins: 0.5 to 0.7, 0.7 to 0.9, and 0.9 to 1.0. In each bin, compute the average stated confidence and the accuracy, the share that were right. Plot accuracy against confidence, one bar per bin. This is a reliability diagram. A calibrated model puts every bar on the diagonal.
Each button is one question with a fixed stated confidence. Pressed means the answer was right. Flip some, or load a preset.
Toy batch of ten. Confidences 0.95, 0.92, 0.88, 0.85, 0.82, 0.78, 0.75, 0.68, 0.60, 0.55. Bars are accuracy; the warm tick is the bin's average confidence.
To sum the gaps into one number, weigh each bin by how many answers it holds. Call a bin m. Call the number of answers in it nm and the total N. Call its accuracy accm and its average confidence confm.
E-C-E equals the sum over m of n-m over N, times the absolute value of acc-m minus conf-m.
For each bin, take the gap between acc-m and conf-m. Weigh it by the bin's share of answers, n-m over N. Add the weighted gaps.
With the toy batch: the bins hold 3, 5 and 2 answers with gaps 0.057, 0.216 and 0.435. ECE = 0.3 × 0.057 + 0.5 × 0.216 + 0.2 × 0.435 = 0.212. The stated confidence is off by about 21 points.
The top bin is the alarm. The two answers given at 92% and 95% are right half the time: gap 0.935 − 0.5 = 0.435. Flip Q1 and Q4 to right and ECE falls to 0.038. The confidences did not change. Only their match with reality did.
Failure. The symptom: a rule like "show the answer if confidence is above 90%" still ships wrong answers. Measure ECE and the top bin's accuracy on a held-out set. Fix: recalibrate or replace the score before you set any threshold. For more on reading these plots, see Plots That Tell the Truth.
Chapter 2
Change the bins, watch ECE move, and add a score that needs no bins
The three bins in Chapter 1 were a choice. Choose differently and the same ten answers give a different ECE. A published ECE without its binning scheme is half a number.
The ten answers from Chapter 1, overconfident version. Pick how many bins.
Toy batch. Two bins split at 0.9; three bins at 0.7 and 0.9; five and ten bins are equal widths from 0.5 to 1.0.
Read the two ends. One bin compares the overall average confidence, 0.778, with the overall accuracy, 0.600: ECE 0.178. Inside one wide bin, overconfident and underconfident answers cancel. Ten bins give 0.372, because most bins hold one answer, and one answer is either 0% or 100% right. Few bins hide gaps; many bins add noise.
The Brier score needs no bins. For each answer, call its stated confidence ci and its outcome yi: 1 if right, 0 if wrong.
B-S equals one over N, times the sum over i of c-i minus y-i, squared.
For each answer, subtract y-i from c-i and square the result. Add the squares and divide by N.
With the toy batch: Q1 says 0.95 and is wrong, so (0.95 − 0)2 = 0.9025. Q2 says 0.92 and is right, so (0.92 − 1)2 = 0.0064. The ten squares add to 2.954, so BS = 0.295. The well-calibrated version scores 0.135.
Brier mixes two things that ECE keeps apart. A model that is always right but always says 60% pays (0.6 − 1)2 = 0.16 on every answer. Its accuracy is perfect; its honesty is not. That is why the confidence-token paper reports ECE, Brier and a third score side by side.
Failure. The symptom: two methods swap ranks when you change the bin count. Measure ECE at two or three bin counts, plus Brier, on the same split. Fix: report the scheme with every ECE, and use enough answers per bin (dozens, not one).
Chapter 3
Compare four confidence signals and see what temperature can and cannot fix
A language model learns with cross-entropy loss: on each example, push up the probability of the right next token. Nothing in that loss compares "90% sure" with a record of being right 90% of the time. The confidence-token paper says it plainly: models "can overfit on accuracy rather than calibration, often leading to overconfidence".
The paper tests four common ways to get a confidence number. On Llama3-8B-Instruct answering MMLU, its Table 2 reports these ECE values.
| Signal | How it gets a number | ECE, MMLU |
|---|---|---|
| Verbalizing Yes/No token | ask "are you confident?"; P(Yes) / (P(Yes) + P(No)) | 0.466 |
| Zero-shot logits | the probability of the answer token | 0.347 |
| Verbalizing uncertainty | ask for a score from 0 to 1 | 0.217 |
| Fine-tuned logits | answer-token probability after task fine-tuning | 0.081 |
| Self-REF (Chapter 7) | a trained confidence token | 0.040 |
The cheapest fix after training is temperature scaling (Guo and others, 2017). Call the model's raw score for option k its logit, zk. Divide every logit by one number, the temperature T, before the softmax.
p-k equals e to the z-k over T, divided by the sum over j of e to the z-j over T.
Divide each logit z-k by T. Take e to that power. Divide by the total over all options. A T above 1 flattens the probabilities; T = 1 changes nothing.
With made-up logits 4.0, 1.0 and 0.5: at T = 1, e4 = 54.60 of a total 58.97, so p = 0.926. At T = 2 the logits become 2.0, 0.5 and 0.25, and p = 7.39 / 10.32 = 0.716. The top option is still the same one.
The ten answers from Chapter 1, treated as two-option questions. Raise T and watch the confidences slide toward 0.5.
Toy. For two options, the scaled confidence is 1 / (1 + e−z / T), where z is the log-odds of the original confidence. ECE uses the three bins of Chapter 1, so it jumps when an answer crosses a bin edge.
At T = 4, ECE drops to 0.012. Every answer now sits between 0.51 and 0.68. Yet the most confident answer is still Q1, which is wrong. Temperature moves all confidences together. It cannot pull one wrong answer below the right ones, so any threshold flags the same answers as before.
Failure. The symptom: ECE looks fine after temperature scaling, but routing on the score is no better. Measure the ranking, not only ECE: how many wrong answers sit in the lowest-confidence share. Fix: train a per-answer signal (Chapter 7).
Chapter 4
Define when a request allows answers the asker would reject
Imagine a perfectly calibrated model. A user writes: "Combine these two spreadsheets."
One table or two tabs? All rows, or only rows in both files? Match rows by an ID column, or by position? Eight merges fit the words. The user wants one of them.
The Active Task Disambiguation paper splits a request S into two parts. The requirements R are checkable rules every answer must meet. The context C is everything else that shapes which answer the user prefers. Call any candidate answer h. Call the set of answers that meet R H, and the smaller set the user would accept H*.
The paper's definition: S is ambiguous when H is strictly larger than H*. Some answers meet every stated rule and still get rejected.
Eight merges fit "combine these two spreadsheets". The user secretly wants the one marked with a ring. State each requirement and watch H shrink.
Toy example, our own; the paper's running example is a list-search function (its Figure 1).
The paper writes the user's preference over answers as two factors.
p-star of h given S equals the indicator that h satisfies R, times p-tilde-star of h given R and C.
First check h against R; a failed check gives 0. If h passes, its weight is the user's private taste, p-tilde-star, which depends on the unwritten context C.
With the toy merges: a merge that drops a file entirely gets indicator 0, so p-star is 0. The eight valid merges get indicator 1, and the user's taste gives one of them weight 1 and the other seven weight 0.
The user and the model share only the first factor. So the paper asks only requirement questions: each answer adds a checkable rule to R. Two ways to handle ambiguity compete:
| The model's spread | Task not ambiguous (H = H*) | Task ambiguous (H ⊃ H*) |
|---|---|---|
| Low (sure) | healthy | dangerous: sure of one reading |
| High (unsure) | capability gap: a question will not help | a question helps |
Failure. The symptom: users rephrase the same request after each answer. Measure how often the first answer is accepted on underspecified prompts. Fix: detect ambiguity from the spread of valid answers, not from the model's confidence in one.
Chapter 5
Score a question by how evenly its answers split the candidates
You may ask the spreadsheet user one yes-or-no question. "Is it one table?" splits the eight merges four and four. "Is it one table, all rows, by ID?" splits them one and seven. Which is better?
Measure uncertainty with entropy, in bits: with K equally likely candidates it is log2 K. Eight candidates hold 3 bits. The information gain of an answer is the entropy before minus the entropy after. You do not know the answer before you ask, so average over the answers. That average is the expected information gain, or EIG. Learn the basics of entropy in NEU 560 L08.
The paper assumes every candidate in H is equally likely, because the model's own preferences may be biased. Call the number of candidates |H|, a possible answer to question q a, and the number of candidates that give answer a |Ha|.
E-I-G of q equals log base two of the size of H, minus one over the size of H, times the sum over a of the size of H-a times log base two of the size of H-a.
Group the candidates by the answer each would give to q. Each group of size |H-a| leaves log of |H-a| bits, with chance |H-a| over |H|. Subtract that average from the starting log of |H|.
With the eight merges: a 4 and 4 split gives 3 − (4 × 2 + 4 × 2) / 8 = 1 bit. A 7 and 1 split gives 3 − (7 × 2.807 + 0) / 8 = 0.544 bits. The even split wins.
Each card is one merge. Choose a yes-or-no question by the size of its "yes" group, or a question with more answers.
Exact, for eight equally likely candidates. The best question with n answers splits H into n equal groups and gains log2 n bits (the paper's Corollary 1).
More answers gain more: four even answers give 2 bits, eight give 3. But "which of these eight merges do you mean?" makes the user read all eight. The paper argues for questions with few answers and an even split. The utility it maximizes is U(q) = EIG(q) − c(q), where c is the cost of an answer; its experiments set c constant.
Failure. The symptom: the assistant asks question after question and the task barely narrows. Measure the split each question makes on the candidates. Fix: drop questions whose answer is almost always the same.
Chapter 6
Sample answers first, then pick the question that splits them best
A model cannot list H. It can sample from it. The paper's bet is that LLMs write answers better than they reason about questions, perhaps because the web holds few clarifying questions. So the method "shifts the load from implicit to explicit reasoning about the space of viable solutions." Each round runs six steps:
Step 4 needs no list of H. Call the number of distinct pseudo-answers to one question n, and the number of sampled answers that give pseudo-answer k nk.
E-I-G-hat of q equals minus the sum over k of n-k over N, times log base two of n-k over N.
Count how many sampled answers give each pseudo-answer, n-k. Turn the counts into shares of N. The entropy of those shares is the estimate.
With made-up samples: 5 sampled merges, 3 say "one table" and 2 say "separate tabs". EIG-hat = −(0.6 × log2 0.6 + 0.4 × log2 0.4) = 0.971 bits, near the true 1 bit.
The paper's Algorithm 1 divides nk by n, the number of distinct answers. That is a typo: shares must divide by N, the number of samples, or they do not sum to 1.
Sixteen merges; the model prefers "one table" 85% of the time. Sample N answers plainly or as a diverse list, and see which of four questions wins.
Toy. True EIG assumes all 16 merges equally likely: 1.000, 0.811, 0.544 and 0.337 bits. Plain sampling draws with repeats from the biased model; the diverse list draws N different merges evenly, as the paper's prompt aims to.
The paper tested this in two settings. In a 10-round animal guessing game, the guessing model had to rank the true animal; 10 is best. In code generation, each question is a test case, answered by running the hidden reference program.
| Setting (paper table) | Baseline | EIG-chosen |
|---|---|---|
| 20 questions, GPT-3.5, rank after 10 rounds (App. Table 2) | implicit 4.9; pick-best-of-5 5.1 | 6.2 (4.1 with model log-probs) |
| HumanEval, GPT-3.5, yes/no tests, after 4 (Table 3) | 70.8% (from 44.1%) | 85.6% (from 44.6%) |
| HumanEval, GPT-4o-mini, same (Table 3) | 79.6% | 81.5% |
| APPS, GPT-4o-mini, input questions, after 4 (Table 4) | 75.1% (from 34.6%) | 87.2% (from 35.9%) |
Weighting samples by the model's own log-probabilities did worse than treating them as equal (rank 4.1 against 6.2 for GPT-3.5): the model's preferences are biased. A "diverse and representative" instruction raised a diversity score at N = 10 from 0.46 to 0.57 (Table 1). The gap between the baseline and EIG shrinks for stronger models.
Failure. The symptom: the method asks about a detail the user already settled. Measure how many sampled answers break the current requirements. Fix: filter samples against R before scoring; the paper's self-check filter matters more as R grows (its Figure 6).
Chapter 7
Teach the model to end each answer with a word that says how sure it is
Chapter 3 showed that the probability a model already gives is a poor confidence. Self-REF (Self-Reflection with Error-based Feedback) trains a better one into the model itself. It adds two new tokens to the vocabulary: <CN>, confident, and <UN>, unconfident. Training learns their embeddings, which start as the average of the existing token embeddings.
Training data comes from the model's own mistakes:
One rule in step 3 matters most. On a <UN> example, the answer is wrong. Ordinary fine-tuning would raise the probability of that wrong answer. Self-REF masks the gradient on the answer tokens and trains only the <UN> token.
Two training examples: one the base model got wrong (labelled <UN>) and one it got right (labelled <CN>). Press Train and watch what rises.
Toy: each probability is one logit, and each step adds 0.6 × (1 − p) to the logit of every term in the loss. Starting values are made up.
Work the loss on the wrong example. Say the model gives the wrong answer W probability 0.3 and gives <UN> after W probability 0.4. Unmasked, the loss is −ln 0.3 − ln 0.4 = 1.204 + 0.916 = 2.120, and lowering it raises P(W). Masked, the loss is −ln 0.4 = 0.916; only <UN> moves. The paper's ablation (Figure 4) finds masking improves routing for both base models.
At test time, read the two token probabilities after the answer. Call them P(<CN>) and P(<UN>).
c-M of x and y-hat equals P of C-N, divided by P of U-N plus P of C-N.
Take P of C-N and P of U-N at the position after the answer. Ignore every other token. The share that goes to C-N is the score.
With made-up numbers: P(<CN>) = 0.62 and P(<UN>) = 0.11, with 0.27 on other tokens. c = 0.62 / 0.73 = 0.849.
The score sees the question and the model's own answer, so it judges that answer, not the query alone. That is the difference from an external router model.
Failure. The symptom: after fine-tuning, the model gets worse at the task itself. Measure task accuracy before and after, on a held-out split. Fix: check that the mask covers the gradients on wrong answers and that α is not starving the <CN> side.
Chapter 8
Send only the unsure questions to the big model, and find where accuracy catches up
You run a small model you can fine-tune, Llama3-8B-Instruct. You can also call a bigger one, Llama3-70B-Instruct, at a price. Routing sends a question to the big model when the small model's score is below a threshold t. The paper sets t at quantiles of the scores, so the routed share steps through 0%, 5%, 10% and on to 100%.
Twenty questions, sorted by the small model's score. Drag the share to route, and compare a confidence-token order with a random order.
Toy: the small model gets 12 of 20 right, the big one 15 of 20. The solid blue line is the expected accuracy of random routing; the dashed line is one random order.
In the toy, routing the 7 least confident questions (35%) reaches the big model's 75%. Routing 9 to 11 reaches 80%, above either model alone, because the two models make different mistakes. The paper sees the same effect and calls it a form of ensembling.
The paper's minimum routing rate to match the big model alone (Table 2), with Llama3-8B's speed-up at that point (Table 1):
| Dataset | Llama3-8B routes | Mistral-7B routes | Best baseline, Llama3-8B | Latency gain, Llama3-8B |
|---|---|---|---|---|
| MMLU | 39% | 70% | 90% | 2.03× |
| OpenbookQA | 49% | 40% (text: 50%) | 70% | 1.69× |
| GSM8K | 65% | 75% | 70% | 1.33× |
| MedQA | 40% | 70% | 80% | 2.00× |
The speed-up is per-token latency. On MMLU, all-70B runs at 0.292 s per token; Self-REF on Llama3-8B with 39% routed runs at 0.145, at the same accuracy, 0.739. GSM8K needs the most routing and gives the smallest gain, 1.33×. Weights trained on OpenbookQA still route MMLU, at 70% (Llama3-8B) and 75% (Mistral-7B).
Without a bigger model, the same score drives rejection: abstain when c is below t. The paper tests this on questions where, half the time, the authors remove the right option. Self-REF has the best ROC curve on MMLU and OpenbookQA for both base models (Figure 3), without any training on "none of the above".
Failure. The symptom: routing at 50% costs the big model's price and gives little gain. Measure accuracy against routed share on a held-out set, as in the device, and compare with the random line. Fix: if your curve hugs the random line, the score does not rank errors; retrain it.
Chapter 9
Combine the two signals into one rule and set its two thresholds
Each paper solves one half. Active task disambiguation finds the best question; confidence tokens score an answer. Neither paper combines them. The rule below is this session's synthesis, and it is the rule the hero runs.
Check ambiguity first. A confident answer to the wrong reading looks healthy to the confidence score, so the score cannot catch it. For each request:
Each dot is one request from the hero, placed by its EIG and its confidence. Right of the vertical line, the assistant asks first; an arrow shows the confidence after the reply.
Toy requests and costs, as in the hero: ask 1 minute, defer 3, a wrong answer shipped 20. Asking an unambiguous request costs a minute and changes nothing.
Count the hero's default. Confidence only (tEIG above 2 bits): 5 wrong answers × 20 + 3 deferrals × 3 = 109 minutes. Ask, then confidence: 5 questions × 1 + 4 deferrals × 3 + 1 wrong × 20 = 37 minutes. The one left is the Eiffel Tower date, a confident mistake on a clear question. No threshold catches it without deferring good answers too.
Set both thresholds the way the paper sets t: sweep them on held-out traffic and read the cost. A medical assistant raises tconf and lowers tEIG; a brainstorming tool does the reverse. The confidence-token paper makes the same point for rejection.
Failure. The symptom: users complain the assistant asks too much. Measure the share of questions whose reply did not change the answer. Fix: raise tEIG, or improve the samples, since a noisy EIG asks about things that do not matter.
Chapter 10
Keep the numbers, know the limits, and take the code
Calibration asks whether you can trust a confidence. Disambiguation asks whether the model is solving the right task. The first needs a score trained against correctness; the second needs a question chosen from sampled answers. A deployed assistant needs both, with thresholds set on its own traffic.
| Term | Meaning | Number to remember |
|---|---|---|
| ECE | weighted gap between confidence and accuracy, per bin | toy: 0.212 (3 bins), 0.372 (10 bins) |
| Brier score | mean squared gap between confidence and outcome | toy: 0.295 |
| Temperature T | divide every logit by one number | logits 4, 1, 0.5: 0.926 at T = 1, 0.716 at T = 2 |
| Ambiguous | H strictly larger than H* | 8 merges fit; 1 is wanted |
| EIG | expected bits a question removes | 4 and 4 split: 1 bit; 7 and 1: 0.544 |
| Active task disambiguation | sample answers, score questions by pseudo-answer entropy | N = 20, M = 5; HumanEval 70.8% to 85.6% |
| Confidence score | P(<CN>) / (P(<UN>) + P(<CN>)) | ECE 0.040 on MMLU, Llama3-8B |
| Routing parity | least routed share that matches the big model | 39% on MMLU; 2.03× faster |
pythonimport math from collections import Counter def ece(conf, ok, edges=(0.5, 0.7, 0.9, 1.0)): N, e = len(conf), 0.0 for i, (lo, hi) in enumerate(zip(edges, edges[1:])): last = i == len(edges) - 2 b = [j for j, c in enumerate(conf) if lo <= c < hi or (last and c == hi)] if b: gap = sum(ok[j] for j in b) / len(b) - sum(conf[j] for j in b) / len(b) e += len(b) / N * abs(gap) return e def brier(conf, ok): return sum((c - y) ** 2 for c, y in zip(conf, ok)) / len(conf) def eig_hat(pseudo_answers): # one question, one answer per sampled solution N = len(pseudo_answers) return -sum(n / N * math.log2(n / N) for n in Counter(pseudo_answers).values()) def confidence(p_cn, p_un): # Self-REF score return p_cn / (p_un + p_cn) def decide(eig, c, t_eig=0.5, t_conf=0.6): # this session's synthesis if eig >= t_eig: return "ask" return "answer" if c >= t_conf else "defer" 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(round(ece(conf, ok), 3), round(brier(conf, ok), 3)) # 0.212 0.295 print(round(eig_hat(["one"] * 3 + ["tabs"] * 2), 3)) # 0.971 print(round(confidence(0.62, 0.11), 3)) # 0.849
Credit: Session 21 of Georgia Tech CS 8803, LLM seminar. Papers: Kobalczyk, Astorga, Liu and van der Schaar, Active Task Disambiguation with LLMs (arXiv 2502.04485v1, ICLR 2025); Chuang, Sarma, Gopalan, Boccio, Bolouki, Hu and Zhou, Learning to Route LLMs with Confidence Tokens (arXiv 2410.13284v3, ICML 2025). The toy batches, merges, requests and costs are ours.
Teach it back: open Present or Teach and explain why temperature scaling cannot fix routing, and why the method samples answers before it picks a question. Then go back to the twelve requests and predict the minutes for each policy before you press it.