Surprise

The first number the whole theory is built from — and it comes from you, not from an app. You will build a probability out of your own numberless hunch, then turn a feeling you’ve had ten thousand times into an exact, checkable number — and derive it, not be handed it.

One plain thread anyone can follow, plus layered boxes — take the ones that fit (they map onto the course’s four registers): ▶ Picture it (kid), the main text (plain), ✎ Try it / ✓ Check it yourself (equation, by hand), ▸ Go deeper (derivation), ⬡ See it in UNI (the running system). Everything runs locally in your browser — no account, no network — and adapts to light and dark. Always commit your answer before you read the reveal: that’s where the learning happens.

One word first — “probability.” A probability is a number between 0 and 1 that writes down how much you’d bet: 0 = “no way,” 1 = “certain,” 0.5 = “even, like a coin.” Hold onto this — the number records a lean you already have; it does not hand you one. Where the lean itself comes from is the whole first half of this lesson.

The one fence that never moves. “Surprise,” and later “free energy,” are functional quantities — numbers a model computes about its own predictions. For you we use felt words, because you’re a person reading a sky; for UNI we use functional words — it reads a hint through a model and its dynamics move to lower a number. Neither is awareness, feeling, or sentience. We keep that line bright on purpose.

0 · The question underneath

Why a book about minds begins with a feeling

How does a mind — yours, an animal’s, or the artificial one we’re building — make sense of a world it can never see directly? You never touch the world. You get hints of it: light on your eyes, pressure on your skin, a smell on the air. From those hints a mind has to guess what’s out there, act on the guess, and not get hurt being wrong.

The astonishing thing is that the whole job reduces to one feeling turned into a number, then one move repeated forever. The feeling is surprise. The move is keep surprise low. So we start where a mind starts: with the jolt of being wrong. No equations yet — just a feeling.

1 · The stakes

A feeling you already own

Step outside, first thing, on a morning you remember. You don’t see a number anywhere. You see the particular grey-green the light has gone. The air is damp and heavy and has stopped moving. You catch that mineral smell — rain that hasn’t landed yet, lifting off dry ground. Maybe a dull pressure sits behind your eyes. And without doing a single calculation, something in you leans. Your hand drifts toward the umbrella, or it doesn’t.

Hold onto that lean. It’s what this whole lesson is about — and notice, it arrived with no digits on it.

▶ Picture it kid
Right now, picture your doorway on a morning like that — your sky, your street, the weather where you live. Did your hand reach for the umbrella in your mind, or not? That motion is the lean.

Now the part that makes surprise matter. Two mornings, both ending with you soaked to the skin:

  • Monday: everything in you said the sky was clear — and it poured. “You have got to be kidding me.”
  • Tuesday: everything in you already said rain — you’d half-packed the umbrella — and it poured. You just sighed.

Same wet shirt. Completely different jolt. And the jolt isn’t tracking the weather (same both days) or whether getting wet is good or bad (annoying both days). It tracks how far what happened sat from what your own lean expected. Monday your lean said no rain, and reality shoved back hard. Tuesday your lean was ready. That jolt is surprise — the alarm that fires when the world contradicts your lean. Staying un-surprised, over a life, is understanding your world.

✎ Try it — rank before you read on commit first
Order these five jolts, smallest to biggest, by gut: (a) you were sure it’d stay dry and got soaked, (b) a famously-reliable friend is 20 minutes late, (c) a coin you called “heads” lands tails, (d) your lottery ticket actually wins, (e) your usual bus arrives on time. Now say in one sentence what your ranking tracks. (It isn’t good-vs-bad — it’s how far each thing sat from your lean.)
⬡ See it in UNI the system
The organism in the lab is built to run exactly this loop, with no weather app. It gets a raw sensory hint, its model turns that hint into a lean about what comes next, and when the world disagrees it registers the mismatch — prediction error — and adjusts. You reading the sky and it reading its sensors run the same loop. (Functional quantities only — it has dynamics that lower a number; we never say it “feels.” What’s proven today is the free-energy arithmetic, Gate F0 sealed; the full running behaviour is the build underway.)

And the weather app? It was never in this scene. The lean came first, and it came from you. We’ll get to the app next.

1.5 · The construction rung

Where does the number even come from?

