Chapter 3 · Neurons
Spikes and thresholds
A membrane that only leaks just relaxes toward its input. Add a threshold and a reset and it fires, at a rate that depends on its input in a specific way. This chapter works out that dependence, then adds the two features real neurons have that the simple model lacks, refractoriness and adaptation.
Threshold and reset
Take chapter 2’s membrane in steps, , with . On a constant input it settles where the leak takes away exactly what the input adds, , at
Now add a threshold : when reaches it, the neuron emits a spike and resets. If is below the membrane never gets there and the neuron never fires, however long it waits. So there is a smallest input that fires the neuron at all, the rheobase:
With steps, and the rheobase is 0.080 of the threshold per step.
What happens after a spike matters as much as the threshold. Two resets are common. Reset to zero forgets the membrane. Reset by subtraction takes away and keeps whatever overshoot there was, so a large input that pushes the membrane well past threshold carries the excess into the next spike.
How fast it fires
With reset to zero, the membrane starts from 0 after every spike and climbs the same curve each time. After steps it holds , a geometric sum:
It fires at the first for which :
and fires every steps, a rate of . The ceiling makes the curve a staircase. Near rheobase the logarithm blows up and the rate falls to 0. Far above it, reaches 1 and the neuron fires every step.
Subtraction has no tidy formula, but it has a tidy limit. Without a leak, every spike removes exactly and every step adds exactly , so in the long run the neuron fires times per step: the rate is proportional to the input. The leak makes it fire somewhat less, most of all near rheobase.
The scope shows the membrane of the neuron you pick; the right panel shows its firing rate for every input, with yours marked. The dashed line is the rheobase. The grey curve, reset to zero, is the staircase of the formula, computed here by running the neuron. Subtraction’s blue curve rises almost in a straight line toward a rate equal to the input.
Continuous time and refractoriness
In physical units, chapter 2’s membrane relaxes toward with time constant . Start it at the reset voltage and solve for the time it takes to reach threshold :
which is Gerstner et al.’s equation 8.34. Real neurons cannot fire again immediately after a spike. For a millisecond or more their sodium channels are inactivated and no input can trigger a second spike. The model captures this with an absolute refractory period during which the membrane is held at reset. With reset to rest, , the interval between spikes and the rate become
The rheobase is now a current, , and the rate can never exceed . For the neuron of the earlier chapters, with ms, pF (so ), a threshold 10 mV above rest and ms, the rheobase is 100 pA and the ceiling is 200 Hz.
The formula is for continuous time. A simulation steps time, and a neuron that crosses threshold between two steps fires at the later one. Chapter 2’s lesson returns: the step size changes the answer, here by up to a tenth. sparx’s LeakyIntegrateAndFire lets you compute the same curve:
import jaximport jax.numpy as jnp
import sparxfrom sparx.dynamics import LeakyIntegrateAndFire, SynapticInput
jax.config.update("jax_enable_x64", True)# 20 ms, 200 pF: R = 100 MOhm. Threshold 10 mV above rest, 5 ms# refractory, reset to rest.cell = LeakyIntegrateAndFire(tau_m=20.0, c_m=200.0, e_l=-60.0, v_th=-50.0, v_reset=-60.0, t_ref=5.0)dt, steps = 0.1, 20_000 # 2 s
def rate(pA): """Spikes per second over the last second of a constant current.""" out, _ = sparx.run(cell, SynapticInput(jnp.full((steps,), pA)), dt=dt) return out.value[steps // 2:].sum() # one second
currents = jnp.arange(120.0, 620.0, 100.0)measured = jax.vmap(rate)(currents)
RI = currents * 0.1 # mV, with R = 0.1 mV/pAformula = 1000 / (5.0 + 20.0 * jnp.log(RI / (RI - 10.0)))for i, m, f in zip(currents, measured, formula, strict=True): print(f"{int(i)} pA: {int(m)} Hz stepped, {float(f):.1f} Hz exact")jax.vmap runs the neuron at all five currents at once. At 0.1 ms the stepped rates sit within about 1 Hz of the formula.
Adaptation
Hold a real cortical neuron at a constant current and it fires fast at first, then slows down. This is spike-frequency adaptation: each spike opens slow potassium channels, or leaves some other trace, that makes the next spike harder.
The adaptive LIF neuron models that trace directly. It keeps a second variable that jumps by 1 at each spike and decays with its own, much longer time constant. Its threshold rises with :
with . Choose “Adaptive” in the figure above: and steps. The first spikes come at the plain neuron’s rate, then each one raises the threshold a little and the intervals stretch until adaptation and input balance. Its rate curve lies below the others and grows more slowly.
Adaptation also gives a network memory. A neuron’s adaptation variable holds a trace of its recent firing for about steps, far longer than its membrane remembers anything. Bellec et al. used adaptation time constants of hundreds of milliseconds and more this way, in recurrent networks that had to hold cues for seconds. In sparx this is sparx.nn.ALIF.
Many behaviours from two variables
Real neurons do much more than fire regularly. Some fire bursts of spikes, some chatter, some fire once and stop, some only fire when released from inhibition. Izhikevich (2003) found a model with two variables that reproduces most of these patterns. The membrane in mV follows a quadratic, and a recovery variable follows and pulls it down:
When reaches 30 mV the neuron fires, resets to and jumps by . The four numbers , , and select the behaviour. The quadratic term is what lets run away upward once past a point, so there is no fixed threshold: the spike starts wherever ‘s rise outruns .
Izhikevich(a=0.02, b=0.2, c=-65.0, d=8.0) · dt 0.1 ms · 400 ms window
Try each class. Regular spiking slows down, like the adaptive LIF, because each spike adds to . Bursting and chattering reset to a higher , close enough to the runaway region that one spike can lead straight into the next. Fast-spiking interneurons recover quickly, with a large , and keep a steady fast rate.
import jax.numpy as jnp
import sparxfrom sparx.dynamics import SynapticInput, izhikevich_2003
# a, b, c and d of one class of the 2003 papercell = izhikevich_2003("chattering")# 400 ms at 0.1 ms, the current switched on after 20 mscurrent = jnp.where(jnp.arange(4000) > 200, 10.0, 0.0)(spikes, v), _ = sparx.run(cell, SynapticInput(current), dt=0.1, record=lambda s: s.v)print(int(spikes.value.sum()), "spikes")Izhikevich estimated the model’s cost at about 13 floating-point operations per millisecond of simulated time, against about 1,200 for Hodgkin and Huxley’s equations, each with the step size its accuracy needs. sparx runs both, and chapter 11 compares them with NEST and with Izhikevich’s own code.
Try this
- In the figure, with reset to zero, find the input at which the neuron fires every other step. Check it against the formula.
- With reset by subtraction, set the input to 1.2. The rate is not 1.2 spikes per step. Why, and what is it?
- Using the formula, what rate does 260 pA give the physical neuron? How many spikes should it fire in its first 300 ms, starting from rest?
- Why does the adaptive neuron’s rate curve keep rising past the point where the plain neuron’s does not?
Answers
- Every other step means , so while : from up to 1.
- A neuron sends at most one spike per step, so its rate tops out at 1. At 1.2 it fires every step, and the extra 0.2 a step piles up in the membrane until the leak removes it as fast as it arrives, at after each reset.
- ms, about 68 Hz. Starting from rest, the first spike takes 9.7 ms, with no refractory period before it, and then one comes every 14.7 ms: at 9.7, 24.4, 39.1 ms and so on, 20 of them before 300 ms. sparx’s neuron, stepped at 0.1 ms, fires 20.
- The plain neurons reach the ceiling of one spike per step near an input of 1. The adaptive neuron’s threshold rises with its own recent firing: at a steady rate , settles at , so the threshold sits near . Firing every step would need a threshold of about 31 crossed every step, so its rate is still climbing at the largest inputs shown.
Summary
A threshold turns a leaky membrane into a neuron with a rheobase, below which it never fires, and a rate that grows with the input: a staircase with reset to zero, nearly proportional with subtraction, capped by a refractory period. Adaptation slows a neuron under constant drive and gives it a memory of its recent firing; Izhikevich’s two variables produce bursting, chattering and more. The next chapter turns the question around: given a number, how should a neuron put it into spikes?
References
- W. Gerstner, W. M. Kistler, R. Naud and L. Paninski, Neuronal Dynamics, section 8.3, Cambridge University Press, 2014, doi:10.1017/CBO9781107447615. Equation 8.34; the refractory period is added here.
- G. Bellec, F. Scherr, A. Subramoney, E. Hajek, D. Salaj, R. Legenstein and W. Maass, “A solution to the learning dilemma for recurrent networks of spiking neurons”, Nature Communications 11, 3625, 2020, doi:10.1038/s41467-020-17236-y. The adaptive LIF neuron.
- E. M. Izhikevich, “Simple model of spiking neurons”, IEEE Transactions on Neural Networks 14(6), 2003, doi:10.1109/TNN.2003.820440.
- E. M. Izhikevich, “Which model to use for cortical spiking neurons?”, IEEE Transactions on Neural Networks 15(5), 2004, doi:10.1109/TNN.2004.832719. Figure 2: the cost estimates, with first-order Euler steps chosen per model.