The SciPhi Initiative · Evaluation

Perplexity

This Article is Being Calibrated

The evals and judge pipeline on this page are live, but still being calibrated against hand labels via manual review, so outputs may shift.

Still refining:

  • Scoring units
  • Belief-distance display
  • Routing demo

A proper scoring rule grades a stated probability against what happens. A language model is scored the same way: the usual training objective is log loss, also called cross-entropy. Perplexity is that score rewritten as a count, PPL=eCE\mathrm{PPL} = e^{\mathrm{CE}}.

Step 1

Proper scoring

A scoring rule grades a stated probability against what actually happens. Log loss is how surprised you were at the outcome — it depends only on the probability you gave that outcome, which is why it converts cleanly into bits and perplexity. The Brier score is the squared error (p−y)2(p - y)^2, bounded between 0 and 1. Both rules are strictly proper: expected loss is uniquely minimized by stating your subjective degree of belief. A subjective degree of belief is the number you would stand behind under a proper score, not a certified fact.

Drag either marker. What you believe and What you state move independently. Any distance between what you believe and what you state implies a penalty: the first bar is the Brier penalty (p−q)2(p - q)^2, and the second is the KL divergence, a steeper penalty on the same gap. Both shrink away when the markers coincide. Then choose Observe tomorrow if you want the scores on a realized outcome.

Will it rain tomorrow?

Show exact numbers
De Finetti and Bayesian epistemology

de Finetti treated a probability as a subjective degree of belief, made operational by the bets you would accept. A Dutch book — a set of bets that costs you money no matter what happens — is the mark of an incoherent belief. Strictly proper scoring rules come from the same tradition: the unique report that minimizes expected loss is the degree of belief you actually hold. That is the operational core of Bayesian epistemology on this page: a probability is scored by the world, not certified as true in some stronger sense.

How the two rules feel different

They agree on honesty and disagree in feel. Log loss has no ceiling — a near-zero probability on the realized outcome is punished without bound. Brier is capped at 1 and barely moves once that probability is already tiny. The exact numbers (behind Show exact numbers) grade the same belief, statement, and outcome both ways. The formulas sit in Formulas and units.

Step 2

Perplexity

Perplexity is the same log score, rewritten as a count: a model with perplexity 32 is, on average, as uncertain as if it were torn between 32 equally likely next tokens. Lower is more confident. That confidence is about the next token, not yet about whether a whole answer will be correct — that question is calibration, in the next step.

Look at the tokens

These scores were measured on a CPU, on short passages, with public checkpoints of GPT-2 small, DistilGPT-2 (same tokenizer as GPT-2), and SmolLM2-135M (a different tokenizer). They are not full WikiText or C4 benchmark runs.

Choose a passage, or type your own. Switch the comparison to see two models side by side. Hover or click a token for its probability, log loss, and token Brier. Darker / warmer tokens surprised the model more. Your own text is scored live by a small toy model (a byte trigram trained on WikiText-2). The neural models are precomputed for the six passages only.

Compare

Hover or click a token to see its probability, log loss, and token Brier.

Feel the scale

Drag the slider. The three readouts are the same number in different units: a count (perplexity), a cost in bits, and the geometric-mean probability 1/PPL. This slider is not a trained model; it is the conversion itself.

Formulas and units

The usual training objective is the average log loss, also called cross-entropy, here in nats:

CE=−1N∑t=1Nln⁡p(xt∣x<t),PPL=eCE,BPB=N⋅CE(ln⁡2) B.\mathrm{CE} = -\frac{1}{N}\sum_{t=1}^{N}\ln p(x_t\mid x_{<t}), \qquad \mathrm{PPL} = e^{\mathrm{CE}}, \qquad \mathrm{BPB} = \frac{N\cdot\mathrm{CE}}{(\ln 2)\, B}.

Under a believed distribution qq, expected log loss and expected Brier split into an uncertainty term that depends only on qq, plus a divergence that is zero only when the report equals the belief. The binary Brier on this page is the plain quadratic (p−y)2(p-y)^2, bounded by 1:

Eq[−ln⁡p(Y)]=H(q)+DKL(q∥p),Eq[(p−Y)2]=q(1−q)+(p−q)2.\mathbb{E}_q[-\ln p(Y)] = H(q) + D_{\mathrm{KL}}(q\|p), \qquad \mathbb{E}_q[(p-Y)^2] = q(1-q) + (p-q)^2.

