How Neurons Fire and Learn
Notes from studying three classic models: why a neuron fires, why neurons fire in different rhythms, and how the brain learns from surprise.
These notes come from our self-study of computational neuroscience, starting with three classic models. They are written for someone new to the topic. You don't need any maths to follow along, and the equations are at the end of each section. Each section also includes a working simulation of the model, so you can check each result for yourself.
A neuron is a leaky bucket
The simplest way to explain a neuron is as a bucket. It constantly receives small electrical signals from other neurons, like water pouring in. The bucket has a small hole, so water is always draining away. If the water ever reaches a line near the top, called the threshold, the neuron fires. It sends out a brief electrical pulse, called a spike, then empties and starts over.
You can see this in the simulation below. Pour gently at first, then harder, and watch the number of spikes per second.
Two results matter here. A weak input never produces a spike, however long it lasts, because the leak keeps up with it. Above that point, a stronger input refills the bucket faster, so spikes come more often. There is a limit, because a neuron needs a moment to recover after each spike.
This is the leaky integrate-and-fire model. “Integrate” is the filling, “leaky” is the hole, and “fire” is the spike. It ignores a lot of biology, yet it remains a standard starting point in computational neuroscience.
τ dV/dt = −(V − E_L) + R·I
V is the water level, which in a real neuron is its voltage. I is the pour, or input current. E_L is the resting voltage, R is the membrane resistance, and τ sets how quickly the voltage responds. The simulation uses τ = 10 ms, R = 10 MΩ, and a threshold 15 mV above rest, so the leak wins below 1.5 nA.
Neurons have personalities
The bucket treats every neuron the same, but real neurons are not all alike. Give them the same steady input and they answer in different rhythms. In 2003, Eugene Izhikevich published a model that reproduces many of these rhythms with two equations and four numbers, cheaply enough to simulate very large networks.
The simulation below shows three well-known types. Pick one and watch its rhythm, or turn the sound on and listen to it.
Regular spiking neurons start with a quick pair of spikes, then settle into a slow, steady beat. Bursting neurons fire a tight cluster, pause, and do it again. Fast spiking neurons keep firing rapidly with little slowing down. All three receive the same input and run the same equations. Only the four numbers changed.
v′ = 0.04v² + 5v + 140 − u + I
u′ = a(bv − u)
if v ≥ 30 mV: v ← c, u ← u + d
v is the voltage and u is a recovery variable that pushes back after each spike. The numbers below come from Figure 2 of the paper, where the bursting neuron is called chattering. The simulation uses I = 10 with a 0.1 ms time step.
| Neuron | a | b | c | d |
|---|---|---|---|---|
| Regular spiking | 0.02 | 0.2 | −65 | 8 |
| Bursting | 0.02 | 0.2 | −50 | 2 |
| Fast spiking | 0.1 | 0.2 | −65 | 2 |
The surprise signal
So far a neuron only reacts. The third model is about how a brain learns. In 1997, Wolfram Schultz, Peter Dayan, and Read Montague linked recordings of dopamine neurons to a theory of learning. These neurons fire strongly for a reward nobody expected. Once a cue reliably predicts the reward, they fire at the cue instead and barely respond to the reward itself. And if the expected reward fails to arrive, their activity dips at the moment it was due.
The experiments behind that paper used monkeys and juice. To explain it here, we use a dog, a bell, and a treat. In the simulation below, ring the bell a few times, repeat until the spike has moved, then take the treat away.
The orange line is the reward prediction error: what the dog got, minus what it expected. When the two match, the error is zero and there is nothing left to learn. So dopamine neurons do not simply signal pleasure. They signal the difference between what happened and what was predicted.
The rule in this simulation is called temporal-difference learning, and it is also a foundation of reinforcement learning in AI. In the model, the spike slides gradually back in time from the treat to the bell. Whether real dopamine neurons show that gradual slide is still being studied.
δ(t) = r(t) + γ·V(t) − V(t−1)
δ is the prediction error, r is the reward, and V is the predicted future reward. γ = 0.98 discounts the future, and the simulation learns at a rate of 0.35.
Sources
These are the sources we studied, if you want to go further.
- Gerstner, Kistler, Naud & Paninski, Neuronal Dynamics, a free online textbook that starts from the leaky integrate-and-fire model.
- Izhikevich (2003), Simple Model of Spiking Neurons.
- Schultz, Dayan & Montague (1997), A Neural Substrate of Prediction and Reward.
