Fit one linear map from a language model’s features to a brain recording, and the model predicts the brain almost as well as the noise allows. What does that prove?
Pick a feature set and watch how much of the brain’s explainable response it predicts. Then we build the encoding model, the brain score and the noise ceiling piece by piece, and weigh what the match really says.
You need a rough idea of what a correlation is (a number from −1 to 1 for how two curves move together) and that a language model guesses the next word. We build the rest from zero.
Built from primary sources: Schrimpf et al., PNAS 2021; Caucheteux and King, Communications Biology 2022; Tang et al., Nature Neuroscience 2023. The full list is in the Field Guide. Lesson 25 of the BCI series.
The bars are Schrimpf et al. 2021: a random context-free embedding under 15%, an untrained GPT-2 XL about 51%, earlier models at most 30 to 50%, the trained GPT-2 XL close to 100% on Pereira 2018 and 32% on Blank 2014. The two traces are illustrative: drawn so their match equals the chosen bar.
Chapter 0
See why a language model and a listening brain might share one job, and what we must show before we believe it
You are listening to a podcast. The host says: “She poured the coffee into the…” and pauses to breathe. Before the next word arrives, you already expect one. “Cup.” Maybe “mug.” You would be startled by “gravel.”
That small expectation is the whole subject of this lesson. A language model (LM) is a program that reads the words so far and gives every possible next word a probability. It is the engine inside GPT-2 and its larger cousins. Your guess about “cup” looks like the same job.
So here is the question. When a person hears a story, does the brain do something like what the language model does? And if we could test it with a recording, what would the test look like?
Put a person in a scanner and play a story. The scanner records the brain’s response, a long list of numbers that changes every two seconds. Feed the same story, word by word, to a language model. The model produces its own list of numbers for every word: its features, the internal summary it keeps of the words so far.
Now ask one question. Can we find a fixed recipe that turns the model’s features into the brain’s response? The simplest recipe is a weighted sum, one weight per feature. That is a linear map. If a linear map predicts a brain recording the model has never seen, the model’s features and the brain’s activity share structure.
The linear map is called an encoding model, because it encodes the story into brain activity. The score it earns on held-out data is the brain score. Chapters 3 and 4 build both from zero.
A high brain score is a fact about a match. It is not yet a fact about a mechanism. A model can match a brain for many reasons, and only one of them is “the brain also predicts the next word.” Keeping those two apart is the real skill of this lesson.
First a feel for the quantity predictive theories care about. A language model’s surprisal for a word is how unlikely the model found it, measured in bits: surprisal = −log2 of the probability. A word with probability 1/2 costs 1 bit. A word with probability 1/1024 costs 10 bits. Rare words cost more.
Drag the slider to reveal the sentence one word at a time. Each bar is the surprise of that word in bits. Then press the toggle to swap “mug” for “gravel”.
Illustrative: the probabilities are made-up numbers for a small language model, not measurements. The arithmetic is exact: surprisal in bits = −log2(probability).
The device shows the pattern that matters. Words the model expects cost almost nothing. A word the model found absurd costs about 11 bits, more than any other word in the sentence. Predictive theories of the brain say this same quantity should show up in the recording.
We follow the evidence in the order a researcher would meet it. First comes what the recording is, then what the features are, then the map between them. Next we learn how to score that map fairly. Then come the two landmark papers, the theory they were used to support, and the doubts. The last step is the use that matters most for brain-computer interfaces: reading language out of the brain.
Chapter 1
Meet the three ways to record a listening brain, and learn why the signal always arrives late
A volunteer lies in an MRI scanner with headphones on. For 16 hours, spread over many sessions, she hears autobiographical stories. That is the setup in Tang and colleagues, 2023. Every 2 seconds the scanner takes one picture of her brain. We want to turn those pictures into numbers a computer can fit.
The picture is a grid of small cubes called voxels (volume pixels, a few millimetres wide). Each voxel gets one number per scan: how much blood-oxygen signal it carries. That number is the BOLD signal (blood-oxygen-level dependent). Active neurons use oxygen, and the blood supply responds. So BOLD is a slow, indirect echo of neural work.
In data terms, one recording is a table Y: T × V. Each of the T rows is one scan. Each of the V columns is one voxel. At one scan every 2 s, 16 hours is about 28,800 rows (our arithmetic). V runs to tens of thousands.
The studies in this lesson use three kinds of recording. Each trades speed for reach.
Caucheteux and King, 2022, used fMRI and MEG from 102 Dutch speakers reading 400 sentences. Schrimpf and colleagues, 2021, used fMRI and ECoG. Goldstein and colleagues, 2022, used ECoG from 9 participants who heard a 30-minute podcast. Our series covers the instruments in The Recording Map.
Now the trap. Words arrive about two or three per second. A word shapes neural firing within a fraction of a second. But the blood takes several seconds to respond. So a voxel’s value at scan t reflects words heard two, four, six and eight seconds earlier, not the word heard right now.
The fix is simple and general. Do not match the voxel at time t with the features at time t. Match it with copies of the features shifted back in time, and let the regression decide how much each copy matters. Tang et al. used shifts of 2, 4, 6 and 8 s. Caucheteux and King used five delays from 2 to 10 s for fMRI. This is a finite impulse response (FIR) model: the output is a weighted sum of the input’s recent past.
Try it. The device below hides a voxel whose true response arrives mostly 4 to 6 seconds late. Use only the present, then add delays, and watch the match on the held-out part.
The warm line is one language-model feature over time. The blue line is a voxel. The green line is the prediction. The shaded right part is held out: the fit never saw it. Switch delays on and off.
Toy data, seeded so it is the same every visit: 150 scans at 2 s, a made-up feature, and a voxel built as 0.2, 0.9, 0.6 and 0.15 times the feature 2, 4, 6 and 8 s earlier, plus noise. The fit is ridge regression on the first 90 scans; the correlation is on the last 52.
With only the present, the prediction has almost nothing to grab. Add 4 s and 6 s and it locks on. Adding more delays than the voxel uses costs little, because the regression gives unused delays a weight near zero. That is why real studies simply include four or five.
One more detail: the language model makes one feature set per word, but the scanner makes one row per 2 seconds. The words must be resampled onto the scan clock. Tang et al. did this with a smooth filter (a 3-lobe Lanczos filter). Chapter 2 shows what comes out.
Take one word with a feature value of 1 at second 0. The toy voxel in the device answers 0.2 at 2 s, 0.9 at 4 s, 0.6 at 6 s and 0.15 at 8 s. Those four add to 1.85, spread over eight seconds. A regression that sees only the present sees a 1 at second 0 and a voxel that has not moved yet. It learns a weight near zero. A regression with four delayed copies sees a 1 in the “4 s” column exactly when the voxel reads 0.9. It learns that weight directly.
The failure has a recognisable face. The symptom is an fMRI score near zero for a model that works well in MEG. The measurement is a sweep of the delay set: score with no delays, then 2 s, then 2 and 4 s, and so on. The fix is to include delays that cover the whole blood-flow response.
Chapter 2
Follow one sentence through a model and see which of its many internal vectors becomes the feature
Take the sentence “The chef chopped the onions.” You feed it to a language model. Out come not one list of numbers but a whole stack of them. We must choose which list to line up with the brain. That choice matters more than it seems.
First the plumbing. The model cuts the text into tokens, the pieces it counts (here, one token per word, to keep the picture simple). Each token becomes a vector, a list of d numbers, and passes through a stack of layers. Each layer reads the vectors from the layer below and rewrites them, mixing in the words that came before. These rewritten vectors are the hidden states.
Here is the data flow, with the sizes of the model Tang and colleagues used (GPT, a 12-layer network with 768 numbers per vector):
That last number, 3,072 = 4 × 768, is quoted from the paper’s Methods. The matrix X has one row per scan and thousands of columns. The brain table Y from Chapter 1 has the same rows and one column per voxel.
Think of the layers as a reading process. At the bottom, a vector knows little more than which word it is. Higher up, the vector for “chopped” has absorbed that a chef is the doer and onions are the object. The top layers are tuned for one job: pushing out the next-word probabilities. They throw away some detail that the brain may still carry.
Caucheteux and King tested this directly. They trained 36 small architectures, 18 causal models (they see only earlier words, like GPT) and 18 masked models (they fill in blanked words, like BERT). Each was saved at about 100 points during training. Then they asked which layer predicts the brain best. Layers in the middle won: from half the depth to three quarters of it. Both the input layers and the output layers did worse. Compared with the input layer, the middle layers gained a correlation of 0.031 in fMRI and 0.009 in MEG (averages in the paper).
The row of boxes is a 12-layer model, input on the left. Drag the slider to choose a layer. The curve shows the shape found in the paper: low at the input, high in the middle, lower at the output. Switch between fMRI and MEG.
The shaded band (layers 6 to 9 of 12) and the peak gains over the input layer (0.031 fMRI, 0.009 MEG) are Caucheteux and King 2022. The curve between them is illustrative, a smooth inverted U drawn through those two facts.
Notice the failure this suggests. If you take the last layer because it is “the model’s answer,” you lose brain score. The symptom is a weaker fit than a smaller model gets. The measurement is a sweep over layers. The fix is to pick the layer on data held apart from the final test. Choosing the layer on the test data would hide a leak inside the result.
Two more facts about features deserve a plain statement. First, a model with random weights still produces features, and they still predict the brain a little: Caucheteux and King report a score of 0.019 in fMRI and 0.018 in MEG from random embeddings. Chapter 8 returns to why that matters. Second, a causal model uses only earlier words, so its feature for a word never contains the future. That matches what a listener has heard at that moment, and it is why causal models suit the prediction question.
Back in sampling and decoding you saw how the top layer becomes probabilities. In the transformer lesson you saw how each layer mixes in earlier words. Here we reuse the stack, but we read the middle instead of the top.
A hidden state for one word is 768 numbers. No single number means anything alone, such as “animal” or “past tense.” The meaning sits in the direction of the whole vector. Two words used in similar ways point in similar directions. You met this idea in word vectors. The regression of Chapter 3 can then use any direction the brain also cares about.
Now the resampling step with numbers. Suppose five words fall inside one 2-second scan (an illustrative rate). You have five vectors of 768 numbers. Average them and you get one row of 768 numbers for that scan. Slide through the story and you build the table of T rows. The papers used a smoother filter than a plain average, but the shape is the same.
Chapter 3
Build the weighted sum that turns features into a voxel, and learn why the test must use a story the fit never saw
Two students prepare for an exam. One memorises last year’s answer key. The other learns the method. On last year’s paper, the first student scores 100%. On this year’s paper, she fails. The only fair grade comes from questions neither student has seen.
An encoding model faces the same trap. With thousands of features and a limited number of scans, a regression can memorise the noise in the training story. It will then look brilliant on that story and useless on the next. So the score that counts is always measured on held-out data: scans the fit never touched.
The setup from Chapters 1 and 2 gives two tables. X holds the language-model features, T × F, one row per scan. Y holds the brain, T × V, one column per voxel. We want a table of weights W, F × V, so that X times W is close to Y.
“Close” means a small sum of squared errors. With thousands of features that is not enough: some columns of X are nearly copies of each other, and the best weights become huge and wild. Ridge regression adds a penalty on the size of the weights. A tuning number λ says how hard to punish large weights.
Here is the smallest case with every step. One feature, three training scans: x = (1, 2, 3) and the voxel y = (2, 3, 7). Then XTX = 1 + 4 + 9 = 14, and XTy = 2 + 6 + 21 = 29. With λ = 0, the weight is 29 / 14 = 2.07. With λ = 14, it is 29 / (14 + 14) = 1.04. The penalty halved the weight. That is shrinkage.
Tang et al. fit a separate λ for each voxel, chosen by cross-validation. Caucheteux and King chose theirs by nested leave-one-out cross-validation. In both, the voxel columns share X, so one matrix inverse serves every voxel at a given λ.
With W in hand, predict held-out scans: Ŷ = Xtest W. For each voxel, compute the Pearson correlation between its predicted and its real held-out curve. That number is the voxel’s brain score. Caucheteux and King report exactly this, averaged over voxels and subjects. A split by time block, not by random scan, is essential: BOLD is slow, so neighbouring scans look alike and a random split leaks. Caucheteux and King held out blocks of 5 sentences. Tang et al. tested on whole new stories.
A made-up voxel depends on 40 features plus noise. Choose how many scans to train on and how hard to punish big weights. The green curve is the score that counts: correlation on 200 held-out scans.
Toy data, seeded: 40 random features, true weights drawn once, noise three times the signal variance, so even perfect weights reach about r = 0.5. The ridge solve runs live in your browser. The curves show every λ for the training size you chose.
Read the device in three steps. With 60 scans and almost no penalty, the training correlation is near 1 while the held-out score is poor. That gap is the symptom of memorising. Raise λ and the training score falls while the held-out score climbs. Add scans and the gap closes by itself. The measurement is the gap between the two curves. The fix is either more data or a stronger penalty, chosen on validation scans.
This pipeline is the same one used in the GLM and decoding lessons of this series. See generalized linear models for the cousin used on spikes, and bias and variance for why the penalty trades one for the other.
Count the cost. With 3,072 columns, the matrix XTX has 3,072 × 3,072 = 9,437,184 entries. You build it once. For each penalty λ you invert it once. The right-hand side XTY simply gains one column per voxel, so tens of thousands of voxels add almost nothing to the cost of the solve. That is why a whole-brain encoding model runs in minutes.
Choosing λ is the part that needs care. Try a grid of values, such as powers of ten. For each voxel, keep the λ whose predictions score best on validation scans. Tang et al. did this voxel by voxel. The final report then uses a separate test story, so the choice of λ never touches the score you publish.
Chapter 4
Learn why a correlation of 0.06 can be a perfect score, and how to divide by the best any model could do
A paper reports that its best model reaches a brain score of 0.32. A reader frowns. A correlation of 0.32 sounds weak. But the recording itself is noisy, and no model, however good, can predict noise. The question is not “is 0.32 big?” but “how close is 0.32 to the most that is possible?”
That most-possible number is the noise ceiling. It is the correlation you would get if your model knew the brain’s true signal exactly and only the measurement noise were left over. Think of a bathroom scale that jitters by a kilogram. Even a perfect guess of your weight will not match the display every time.
You cannot see the true signal. But you can see how well two independent measurements of the same response agree. Suppose a voxel is recorded twice while the same story plays. If both recordings are the signal plus separate noise, then their correlation, called the split-half reliability, tells you how much of each recording is signal. The best correlation any model can reach with one recording is the square root of that reliability.
Real studies do not always have repeats, so they estimate the ceiling by other means. Schrimpf and colleagues subsampled participants. Caucheteux and King built a shared-response model across subjects. The methods differ, so ceilings are not interchangeable between papers.
The numbers from Schrimpf et al. 2021 make this concrete. The ceilings were 0.32 for the Pereira fMRI data, 0.17 for the Fedorenko ECoG data and 0.20 for the Blank fMRI data. A model scoring r = 0.30 on Pereira would score 0.30 / 0.32 = 94%. The paper reports GPT-2 XL near 100% on Pereira and Fedorenko, and 32% on Blank. On Blank, then, the raw correlation is about 0.32 × 0.20 = 0.064 (our arithmetic from their two numbers).
The same logic appears in Caucheteux and King. Their ceiling from the shared-response model was 0.060 for fMRI and 0.020 for MEG, and the scores of their compositional features were 0.048 and 0.041. In MEG the score of 0.041 sits above the ceiling estimate of 0.020. The paper stresses that these are noisy single-sample data. The lesson: treat ceilings as estimates with error, not as hard walls.
A made-up voxel is recorded twice. The yellow marker is the noise ceiling, from how well the two recordings agree. Raise the noise and watch the raw score fall while the share of the ceiling stays put.
Toy data, seeded: 200 scans of a made-up signal, two recordings with the same signal and separate noise, and a prediction whose true match to the signal is the model quality. The ceiling is the square root of the correlation between the two recordings. All three numbers are computed live.
Here is the failure to avoid. The symptom is a raw score of 0.06 that looks like a failure. The measurement is the ceiling, 0.060 in the same recording. The fix is to report both numbers, or their ratio, and to name how the ceiling was estimated. A raw score alone cannot be compared across datasets with different noise.
There is also a limit on the other side. When a model reaches 100% of the ceiling, the test can no longer separate it from a better one. Schrimpf and colleagues note that their ceilings are low compared with, for example, 0.82 for primate inferior temporal cortex in vision, and that high reliability may not be attainable for higher-level cognition. Reaching the ceiling means the data ran out of resolution, not that the brain is understood.
Run the arithmetic for the device’s starting setting. The noise has twice the size of the signal. Two recordings then agree with a correlation of about 1 / (1 + 4) = 0.2. The ceiling is the square root, about 0.45. A model whose true match to the signal is 0.8 earns a raw score of about 0.8 × 0.45 = 0.36. Divide: 0.36 / 0.45 = 80% of the ceiling.
Now double the noise again, to four times the signal. The agreement falls to 1 / 17, about 0.06, and the ceiling to 0.24. The same model now scores about 0.19 raw, still 80% of its ceiling. This is the point of the ratio: the raw score falls with the noise, but the share does not.
Chapter 5
Read the first large test of language models against brain data and learn what a correlation of 0.44 really says
Imagine a league table. Forty-three language models line up. Each is asked to predict the brain of people reading sentences. Which ones win, and what do the winners have in common? Schrimpf and colleagues, from MIT, ran exactly this contest and published it in PNAS in 2021 under the title “The neural architecture of language: Integrative modeling converges on predictive processing.”
The 43 models spanned the field: word-vector models such as GloVe, recurrent networks such as lm_1b and skip-thoughts, and transformers such as BERT, GPT, GPT-2 and XLNet. They were tested on three brain datasets:
They also used one behavioural dataset: self-paced reading times from Futrell 2018, with about 180 readers. For each model and dataset, a linear map was fit with five-fold cross-validation (80% of data to train, 20% held out, five times). The score was the median held-out Pearson correlation, divided by the noise ceiling of Chapter 4. Ceilings were 0.32, 0.17 and 0.20 for the three brain sets and 0.76 for reading times.
The best model, GPT-2 XL, predicted Pereira and Fedorenko at close to 100% of the ceiling. On Blank it reached 32%. Earlier models, the paper says, had explained at most 30 to 50% of the predictable signal. So for sentences, the transformers closed most of the gap.
The more interesting step is the comparison between models. Each of the 43 models also has a score on its own language task. The authors asked which task score lines up with brain score. Next-word prediction did, with a correlation of r = 0.44 (P < 0.01), averaged across datasets. Scores on the GLUE benchmark, a suite of other language tasks such as judging if two sentences mean the same, did not predict brain scores.
Behaviour told a similar story. Next-word prediction correlated with how well a model predicts human reading times at r = 0.67. Brain score and behavioural score correlated at r = 0.65. The authors read these together as support for the idea that language processing in the brain is organised around prediction.
Each dot is one of the 43 models. Pick a comparison from the paper and see the cloud its correlation makes. Then drag the slider to a stronger or weaker value.
The dots are illustrative: 43 seeded random points, adjusted so their correlation equals the chosen value exactly. The correlations (0.44, 0.67, 0.65) are Schrimpf et al. 2021. The paper reports GLUE does not predict brain scores; the dots show r = 0 for that case.
The cloud makes the size of the claim plain. At r = 0.44 the models still scatter widely. A model with a better next-word score is usually a better brain model, not always. Squaring the correlation gives 0.19 (our arithmetic): next-word skill accounts for roughly a fifth of the variation in brain score across models. The measurement is that spread. The fix for over-reading it is to say “tends to” where the paper's number only supports “tends to”.
First, an untrained GPT-2 XL, with random weights and only a linear readout trained on top, still scored about 51% on average, roughly 20% below the trained network. Training added the rest. Architecture alone carries a lot. Second, a random embedding with no context, of the same size, predicted under 15% of the neural data. So raw dimension is not the reason: the way each word is mixed with its neighbours is.
The authors list their own limits. Models lack grounded meaning. Fit was lowest on the long stories of Blank. The mapping from layers to brain regions is not established. And language modelling is built into how these architectures are designed, so its influence cannot be fully separated from the architecture’s.
A fair worry: maybe a model wins on one dataset by luck. The authors checked. The brain scores of the 43 models on the two Pereira experiments correlated at r = 0.94. Between Pereira and Fedorenko the correlation was r = 0.50, and between Pereira and Blank it was r = 0.63. So the order of the models carries over, strongly within one lab’s data and moderately across recording methods.
That matters for how you read the headline. “Close to 100%” on one dataset is a statement about that dataset’s ceiling. The across-dataset correlations say the model ranking is not a fluke of one scanner or one set of sentences.
Chapter 6
Follow thousands of small networks through training and watch when, and where in time, they start to look like a reading brain
Schrimpf compared finished models. Charlotte Caucheteux and Jean-Rémi King, at Meta AI and ENS, asked a sharper question: what happens during training? If a network starts as random numbers and slowly learns to predict words, at what point does it begin to resemble a brain? Their answer, published in Communications Biology in 2022, is in the title: brains and algorithms partially converge.
They used one open dataset: 102 native Dutch speakers, each reading 400 isolated sentences of 9 to 15 words, in two one-hour sessions. The data had both fMRI and MEG, so the same words were seen by a slow, accurate scanner and a fast, blurry one.
On the model side they trained 36 small architectures (the paper also says 32 in places) on Dutch Wikipedia (about 278 million words): 18 causal and 18 masked, with 128, 256 or 512 dimensions, 4, 8 or 12 layers and 4 or 8 attention heads. They saved each at about 100 moments in training. That gives about 3,600 networks, each used as a feature extractor, with the same ridge-and-held-out brain score of Chapters 3 and 4.
To see what the networks add, they compared three feature sets. A small visual network stood for the letters on screen. A lexical set stood for the identity of each word. The compositional set was the extra gain from the network’s context-mixing layers beyond the word identity.
The brain answered in order. Visual features predicted early visual cortex (fMRI peak at the first visual area, r = 0.022) and, in MEG, peaked around 100 ms after a word appeared. Lexical features predicted the left superior temporal gyrus best (fMRI r = 0.052); their MEG gain started around 200 ms in the left posterior fusiform region and peaked near 400 ms. The compositional gain peaked later, around 1 second after word onset.
Each curve is how much a feature family adds to the MEG brain score at a given time after the word appears. Drag the cursor along the second. Switch families on and off.
The peak times (visual about 100 ms, lexical about 400 ms, compositional about 1 s) are from Caucheteux and King 2022. The widths and heights of the bumps are illustrative, drawn only to show the order.
Two measurements here matter for BCIs too. The first is timing: MEG shows the order of processing that fMRI blurs. The second is that the later stages need context. A model that sees only isolated words cannot produce the compositional gain.
Across all networks and checkpoints, brain score correlated with the network’s word-prediction accuracy (how often its top guess was the right word). The average correlation was R = 0.77 in MEG and 0.57 in fMRI. Looking only at middle layers, it rose to 0.86 and 0.81. A random forest asked which property of a network best predicts its brain score, and the answer was its language performance, ahead of training amount or layer position.
Now the “partial” in the title. Among the causal models, the best brain scores came at lower accuracy than the maximum: MEG R = 0.039 at 43% accuracy and fMRI R = 0.056 at 32%. The most accurate networks, at 46%, scored lower. The authors read this as convergence only in part: past some point, being a better predictor of words did not make a network a better predictor of the brain.
The measurement behind that claim is a curve, brain score against accuracy. The symptom of over-reading is the sentence “bigger models are more brain-like.” The fix is to plot the whole curve of score against accuracy and read its shape, not to read off a ranked list.
The study also lists limits. The correlations are low, as expected from single noisy samples. The text was 400 isolated Dutch sentences, not narratives. Models saw Wikipedia only and received no tuning. A transformer is feedforward over its context; the brain is recurrent and learns from far less text. And random embeddings already scored 0.019 in fMRI and 0.018 in MEG, a fact Chapter 8 uses.
Put the pieces next to each other. The compositional features reached R = 0.048 in fMRI, against a shared-response ceiling estimate of 0.060. That is about 80% of the estimate (our arithmetic). In MEG the estimate was 0.020 and the score 0.041, which shows why estimates carry error, as Chapter 4 warned. Brain scores moved with accuracy more tightly in MEG (R = 0.77) than in fMRI (R = 0.57), as if the fast signal sees the model’s progress more cleanly.
Note what the design bought. Because the networks were small and trained by the authors, they could be compared at every stage of learning, which a downloaded model cannot be. The cost is that 278 million words of Wikipedia is far less text than a large modern model sees.
Chapter 7
Turn the idea that the brain guesses ahead into three measurable claims, and see how far ahead the guesses reach
A friend finishes your sentence. You were about to say the same words. The little jolt you feel when a friend finishes it wrong is the thing this chapter is about. Your mind was running ahead of the speaker, and the world disagreed.
Predictive processing (also called predictive coding) is the theory that the brain does this all the time, at every level. Higher areas send down a guess about what comes next. Lower areas compare the guess with the arriving signal. The difference is the prediction error, and it is what gets passed upward and learned from.
For language the theory makes crisp, testable claims. The chapter looks at two studies that test them with language models as the measuring stick.
Goldstein and colleagues, 2022, in Nature Neuroscience, recorded ECoG from 9 participants who heard a 30-minute podcast. They argued that the brain and autoregressive language models (like GPT-2) share three principles:
The first claim is the bold one. It means signs of the upcoming word should appear in the recording before the word does. Our access to this study is through its abstract and listing, so we use only its design and its three claims here. The details are in the paper (link in the Field Guide).
Caucheteux, Gramfort and King, 2023 (Nature Human Behaviour; we read the arXiv preprint of the same work) asked how far the guesses reach. They used fMRI from 304 people, each hearing about 70 minutes of short stories.
Their trick is simple. Take the model’s features for the current word, as in Chapter 3. Then add features of the words that come next, a forecast window d words ahead. The window is shrunk with PCA (the principal-component method from the PCA lesson) to the same size as the current features, so the extra input cannot win just by being bigger. The forecast score F is the gain in brain score from adding the window.
Two results stand out. F is largest, on average, for a window of d = 8 words. And the best depth of the network changes along the brain’s hierarchy: association cortices, such as fronto-parietal regions, are best modelled by deeper layers (best layer above 6 of 12) than low-level language areas (best layer below 6). The authors read this as long-range, more abstract forecasts higher up, short-range ones lower down.
The green words are the window of upcoming words added to the features. The curve below is the gain in brain score, with its peak at 8 words. Pick a region to see which layer of the 12 fits best.
Only two facts here are the paper’s: the forecast score peaks at a distance of 8 words, and the best layer is below 6 in low-level areas and above 6 in association cortex. The smooth curve and the marked layers (4 and 9) are illustrative.
The paper ran controls that matter. Random forecast representations did not improve the brain score. Using the words GPT-2 itself generated, instead of the true upcoming words, gave lower but similar results. Those controls are why the result is evidence and not an accident of text statistics.
Still, name the possible failure. Words that come next are correlated with the words already heard, because text is smooth. The symptom would be a gain from the window that has nothing to do with prediction. The measurement is the random-window control, which the authors ran. The fix is that kind of control, plus the alternative accounts of Chapter 8.
The second principle of Goldstein et al. links back to Chapter 0. If the brain holds a guess before the word, then the word that arrives either matches it or does not. The size of the mismatch is the surprise, which the model computes as surprisal in bits. A theory that says “the brain predicts” therefore also says “the brain signal after a word should grow with the word’s surprisal.” Each claim can be checked in a recording, and each can fail.
Count the columns in the forecast test. The current word has 768 features. A window of eight upcoming words has 8 × 768 = 6,144. PCA squeezes those back to 768, so the model with the window has 1,536 columns, not 6,912. Any gain then comes from what the window contains, not from how many numbers it adds.
Chapter 8
Separate a model that predicts the brain from a brain that works like the model, and learn the checks that tell them apart
A doctor sees a red face and a fever. Does the patient have a cold, the flu, or a sunburn? The signs fit all three. A good doctor does not pick the first story that fits. She asks which story the signs exclude.
Encoding results are like the red face. A high brain score says the model’s features and the brain share structure. It does not say which structure, or why. The first three studies in this lesson give evidence that fits predictive processing. This chapter asks what else fits.
Look back at the numbers. Schrimpf et al. found that an untrained GPT-2 XL already predicts about 51% of the neural data. Nothing in a random network was trained to predict words. Caucheteux and King found that random embeddings gave significant scores too: 0.019 in fMRI and 0.018 in MEG. A random network still mixes each word with its neighbours, and that mixing carries information about words and their order. A linear map can use it.
Next, the task link. In the 43-model study, next-word prediction predicts brain score and GLUE does not. But next-word prediction is also how the strongest models are built. The relation between task skill and brain score may reflect which models are rich in features, not which ones predict.
Antonello and Huth, in Neurobiology of Language (2024), make this argument directly. We read their abstract through a search listing, not the full text, so we report only its stated claims. They argue that the high performance of language-model encoding models should not be taken as positive evidence for predictive coding. They report that, within a model, the representations that are best at predicting future words are worse brain models than other representations. Their alternative: language models fit the brain because they capture a wide variety of linguistic properties, which the authors call feature discovery. They also note that the brain could still be doing predictive coding; this kind of evidence just cannot show it.
This does not cancel Chapter 7. The two studies ask different questions, and the field has not settled them. Treat both as live.
Here is the cleanest way to feel it. In the device, a made-up voxel responds to five linguistic properties of the text (think word frequency, part of speech, syntax, topic, position). It does not respond to surprisal at all. Now fit a model whose only feature is surprisal. Text is tangled: words that are surprising tend to differ in the other properties too. The slider sets how tangled.
Raise the entanglement between surprisal and the other properties. The surprisal-only model scores higher, though the voxel never reads surprisal. Then press the toggle to let the voxel use it.
Toy data, seeded: 600 training and 300 held-out words, five properties the voxel uses, one surprisal feature, noise equal to the signal. The scrambled model has all six properties mixed by a random matrix, like an untrained network. Ridge fits run live. Nothing here is from a paper; it shows the logic of the confound.
With entanglement 0, surprisal alone scores near zero, as it should. At 0.8 it scores well, yet the voxel does not use it. The scrambled model, which holds all properties in a jumbled but linear form, scores near the best possible, just as an untrained network does in the real data.
Now the failure mode in three steps. The symptom: a prediction-based feature fits the brain. The measurement: add the competing features to the same model and ask whether the prediction feature still adds anything on held-out data. This is called variance partitioning. The fix: report what the feature adds beyond the others, not what it explains alone.
Researchers use several levers. They compare models trained for different objectives on the same text. They choose sentences where surprisal and the other properties are pulled apart. They look for signals that arrive before a word, as in Goldstein et al. And they test whether a forecast helps beyond the context, as in Chapter 7. No single check closes the case; together they narrow it.
Here is the check in its simplest form, with made-up scores. Fit model A with five linguistic properties and no surprisal. Say it explains 30% of a voxel’s variance on held-out data. Fit model B with the same five properties plus surprisal. If B also explains 30%, surprisal added nothing: its earlier success was borrowed. If B explains 35%, surprisal added 5 points that the other properties did not carry. That 5 is the evidence for a prediction signal.
Real studies run this with many more feature groups and with care about shared variance. The idea stays the same. Ask what the feature adds beyond its rivals, on data it has not seen.
Chapter 9
Run the encoding model backwards with a language model and a beam search, and see what it can, and cannot, recover
So far we predicted the brain from words. A brain-computer interface wants the other direction: given a brain scan, what words were heard or imagined? You cannot simply invert the map. There are far more possible word sequences than brain images, and the map is many-to-one. The problem is ill-posed.
Jerry Tang, Amanda LeBel, Shailee Jain and Alexander Huth found a way around it, published in Nature Neuroscience in 2023. The method is a game of guess and check. It reuses everything from this lesson.
Why a beam, and not just the best word each time? One scan blurs several words together, and noise can make a wrong word look right. A decoder that commits to one word at a time (greedy, k = 1) has no way back. A beam keeps rivals alive until later words settle the matter.
A toy brain heard “we were busy at work”. Each scan blends two words, as fMRI does, and adds noise. The decoder proposes words with a toy language model and scores each guess against the scan. Choose a beam width, raise the noise, and try new recordings.
Toy model, all numbers illustrative: ten words as points in a 4-D space, a hand-made bigram language model, and Gaussian noise on each scan. A scan is the mean of its two words. The decoder adds the log language-model probability and the log match to the scan, and keeps the best k. The bars average 20 fixed recordings at the noise you set. Only the idea is Tang et al.’s.
Watch the pattern in the bars. At very low noise every width decodes the sentence. As noise rises, greedy decoding drops first: a wrong early word drags the rest after it. Wider beams recover more words, until the noise is too high for any width. That is the failure mode in full: the symptom is a sentence that goes wrong from one word onward, the measurement is words correct against beam width, and the fix is a wider beam, which costs compute and eventually stops helping.
The decoders were trained for three people and tested on stories they had never heard. On a test story of 1,839 words, decoding scored above chance on every similarity metric, most clearly on BERTScore, which compares meaning rather than exact words. Between 72% and 82% of time points scored above chance. The decoded text usually kept the gist and sometimes whole phrases. Readers who saw only the decoded words answered 9 of 16 reading-comprehension questions about the story.
One decoder also worked, with no retraining, on imagined speech and on silent video, and meaning could be decoded from several cortical regions separately.
The authors tested whether the decoder works without the person’s cooperation. It did not. A decoder trained on other people’s brains recovered only 1 to 5% of time points. And a person can resist a decoder trained on them. While passively listening, 52 to 57% of time points decoded. When the person counted by sevens, 4 to 50% decoded; when they named animals, 0 to 3%; when they imagined telling a different story, 1 to 26%.
Read these as the paper’s own limits too. The method needs about 16 hours of scanner time per person and a scanner. It recovers meaning, not exact words. It is an fMRI result, not a portable device. Faster, invasive routes to speech are in other lessons of this series, for example the speech neuroprosthesis paper and the semantic decoding paper in full.
The toy in the device has a language model too. After “we,” it gives “were” a probability of 0.72 and “was” 0.012. The log probabilities are −0.32 and −4.42. So before looking at the scan, the language model already favours “we were” over “we was” by 4.1 in log terms. The scan then adds its own vote: how close the predicted response is to the recorded one. The decoder adds the two and keeps the best k.
Tang et al. do the same with a real GPT. The language model keeps guesses fluent. The encoding model keeps them tied to the brain. Neither alone would work: the language model alone writes plausible stories that ignore the person, and the encoding model alone has far too many sequences to check.
Chapter 10
Keep the whole lesson on one page, and carry a short list of questions to ask of any encoding-model claim
The lesson in one paragraph. A language model turns a story into one feature vector per word. A ridge regression, trained on one part of a brain recording and tested on another, maps those features to each voxel, sensor or electrode. The held-out correlation is the brain score, and the noise ceiling tells you how much is possible. Large transformers reach close to the ceiling on some sentence datasets, and better next-word skill tends to go with a better fit. That is evidence of shared structure. Whether it shows that the brain predicts the next word is still argued. Run in reverse, with a language model to propose words and a beam search to keep the best, the same map decodes the gist of a story from fMRI.
| What | Number | Source |
|---|---|---|
| Delays for fMRI | 2, 4, 6, 8 s on 768 features = 3,072 columns | Tang 2023 |
| Noise ceilings | 0.32 Pereira, 0.17 Fedorenko, 0.20 Blank | Schrimpf 2021 |
| GPT-2 XL, share of ceiling | close to 100% (Pereira, Fedorenko); 32% (Blank) | Schrimpf 2021 |
| Next-word skill vs brain score, 43 models | r = 0.44 | Schrimpf 2021 |
| Untrained GPT-2 XL; random context-free vectors | about 51%; under 15% | Schrimpf 2021 |
| Networks, subjects, sentences | about 3,600 networks; 102 subjects; 400 sentences | Caucheteux and King 2022 |
| Accuracy vs brain score | R = 0.77 (MEG), 0.57 (fMRI) | Caucheteux and King 2022 |
| Best layers | from n/2 to 3n/4 of the depth | Caucheteux and King 2022 |
| Best forecast window | 8 words; 304 subjects | Caucheteux, Gramfort and King |
| fMRI decoder | 16 h per person; beam k = 200; 72 to 82% of time points above chance | Tang 2023 |
| Resisting the decoder | 52 to 57% passive; 0 to 3% naming animals | Tang 2023 |
The whole encoding model in a few lines of numpy, with shapes in the comments. The resampling here is a plain average per scan; the papers used smoother filters.
pythonimport numpy as np def resample(feats, onsets, n_scans, tr=2.0): # feats: (n_words, d) hidden states of ONE layer; onsets: seconds per word X = np.zeros((n_scans, feats.shape[1])) idx = np.minimum((onsets // tr).astype(int), n_scans - 1) for t in range(n_scans): m = idx == t if m.any(): X[t] = feats[m].mean(0) return X # (T, d) def delays(X, lags=(1, 2, 3, 4)): # lags in scans: 2, 4, 6, 8 s return np.hstack([np.roll(X, l, axis=0) * (np.arange(len(X))[:, None] >= l) for l in lags]) # (T, d*4) def fit_ridge(X, Y, lam): # X: (T, F), Y: (T, V) -> W: (F, V), one column per voxel return np.linalg.solve(X.T @ X + lam * np.eye(X.shape[1]), X.T @ Y) def brain_score(Yhat, Y): # per-voxel Pearson r on HELD-OUT scans Yh, Yt = Yhat - Yhat.mean(0), Y - Y.mean(0) return (Yh * Yt).sum(0) / np.sqrt((Yh**2).sum(0) * (Yt**2).sum(0)) # train on whole stories, test on a story the fit never saw Xtr, Xte = delays(resample(F_train, on_train, T_train)), delays(resample(F_test, on_test, T_test)) W = fit_ridge(Xtr, Y_train, lam=1e3) # choose lam on validation stories r = brain_score(Xte @ W, Y_test) # (V,) score = np.median(r) / ceiling # normalized predictivity, 0 to 1
All opened for this lesson. Full text read: Schrimpf et al., “The neural architecture of language,” PNAS 118(45), 2021; Caucheteux and King, “Brains and algorithms partially converge in natural language processing,” Communications Biology 5:134, 2022; Caucheteux, Gramfort and King, arXiv:2111.14232 (the preprint of the Nature Human Behaviour 2023 paper); Tang, LeBel, Jain and Huth, Nature Neuroscience 26, 2023. Abstract and listing only: Goldstein et al., Nature Neuroscience 25, 2022; Antonello and Huth, Neurobiology of Language 5(1), 2024. Numbers in the lesson come from these texts; the toy devices say so in their fine print.
Now press Present or Teach and explain the pipeline out loud, from memory: the delays, the layer, the ridge map, the held-out score, the ceiling, and one reason a good fit is not yet a mechanism. Then go back to the feature sets at the top and say, for each bar, what it tells you and what it does not.