Reverse-Engineering Visual Cortex and Recurrent Neural Memory
MIT 6.874 · Lecture 24: Task-Optimized Ventral Stream Models, Neural Control, and Chaotic Reservoir Attractors
Every 200 ms glance across a street scene lands on roughly 10 degrees of high-acuity central gaze—and within ~100 ms of photons striking the retina, population firing rates in primate inferior temporal (IT) cortex already carry linearly decodable object identity (l24a.pdf, Slides 6–30, [06:24]–[23:45]). Yet biological intelligence is not only a feedforward visual feature extractor: brains also sustain, manipulate, and extrapolate continuous temporal memories inside recurrent circuits without an engineered binary memory bus (l24b.pdf, Slides 1–2 / PDF pp. 15–22, [54:47]–[57:27]).
MIT 6.874 Lecture 24 (Neuroscience, Spring 2021) closes the semester with two complementary guest lectures that examine the bidirectional loop between neuroscience and deep learning:
- James DiCarlo (MIT,
[00:00]–[48:03]): Reverse-engineering human visual intelligence through the primate ventral visual stream (V1 → V2 → V4 → IT), task-optimized convolutional neural networks (Yamins et al., 2013, 2014), closed-loop V4 neural population control (Bashivan, Kar & DiCarlo, Science 2019), and remaining discrepancies around recurrence and adversarial robustness (Kar et al., 2019;Dapello et al., 2020). - Jason Z. Kim (University of Pennsylvania / Danielle Bassett Lab,
[48:03]–[85:01]): Teaching recurrent neural networks—specifically continuous-time reservoir computers (Kim et al., Nat. Mach. Intell. 2021 / arXiv:2005.01186)—to store chaotic attractor memories and extrapolate translations, linear transformations, and unseen bifurcations from local examples.
V1→V2→V4→IT), unit-matched held-out V4/IT response prediction (Yamins et al., PNAS 2014), closed-loop V4 neural control and out-of-distribution response prediction (Bashivan, Kar & DiCarlo, Science 2019), and the measure–break–build cycle addressing missing recurrence and adversarial fragility (MIT 6.874 Lecture 24, l24a.pdf Slides 38, 40–46, 54, 61–63).Part I: Reverse-Engineering the Primate Ventral Visual Stream (James DiCarlo)
1. Core object recognition and primate behavioral equivalence (Slides 5–15)
DiCarlo narrows broad visual intelligence (“what is in this scene, what happens next, where is it safe to walk?”) to an operationally tractable foundation: core object recognition (Slide 8, [07:10]). Rather than taking in an entire scene at uniform acuity, primates execute rapid eye movements (saccades), dwelling roughly ~200 ms per fixation over the central ~10 degrees of gaze ([06:24]–[06:55]). In laboratory psychophysics, flashing an 8-degree image at center of gaze for ~100 ms (Slide 9, [07:55]) probes rapid object categorization across pose, scale, and background variation.
Across 276 core object recognition tasks spanning pairwise discriminations among 24 objects (Camel, Wrench, Knife, Guitar, Hammer, etc.; Rajalingham, Schmidt & DiCarlo, 2014, 2015, 2017, Slide 14, [09:38]–[10:25]):
- Humans (
Homo sapiens) and rhesus monkeys (Macaca mulatta) exhibit nearly identical pairwise sensitivity patterns (\(d' \in [1, 4+]\)), with monkeys trailing humans by only a few percentage points in absolute \(d'\) ([10:15]). - Computer vision systems now match human/monkey heatmaps at the coarse object-pair level, yet still diverge when examined image by image (
[10:48]–[11:04]). That close behavioral equivalence justifies using invasive neurophysiology in rhesus macaques as a quantitative model of human visual processing ([11:08]–[12:08]).
2. Ventral stream anatomy and linearly decodable IT manifolds (Slides 17–30)
Visual signals travel from ~1 million retinal ganglion cells (RGC) through the lateral geniculate nucleus (LGN) into a deep cortical hierarchy—V1 → V2 → V4 → IT (inferior temporal cortex), whose lesions cause object recognition deficits (Slides 17–21, [12:24]–[14:15]). Key physiological facts from DiCarlo’s recordings:
- Latency (
~100 ms): Initial stimulus-evoked spiking patterns emerge inITroughly100 msafter image onset, fitting comfortably inside a single200 msfixation dwell ([14:15]–[14:38]). - Chronic sampling (Slides 26–28,
[19:30]–[21:15]): Three96-electrode arrays (Kelly et al., J. Neurosci. 2007) chronically sample hundreds ofV4/ITsites (out of millions of neurons) across thousands of images (2,000+images onSlide 28), summarizing each site’s response over a100 mswindow as a mean firing rate (spikes/s). - Spatial clustering (
[17:56]–[18:35]): Neurons with similar selectivity vectors cluster over~1 mmcortical scales, including specialized domains for faces, bodies, and places. - Linear decodability (Slide 29,
[21:40]–[22:50]): Simple linear decoders trained on tens to hundreds of examples over theITpopulation vector reproduce human and monkey behavioral error patterns across unseen images (Hung, Kreiman, Poggio & DiCarlo, Science 2005;Rust & DiCarlo, 2010;Majaj et al., 2015). You cannot achieve this same one-step linear generalization from raw pixels or earlier areas ([22:40]), implying that the hard nonlinear untangling of object manifolds is largely complete byIT.
3. Why hand-crafted models failed and how task optimization broke through (Slides 32–50)
Between ~1980 and 2010, neuroscientists distilled cortical physiology into architectural motifs: spatially local filters tiled across the visual field (convolution), rectifying nonlinearities, and divisive gain-control normalization (Carandini & Heeger, 1994; Fukushima, 1980; HMAX; PLoS09, Slides 33–37, [24:23]–[28:55]). Yet when evaluated on held-out images against recorded V4 and IT neurons (Slide 38), every hand-crafted hypothesis fell short.
The underlying bottleneck was not that the brain-inspired macro-architecture was wrong, but that millions of micro-parameters could not be measured directly from neurophysiology (Slide 39, [30:06]–[30:24]). The breakthrough (Yamins, Hong, Solomon, Seibert & DiCarlo, NIPS 2013, PNAS 2014; Slides 40–46, [30:26]–[35:04]) coupled two steps:
- Macro/meso-architecture from neuroscience: Build a stacked convolutional linear-nonlinear (
LN) architecture. - Task optimization from engineering: Tune all internal filter weights solely to maximize core object recognition accuracy (never fitting to neural recordings during training).
Once frozen, the resulting HMO (hierarchical modular-optimized) CNN’s internal units were matched to recorded V4 and IT sites on a subset of images (either selecting the closest individual model unit or fitting a linear mapping; [33:57]–[34:10]) and then evaluated on held-out test images. The embedded PDF text layers of Slide 38 (underlying the visible control-model comparison panel) report the resulting median single-site explained variance across recorded neurons:
Model / Layer (l24a.pdf, Slide 38 embedded layers) |
Cortical Area V4 Median Explained Variance |
Cortical Area IT Median Explained Variance |
|---|---|---|
Category Ideal Observer |
0.08 |
0.15 |
V1-Like |
0.11 |
0.16 |
HMAX |
0.24 |
0.25 |
V2-Like |
0.34 |
0.26 |
HMO Layer 1 |
0.08 |
0.04 |
HMO Layer 2 |
0.48 |
0.21 |
HMO Layer 3 |
0.52 |
0.36 |
HMO Top Layer |
0.33 |
0.48 |
Notice the hierarchical depth correspondence: mid-level HMO Layer 3 (0.52) best predicts mid-level V4, whereas HMO Top Layer (0.48) best predicts high-level IT (Slide 38). Across thousands of candidate CNNs (Slide 46), higher core-recognition accuracy correlates strongly with higher IT neural match score. Crucially, DiCarlo stresses (Slide 62, [38:33]–[39:02]): this convergence is consistent with, but does not imply, that the brain learns via classical backpropagation—optimization is an engineering proxy for whatever evolutionary and unsupervised developmental processes shape biological cortex.
4. Closed-loop neural control and open model gaps (Slides 51–63)
In Slide 54’s embedded Science summary (Bashivan, Kar & DiCarlo, Science 364, eaav9436, 2019; briefly summarized verbally at [39:03]–[39:25] while skipping the detailed slide walkthrough), the authors match deep ANN units to recorded V4 neural sites in 3 macaques and optimize novel 8-degree synthetic “controller” images via model gradients:
- Super-activation (
68%vs.1%chance): Model-synthesized controller images drove68%of recordedV4sites beyond their naturally observed maximal activation levels (Slide 54, Slide 57). - One-hot subpopulation control (
76%vs.1%chance): Across recorded subpopulations sharing overlapping receptive fields (illustrated onn = 39V4sites in Slide 58, targeting site12while holding other recorded sites near baseline), synthetic stimuli achieved a76%selective-control success rate (1%chance;Slide 54). - Out-of-distribution response prediction (
54%vs.0%chance): On non-natural synthetic controller stimuli far outside the natural-image training distribution, the ANN predicted54%of image-evoked brain response patterns (0%chance,100%ceiling;Slide 54).
Those remaining discrepancies drive the next cycle of the measure–break–build loop tracked on brain-score.org (Slides 52, 61, 63, [36:54]–[39:50]):
- Recurrent feedback circuits (
Kar et al., Nature Neurosci. 2019): Fast-acting recurrent connections—omitted by pure feedforward CNNs—help primateITsolve challenging images beyond the initial100 mssweep (Slide 63; Q&A[44:23]–[45:11]also highlights long-range skip and inter-area recurrent connections). - Adversarial fragility and early visual processing (
Dapello*, Marques*, Schrimpf, Geiger, Cox & DiCarlo, NeurIPS 2020): White-box pixel perturbations flip a CNN’s classification ("Terrier"\(\to\)"Church",Slide 61), motivating biologically constrained V1 front-end circuits that improve efficiency and perturbation robustness (Slide 63). In closing Q&A ([45:17]–[47:48]), DiCarlo adds that while retinas are largely conserved and hard-coded across species, higher-order cortical areas gain greater plasticity and expanded downstream tissue in humans.
Part II: Teaching Recurrent Neural Networks to Modify Chaotic Memories by Example (Jason Z. Kim)
DiCarlo’s Q&A ([42:39]–[43:04]) noted that moving beyond 200 ms feedforward perception toward memory and cognition requires recurrent dynamics evolving over time. Jason Z. Kim ([48:03]–[85:01], l24b.pdf, Kim, Lu, Nozari, Pappas & Bassett, arXiv:2005.01186 / Nat. Mach. Intell. 2021) asks how a recurrent network can store and continuously manipulate complex temporal memories purely by imitating examples.
1. Neural memory manipulation vs. engineered computers (l24b Slides 1–2 / PDF pp. 3–22)
After reviewing how \(L_1\) sparsity penalties recover localized Gabor-like V1 receptive fields where PCA yields global spatial-frequency grids ([49:55]–[52:02]), Kim highlights two biological examples of manipulable temporal memory (PDF pp. 3–14, [54:47]–[56:45]):
- Hippocampal place-cell planning (
Pfeiffer & Foster, Nature 2013): Decoded neural sequences sweep ahead along future trajectories before a rat moves. - Songbird temporal scaling (
Fee & Scharff, 2010): As juvenile songbirds learn mature motifs (days 40 → 55 → 80), cooling brain regionHVClinearly stretches song duration.
Whereas a digital computer performs 7 + 17 = 24 via pre-engineered decimal-to-binary encoding, bitwise arithmetic, and decoding (PDF p. 22, [56:48]–[57:27]), biological circuits have no pre-specified binary code.
2. Reservoir computers and autonomous chaotic attractors (l24b Slides 4–8 / PDF pp. 24–41)
To model structured yet unpredictable temporal memories, Kim uses the 3D Lorenz attractor (Lorenz, 1963; PDF p. 24 & PDF p. 62, arXiv:2005.01186 Eq. 1):
\[ \dot{x}_1 = \sigma(x_2 - x_1), \qquad \dot{x}_2 = x_1(\rho - x_3) - x_2, \qquad \dot{x}_3 = x_1 x_2 - \beta x_3, \]
with standard chaotic parameters \(\sigma = 10\), \(\beta = 8/3\), and \(\rho = 28\). The neural circuit is modeled as a continuous-time reservoir computer (echo-state / FORCE-style RNN; Jaeger, 2010; Sussillo & Abbott, 2009; Slide 6 / PDF p. 35):
\[ \frac{1}{\gamma}\dot{\mathbf{r}}(t) = -\mathbf{r}(t) + \mathbf{g}\!\big(A\mathbf{r}(t) + B\mathbf{x}(t) + C\mathbf{c} + \mathbf{d}\big), \]
where \(\mathbf{r}(t) \in \mathbb{R}^N\) are hidden neuron states, \(\mathbf{x}(t) \in \mathbb{R}^3\) is the driving input, \(\mathbf{c} \in \mathbb{R}^K\) is a low-dimensional context/control parameter (e.g., scalar \(c \in \mathbb{R}\) biasing baseline firing rates, [59:24]–[62:09]), and \(\mathbf{g} = \tanh\) acts elementwise. (Note: Slide 6 writes \(\gamma = 1\), whereas Kim et al. Supp. Sec. I.C sets \(N = 300\), \(\gamma = 100\), \(\Delta t = 0.001\), \(10\%\) sparse \(A\) scaled to \(\operatorname{Re}(\lambda_{\max}(A)) = 0.95\), \(B_{ij} \in [-0.004, 0.004]\) for translation/transformation or \([-0.04, 0.04]\) for bifurcation, and \(C_{i} \in [-0.002, 0.002]\).)
Crucially, \(A\), \(B\), \(C\), and \(\mathbf{d}\) are randomly initialized and never trained. Only a linear readout \(W \in \mathbb{R}^{3 \times N}\) is fit via minimum-norm least squares (Slide 8 / PDF p. 41, [63:08]–[64:05]):
\[ W = \arg\min_W \|W\mathbf{r}(t) - \mathbf{x}(t)\|_2, \]
after which closing the feedback loop (\(\mathbf{x}(t) \leftarrow W\mathbf{r}'(t)\)) yields an autonomous dynamical system with effective recurrent matrix \(R = A + BW\):
\[ \frac{1}{\gamma}\dot{\mathbf{r}}'(t) = -\mathbf{r}'(t) + \mathbf{g}\!\big((A + BW)\mathbf{r}'(t) + C\mathbf{c} + \mathbf{d}\big). \]
To analyze arbitrary sigmoidal nonlinearities analytically, Kim et al. (arXiv:2005.01186 Eq. 2–5) expand the reservoir to quadratic order around a fixed point \(\mathbf{r}^*\) (\(\delta\mathbf{r} = \mathbf{r} - \mathbf{r}^*\), \(\mathbf{x}^* = 0, \mathbf{c}^* = 0\)):
\[ \frac{1}{\gamma}\delta\dot{\mathbf{r}}' = -\delta\mathbf{r}' + U(R\delta\mathbf{r}' + BW\mathbf{r}^* + C\mathbf{c}) + V(R\delta\mathbf{r}' + BW\mathbf{r}^* + C\mathbf{c})^2, \]
where for \(\mathbf{g} = \tanh\), diagonal matrices \(U_{ii} = 1 - r_i^{*2}\) and \(V_{ii} = r_i^{*3} - r_i^*\) capture the first and half-second derivatives. Minimum-norm regression maps \(W\mathbf{r}^*\) to \(O(10^{-6})\) in Kim et al.’s main simulations (Supp. Sec. I.F, PDF p. 30)—even though \(x_3\) oscillates around \(\rho - 1 = 27\)—so the paper’s subsequent perturbation equations drop the residual offset \(BW\mathbf{r}^*\).
3. Learning translations, linear transformations, and bifurcation inference (l24b Slides 9–20 / PDF pp. 43–76)
By driving the reservoir with only four nearby example trajectories (\(c \in \{0, 1, 2, 3\}\)) and closing the feedback loop with \(c\) left as a free external knob ([64:19]–[69:18]):
- Spatial translation (PDF pp. 47, 73): Training on \(\mathbf{x}_c(t) = \mathbf{x}_0(t) + P c\) (\(P = [1, 0, 0]^\top\)) lets the autonomous reservoir continuously interpolate and extrapolate shifted Lorenz attractors across \(-40 \le c \le 40\) (and independently along multiple axes when \(\mathbf{c} = [c_1, c_2]^\top\),
Slide 18 / PDF p. 73). - Linear shape transformation (PDF p. 54): Training on squeezed/sheared attractors \(\mathbf{x}_c(t) = (I + cP)\mathbf{x}_0(t)\) (written with opposite sign convention \(W\mathbf{r}_c \approx [I - Tc]\mathbf{x}(t)\) on Slide 19 / PDF p. 75, where \(T = -P\)) extrapolates continuous stretches and shears across \(-40 \le c \le 40\).
- Differential mechanism (Slide 19 / PDF p. 75,
Kim et al.Eq. 7–9): For sufficiently close examples, \(W\mathbf{r}_c \approx \mathbf{x} + P c\) implies \(W d\mathbf{r}' \approx P\, dc\) (or \(-T\mathbf{x}\, dc\) for transformations). Dropping \(BW\mathbf{r}^*\) and evaluating the total differential of the quadratic feedback equation at \(c = 0\) yieldsEq. 7: \[ (I - KA)d\mathbf{r}' + \frac{1}{\gamma}d\dot{\mathbf{r}}' = K(BW d\mathbf{r}' + C\, dc), \qquad K = U + 2V\operatorname{diag}(R\delta\mathbf{r}'(t)), \] from which taking successive time derivatives produces a block-Hessenberg system (Kim et al.p. 11) linking \(dc\) directly to \(d\mathbf{r}'\) (Eq. 8–9). - Inferring a Hopf bifurcation from stable decays (PDF pp. 62, 69, 76,
[66:55]–[72:00]): For \(\rho > 1\), the Lorenz system has two nonzero wing equilibria \(\big(\pm\sqrt{\beta(\rho-1)}, \pm\sqrt{\beta(\rho-1)}, \rho-1\big)\), which are stable foci below the subcritical Hopf threshold \(\rho^* \approx 24.7\).Kim et al.(pp. 9–10,Fig. 5) test two distinct pre-bifurcation training protocols:- Two-wing protocol (
Slide 14): Train on trajectories spiraling into both wing fixed points at \(\rho = 23\) (\(c = 0\)) and \(\rho = 24\) (\(c = 1\)), then sweep \(c\) from \(0 \to 5\). - One-wing protocol (Slide 15 / PDF p. 69): Train on trajectories spiraling into only one wing fixed point across four values \(\rho = 21, 22, 23, 24\) (\(c = 0, 1, 2, 3\)), then sweep \(c\) from \(0 \to 7\).
Kim et al.Eq. 10), \[ \frac{1}{\gamma}\delta\dot{\mathbf{r}}' \approx \big[-I + UR + 2V\operatorname{diag}(R\delta\mathbf{r}^* + BW\mathbf{r}^* + C\mathbf{c})R\big](\delta\mathbf{r}' - \delta\mathbf{r}^*) \] (printed without the negligible \(BW\mathbf{r}^*\) term inEq. 10on p. 12), shows why (Slide 20 / PDF p. 76): slower decay at \(\rho = 24\) vs. \(\rho = 23\) teaches the reservoir a smooth eigenvalue shift toward zero, pushing its leading complex-conjugate eigenvalues across \(\operatorname{Re}(\lambda_{\max}) = 0\) as \(c\) increases. Beyond Hopf bifurcations,Kim et al.also demonstrate period-doubling cascades (\(\rho = 100.3 \to 99.53\)), saddle-node and supercritical pitchfork normal forms (Slide 16 / PDF p. 71), and non-dynamical kinematic Jansen linkages (Slide 17), reflecting the interplay between smooth differential tracking (Eq. 7–9) and spectral stability shifts (Eq. 10). - Two-wing protocol (
Kim closes ([72:30]–[76:15]) by framing memory storage as invertible generalized synchronization: neural activity \(\mathbf{r}(t) = \phi(\mathbf{x}(t))\) must admit an inverse \(\mathbf{x}(t) = \phi^{-1}(\mathbf{r}(t))\) (approximated by \(W\)) so the network can drive itself autonomously, switch among multiple stored chaotic attractors, or wander toward stable memories when an attractor is poorly stabilized.
Constructed RK4 numerical verification (not biological recordings)
To verify Kim et al.’s reservoir ODE, quadratic expansion, SVD readout, and linearized Hopf stability continuation (Eq. 1–5, 10) independently of slide illustrations, our figure script (create_figures.py, manifest.json) runs fourth-order Runge–Kutta (RK4, \(\Delta t = 0.001, \gamma = 100, N = 300\)) simulations retaining 100 dimensionless time units per trajectory (T_waste = 20, subsampled every 5th step for lstsq, vs. 200 units at every step in Kim et al. Supp. Sec. I.E):
- Translation extrapolation (
seed = 42): Trained only on \(c \in \{0, 1, 2, 3\}\), SVD readout achieves training RMSE2.76e-07with \(W\mathbf{r}^* = [1.45\times 10^{-7},\; -3.90\times 10^{-6},\; -2.86\times 10^{-6}]^\top\). Over a finite16-unit post-transient autonomous window, mean \(x_1'(t)\) shifts from-1.37(\(c=0\)) to-16.89(\(c=-20\)) and+24.14(\(c=+20\)) (exact finite-window chaotic trajectory averages vary modestly across floating-point BLAS summation orders). - Pre-bifurcation Hopf stability check (
seed = 7, both-wing protocol, steppedc = 0 → 4): Trained only on decaying spirals toward both wings at \(\rho = 23\) (\(c=0\)) and \(\rho = 24\) (\(c=1\)) (training RMSE = 6.42e-10; \(W\mathbf{r}^*\) reaches1.40e-3on \(x_3\), retained explicitly in both feedback and Jacobian evaluations). Newton continuation of the linearized Jacobian shows the leading complex-conjugate pair shifting from-0.0540(\(c=0\)) to-0.0225(\(c=1\)), with-0.0013475atc = 1.70and+0.0001395atc = 1.75(interpolated Hopf-like stability crossing nearc ≈ 1.7453). Stepping \(c = 0 \to 4\) in autonomous feedback triggers finite-time two-wing switching (\(x_1'(t) \in [-16.43, 17.01]\)).
Lecture and sources
- MIT 6.874 Spring 2021 official schedule (Lecture 24, Neuroscience) and official lecture recording (
85:01; verified with timestamped captions). - Part A Slides — James DiCarlo, A Quest to understand the neural mechanisms of human visual intelligence (
l24a.pdf, 64 pp.), especially Slides 6–15, 22–38, 40–46, 54–58, and 61–63. - Part B Slides — Jason Z. Kim, Teaching recurrent neural networks to infer global temporal structure from local examples (
l24b.pdf, 79 build pages / 22 numbered slides). - Primary paper cited throughout Part B for exact reservoir equations (
Eq. 1–10) and simulation parameters (N=300, gamma=100, dt=0.001): Jason Z. Kim, Zhixin Lu, Erfan Nozari, George J. Pappas, and Danielle S. Bassett, Teaching Recurrent Neural Networks to Modify Chaotic Memories by Example (arXiv:2005.01186/ Nat. Mach. Intell., 2021). - Original explanatory figures and reproducible simulation manifest: create_figures.py and manifest.json. Constructed RK4 simulations (
seeds 42 & 7) are explicitly separated from lecture-reported primate physiology and benchmarks.


