Neural coding
Rate codes, temporal codes, population codes, tuning curves, and low-dimensional manifolds. The theory that says what a decoder can and cannot read from a set of neurons.
On this page14 min
When you brushed the cockroach leg and heard the firing rate jump, you heard a rate codeRate code The idea that a neuron carries information in how many spikes per second it fires. Related: Temporal codeTemporal code The idea that the precise timing of spikes, not just their count, carries information., Population vectorPopulation vector A way to read out intended movement direction by adding up the preferred directions of many motor cortex neurons, weighted by how fast each is firing.. Glossary entry: intensity encoded as spikesSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry per second. When you built the Kalman decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry, you read a population codePopulation vector A way to read out intended movement direction by adding up the preferred directions of many motor cortex neurons, weighted by how fast each is firing. Related: DecoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter., Rate codeRate code The idea that a neuron carries information in how many spikes per second it fires.. Glossary entry: direction encoded across many neurons at once. The question of how neurons represent the world, “the neural code,” is the theoretical heart of the field and the thing every decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry is implicitly a theory of. Let’s lay out the candidates and what the data say.
Tuning curves
Record one neuron while varying a stimulus and plot its rate against the stimulus value. A retinal ganglion cell’s rate against light intensity; a visual cortex cell’s rate against edge orientation; a motor cortex cell’s rate against movement direction. The resulting curve is the neuron’s tuning. Most cortical tuning curves are broad (a motor neuron responds to a wide range of directions, most strongly to one), noisy (the same stimulus gives a different count each trial), and overlapping (neighbouring neurons prefer neighbouring values). Broad, noisy, overlapping tuning is not a flaw; it is the design that makes population codes robust.
A typical tuning curve is a baseline plus a bump at the preferred value:
Here is the firing rate, the stimulus value, the preferred value, the baseline rate, the modulation depth, and the tuning width.
Rate versus timing
The rate codeRate code The idea that a neuron carries information in how many spikes per second it fires. Related: Temporal codeTemporal code The idea that the precise timing of spikes, not just their count, carries information. , Population vectorPopulation vector A way to read out intended movement direction by adding up the preferred directions of many motor cortex neurons, weighted by how fast each is firing. . Glossary entry says information is in how many spikesSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry per unit time. Its evidence: nearly every tuning curve ever measured is a rate curve; rates decode movement and stimuli well; and the noise in spikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry counts looks roughly Poisson, as if only the rate were controlled.
SpikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry counts in a fixed bin follow roughly a Poisson distribution around the rate:
Here is the spikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry count and the mean count. Variance equals the mean (), so single-trial counts are noisy by nature.
The temporal codeTemporal code The idea that the precise timing of spikes, not just their count, carries information. Related: Rate codeRate code The idea that a neuron carries information in how many spikes per second it fires.. Glossary entry says the precise timing of spikesSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry matters too. Its evidence: auditory neurons phase-lock to sound waves at sub-millisecond precision; the timing of the first spikeSpike Shorthand for an action potential as seen by an electrode, a brief blip about a millisecond wide. Related: Action potentialAction potential The brief, all-or-nothing voltage spike a neuron fires, about a millisecond long and about 100 millivolts tall across its membrane. , Spike sortingSpike sorting Deciding which spikes on an electrode came from which neuron, by clustering their waveform shapes. , Extracellular recordingExtracellular recording Recording with an electrode near neurons rather than inside one; you see small, fast blips from nearby cells rather than the full membrane swing. . Glossary entry after a stimulus carries information before any rate could be estimated; in the hippocampus, when a cell fires relative to the theta rhythmTheta rhythm Roughly 4 to 8 Hz activity, prominent in drowsiness, some memory tasks, and strongly in the rodent hippocampus. Related: Alpha rhythmAlpha rhythm A roughly 8 to 12 Hz oscillation over the back of the head that appears when the eyes close and fades when they open. . Glossary entry encodes position within its place field (phase precession).
The honest summary: rates carry most of the information a decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry can currently use, timing carries more in specific systems (hearing, spatial navigation), and the brain probably uses both to different degrees in different places. Every practical BCIBrain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. Related: DecoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. , Closed loopClosed loop A system in which the output feeds back to influence the input, such as a user adjusting their brain activity while watching the cursor it controls. . Glossary entry decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry is a rate decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry with 20 to 50 millisecond bins, and it works.
A neuron's firing is so noisy that its count for a repeated stimulus varies by a factor of two. How can a population of such neurons encode the stimulus precisely?
By pooling across neurons in a single trial. If a hundred neurons each report the stimulus noisily and their noise is independent, the population average has a tenth the noise of any one. Independent noise averages as the square root of the count:
so . That is why decoding accuracy rises with neuron count in the Allen data, and why the noise correlations between neurons (which limit how much pooling helps) are a central topic in coding theory.
Population codes and the manifold
Take N neurons and plot each trial’s activity as a point in N-dimensional space. For a hundred neurons, a hundred dimensions. The remarkable empirical finding of the last fifteen years is that the points do not fill the space; they lie on or near a low-dimensional surface, a manifold, of perhaps ten dimensions, and movement of the population along that surface is what encodes the variable of interest and what evolves over time. PCA on your Allen data found it. Motor cortex during reaching traces smooth, rotational trajectories on its manifold that look more like a dynamical system than like a lookup table of muscle commands.
Each trial is then a mean plus a few weighted patterns:
Here is the trial’s activity vector, the mean, the principal patterns, the trial’s weights, and the manifold dimension, near ten for a hundred neurons.
For decodersDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry this is good news. A hundred noisy neurons carry only ten dimensions of signal, so the decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry’s job is to find the ten, and a linear method often can. It is also why decodersDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry survive losing neurons: the manifold is redundantly represented. And it is why the newer decodersDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry learn the manifold’s dynamics rather than mapping neurons to kinematics directly.
Sparse codes and grandmother cells
At the other extreme, some neurons in the human medial temporal lobe respond to one specific person or concept, across pictures, names, and voices. Sparse, selective coding exists. It is efficient for memory and hopeless for movement, and the brain appears to use dense population codes in sensorimotor areas and sparser ones as you move toward memory. A decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry for speech in ventral premotor cortex reads a dense code; a hypothetical decoderDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry of “what are you thinking about” would face a sparse one, which is one reason it is not close.
What the code says about ethics
The codes we can read are motor intent and sensory content, from dense population activity in the relevant cortex, with electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry in that cortex. Reading thoughts, memories, or intentions beyond movement is not a matter of better electrodesElectrode The conductor that turns ion currents in tissue into electron currents in a wire; its chemistry and contact quality set the noise you live with. Related: Silver/silver-chloride (Ag/AgCl)Silver/silver-chloride (Ag/AgCl) The standard electrode material for biopotentials, because its chemistry produces a stable, low-noise, low-drift interface with salty gel. , Electrode impedanceElectrode impedance How hard it is to push current through the skin-electrode contact, typically 5 to 50 kilohms with gel and megohms dry, higher at low frequencies. , Half-cell potentialHalf-cell potential The DC voltage that appears wherever a metal meets an electrolyte; two electrodes with different half-cell potentials produce an offset that can swamp the signal. . Glossary entry; it would require decoding sparse, distributed, poorly understood codes from areas nobody records from in humans outside of epilepsyEpilepsy A tendency to recurrent seizures; its monitoring units are where seizure-detection algorithms get validated and where ECoG data comes from. Related: Epilepsy monitoring unit (EMU)Epilepsy monitoring unit (EMU) The hospital ward where patients are recorded on video-EEG for days to capture seizures before surgery. , Seizure detectionSeizure detection Automatically flagging seizures in EEG, a real clinical need and a good first machine-learning project on the TUH corpus. . Glossary entry surgery. NeuroethicsNeuroethics The study of the ethical questions raised by measuring and changing brains, from privacy of neural data to who owns an implant. Related: NeurorightsNeurorights Proposed rights to mental privacy, identity, and agency, already written into Chile's constitution and debated elsewhere. , Neural data privacyNeural data privacy The question of who may collect, store, and sell recordings of brain activity, now addressed by laws in several US states. . Glossary entry discussions that assume mind-reading is near are not describing this field. Discussions about who owns your motor cortex’s recordings are.
Deep dive Fisher information and why broad tuning is good 3 min
How precisely a population can encode a variable is measured by Fisher information: roughly, how steeply firing changes with the variable, divided by the noise, summed over neurons. Sharp tuning curves give steep slopes but only near their peaks; broad curves give shallower slopes over a wide range. For a fixed number of neurons and realistic noise, moderately broad tuning maximizes information over the whole range, which is what cortex has. Noise correlations between neurons can raise or lower the total depending on their structure; that is an active area.
For one variable encoded by independent neurons with Gaussian noise, precision is slope squared over noise, summed:
Here is how steeply neuron ’s rate changes with the variable and is its noise variance. Broad curves keep moderate slopes over a wide range, which is why they win for a fixed neuron count.
Deep dive Neural dynamics as the code 3 min
An influential view of motor cortex (Churchland, Shenoy, and others) holds that its population activity is best understood not as representing movement parameters but as a dynamical system whose evolution generates the muscle commands. Preparation sets an initial state; the dynamics unfold. DecodersDecoder The algorithm that maps neural signals to intended actions, such as a classifier or a Kalman filter. Related: ClassifierClassifier An algorithm that assigns each trial a label, such as left hand or right hand, after being trained on labelled examples. , Kalman filterKalman filter An estimator that blends a prediction from a motion model with a noisy measurement, weighting each by how much it trusts it; the decoder behind most intracortical cursor control. , Brain-computer interface (BCI)Brain-computer interface (BCI) A system that turns measured brain activity into control of something outside the body, from a cursor to a wheelchair to a speech synthesizer. . Glossary entry built on this view (latent factor models, recurrent networks trained on population activity) fit held-out neurons and predict behaviour better than tuning-curve models. The Neural Latents BenchmarkThe Neural Latents BenchmarkStandard monkey datasets with held-out evaluation, the right place to compare a decoder against the field. measures exactly this.
Explain what this page was about to your roommate in three sentences. No jargon they would not know.
We read movement from firing rates counted in bins of 20 to 50 milliseconds, because nearly every tuning response is a rate curve and rates decode well. We pool across about one hundred noisy cells because their shared signal sits on a surface of roughly ten dimensions, so losing cells does not lose the message. We do not read thoughts from these recordings because thoughts use sparse codes in areas we do not record outside epilepsy care, while movement uses dense codes in the area we do record.
Yours does not have to match. Check that the three ideas are there.