Your lean had no number on it. So where would a probability come from? Let’s build one. Yours — in three moves: feel it, lay a ruler on it, then read your own number off your own hunch.

Build your own probability

No number is handed to you. You pick a numberless word, a 0–1 ruler is laid on it, and you read your OWN number off your OWN hunch — then see what you just did.

Step 1 · Feel it (no digits)

Back in that doorway — grey-green light, damp heavy air, that smell. How much does part of you expect rain in the next hour? Pick the word. Say it out loud.

Step 2 · Lay a ruler on the feeling

The ruler runs from 0 = no way to 1 = certain, with “even” dead centre at 0.5. Your “” sits roughly in the shaded zone — but that’s a rough place, not your number. Let’s get your exact one.

Step 3 · Read your own number (commit before the reveal)

Out of 10 mornings that look and smell and feel exactly like this one, where you live, how many end in rain? Write a number and commit it.

▸ Go deeper — there is no “true” probability in the air derivation
Because the number is read off your model, a different person — or a satellite — reading the same sky writes a different number. There is no single “true probability of rain” hanging in the air to be measured. Probability lives in a model. (Hold that — it’s the on-ramp to Module 2.)
⬡ See it in UNI mechanism, not metaphor
This is exactly, mechanically, what the organism is built to do: it is handed a numberless hint — not a probability — reads it through its model (its internal likelihood, o = A·s), forms a lean, and only then produces a number. The tie to reality here isn’t a metaphor — it’s the arithmetic the code runs (Gate F0 sealed); the fuller behaviour is the build underway. Neither you nor it is ever handed the number from outside. And the weather app? Just another mind doing your job — reading raw hints through its model and writing its lean down as a percentage. Its “90%” is its hunch, no more the world’s oracle than yours.
2 · The hinge

Surprise lives in your model, not in the world

Now surprise lands on something real — the lean you just built — and we can be precise. Keep three jobs apart; this is the fix for the thing that trips everyone:

Three jobs

Reality decides what happens; your model turns numberless hints into the expectation; you read the number off it. Surprise is built from your model’s number for the slot reality chose — never a fact handed to you after the event.

1 · Reality’s job

Decide what actually happens. This morning — it will rain or stay dry.

2 · Your model’s job

Turn the numberless hints (sky, smell, pressure, memory) into an expectation — the lean you built in §1.5.

3 · Your job

Read the number off that expectation: 0.70 for rain.
Reality picks:
Set your model’s number, then let reality pick a slot — the surprise will use your number for whichever slot reality chose.

And look what falls straight out: if your model had been certain of rain (a lean of 1) and it rained, your surprise should be zero — you can’t be surprised by what your model already knew. That’s our first rule. So before any formula, fix the shape a surprise number must have. Call the surprise of an outcome your model gave probability p by the name S(p):

  1. S(1) = 0 — a sure thing happening is no surprise.
  2. S grows as p shrinks — rarer stings more, smoothly.
  3. S is never negative — surprise doesn’t run backward.

We haven’t chosen a formula — we’ve written the rules a formula must satisfy.

✎ Try it commit first
Pencil in gut values for S at p = 1, 1/2, 1/10, 1/100 — any positive, increasing numbers. Did you put 0 at p = 1? If two of your numbers break a rule you just wrote, fix one. You’re already making your intuition obey its own rules.
3 · The one demand that does all the work

Putting a number on it — and why it has to be a logarithm

Flip two fair coins in two separate rooms; they land heads and heads. The two flips have nothing to do with each other, so the surprise of “both heads” can only be the surprise of one plus the surprise of the other — the shocks add. For two unrelated outcomes with probabilities p and q (whose joint is p × q): S(p × q) = S(p) + S(q). That’s the demand. Now — before any arithmetic — commit your bet.

Break the impostors — predict first

Commit a guess (with a confidence) about which rules survive additivity. THEN test them by hand. Being wrong here is the most useful thing that can happen — it’s the jolt that makes it stick.

Step 1 · Commit your prediction (then the tester unlocks)
Step 2 · Now break them by hand
Test a pair:

