01 / 04
The brain as a prediction machine
01 — The big idea
The Hitchhiker's Guide to the Hungarian Subconscious — series

Your brain is not a window.
A hypothesis.

Your senses deliver billions of impulses per second. A passive brain could never keep up — too much, too fast. The trick: the brain does not wait for the input. It predicts what is about to arrive, and updates only when it was wrong.

használati utasítás — after István Örkény

Ha ezt a bekezdést gond nélkül elolvassa, Önnek nem ez a kiadás kell: az eredeti a tanul.io/prediktiv címen várja, és az agya már meg is jósolta, mi lesz benne. Ha viszont egy szót sem ért belőle, ne aggódjon: az agya ezt is megjósolta.

P.S. If the paragraph above surprised you, excellent: surprise is how you learn. That is, in fact, the entire article. The rest is detail.

/ 01

The brain knows in advance

By the time light reaches the retina, the cortical regions have already stated what they expect. Perception is not discovery but expectation, which the world later confirms — or doesn't.

/ 02

The input is not what matters

The error is: the difference between what you expected and what you got. What travels up the cortex's ascending pathways is mostly not the input itself but this surprise signal.

/ 03

Reality is a controlled hallucination

You do not see the world directly; you see your own model of it, continuously corrected by the world. Anil Seth calls this "controlled hallucination" — with equal stress on both words.

Perception does not run bottom-up. Nor top-down. It is a
standing negotiation between the two. — The core of predictive coding

The idea reaches back to Helmholtz (1860) ("unconscious inference"); its modern mathematical form was worked out by Rao & Ballard (1999) and Karl Friston. Today it is one of the most-cited frameworks in cognitive neuroscience — and it tells a radically different story about how we learn.

the guide on: tanul

The site you are reading is called tanul.io. Tanul is Hungarian for "learns" — third person singular, present tense. Hungarian omits the pronoun, so the name quietly declines to say who is doing the learning: the reader, the brain, or — increasingly — the models. The Guide considers this ambiguity load-bearing and this article the site's founding document.

02 — The mechanism

Two directions.
One noise.

For a long time we pictured the brain as a conveyor belt: raw data at the bottom, finished result at the top. According to predictive coding it is roughly the other way round. Each level tells the one below it what to expect — and only the mistakes, the prediction errors, travel upward.

The cortical hierarchy / schematic
HIGH LEVEL — concepts, context MID LEVEL — objects, shapes LOW LEVEL — edges, patches ↓ sensory input ↓ PREDICTION ERROR
Prediction (top-down)
Prediction error (bottom-up)

The three key moves

1. Predict. Each layer sends a prediction from its own generative model downward — a "this is what I expect" message.

2. Error. The layer below compares the prediction with the actual activity. The difference — and only the difference — travels up.

3. Update. The higher level revises its model so that the future holds fewer surprises. This is what learning is.

error = input − prediction the engine of learning

Bayesian psychology

Each layer essentially runs a small Bayesian computation: it combines the prior belief with the incoming evidence (likelihood), and produces the updated belief (posterior). Which one to trust more — the conviction or the sense organ — is weighted by precision.

/ Try it — perceptual balance
Move the sliders.
03 — The fourth revolution

What is new here?

The learning theories of the 20th century started from rather different assumptions. Tap the cards — each shows the old claim, and what predictive coding says instead.

BehaviourismPAVLOV · SKINNER · 1900–1960

+
"Stimulus → response. Reinforcement or punishment teaches. The mind is a black box."

The brain is passive: it merely reacts to the environment. Talking about internal representations is superstition.

The brain is not passive: as long as it is alive, it predicts. A "stimulus" reaches consciousness already prediction-modulated — by then the box has been manufacturing hypotheses about it. Worth looking inside.

CognitivismINFORMATION PROCESSING · 1960–

+
"Input → processing → output. The brain is a computer that encodes, stores and retrieves sensory data."

The process is one-directional and runs bottom-up. Higher regions join in later.

The anatomy says rather the opposite: far more axons run downward from the higher cortical regions than upward. Prediction starts first, and perception is the test of that prediction, not its beginning. Processing is bidirectional and parallel.

Hebbian learningHEBB · 1949

+
"Neurons that fire together, wire together." — Correlation strengthens connections.

Learning is blind co-occurrence detection: whatever is active at the same time gets linked.

It is not correlation by itself that teaches, but surprise. If everything is perfectly predictable, the error signal is zero and the weights do not move. In PC, synapses change only when the prediction missed — a far more selective learner than the blind co-occurrence rule.

Standard neural networksBACKPROP · LABELLED DATA

+
"Feed-forward layers with an external teaching signal (label). Supervised learning on huge labelled datasets."

The network needs external truth: someone has to say what the right answer is.

In the PC model the network manufactures its own teaching signal — its own predictions. No external labels needed: the difference between input and prediction is enough by itself. A self-driven, self-supervised learner.

Reinforcement learningRL · MAXIMISE THE REWARD

+
"The agent acts, the environment hands out reward, the agent learns to maximise it."

The goal of learning is reward. Reward is external, scalar, and universally evaluable.

In the PC frame the goal is to minimise surprise (formally: free energy). Reward itself is a prediction: "this is what I expected, this is what happened." There are two ways to get there — update the model, or act so that the world fits it. The latter is active inference.

The four leaps, briefly

(1) Passive → active brain. (2) One-way → two-way processing. (3) Correlation → prediction error as the schoolmaster. (4) External reward → internal surprise-minimisation.

04 — Where it leads

Your whole life plays against surprise.

If the brain is a prediction machine, a number of mysterious phenomena suddenly make sense. A few examples:

/ Mini-demo — controlled hallucination
"the cat sat on the carpet"
The prior fills in what the sense organ leaves out.
👁

Optical illusions

The hollow-mask illusion, the Müller-Lyer lines, Adelson's checker shadow: the prior overrides the input. You know the shadowed square is the same grey as the bright one — you still see it differently. That is how strong a prior is.

Dreams and hallucination

In sleep, sensory input drops dramatically, but the generative model keeps working. Nothing contradicts the downward predictions — the result is an internal, coherent world. A dream.

!

Learning & curiosity

You can only learn from error. If everything is perfectly predictable, there is nothing to update from — hence the feeling of boredom. Curiosity is the inverse: hunting for fresh surprises the model can grow on.

Attention

Attention is not a spotlight that illuminates something; it is precision weighting: the system decides which error signal deserves belief — the loud neighbour or your own expectation. The machinery behind the cocktail-party effect is the same.

Active inference

There are two ways to reduce the error: (a) update the model to fit the new evidence, or (b) change the world so it fits the model. The second one is called action. When you move, you are fulfilling a prediction.

Anxiety, depression, psychosis

Clinical theories suggest many mental disorders are precision gone wrong: the error signal too strong (anxiety), the prior too rigid (compulsion), or the balance between the two broken (psychosis).

If the brain is a prediction machine, then learning is not information-gathering.
It is error correction. And curiosity?
The hunting of new opportunities to be wrong.

— The end. Read it again and your model gets sharper. That was a prediction.