Train a network to do a job, never show it a single neuron, and real neurons can still agree with it. The better the network does the job, the better it fits.
Learn the goal-driven recipe behind two famous results: deep networks that predict monkey visual cortex, and recurrent networks that rebuild the dynamics of monkey motor cortex.
Switch between the two kinds of model, then drag the cutoff up. Watch what happens to the neural fit of the models you keep. Then we build, piece by piece, every step of the recipe.
You need a rough idea of what a neuron's firing rate is (spikes per second) and what a correlation is (a number from −1 to 1 that says how closely two lists move together). We build the rest from zero.
There are no course slides for this lesson. It is built from the primary papers: Yamins et al. 2014, Sussillo et al. 2015, Yamins and DiCarlo 2016, and Schrimpf et al. 2020.
The 48 dots are illustrative and seeded, built so their correlation equals the paper's: r = 0.78 across performance-optimized models and r = 0.55 across randomly selected ones (Yamins et al. 2014, Fig. 4 text). The dashed line is the paper's best result, 48.5% of IT variance explained by the top layer of its best model.
Chapter 0
See why fitting a model straight to neural data explains little, and what a goal gives you instead
A lab has implanted a thin array of electrodes in a monkey’s brain. Each electrode listens to a small patch of tissue and reports how fast it fires. The monkey looks at thousands of pictures. When the day ends, you hold a big table: one row for each picture, one column for each recording site, and a firing rate in every cell.
Now you want a model: a program that takes a picture and predicts that row of firing rates. A good model would tell you what the brain area is doing. A bad one would just copy the table.
The area in this story is the inferior temporal cortex, or IT. It is the last stage of the visual path that runs along the underside of the monkey’s brain. Cells in IT respond to whole objects, such as a face or a chair, and they keep doing so when the object moves or turns. A neighbouring area, V4, sits one stage earlier. In the 2014 study this lesson starts with, the team recorded 296 sites in two monkeys: 168 in IT and 128 in V4 (Yamins et al. 2014).
The first way is to write the model by hand. You guess that a site likes edges tilted at 30 degrees, you code that guess, and you test it. This works for the earliest stage of vision. It runs out of road quickly in IT, because nobody knows what a site that likes “faces” computes from pixels.
The second way is to fit a flexible model straight to the table. You pick a large network and adjust every weight until its output matches the firing rates. This can predict the table well. But it has a trap. A network with enough weights can match any table, including the random noise in it. A good fit then proves nothing about the brain.
Try the trap yourself. The device below counts the numbers in the recording against the free numbers in the model.
The blue bar is the size of the recording: about 6,000 images times 296 sites. The warm bar is how many numbers the model may adjust. Pick a recipe, then drag the model size.
Illustrative arithmetic. The recording size is the paper’s (296 sites, about 6,000 images, Yamins et al. 2014, Fig. 2). In the first recipe each unit is given 1,000 free weights; in the second, only one readout weight per unit per site is fitted. Both counts are toy choices.
With the first recipe, a model of a few thousand units already has more free numbers than the recording holds. It can memorize. With the second recipe the free numbers stay far below the data for a long way. That is the point of the third way.
The third way is called goal-driven modeling. You do not ask the network to match neurons. You ask it to do the job the brain area is probably for. For IT, the job is to tell what object is in a picture. You train the network, which means you adjust its weights step by step to lower its mistakes, on that job alone. Only afterwards do you open the monkey table and ask: does this network’s inner activity look like the neurons’?
If the answer is yes, that is a real finding. The network was never told to look like a brain. The match came from the task. It suggests that the brain area is shaped by the same demand.
Two studies carry this lesson. The first, by Yamins, DiCarlo and colleagues in 2014, did it for vision with deep networks. The second, by Sussillo, Churchland, Kaufman and Shenoy in 2015, did it for movement with recurrent networks, which are networks that feed their own activity back into themselves. A third piece, Brain-Score, is the public scoreboard that grew from the first.
Why does this belong in a course on brain-computer interfaces? A decoder reads neurons. Task-trained networks give you a rival story of what the neurons are for. They also give you free practice data with known ground truth. You will see both uses near the end.
Chapter 1
Draw a tuning curve for a simple cell, then see why the same trick fails for a cell that likes faces
Picture a single cell near the start of the visual path. You show a monkey a bright bar on a dark screen and tilt the bar a little at a time. At 90 degrees the cell fires hard. At 60 or 120 degrees it hardly fires. Plot spikes per second against tilt and you get a hill.
That hill is a tuning curve: a plot of a neuron’s firing rate against one property of the stimulus. The tilt that gives the highest rate is the cell’s preferred stimulus. A tuning curve is the oldest kind of encoding model, a rule that goes from the world to the neuron (the reverse direction, from neuron to world, is decoding, which Chapters 15 and 16 of this series cover).
A hill like this is well described by a bell shape. Here is the formula, then every symbol.
Take a cell with baseline 5, height 40, preferred tilt 90 and width 20 degrees. At 90 degrees the exponent is zero, so the rate is 5 + 40 = 45 spikes per second. At 110 degrees the exponent is −(20)2/(2 × 202) = −0.5, and exp(−0.5) is 0.607, so the rate is 5 + 24.3 = 29.3. At 130 degrees the exponent is −2, exp(−2) is 0.135, and the rate is 5 + 5.4 = 10.4. Four numbers describe the whole cell.
Notice what the formula leaves out. It has no memory, no other cells, and no word about what the bar means. It takes one number in and gives one number out. That is why tuning curves are easy to fit and easy to read, and also why they say little about cells whose job is not one number wide. A real cell also fires a little differently on each repeat, so the curve is an average over trials.
The curve above works because someone chose the right axis. The cell cares about tilt, so tilt is the thing to plot. Now think about a cell in IT that fires for faces. What is the axis? It is not tilt, nor size, nor position, nor colour. The cell fires for a face at the left or the right, big or small, and stays quiet for a chair in the same places. Its preferred stimulus is a category, and no one handed us a formula that turns a photograph into “faceness”.
You can see the problem in the device below. Pick the cell, then pick which stimulus property to plot on the horizontal axis.
Each dot is one picture shown to the cell. Choose a cell, then choose the property on the horizontal axis. The line is the best simple fit. Watch the fit score.
Toy data, seeded: 80 pictures, each with a random tilt and a random category (face or other). The tilt cell follows the bell above (b = 5, a = 40, μ = 90, σ = 20) with noise; the face cell fires about 8 spikes per second for others and 38 for faces, with noise. The fit is a bell for the tilt axis and the two category means for the category axis. Fit scores are R²: the share of the rate’s variation the fit explains.
The tilt cell is easy: pick tilt and the fit is close to perfect. The face cell fails on tilt, with an R² near zero, and wins on category. The lesson is not about faces. The lesson is that you had to know the axis first. For a deep area like IT, the right axes are tangled mixtures of many image features. Guessing them by hand has been the bottleneck for decades.
A natural reply is to give up on guessing and fit a large network straight to the neurons. Chapter 0 showed the trap: a large model can memorize the table. There is a second, quieter trap. Even if the large model fits well on new images, its inner parts are an arbitrary solution among very many. The fit says the model can predict. It does not say why the cell fires.
The goal-driven idea answers both traps with one move. The task supplies the structure that tells the network what to compute. The neural data is then used only for a small, cheap check.
Chapter 2
Follow six steps from a task to a score, and see which step is the first to touch a neuron
A teacher wants to know how a star student thinks. She cannot read the student’s mind. So she trains a second student on the same exam, then compares the two students’ scratch paper. If the scratch paper looks alike, the exam probably forced that way of thinking. She never told the second student to copy anyone.
Goal-driven modeling is this plan, with a network as the second student and a monkey as the first. It has six steps. Read them once, then step through them in the device.
Press Next step to move along the chain. The strip under the boxes shows whether the network’s weights are changing, and whether the monkey recording has been used yet.
The step order is the method of Yamins et al. (2014) and Yamins and DiCarlo (2016). Tensor shapes in the read-out are for the paper’s best network where the paper states them (1,250 top-level outputs, eight categories, about 6,000 images shown to the monkeys); the image size is not taken from the paper.
Make it concrete. A picture enters as a grid of pixels: height by width by three colour channels. Layer after layer turns it into a smaller grid with more channels, until the last stage gives one list of numbers. In the paper’s best network that list has 1,250 entries. A final step turns the list into eight scores, one for each object category: animals, boats, cars, chairs, faces, fruits, planes and tables.
Training uses those eight scores and the correct label. The loss falls as the network gets more pictures right. At step 5, the same network sees the monkey’s pictures, and we keep the 1,250-entry list for each one. Stack the roughly 6,000 pictures shown to the monkeys and you get a table of shape [about 6,000 images × 1,250 units]. The monkey’s table has shape [about 6,000 images × 296 sites]. The model table and the monkey table share their rows. They differ in columns. Step 6 learns a map from 1,250 columns to each of 296.
One more fact shapes the recipe. The paper did not hand-pick the network. It searched a family of networks, described by 57 settings with one to three layers, for the ones that did best on a screening task. The search used a method the authors call hierarchical modular optimization, which builds a strong network from many small modules, a bit like adding weak learners together. The search ran on object recognition, not on the monkey table (Yamins et al. 2014).
There is one way this recipe fails quietly: the neural data leaks into the choice of network. Say you try 500 networks and keep the one that predicts the monkey best. Then you report its score on the same monkey images. The score is inflated, because you picked the winner of 500 draws. The symptom is a fit that looks too good. The measurement is a score on images that played no part in any choice. The fix is to keep a held-out set of pictures locked away until the very end.
That is why the six steps are in this order, and why step 6 has a built-in train and test split. The goal fixes the network. The neurons only audit it.
Chapter 3
Build a readout, score it on pictures it never saw, and divide by the most any model could score
The frozen network gives you 1,250 numbers for each picture. One recorded site gives you a single number for the same picture: its firing rate. You ask a simple question. Is there a weighted sum of the 1,250 numbers that tracks the site’s firing rate?
That weighted sum is a linear readout. The paper calls the result a “synthetic neuron”: a made-up cell built by mixing model units. Finding the weights is linear regression, the same fit you may know from drawing a line through dots, only with 1,250 inputs instead of one. If you want the basics first, see linear regression.
A readout has its own weights, and weights can overfit. With 1,250 weights and a few hundred training pictures, a plain regression can hit every training point exactly. So the field uses two guards. The first is a penalty that keeps the weights small (ridge regression, see regularization). The second is a held-out test: fit on some pictures, then score on other pictures the fit never touched.
The device below makes both guards visible. A made-up site responds to 30 features of a picture, plus trial noise. You choose how many pictures the readout trains on, and the strength of the penalty.
The warm curve is the score on held-out pictures as training grows. The teal curve is the score on the training pictures. The dashed blue line is the ceiling: the most any model could score. Drag the training size down toward 30 to 40.
Toy, computed live in your browser: 30 random features, a made-up site whose true signal has variance 1, plus noise with standard deviation 0.8, so no model can pass a ceiling of 1 / (1 + 0.64) = 61%. The held-out set is 300 fresh pictures. Scores are R² against the noisy rates, then divided by the ceiling for the normalized line.
With 120 pictures the held-out score sits close to the ceiling. Drop to 40 pictures, close to the 30 features, and something breaks. The teal training score climbs toward 100%, because the readout has almost as many weights as pictures and can memorize them. The warm held-out score falls far below zero. Below zero means the readout predicts worse than guessing the average. That gap between the two curves is the symptom of overfitting. The held-out score is the measurement. More pictures, or a stronger penalty, is the fix.
How does the penalty work? Ridge regression adds the penalty strength, called lambda, to the diagonal of the matrix it solves. A large lambda pulls every weight toward zero, so no single weight can swing wildly to chase one noisy picture. A tiny lambda leaves the fit free to chase noise. Pick lambda by holding back part of the training pictures and testing on those, never by looking at the final test set. Otherwise the test set has leaked into your choice, which is the same leak as in Chapter 2.
A neuron does not give the same answer twice. Show the same picture again and the firing rate changes a little, from trial-to-trial variability. That noise has no cause that any image-based model can know. So even a perfect model cannot explain all of a site’s variation.
The noise ceiling is the share of a site’s variation that repeats from trial to trial. It is the best score any model could earn. The paper divides each site’s fit by this ceiling and reports explained variance, a percentage of the explainable part. A model that reaches the ceiling scores 100%.
Here is a worked toy. A site has a raw held-out R² of 0.30 and a ceiling of 0.61. The normalized score is 0.30 / 0.61 = 0.49, or 49%. Without the division you would say the model explains 30% and be disappointed. With it you see that the model explains about half of what any model could.
Last, one score for a whole brain area. The paper takes the median explained variance over all sites in the area (the middle value when you sort them). A median is not dragged around by a few odd sites. The result for IT is the number at the heart of the next chapters (Yamins et al. 2014).
Chapter 4
Read the 2014 numbers: what a network built for object recognition explained in V4 and IT
In 2014 Daniel Yamins, Ha Hong, Charles Cadieu, Ethan Solomon, Darren Seibert and James DiCarlo ran the recipe from Chapter 2 on a hard case. The goal was object recognition. The test pictures were 5,760 images of three-dimensional objects in eight categories, pasted on cluttered natural backgrounds. The neurons were 296 sites in two awake macaque monkeys: 168 in IT and 128 in V4.
The network family was a convolutional neural network, or CNN: a network whose early layers slide small filters across the image, so that the same detector runs at every position (see convolutional networks). The search found a four-layer network with 1,250 outputs in the top layer. Its authors called the method hierarchical modular optimization. It matched human accuracy on the recognition task. And no neuron played any part in building it.
The paper makes two claims, and it is worth keeping them apart.
The first claim is about one model against two brain areas. Fit the readouts of Chapter 3 to each site, score on held-out pictures, divide by the ceiling, take the median. The top layer of the best network explained 48.5% of the explainable variance in IT (give or take 1.3). Its next-to-top layer explained 51.7% in V4 (give or take 2.3). For V4 the paper also tested a model built to mimic an earlier area, V2. That control scored 34.1% (give or take 2.4). For IT, the authors report that the new model nearly doubled the score of the best older comparison models.
Pause on what the layers say. Two stages of the network line up with two stages of the monkey’s visual path, and the later stage of the network fits the later area. Nobody asked the network to be organized like the brain’s path. It came out that way from the task.
Choose a brain area. The bars show the share of explainable variance each model captures. The dashed line at 100% is the noise ceiling.
Numbers from Yamins et al. (2014): V4, penultimate layer 51.7 ± 2.3% and V2-like control 34.1 ± 2.4%; IT, top layer 48.5 ± 1.3%. The IT comparison bar (about 25%) is not a number the paper prints in the text we read. It is inferred from the paper’s statement that the new model nearly doubled the best comparison models, so it is drawn hatched and marked “about”.
The second claim is about many models against one area, and it is the claim in the hero at the top of this page. The authors built a large number of networks and scored each on two things: how well it recognized objects, and how well it predicted IT. Across models that had been optimized for recognition, the two scores had a correlation of 0.78. Across models picked at random from the same family, the correlation was 0.55 (the paper reports that optimizing for performance significantly increased the correlation).
This second claim is what turns a nice match into evidence. If the best network happened to match IT, the match could be luck. But the better a network does the job, the better it predicts the cells. That is a trend, and a trend is much harder to get by chance.
Predicting each site alone is one kind of test. The paper also compared whole populations. For every pair of pictures it asked how different the population’s response was, in the model and in IT, and compared the two tables of differences. The model’s top layer came close to the split-half noise ceiling of that comparison, meaning close to how well one half of the recordings predicts the other half. Chapter 5 explains this style of comparison.
Half of the explainable variance in IT is still unexplained. The network reads one still picture and passes it forward once. A real eye sees a stream of pictures, and the brain has loops that send signals backward. The paper does not claim to have found the brain’s algorithm. It shows that a network built only for the job gets surprisingly close, and that the closeness grows with skill. Chapter 10 returns to these limits.
Chapter 5
Choose a yardstick that ignores arbitrary choices, such as which model unit is called unit 1
You have two tables. The network’s table has one row for each picture and one column for each model unit. The brain’s table has one row for each picture and one column for each recorded site. How alike are they?
The obvious plan is to line up column 1 with column 1, column 2 with column 2, and correlate. It fails at once. Model unit 7 has no reason to match recording site 7. The order of the columns is an accident of how someone numbered them. Two tables could hold the very same information, with the columns shuffled and mixed, and the plan would report no match.
A good yardstick must give the same answer when you re-label or mix the units. Three yardsticks do this, each in its own way.
The first is linear predictivity, the one from Chapter 3. Fit a weighted sum of the model units to each site. It is blind to the unit order, because the weights absorb any shuffle or mix. It is blind to any linear mixing too.
The second is representational similarity. Take every pair of pictures and ask: how different are the population’s responses to these two? Collect all the answers in a square table, a representational dissimilarity matrix or RDM, with one row and one column for each picture. Build one RDM from the model and one from the brain, then correlate the two tables. No units are matched at all. Only the geometry of the pictures is compared. Yamins et al. used this style of comparison for whole populations, and the model’s top layer came near the split-half noise ceiling.
The third is canonical correlation analysis, or CCA, which Sussillo et al. used for reaching networks. CCA looks for a weighting of the units in each table so that the two re-weighted tables are as correlated as possible. Then it finds a second weighting, uncorrelated with the first, that is next best, and so on. The result is a list of canonical correlations in falling order. If every one equals 1, the two tables are re-weighted copies of the same patterns. If they are all 0, the tables share nothing. Two similar tables have a few high correlations, and the question is how many stay high (Sussillo et al. 2015).
Try all three on a toy where you know the answer. The model and the “brain” below hold the same 12 pictures in two units. The brain is the model, changed one way you choose.
Warm dots are the model’s 12 pictures in a two-unit space. Blue dots are the same pictures as the brain sees them after your change. Pick a change, then drag it up. Read the three scores.
Toy: 12 seeded points in two units. “Mix” rotates the brain table by up to 90 degrees; “stretch” scales the second brain unit by up to 5 times. Unit-by-unit is the mean correlation of matched columns. RDM is the correlation between the two tables of pairwise distances. Linear predictivity is the R² of a least-squares map from model to brain, fitted and scored on the same 12 points, which is fine for a 2-parameter toy only.
Rotate the axes and the unit-by-unit score collapses to 0 at 90 degrees, although the two tables hold exactly the same pictures in the same layout. The RDM score does not move, because rotation keeps every distance. The regression score does not move either, because a rotation is just a different set of weights. Stretch one unit and the RDM score drops, because distances now count that unit several times more. Yet the regression score stays near 1, because a stretch is also a weighting.
So the yardsticks answer different questions. Regression asks: is the information there, in any linear form? RDM asks: is the geometry the same, with every direction counting equally? CCA asks how many shared patterns there are, and lists them one by one. Strong claims quote more than one.
Regression has the opposite problem to unit matching. It forgives so much that a rich enough model can predict almost anything. The symptom is a high score for a model nobody believes. The measurement is a baseline: score an untrained network, with random weights, through the same pipeline. Sussillo et al. did exactly this, and their untrained network had a mean canonical correlation of 0.50 with the data of one monkey, so the number to beat was never zero. The fix is to always report the baseline next to the score.
Chapter 6
Feed a network its own activity, and a short nudge turns into a rhythm that can drive an arm
You reach for a cup of coffee. Your hand sets off, curves around the laptop, slows, and closes. Nothing in your motor cortex receives a movie of this path. A few signals say “go” and “the cup is there”. From these, the cortex produces a long, shaped pattern of commands that unfolds over about a second.
A picture network, like the one in Chapter 4, cannot do this. It reads one input and gives one answer. A movement needs a network that keeps going after the nudge is over. It needs memory.
A recurrent neural network, or RNN, has a state: a list of numbers, one for each unit, that describes what the network is doing right now. At every small time step, the new state depends on the old state. That dependence is the loop. A nudge at one moment changes the state, and the state carries the change forward.
Sussillo, Churchland, Kaufman and Shenoy used this form for their motor model (Sussillo et al. 2015, Online Methods, eq. 1):
Read the main line in words. The state wants to relax to zero (the −x term). The recurrent push J r and the input B u move it away. The time constant τ says how quickly the state follows. A computer cannot run continuous time, so it takes small steps. The paper used Euler steps of 5 ms, a tenth of τ.
One step by hand, with two units. Let τ = 50 ms, step 5 ms, x = (1, 0), no input, and J with rows (0.6, −1.0) and (1.0, 0.6). The rates are r = tanh(x) = (0.762, 0). Then J r = (0.6 × 0.762, 1.0 × 0.762) = (0.457, 0.762). The change is (5/50) × (−x + J r) = 0.1 × (−0.543, 0.762) = (−0.054, 0.076). The new state is (0.946, 0.076). Unit 2 woke up because unit 1 pushed it. That sideways push is what starts a rotation.
A short kick hits unit 1 at time zero. The left panel is the state of the two units. The right panel is the output z, a stand-in for one muscle. Drag the feedback gain up past 1, then turn the twist.
Toy, simulated live with the paper’s time constants (τ = 50 ms, 5 ms Euler steps, 1.5 s). J = g times a rotation by φ, the rates are tanh(x), and the output is z = x1. The frequency and decay quoted come from the eigenvalues of the linear part: −1 + g(cos φ ± i sin φ), divided by τ. This two-unit network is not the paper’s 300-unit model.
With a low gain the ring dies in a fraction of a second: the state falls back to zero. With a high gain and a twist, the state keeps circling, and the output swings up and down. Because tanh caps the state, it does not blow up; it settles into a steady circle. This is the simplest oscillator: a system that repeats a pattern. Sustained swings from a single kick are what a muscle command looks like.
The paper trains J, B and W so that the output z matches recorded muscle signals. It uses back-propagation through time: copy the network once for every time step, then pass blame backward through the copies (see recurrent networks). The starting size of J matters. The authors draw J with variance g2/N. If g is far below 1, gradients vanish and the network is hard to train. If g is far above 1, the dynamics are chaotic, and training can also struggle. This is the same knob you just turned.
Why does the model squash x into a rate r? A real cell has a floor, since it cannot fire below zero, and a ceiling, since it cannot fire without limit. The squashing function builds both limits in. It also makes the loop nonlinear, which lets a small network make shapes that a straight-line system cannot, such as a steady circle that neither grows nor shrinks. The paper used 300 units. That is a small number next to the millions of cells in a motor area, so each unit stands for a pool of cells, not for one.
Chapter 7
Train a loop to write muscle signals, then see why only the simplest solution looks like the cortex
Two monkeys, called J and N in the paper, sat in front of a screen. A maze appeared, with a target and some barriers. The monkey had to wait, then reach around the barriers when a go cue came. Each combination of target and barriers is a condition. The study used 27 conditions, with reaches that were straight and reaches that curved.
During the wait, the monkey knew the whole plan but did not move. This is the preparatory period, and neurons in primary motor cortex (M1) and the neighbouring dorsal premotor cortex (PMd) already fired in a pattern that depended on the coming reach. After the go cue the pattern changed fast, and about 150 ms later the muscles moved. The team also recorded the electrical activity of arm muscles, called EMG (electromyogram), from seven muscles in monkey J and eight in monkey N.
The goal-driven recipe needs a goal. Here it is: produce the right EMG. The network sees two kinds of input. The first is a condition-independent hold signal that says “wait” and then switches off. The second is a six-number input, constant during the wait, that tells the network which of the 27 reaches to prepare. The input vector has I = 7 numbers in all. The network has N = 300 units, with τ = 50 ms (Sussillo et al. 2015).
One detail needs plain honesty. The six numbers for each condition were derived from the recorded preparatory neural activity, so that the authors would not have to guess a reference frame for the inputs. So the network was never trained to copy neural responses, but its inputs do carry a summary of the recorded wait-period activity. The match reported later is about the movement-period dynamics that unfold after the hold signal ends.
Training lowers a loss. The first term is the muscle error:
The paper reports E normalized: divided by the variance of the EMG. A normalized error of 7% means the leftover gap holds 7% as much power as the muscle signal itself. Both networks in the study reached 7% for monkey J and 3% for monkey N. By the output test, they were equally good.
The authors trained two kinds of network for each monkey. The complicated model started with a large, chaotic loop (g far above 1) and had no penalty. The regularized model started calmer (g above 1, not far above) and added three penalties to the loss:
The loss was minimized with a second-order method called Hessian-free optimization, which takes into account how the loss curves and not only which way it slopes. The three Greek letters set how strongly each cost counts.
Choose a network. The top bar is how well it makes the muscle signals. The bottom bar is how much its units resemble the cortex. Switch between them and compare the two bars.
Numbers for monkey J from Sussillo et al. (2015), Fig. 8a: mean canonical correlation with cortex 0.50 (untrained network with the correct inputs), 0.53 (trained with no regularization) and 0.67 (trained with regularization). Muscle error: normalized error 7% for both trained models (Fig. 1 text). The untrained network was not trained to make muscles, so its muscle error is not shown. The Fig. 5 value of 0.74 is for a different network and comparison and is not mixed in here.
Look at the bottom bars. The unpenalized network matches the muscles as well as the penalized one, yet it resembles the cortex barely more than a random loop (0.53 against 0.50). Training with penalties lifts the similarity to 0.67. The muscles cannot tell the two apart. The neurons can.
Single cells tell the same story. The paper plots firing rates over time for five real neurons and five units from the regularized network. They look alike: plateaus during the wait, then a mix of one-bump and many-bump responses. The complicated network’s units are far busier and, in the authors’ words, bear little resemblance to most neural responses.
There is a practical catch. The authors found that starting from a wildly chaotic loop and then regularizing heavily with a rectified tanh nearly always stalled. They avoided that mix and used a gentler start for the regularized model.
Chapter 8
Find the one resting point that organizes all 27 reaches, and read the oscillation off its eigenvalues
A trained network is a black box until you open it. The reward for opening this one is a short, clear story. The 300 units, all 27 reaches, and a whole second of movement reduce to one point and one spin.
Plot the population state of the real neurons for a reach. Each unit is one axis, so the state is a point in a space with a few hundred dimensions, and a reach is a path through that space. We cannot see hundreds of dimensions. A method called jPCA chooses the planes where the path most clearly rotates. It fits the whole population response with a purely rotating linear system, then shows the planes of that rotation (see neural manifolds for the idea of a few dimensions carrying the activity).
The monkey’s cortex showed rotations: the goodness of fit (R²) of the rotating system was 0.60, so about 60% of the way the population changes in time is rotation. The regularized network gave 0.61. The complicated network gave 0.35. The three best planes held 45% of the variance in the data and 50% in the regularized model. The rotation speeds matched too: 2.1, 1.3 and 0.9 Hz in the neurons, 2.4, 1.6 and 0.9 Hz in the regularized network. The complicated network rotated at about half those speeds: 1.3, 0.8 and 0.6 Hz.
Rotation is not the obvious answer. The authors note that standard models of motor cortex, such as units tuned to hand velocity, do not show a strong rotation. So the regularized network produced a signature that the older models lacked.
A fixed point is a state where, if the network sat exactly there, it would stay. For the regularized network the authors searched the state space and found a single fixed point in almost every trained network (a few had a tight cluster of two or three). During the wait, each of the 27 reaches sits at its own prepared state, far from it. When the hold signal switches off, every state first shifts toward the fixed point, and then rotates around it. The 27 reaches turn the same way, with a different starting phase and size. The complicated network had a huge number of approximate fixed points and no tidy picture.
Near a fixed point, the curved dynamics look almost straight. To linearize means to replace the real dynamics by the straight-line approximation around that point. Its behaviour is set by eigenvalues: special numbers, one for each independent mode of the linear system. Each is a complex number, written σ + iω. The real part σ says how fast the mode shrinks (it is negative for a mode that dies away). The imaginary part ω says how fast it spins, in radians per second. A mode moves as exp(σt) times a rotation at ω.
A worked example. Take σ = −5 per second and ω = 2π × 2 = 12.6 radians per second. The shrink time is 1/5 = 200 ms. After 200 ms the swing is exp(−1) = 0.37 of its start. After one second it is exp(−5) = 0.0067. The phase advances 12.6 × 0.2 = 2.5 radians, about 144 degrees, in those 200 ms. That is a 2 Hz spiral that shrinks to nothing in about a second, which is the span of a reach.
What did the authors find in the regularized network? Most modes decayed very fast. A handful persisted, and at least three were strongly oscillatory. Their time constants fell between about 100 and 400 ms, and their frequencies between about 0.5 and 2.5 Hz. The frequencies seen by jPCA on the same network (0.9 to 2.4 Hz) agreed with those from the wiring, so the data-driven method and the wiring-driven method told the same story.
Each curve is one reach. All spiral around the same point. The right panel shows three of them read out as a muscle-like signal. Change the spin and the shrink time of the one oscillatory mode.
Illustrative geometry, not the paper’s network: 27 seeded start points around a fixed point at the centre, each spiralling as exp(−t/τ) with a rotation at the chosen frequency. The output is the first coordinate. The paper’s regularized network had persistent modes with time constants of about 100 to 400 ms and frequencies of about 0.5 to 2.5 Hz (Fig. 7); the read-out says whether your setting lies inside that window.
Spin it faster and each reach crosses zero more often, so the muscle signal gets more phases. Shrink it faster and the signal dies before the reach ends. The sweet range is the one the paper found. Different reaches differ only in where they start, so their muscle signals share a rhythm and differ in phase and size. That is how one small oscillator can write 27 different movements.
Chapter 9
Score every network the same way, and see how the way you add up the scores can change the winner
After 2014, many labs built networks and compared them with brains. Each lab chose its own recordings, its own readout, its own yardstick. A claim like “our model predicts IT” could not be compared with a rival claim. Imagine a sports league where every team plays on its own pitch and keeps its own score.
In 2018 a team led by Martin Schrimpf, with Jim DiCarlo and Daniel Yamins among the authors, released Brain-Score. It is a composite of several neural and behavioral benchmarks that scores any network on how closely it matches the primate brain’s way of recognizing objects. A benchmark here is a fixed dataset plus a fixed way of scoring a model on it. The team also opened a website, brain-score.org, where anyone can submit a network and see its rank.
The 2020 Neuron perspective by Schrimpf and colleagues, “Integrative Benchmarking to Advance Neurally Mechanistic Models of Human Intelligence”, names three key elements: a software standard so that any model can be plugged in, scores that quantify and guide progress, and benchmarks that compare models with experimental data. It also lists the hard parts: choosing benchmarks, maintaining them, possible overfitting, and whether anyone will submit models.
The word integrative matters. One model has to face all the tests together: the early area V1, then V2, V4, IT, and the behavior of humans and monkeys. A network that fits IT but is bad at V1 shows its weakness at once. The data flow is the one from Chapter 3, repeated for each benchmark: freeze the network, run the benchmark images, fit a readout on part of the data, score on the rest, normalize by the ceiling.
The 2018 paper scored a wide range of deep networks and reports four things.
Point 3 is the 2014 trend meeting its limit. The hero at the top of this page showed that more skill meant a better fit. Past a certain skill, more skill alone stops paying. The authors say that further advances may need additional guidance from neuroscience.
A leaderboard needs one number per model. The overall score is the arithmetic mean of a neural score, itself an average over V1, V2, V4 and IT, and a behavioral score. An engineering benchmark, such as ImageNet accuracy, is listed but does not enter the final score. A later analysis of Brain-Score argues that this simple average lets behavior dominate the overall ranking: it reports 95.25% explained variance for behavior and only 33.33% for neural predictivity.
You can feel the effect with a toy leaderboard. The five models below are invented for the exercise. Move the weight between behavior and the neural average and watch the order change.
Each bar is a model’s overall score. The weight slider sets how much of it comes from behavior; the rest comes from the neural average of V1, V2, V4 and IT. At 50% it is the plain average Brain-Score uses.
Models A to E and all their scores are invented for this exercise and do not describe real networks. Only the rule is real: an overall score as a weighted mean of a neural average and a behavioral score, with the plain mean at 50% (Schrimpf et al. 2018; aggregation described in arXiv 2407.07530).
Model C has the best neural fit and loses at 50% to a model with strong behavior. Slide toward neural and C takes the lead. Neither ranking is wrong. They answer different questions, and the weight is a choice made by people.
Behind every row of such a board sits the same question, asked of every model in the same way: here are these images, so what do your units do? The platform then runs its fixed readout and its fixed scoring. A model cannot choose its own test, and that is the whole point. If it could, each model would pick the test it passes best, and the board would return to the league where every team keeps its own score.
Once a benchmark is public, builders tune to it. The symptom is a model that climbs the board while behaving worse on new data. The measurement is a score on fresh recordings or images that no one has seen. The fix is what the 2020 perspective proposes: keep adding new data and benchmarks, and keep some held out. The same ideas were carried to language models in a 2021 PNAS paper by Schrimpf and colleagues.
Chapter 10
Separate what the evidence shows from what it only suggests, and see where these networks meet a decoder
A paper reports that a network predicts a brain area. A headline turns it into “the brain works like this network”. The gap between those two sentences is where careful readers earn their keep.
Goal-driven results are strong, and that is exactly why their limits need stating. This chapter lists them, using the studies you have just read.
Many models can fit. In Chapter 7, two networks made the same muscle signals with the same 7% error. A third test, the match to cortex, separated them. Whenever two models tie on one test, ask what third test would split them. A claim is only as strong as the rival it beat.
A fit is about activity, not parts. The reaching paper says plainly that its networks are models of emergent dynamics, not of cortical architecture or implementation. The vision paper likewise shows that a readout of the network’s units predicts the sites. Neither shows that cells are wired like the units.
The goal is a guess. We chose object recognition for IT and muscle output for motor cortex. A different goal may fit as well or better. The choice of goal is part of the hypothesis, not a fact to read off.
Inputs and scope are chosen. The reaching network got no sensory feedback after the reach began, and its condition inputs came from recorded preparatory activity. The authors argued this was reasonable and tested that the solutions survive reasonable feedback in extra simulations, but it is still a choice. The vision network saw one still picture, scored on a fixed list of tested images.
One claim at a time. Decide if the evidence in this lesson supports it as written. Then read why.
The claims are written for this exercise. Every number the explanations use comes from Yamins et al. (2014), Sussillo et al. (2015) or Schrimpf et al. (2018).
Take a hypothetical lab that finds its network predicts a brain area at 45% explained variance. The symptom is a headline that says “explains the brain”. The measurement that checks it is a rival: score an untrained copy, a smaller network and a model with a different goal, all through the same readout. The fix is to report the whole table, as Sussillo et al. did when they scored an untrained loop at 0.50 and four rival models between 0.49 and 0.59 against the regularized network’s 0.74.
This course is about reading the brain, so connect the pieces. A Kalman decoder assumes the neural state moves by a linear rule, x(t+1) = A x(t) plus noise. That is exactly the linearization from Chapter 8, near one fixed point. The eigenvalues of A carry the same two facts: how fast a mode shrinks and how fast it spins.
A worked bridge. Say a decoder runs on 50 ms bins and one eigenvalue of A has magnitude 0.9. Each bin keeps 90% of the mode. In continuous time that is a shrink rate of ln(0.9) / 0.05 s = −2.1 per second, a time constant of about 475 ms. The reaching network’s modes were faster, about 100 to 400 ms. The numbers are in the same range, which suggests a dynamics model with a few slowly shrinking, rotating modes is a sensible prior for movement-related cortex. That is a hint, not a theorem.
What would make a stronger case? Test on stimuli or movements outside the training range, where the model must extrapolate. Compare against rival goals on the same data. And try a causal test: if the model says a certain mode drives the movement, a perturbation of that mode in the animal should change the movement in the way the model predicts. A model that survives all three has earned more trust than any single score can give.
Two more uses are worth knowing. A trained network can generate unlimited data with known ground truth, which is handy for testing a decoder. Latent-dynamics tools such as LFADS use an RNN generator to clean single trials (Pandarinath et al. 2018, Nature Methods). Both rest on the same idea: a recurrent network is a flexible, fittable model of neural dynamics. The earlier chapter on linear decoders shows the baseline these richer models must beat.
Chapter 11
Keep the numbers, the checklist and the code, and know where to read next
A goal-driven model is a network trained on a task and never on neurons. You freeze it, run the animal’s stimuli through it, fit a simple linear readout from its units to each recorded site, and score the readout on held-out stimuli, divided by the noise ceiling. For vision, a network built for object recognition explained 48.5% of the explainable variance in IT, and across optimized networks better recognition went with better IT prediction (r = 0.78). For movement, recurrent networks trained only to write muscle signals developed rotating dynamics around one fixed point like motor cortex, but only when regularized toward simple solutions. Brain-Score turned the idea into a shared scoreboard, with its own caveats.
| What | Number | Source |
|---|---|---|
| Vision test set | 5,760 images, 8 categories | Yamins et al. 2014 |
| Recorded sites | 296: 168 in IT, 128 in V4, two monkeys | Yamins et al. 2014 |
| Best vision network | 4 layers, 1,250 top outputs | Yamins et al. 2014 |
| IT explained variance, top layer | 48.5 ± 1.3% | Yamins et al. 2014 |
| V4 explained variance | 51.7 ± 2.3% (network) vs 34.1 ± 2.4% (V2-like control) | Yamins et al. 2014 |
| Performance against IT fit | r = 0.78 optimized, r = 0.55 random draws | Yamins et al. 2014 |
| Reaching task | 27 conditions, 7 muscles (monkey J) or 8 (monkey N), N = 300, I = 7, τ = 50 ms, 5 ms steps | Sussillo et al. 2015 |
| Muscle error, both trained models | 7% (monkey J), 3% (monkey N) | Sussillo et al. 2015 |
| Similarity to cortex, monkey J | 0.50 untrained, 0.53 no penalty, 0.67 penalized | Sussillo et al. 2015, Fig. 8a |
| Rotation fit (jPCA R²) | 0.60 neurons, 0.61 regularized, 0.35 complicated | Sussillo et al. 2015 |
| Persistent modes | time constants about 100 to 400 ms, frequencies about 0.5 to 2.5 Hz | Sussillo et al. 2015 |
| Brain-Score 2018 | DenseNet-169, CORnet-S, ResNet-101 top; link to ImageNet flattens at 70% top-1 | Schrimpf et al. 2018 |
| Term | Meaning |
|---|---|
| Goal-driven model | A network trained on a task, then compared with neurons. |
| Linear readout | A weighted sum of model units fitted to one site. |
| Noise ceiling | The share of a site’s variation that repeats across trials. |
| Explained variance | Held-out R² divided by the ceiling. |
| RDM | A table of how different each pair of pictures looks to a population. |
| CCA | Finds matched weightings of two populations; lists the correlations. |
| Fixed point | A state where the network would stay still. |
| Eigenvalue | A complex number: real part is shrink rate, imaginary part is spin. |
pythonimport numpy as np def ceiling(y_rep): # y_rep: [n_reps, n_images] firing rates of ONE site h1, h2 = y_rep[::2].mean(0), y_rep[1::2].mean(0) r = np.corrcoef(h1, h2)[0, 1] return 2 * r / (1 + r) # Spearman-Brown: reliability of the full mean (a common estimate) def explained_variance(F, y_rep, lam=1.0, seed=0): # F: [n_images, n_units] features of the FROZEN network (e.g. n_units = 1250) y = y_rep.mean(0); n = len(y) idx = np.random.default_rng(seed).permutation(n); tr, te = idx[:n // 2], idx[n // 2:] mu, ym = F[tr].mean(0), y[tr].mean() X = F[tr] - mu w = np.linalg.solve(X.T @ X + lam * np.eye(F.shape[1]), X.T @ (y[tr] - ym)) # ridge readout: [n_units] pred = (F[te] - mu) @ w + ym r2 = 1 - ((y[te] - pred) ** 2).sum() / ((y[te] - y[te].mean()) ** 2).sum() return r2 / ceiling(y_rep) # held-out R^2 over the ceiling def rnn_step(x, u, J, B, b, tau=0.05, dt=0.005): # x: [N], u: [I], J: [N,N], B: [N,I] r = np.tanh(x) # the paper used a rectified tanh return x + dt / tau * (-x + J @ r + B @ u + b) def loss(z, emg, W, B, r, a=1e-4, bfr=1e-3): # z, emg: [C, T, M]; r: [C, T, N]; a, bfr are toy strengths E = ((z - emg) ** 2).mean() # muscle error only: no neuron appears return E + a * ((B ** 2).sum() + (W ** 2).sum()) + bfr * (r ** 2).mean() # + the R_J term in the paper
Read it line by line. ceiling splits the repeats in two and asks how well half predicts half. explained_variance never lets the readout see the test images. rnn_step is the equation of Chapter 6, one Euler step. loss has no neuron in it: only muscles, a weight cost and a firing-rate cost. The paper adds a third penalty, RJ, on the Jacobian, which this sketch leaves out. The strengths here are toy values, not the paper’s.
These studies belong to a larger move in neuroscience: instead of describing cells one at a time, build a working system for the cells’ likely job and test the system against them. Yamins and DiCarlo reviewed this approach in 2016 and argued it can be pushed deeper into how sensory cortex develops and is organized. Later work carried the method to language, in a 2021 PNAS paper by Schrimpf and colleagues.
This lesson has no course slides. It is built from the primary papers, each opened and read: Yamins, Hong, Cadieu, Solomon, Seibert and DiCarlo, “Performance-optimized hierarchical models predict neural responses in higher visual cortex”, PNAS 111(23), 2014; Sussillo, Churchland, Kaufman and Shenoy, “A neural network that finds a naturalistic solution for the production of muscle activity”, Nature Neuroscience, 2015; Yamins and DiCarlo, “Using goal-driven deep learning models to understand sensory cortex”, Nature Neuroscience, 2016 (abstract); Schrimpf et al., “Brain-Score”, bioRxiv, 2018 (abstract); Schrimpf et al., “Integrative Benchmarking to Advance Neurally Mechanistic Models of Human Intelligence”, Neuron, 2020 (section outline); and “How aligned are different alignment metrics?”, arXiv 2407.07530 for the score aggregation. Toy numbers are marked illustrative where they appear.
Now press Teach and explain the six steps of the recipe from memory, then draw the spiral around the fixed point and say what its eigenvalue means. Then go back to the scatter at the top, switch to the random draws, and say why the link between skill and fit weakens.