Only −log survives. A logarithm is the one function whose defining identity is “turn multiplying into adding”: log(p×q) = log(p) + log(q), always. The demand you insisted on is that identity.
▶ Picture it — meet the logarithm as a thing you DO, before its name kid · above the formula
Take 1 and keep halving: 1 → ½ → ¼ → ⅛ → 1/16. Count the halvings. “How many times do I halve 1 to reach p?” is a logarithm — here log₂(1/p). And halvings add — two halvings then three is five — which is exactly the property we need. Move the ladder and watch it.

The halving ladder

Meet −log₂ p as the number of halvings from 1 down to p — a thing your hand does — BEFORE the formula gets its name. Halvings add; that is why it must be a logarithm.

Jump to:

The one operation whose whole identity is “turn multiplying into adding” is the logarithm: log(p × q) = log(p) + log(q), always — exactly our demand. Two small fixes finish it, and neither is a new idea: a log of a number below 1 is negative, so put a minus in front (that’s your Rule 3); and log(1) = 0 hands you Rule 1 for free. So the rule that survives is:

surprise of an outcome = −log( the probability your model gave it )
written S(p) = −log p · its name is surprisal

One more small step, on its own — the unit. Count in halvings (log base 2) and surprise comes in bits. Use the natural log (the ln on your calculator) and it comes in nats. Same quantity, different ruler. UNI works in nats.

✓ Check it yourself — start with the easy one equation · by hand
  • Fair coin, heads, p = ½: −log₂(½) = 1 bit — one clean yes/no’s worth. Good footing.
  • Two coins both heads, p = ¼: −log₂(¼) = 2 bits — exactly double. Additivity in your hands.
  • Fair die shows 4, p = ⅙: −log₂(⅙) ≈ 2.58 bits — more than a coin, less than two.
Punch each into the calculator below.

Surprisal calculator — and land on the golden value

Enter any probability; read its surprisal in nats and bits. Then compute one specific value by hand and watch it land on an externally sealed reference. Trust is the match, never the authority.

Sanity cases:
−ln p · nats
0.6931
−log₂ p · bits
1.0000


⬡ Land on the golden value

In the system’s first reproducibility test, the model’s own lean — the probability it had built for the thing it then observed, the same way you built your rain number in §1.5 — was 0.69. Compute its surprisal by hand, then we’ll show you the sealed record.

Your arithmetic: nats

Sealed reference in the release gate: 0.3710636814 nats

The seal is not why you believe it — you just computed it. The seal is the independent, hash-locked record that your arithmetic and the running code land on the same digits. Trust is the match, never the authority.

▸ Go deeper — the functional equation derivation
A continuous, decreasing S on (0,1] with S(pq)=S(p)+S(q) has exactly one family of solutions, S(p) = −k·log p; the base is the unit k. Nothing else survives — which is why information theory, thermodynamics and active inference all speak in logs. It’s forced, not chosen.
4 · Make it yours

Use it on your own doorway

Teach it back

In two sentences, with no formula, tell an imaginary friend why surprise has to be built from a logarithm.

Your own morning, measured

Take the probability YOU built in §1.5 and measure the surprise both ways — this is your doorway, not a textbook coin.

⏳ Beyond this lesson — your spaced practice

The hardest practice isn’t here, on purpose. In a later module you’ll be asked to rebuild −ln p and the demands cold, from a blank — no peeking — and to use surprise in new numberless settings with no app at all: a nurse reading a patient’s colour and breathing, a sailor reading the swell, a cook smelling the oven. Recalling something under a little effort, days later, in a new place, is what burns it in. (We teach in small steps and test in bigger ones — which is exactly the learning law this book is about.)
5 · Where this goes next

Stand back and see what you have

You can now put an exact, checkable number on the surprise of a single outcome — and, crucially, you know where that number came from: your own model, reading a world that arrives with no numbers. Two doors open: what is the true surprise of what happened, over every hidden cause (it needs a sum you can never finish — the wall); and if you can’t compute your true surprise, how does a mind minimize it? The answer is what this book is named for — free energy: a height, a belief a position, and “making sense of the world” a ball rolling downhill into a valley whose lowest point is a truth you couldn’t compute directly. You’ll build that landscape yourself.

⬡ Notice what you just did self-reference
You stood in a doorway, turned numberless sensation into a lean, read a number off it, predicted which rules would survive, were contradicted (that jolt on guess B), and updated. That loop — predict from your model, meet the world, feel the gap, update — is active inference. It’s the subject of this book, and you just spent a lesson being it.