When the truth is a single outcome (a one-hot vector), KL to that truth is just the log loss. The language-model token Brier is a different object: the squared distance over the full vocabulary, ∥p−ey∥2=∥p∥2+1−2py\|p-e_y\|^2=\|p\|^2+1-2p_y, always between 0 and 2. On this page it is computed from the full softmax, not from the top-5 list, and is shown in the token readout and under Show details.

A tokenizer chops text into pieces. A model that makes more, shorter tokens gets more (easier) guesses, so its raw perplexity can look better for bookkeeping reasons. Bits per byte keeps the same surprise in the numerator and divides by the UTF-8 bytes, so two models can be compared on the same text. The ranking or the size of the gap can change once you stop dividing by each model’s own token count. The table below holds one joint surprise — from the toy byte trigram, on the playground text — and only changes the denominator. Bits per byte stays put. The large per-token and per-word perplexities are this weak toy joint expressed in fewer units, not GPT-2’s own perplexity.

Unit Count Perplexity of the same joint Bits per unit

How the numbers were computed

On 23 November 2026, America/Denver, a CPU box ran compute_scores.py with PyTorch 2.15.0+cpu and Transformers 5.24.0. Checkpoints: gpt2 (124,439,808 parameters, vocab 50,257), distilgpt2 (81,912,576, same tokenizer), and HuggingFaceTB/SmolLM2-135M (134,515,008, vocab 49,152). Each text was encoded with add_special_tokens=False — none of these tokenizers prepends BOS — and scored in one float32 forward pass. The first token is shown but not scored. Bits per byte uses only the UTF-8 bytes of the concatenated scored tokens. Scripts are in scripts/. The toy trigram is an interpolated 3-gram over UTF-8 bytes, trained on the Salesforce WikiText-2 raw train split (10,914,845 bytes).

Sources and published figures

Official Llama, Gemma, Qwen, and Phi cards usually report downstream accuracy, not a standard WikiText or C4 perplexity. Community figures often differ in context length, dataset version, and whether perplexity is per token or per word. The tables below keep the source and protocol attached.

GPT-2 paper, Table 3, zero-shot, per canonical dataset unit (a word on WikiText, a byte on enwik8) — not per BPE token. Source: Radford et al., 2019.

Model WikiText-2 PPL WikiText-103 PPL enwik8 BPB text8 BPC
GPT-2 117M29.4137.501.161.17
GPT-2 345M22.7626.371.011.06
GPT-2 762M19.9322.050.971.02
GPT-2 1.5B18.3417.480.930.98

VidyalAI, 2026: one harness, 1,024-token window, 512-token stride. Perplexity here is per each model’s own tokens and is not comparable across rows; BPB is. Source: Evaluating a Base Model.

Model Parameters FineWeb-Edu BPB WikiText-103 BPB WikiText-103 PPL (own tokenizer)
Pythia-70M70.4M1.1171.21844.5
GPT-2 small124.4M0.9961.02524.6
Pythia-160M162.3M0.9921.04025.5
SmolLM2-135M134.5M0.8530.91815.0

Apple’s Core AI port reports WikiText-2 perplexity with lm-evaluation-harness — a different dataset and protocol than VidyalAI. The 135M figure (24.99) must not be lined up against VidyalAI’s 15.0. Source: apple/coreai-models, SmolLM2 README.

SmolLM2 (float16, macOS) WikiText-2 PPL
135M24.99
360M18.23
1.7B12.27

The official Llama 2 paper does not report WikiText-2 perplexity. Paloma (Magnusson et al., 2023; dataset) is the right framework for bits per byte when vocabularies differ. The Pile (Gao et al., 2020) adopted BPB for the same reason.

Interactive predecessors, mostly one model and without this BPB or scoring-rule pairing: perplexity.vercel.app, MPN, Prism, PicoGPT-JS, Fix the Robot. Written explainers include mbrenndoerfer, Long Form Explainers, and LeetML.

Step 3

Calibration

A model can assign high probability to each next token — low perplexity — and still be a poor guide to whether it will get a task right. Calibration asks a narrower question: when a forecast says “70%,” do the events it called 70% happen about 70% of the time?

Pick a story, or drag the reported confidence. The ten marks are outcomes at that confidence; click a mark to flip it. Compare the reported rate to the observed rate. The dashed diagonal on the small chart is perfect calibration — the same diagram, with measured model bids, appears in the routing experiment below.

Ten forecasts at this confidence. Yes = it happened.

Reliability

What the gap is measuring

The gap is observed frequency minus reported probability. Negative means overconfidence: the report was higher than the record. The mean Brier on these ten trials is the same (p−y)2(p - y)^2 rule as in step 1, so a miscalibrated report is punished for the same reason a misstated belief was. A reliability curve plots reported probability against observed frequency; the diagonal is perfect calibration. The routing experiment in the next step uses that plot on measured bids from three language models.

