Scoring Language Models

Dive into Deep Learning · §18.4

Scoring Language Models
likelihood scores · bits per byte · parsers · pass@k · reasoning · conventions

One Model Is Right on 39% or on 79% of the Same Questions

The problem

Qwen3-1.7B on ARC-Challenge: science questions with four options, where guessing gives 25%.

how the answer is read accuracy
probability of each answer’s text, summed over its tokens 0.39
the same, minus the answer’s log-probability after Answer: 0.46
probability of the option’s letter 0.72
the letter, after five solved examples 0.76
the model writes, and a parser reads the letter 0.79
the model reasons first, then writes (100 of the 500 items) 0.83

Nothing about the model changed between the rows. Which number is its score?

By the End of This Deck You Can

Goals

  • score a multiple-choice item by likelihood, in two formats and under four normalizations;
  • compare models that have different tokenizers by bits per byte;
  • say what a parser, a token budget and a batch size do to a score;
  • estimate pass@k without bias and tell it from majority voting;
  • read the paired difference of two models under several conventions.

The idea: a score is a convention, a rule fixed in advance that turns the outputs of a model into a number.

Running example: 500 ARC-Challenge science questions and five checkpoints. A base model was trained only to predict the next token, a post-trained one further on conversations. Qwen3-0.6B and Qwen3.5-0.8B are the pair to compare, fixed before any score.

A Measurement Needs a Prompt, a Scoring Rule and an Error Bar

Where this fits

movement section
open a checkpoint Pretrained Models with Hugging Face
A Released Checkpoint in the Book’s Own Code
measure it Prompting and In-Context Learning
Scoring Language Models
Evaluation Suites, Judges and Error Bars
inside and outside Interpretability
Models behind an API
  • Uses: a pinned loader, a generator, and the label read-out (a softmax restricted to the tokens of the label words).
  • Skips: paired tests and sample sizes, contaminated benchmarks, answers without a key.

One Question Has Three Ways to Be Scored

Conventions

All three are reasonable, and nothing guarantees that they agree. Here (a) and (b) do: Qwen3-0.6B-Base prefers the text of carbon dioxide and gives the letter B a probability of 0.86.

One Model Gives Three Answers to One Question

A farmer wants to water her vegetables with water from the nearby ocean. Is this a good idea?

option Qwen3-0.6B picks it when we read
A Yes, because there is plenty of ocean water.
B Yes, because ocean water has many natural fertilizers. the letters
C No, because ocean water is too salty for plants grown on land. its written reply
D No, because ocean water is much more polluted than rainwater. the answer texts

Its written reply names a letter on 451 of 500 items. On 352 of them the three readings give at least two different answers.

A Likelihood Score Sums Log-Probabilities over the Continuation

Likelihood scores

\ell(c \mid x) = \sum_{t=1}^{m} \log p(c_t \mid x, c_{<t})

  • x: the prompt. c: a choice. c_1, \ldots, c_m: its continuation, the tokens that it adds to the prompt. One forward pass gives all terms.
  • ' oxygen' adds 1 token, ' carbon dioxide' 2, the letter ' B' 1.
  • Checked against lm-evaluation-harness, a standard program for scoring benchmarks: 200 of 200 predictions agree in 32-bit floats.

The scored tokens must spell the choice. Count boundary merges for every new tokenizer and format. Here: 0 of 2,000.

The Letter Format Scores One Token and Tests a Second Skill

cloze letter
prompt Question: … Answer: question, A. … to D. …, Answer:
choices the texts of the options ' A' to ' D'
tokens per choice one or more one
the model sees the options no yes
asks how probable is this answer? read, choose, name the letter
  • With k solved items in front: letter-0, letter-5.
  • Models of 2022 often failed to bind a letter to its option (Robinson et al., 2023).

Whether current small models can name the letter is measured below.

Sum and Mean Disagree inside a Wedge Set by the Length Ratio

Length normalization

Choice a: l_a tokens, mean log-probability m_a per token. Choice b: l_b < l_a tokens, mean m_b. Both means are negative.

  • The mean picks a if |m_a| < |m_b|. The sum picks a if l_a |m_a| < l_b |m_b|.

1 < \frac{|m_b|}{|m_a|} < \frac{l_a}{l_b}: \quad \text{the mean picks } a, \text{ the sum picks } b

\log p per token carbon dioxide, 2 tokens oxygen, 1 token ratio the sum picks
invented -1.0 each -1.5 1.5, inside (1, 2) oxygen
Qwen3-0.6B-Base -3.9 each -8.9 2.3, outside carbon dioxide

One token per choice: the wedge is empty. Letters need no normalization.

Disagreement Rises from 17% to 57% with the Spread of Option Lengths

Length spread of an item: characters of its longest option over those of its shortest. 500 items in thirds, five checkpoints pooled.

third length spread sum and per-character rule disagree 95% interval
most even 1.00 to 1.29 0.17 0.14 to 0.21
middle 1.29 to 1.60 0.37 0.32 to 0.42
most uneven 1.60 to 6.00 0.57 0.52 to 0.63
  • Top minus bottom third: 0.40, interval 0.33 to 0.47. Every checkpoint shows the rise.

