Every word is a little shock — measure it live
This page contains a real bigram model trained on a tiny storybook corpus. Type a sentence: for each word it computes the probability it expected, converts it to surprise (−log₂ p, in bits), and averages. Perplexity is 2average surprise. Green bars = "saw it coming", red bars = "did not expect that at all".
The model is a bigram counter over ~180 words of storybook text, smoothed so unseen words get a small floor probability instead of zero. GPT does the same accounting with a trillion-word corpus and much longer context.
The gibberish detector — fluent beats scrambled
Three sentences made of perfectly ordinary ingredients: a natural one, the same words shuffled, and a fluent one written with rare words. Score them. Word order and word choice both show up in the number — the shuffled sentence has identical words but broken bigrams, so its perplexity explodes.
Lower perplexity = less surprised = more like the text the model grew up on.
What the number means — a die with N faces
Perplexity has a physical reading: a model with perplexity N is exactly as confused as someone forced to guess by rolling a fair N-sided die. Here is a model choosing among 8 next words. Drag the slider from "clueless" (uniform — an 8-sided die) to "certain" (one word gets everything — a 1-sided die) and watch the die shrink.
The cliché wins — low perplexity is not good writing
Time to break the metric. Score these three: a memorized cliché straight from the training data, a false sentence stitched from familiar pieces, and Carl Sandburg's genuinely brilliant fog line. The masterpiece loses. Badly. Then try to write a great sentence that beats the cliché — you'll feel the bias yourself.
Perplexity only asks "have I seen word patterns like this before?" — it has no column for true, beautiful, or useful.
Surprise is in the eye of the model
Perplexity is not a property of text — it's a property of a text–model pair. This page has two models: the storybook model and a second one trained on tiny tech docs. Score the same sentence under both and watch the number swing by an order of magnitude. Neither model is "right"; they just grew up reading different things.