Step 4

Calibration-based model routing

If a proper score keeps a stated probability honest, and bits per byte is that log score on text, we can turn a bits-per-byte bid into a calibrated P(success). This is a small measured experiment, not a claim that calibration routing always wins.

Three public checkpoints — GPT-2 small, DistilGPT-2, and SmolLM2-135M — bid on sixteen short completion stems. Each bid is bits per byte on a gold continuation, a log score comparable across tokenizers. That number is mapped through a leave-one-out logistic to a P(success). The outcome is not whether the model assigned high probability to the gold span: it is whether the model’s own greedy decode was judged correct by Jev (noul ≥ 0.7).

With one shared logistic map of bits/byte, and a negative slope (as on this set), picking the highest P(success) always agrees with picking the lowest bits/byte: argmax P(success) is a monotone transform of the same number. The point of this step is not a different pick. It is to read the bid as a calibrated probability, and to score a bluff under the same proper rules as in step 1. The router still selects the highest reported P(success), so you can nudge a report off its honest value and watch the score move.

Pick a stem and press Run to reveal the attempts and the verdict. Press Run all to fill the reliability curve and the score table. Then nudge one model toward “sure” — you do not need to reset first — and watch the pick and the loss move.

Each card is a model. bits/byte is its log score on the gold continuation (lower is a stronger bid). P(success) is that score mapped through a leave-one-out logistic fit, unless you nudge it. The highlighted card is the router’s current pick.

honest
What the nudge does
Each model’s bid starts as the bits per byte it assigns to a gold continuation — a log score, comparable across tokenizers. That bid is mapped to a P(success) with a logistic fit on the other fifteen tasks (leave-one-out). The slider moves one model’s reported P(success) from its honest leave-one-out value toward 0 or toward 1, so you can make it overconfident and watch the scoring rule punish it. The nudge is the only illustrative number on this experiment; everything else was measured.

Reliability

Cumulative score

Model Mean log loss (nats) lower is better Correct Jev yes / runs

What Loss is
These are the same two rules as in step 1. Log loss is in nats and has no ceiling, so a near-sure bid that fails is expensive. Brier is (p−y)2(p - y)^2, bounded by 1. The table reports the mean over the stems you have run. Lower is better.

On this set

The comparison below is the un-nudged, full-set result: honest leave-one-out P(success), all sixteen stems. It does not update when you nudge a bid. Accuracy is how often that policy’s pick was judged correct. Size is the mean parameter count of the chosen model — a cost proxy, not a dollar price. “Best single” is chosen in hindsight.

Policy Accuracy Size
How to read this comparison
Sixteen short completion stems, three public checkpoints (GPT-2 small, DistilGPT-2, SmolLM2-135M), greedy attempts, judged by Jev (jev-latest, resolved as jev-1.14.0) with rubric routing-correctness@1. A “yes” is noul ≥ 0.7; noul ≤ 0.3 is “no.” The mid band 0.3 < noul < 0.7 is labelled “unsure” and does not count as a success. The calibration router uses a leave-one-out map so the current task’s outcome is not in its own bid. Because that map is a single decreasing function of bits per byte, its pick agrees with the lowest-bits-per-byte pick on every stem of this set — and, here, with the hindsight best single model, SmolLM2-135M, which is both more accurate and has lower bits per byte on the gold continuations. That is a measurement, not a claim that calibration routing always wins. Cost is mean parameters of the chosen model, a size proxy, not a dollar price.
Inspect the gold bid, token by token

These are the scored gold-continuation tokens that went into the bits-per-byte bid for the stem above. Darker / warmer tokens surprised the model more — the same token-level surprise as in step 2.

How the numbers were measured

On 25 November 2026, America/Denver, a CPU box scored and decoded the three public checkpoints in float32, with add_special_tokens=False. The bid is the teacher-forced log score of the gold continuation given the prompt, divided by the UTF-8 bytes of that gold span. Attempts are greedy completions (do_sample=False, 32 new tokens). Jev judged each attempt against the reference in one request per task (three noul questions, shared state): 16 requests, 14,216 input tokens, $0.000597 at $0.042 per million input tokens (output is free). A “yes” is noul ≥ 0.7; noul ≤ 0.3 is “no”; 0.3 < noul < 0.7 is “unsure” and is not a success. No live model or Jev calls are made from this page. Recompute with perplexity/scripts/compute_routing.py.

These are short-passage measurements, not a general leaderboard. Small base models, not chat models, are doing the completing.