On more than half of the uneven items, dividing by the length decides the answer.

Check: Which Option Wins under Each Rule?

Check

PMI rule: \log P(c \mid \text{question}) - \log P(c \mid \texttt{Answer:}), by how much the question raises the probability of the answer.

option tokens \log P after the question \log P after Answer:
a 1 -2.0 -3.0
b 2 -3.0 -7.0

Which option wins under the sum, per token, and under PMI?

Answer. Sum: a, since -2.0 > -3.0. Per token: b, since -1.5 > -2.0. PMI: b, since -3.0 + 7.0 = 4.0 beats -2.0 + 3.0 = 1.0. Three defensible rules, two answers.

Measured on ARC, paired with the sum: PMI gains 7 to 10 points for every checkpoint. Per token and per character gain 0 to 5, not resolved.

Bits per Byte Survives a Change of Tokenizer; Perplexity Does Not

Running text

\textrm{bpb} = \frac{1}{B} \sum_{t=1}^{T} -\log_2 P(x_t \mid x_{<t}) = \frac{T}{B} \log_2 \textrm{PPL}

B: bytes of the text. T: its tokens. PPL: perplexity per token. A PPL of 16 at T/B = 0.25 is 1 bit per byte.

held-out code tokens per byte PPL bits per byte
Qwen3-0.6B-Base 0.362 3.41 0.64
Qwen3.5-0.8B-Base 0.379 3.63 0.71
  • Per token the models are 5% apart, per byte 10%.

Compare per byte, also across texts: one model has PPL 10.5 on prose and 3.4 on code, but 0.88 and 0.64 bits per byte.

Window Settings Move One Score from 0.93 to 0.81

A long text is scored in windows of ctx tokens that advance by stride, each token once. An unscored boundary token <|endoftext|> is the context of the first.

  • 10 tokens, ctx 4, stride 2: the windows score 4, 2, 2 and 2 tokens.
Qwen3-0.6B-Base, wikitext-2 stride = ctx stride = ctx/2
ctx 512 0.93 0.87
ctx 2,048 0.83 0.81

More context per scored token lowers the score. Report ctx, stride and the boundary token with every bits-per-byte figure.

Wikipedia from 2016 Is Not a Held-Out Text

Bits per byte, windows of 2,048 tokens with stride 1,024:

text bytes Qwen3-0.6B-Base Qwen3.5-0.8B-Base
wikitext-2 test, Wikipedia as of 2016 1,290,000 0.81 0.82
prose written after both releases 68,000 0.88 0.87
code written after both releases 56,000 0.64 0.71
  • The first text was available for pretraining. The other two did not exist yet.
  • 0.81 against 0.88 mixes two differences: seen or unseen, encyclopedia or textbook.

One comparison cannot separate memorization from a change of domain.

The Parser Alone Moves GSM8K Accuracy from 6% to 42%

Generated answers

100 arithmetic word problems, 8 sampled solutions each, after four solved examples that end in a line #### 72. An extractor finds the number.

extractor reads the number Qwen3-0.6B Qwen3.5-0.8B
on a line #### N only 0.00 0.09
after #### or “the answer is” (strict) 0.06 0.09
else the last number in the text 0.42 0.45
  • Qwen3-0.6B writes the line once in 800 samples. Most answers come in bold or in a box.
  • Of about 280 extra credits per model, 2 and 13 are replies cut at the token budget.

A strict parser measures knowledge and format together. A lenient one can credit an answer never given.

The Unbiased pass@k Estimator Is a Fraction of Subsets

pass@k: the probability 1 - (1-p)^k that at least one of k samples is correct, if each is with probability p. From n samples with c correct (Chen et al., 2021):

\hat U = 1 - \binom{n-c}{k} \Big/ \binom{n}{k}

  • The share of size-k subsets that hold a correct sample. It is unbiased.
  • n = 4, c = 1, k = 2: 3 of 6 pairs miss the correct sample.
pass@2 from n=4, c=1: 0.5000; plug-in: 0.4375
n=20, p=0.3, k=5: mean 0.83193, variance 0.018063 (sd 0.1344), plug-in mean 0.79583 (bias -0.0361)

The plug-in 1 - (1 - c/n)^k draws with replacement and is biased low, by 0.036 in the second line.

Voting over Eight Samples Gains 7 to 12 Points and Stays below pass@8

maj@8: accuracy of the most frequent answer among 8 samples.

Qwen3-0.6B Qwen3.5-0.8B
pass@1 0.41 0.43
maj@8 0.48 0.55
pass@8 0.70 0.71
plug-in at 8 0.64 0.66
  • maj@8 minus pass@1, paired over problems: 0.07 (0.02 to 0.11) and 0.12 (0.07 to 0.18).

On 16 to 22% of the problems a correct sample was in the pool and the vote missed it.

Check: Would 80 Samples per Problem Narrow the Band?

Check

Mean pass@1 over M = 100 problems with n = 8 samples has a band of \pm 8 points. Its variance is

\frac{1}{M}\Bigl(\underbrace{\mathbb{E}\bigl[p_i(1-p_i)\bigr]/n}_{\text{within problems}} + \underbrace{\textrm{Var}[p_i]}_{\text{between problems}}\Bigr),

with p_i the probability that a sample solves problem i. Measured share of the within term: 0.07 and 0.09.

Answer. Hardly. Ten times the samples remove at most the within term, under a tenth of the variance: the band narrows by less than 5%. Twice the problems narrow it by 29%.

A Time Limit Is Not a Sandbox

Execution checks

For code the verdict comes from running tests, in a fresh Python process with limits on time and memory. Four versions of one function:

correct        passed=True 
wrong          passed=False
infinite loop  passed=False stopped after 5 s
syntax error   passed=False
  • The process runs with our rights. It can read and delete our files and reach the network.

Run code that a model wrote only in a container. HumanEval’s own harness was released with its execution line commented out.

Reasoning Gains 18 Points on Qwen3-0.6B and an Unresolved 7 on Qwen3-1.7B

Reasoning before answering

Direct: thinking off, greedy, at most 1,024 tokens. Reasoning: thinking on, sampled, at most 4,096. The reply ends in a boxed letter.

the same 100 items Qwen3-0.6B Qwen3-1.7B
accuracy, reasoning / direct 0.67 / 0.49 0.83 / 0.76
difference, with paired 95% interval 0.18 (0.07 to 0.29) 0.07 (0.00 to 0.15)
items right only with reasoning / only directly 25 / 7 11 / 4
tokens per reply, reasoning / direct 1,019 / 91 1,321 / 242
different letters where both name one 30 of 88 16 of 95

A scored letter is one token and shows what a model says at once. What it concludes after a thousand tokens of deliberation is another measurement.

Batch Size Changes up to 2% of bf16 Predictions and None in fp32

Batch drift

bf16: 16-bit floats, in which the models are stored and run. fp32: 32-bit.

batch 8 against batch 1 model convention predictions changed of 500 largest score change
bf16 Qwen3-0.6B cloze, sum 6 1.1 nats
bf16 Qwen3-0.6B letter 12 0.78 nats
bf16 Qwen3.5-0.8B cloze, sum 1 0.35 nats
bf16 Qwen3.5-0.8B letter 7 0.27 nats
fp32 Qwen3-0.6B both 0 0.0001 nats
  • A floating-point sum depends on its order, which a GPU kernel picks by the shape of the batch.

State precision and batch size. A difference between models below this batch drift (0.2 to 1.0 points here) is not a difference.

No Convention Reverses the Pair; the Gap Runs from 0 to 20 Points

Right: Qwen3.5-0.8B minus Qwen3-0.6B, paired over 500 items. Cloze: -1 to +3 points, intervals contain 0. Letter: 11 (6 to 16). Written: 20 (15 to 25), and 18 where both replies name a letter. Fixed before looking: the gap is 12 points (5 to 18) larger under letters than under the cloze sum.

A Smooth Score Is More Sensitive, and Not Only to Knowledge

Bits per byte of the correct option: -\log_2 P(\text{correct option} \mid \text{question}) over the bytes of the option. A real number per item, where accuracy is one bit.

Qwen3.5-0.8B minus Qwen3-0.6B difference difference over half-width of its interval
accuracy, cloze per character 0.01 0.4
bits per byte of the correct option -0.16 3.9
bits per byte of the wrong options -0.14 3.3
wrong minus correct 0.02 0.5
  • A ratio above 1: the interval excludes zero.

Qwen3.5-0.8B predicts the text of ARC options better, right or wrong. The part that tracks the answer separates the pair no better than accuracy.

Check: What Must a Reported Score State?

Check

A model card says “ARC-Challenge: 72%”. What do you need to know before you compare it with a number of your own?

Answer. The format (cloze, letter or written) and the demonstrations; the normalization; for written answers the prompt, the sampler, thinking on or off, the token budget and the parser; precision and batch size; the items; and an interval. For Qwen3-1.7B, 72% is the letter format without demonstrations.

Wrap-up

  • A score is a rule. One checkpoint is right on 39% to 79% of the same 500 questions depending on the rule, and on 83% of 100 when it reasons first.
  • Sum and normalized rules disagree inside a wedge set by the length ratio: on 17% of even items and 57% of uneven ones.
  • Bits per byte compares models across tokenizers, and depends on windows and on whether the text was seen.
  • The parser moved GSM8K accuracy from 6% to 42%. pass@k has an unbiased estimator. Voting gains 7 to 12 points over one sample.
  • Reasoning: 18 points for Qwen3-0.6B, an unresolved 7 for Qwen3-1.7B, at 10 and 5 times the tokens.
  • The pair never swaps places, but its gap runs from 0 to 20 points.

Next: when a difference is real, and how many items that takes.