This interactive simulation demonstrates the Leaky Integrate-and-Fire (LIF) Neuron Model, one of the most important simplified models in computational neuroscience. The LIF model captures the essential dynamics of how biological neurons process and transmit information.
Sections
- What is the LIF Neuron Model?
- The Governing Equation
- The Spike-and-Reset Mechanism
- How Does a Linear Equation Produce Non-Linear Spikes?
- The Leaky Bucket Metaphor
- Numerical Integration: Euler Method
- Key Parameters and Their Effects
- The Time Constant ฯ
- Biologically Realistic Parameter Ranges
- Applications of the LIF Model
- Simulation
- โก Parameters
- ๐ Input Pattern
- ๐ Statistics
- Usage Instructions
- Key Experiments to Try
- Neuron Type Presets
- Understanding the Leaky Bucket
- The Spike-and-Reset Mechanism
- Why Higher Resistance (R) Leads to FASTER Threshold Crossing
- Why Higher Capacitance (C) SLOWS DOWN Threshold Crossing
- Summary: R vs C Effects
- Mathematical Details
- Comparison with Real Neurons
- Extensions of the LIF Model
- Implementation Notes
What is the LIF Neuron Model?
The LIF model describes a neuron as an electrical circuit consisting of a capacitor (cell membrane) and resistor (ion channels) in parallel. When input current flows into the neuron:
- The membrane potential (voltage) integrates the input over time
- The voltage leaks back toward resting potential through the resistance
- When voltage reaches a threshold, the neuron fires (generates a spike)
- After firing, the voltage resets to a baseline value
The Governing Equation
The LIF neuron is described by this first-order linear differential equation:
Where:
- V = Membrane potential (voltage)
- ฯ = R ร C = Time constant (determines how fast the neuron responds)
- R = Membrane resistance (how easily current flows out)
- C = Membrane capacitance (how much charge the membrane stores)
- I = Input current (external stimulation)
- Vrest = Resting potential (equilibrium voltage)
The Spike-and-Reset Mechanism
When the membrane potential V reaches the threshold voltage Vth:
- Generate an action potential (spike)
- Reset V โ Vreset
- (Optional) Enter a refractory period
How Does a Linear Equation Produce Non-Linear Spikes?
A common question: The differential equation ฯยทdV/dt = -(V - Vrest) + RยทI is purely linear. How can it produce highly non-linear spike behavior?
The LIF model is actually a hybrid dynamical system with two components:
Component |
Type |
What It Does |
|---|---|---|
Differential Equation |
Linear, Continuous |
Smooth voltage evolution (charging and leaking) |
Threshold + Reset Rule |
Non-linear, Discrete |
Instantaneous jump (discontinuity in V) |
The differential equation alone would just cause voltage to smoothly approach a steady-state. The threshold rule is what creates the "spike" - an instantaneous reset that produces the sawtooth waveform:
โ
V_th |----โข----โข----โข---- โ Threshold triggers reset
| /| /| /|
| / | / | / | Linear ODE governs
| / | / | / | this smooth rise
|/ |/ |/ |
V_reset โโโโโโโโโโโโโโโโโโ โ Reset snaps V back
โโโโโโโโโโโโโโโโโโโโ t
Spike! Spike! Spike!
Why This Design? Real neurons use complex non-linear ion channel dynamics (Hodgkin-Huxley model with 4+ differential equations) to generate the ~1ms spike waveform. The LIF model abstracts away this complexity, replacing it with a simple rule while preserving the essential input-output behavior. This makes LIF computationally efficient while still capturing the essence of neural firing.
The Beauty of LIF: It demonstrates that complexity can emerge from simplicity - a linear ODE plus a threshold rule creates rich, non-linear spike train dynamics!
The Leaky Bucket Metaphor
The LIF neuron can be understood intuitively as a leaky bucket:
Bucket Component |
Neuron Equivalent |
Mathematical Term |
|---|---|---|
Water Level |
Membrane Potential |
V (voltage) |
Water Input (Tap) |
Input Current (synaptic input) |
I (current in nA) |
Leak (Hole at Bottom) |
Ion channel leakage |
-(V - Vrest)/ฯ |
Overflow Line |
Threshold for firing |
Vth |
Bucket Dumping |
Spike + Reset |
V โ Vreset |
Numerical Integration: Euler Method
The simulation solves the differential equation using the Euler method:
Vnew = Vold + Δt · (dV/dt)
Vnew = Vold + (Δt/τ) · [−(Vold − Vrest) + R · I]
This discrete approximation is computed at each time step to evolve the voltage forward in time.
Key Parameters and Their Effects
Parameter |
โ Increase Effect |
โ Decrease Effect |
|---|---|---|
Input Current (I) |
Faster voltage rise, higher firing rate |
Slower/no firing, may not reach threshold |
Resistance (R) |
Higher steady-state voltage, slower leak |
Lower voltage, faster leak to rest |
Capacitance (C) |
Slower response, more temporal integration |
Faster response, less integration |
Threshold (Vth) |
Fewer spikes, requires stronger input |
More spikes, fires more easily |
The Time Constant ฯ
The time constant ฯ = R ร C is crucial - it determines how quickly the neuron responds:
- Small ฯ (fast neuron): Quick response, short memory, sensitive to fast inputs
- Large ฯ (slow neuron): Sluggish response, integrates inputs over longer time, smooths out noise
Biologically Realistic Parameter Ranges
This simulation uses values calibrated to real neuron measurements:
Parameter |
Simulation Range |
Biological Basis |
|---|---|---|
R (Resistance) |
5-100 Mฮฉ |
Membrane input resistance of cortical neurons |
C (Capacitance) |
0.5-5 nF |
Total membrane capacitance (~1 ยตF/cmยฒ ร surface area) |
I (Input Current) |
0-2 nA |
Typical rheobase and suprathreshold currents |
Vth (Threshold) |
10-30 mV |
~20 mV above resting potential |
ฯ (Time Constant) |
10-50 ms |
ฯ = R ร C (default: 20 ms) |
Note: Units are chosen so that R(Mฮฉ) ร C(nF) = ฯ(ms) directly.
Applications of the LIF Model
Field |
Application |
|---|---|
Computational Neuroscience |
Modeling neural circuits, studying network dynamics |
Machine Learning |
Spiking Neural Networks (SNNs), neuromorphic computing |
Robotics |
Bio-inspired sensory processing, motor control |
Brain-Computer Interfaces |
Decoding neural signals, neural prosthetics |
Hardware Design |
Neuromorphic chips (Intel Loihi, IBM TrueNorth) |
Simulation
The interactive simulator is below. Use the controls to explore the concepts described above.
โก Parameters
๐ Input Pattern
๐ Statistics
Usage Instructions
- Adjust Parameters:
- Input Current (I): Increase to make the neuron fire. Start at 0 and slowly increase.
- Resistance (R): Higher R means higher steady-state voltage for same current.
- Capacitance (C): Higher C means slower response (larger time constant).
- Threshold (Vth): Lower threshold = easier to trigger spikes.
- Try Input Patterns:
- Constant: Steady input - observe tonic firing
- Pulse Train: Rhythmic on/off - see response to transients
- Sinusoidal: Oscillating input - observe phase locking
- Step: Sudden onset - see adaptation dynamics
- Ramp: Gradual increase - find firing threshold
- Noisy: Random fluctuations - realistic synaptic input
- Select Neuron Type: Use the dropdown to load realistic parameters for different neuron types.
- Observe the Visualizations:
- Top Graph: Shows voltage over time with threshold line and spikes
- Bottom Bucket: Intuitive metaphor - water level = voltage
Key Experiments to Try
Experiment |
Setup |
What to Observe |
|---|---|---|
Find Rheobase |
Start I=0, slowly increase until first spike |
The minimum current needed to fire (rheobase current) |
F-I Curve |
Increase I from 0 to 5, note firing rate at each level |
Firing rate increases with current (approximately linear) |
Time Constant Effect |
Use Pulse input, compare Fast vs Slow presets |
Fast neurons respond quickly, slow neurons integrate over time |
Threshold Effect |
Set I=3, vary threshold from 10 to 25 |
Lower threshold = more spikes, higher threshold = fewer spikes |
Subthreshold Dynamics |
Set I just below threshold, watch voltage approach but not reach Vth |
Voltage reaches steady state: Vss = Vrest + RรI |
Resonance |
Use Sine input with different ฯ values |
Neuron responds best to inputs matching its time constant |
Neuron Type Presets
The dropdown includes realistic parameter sets based on different neuron types:
Neuron Type |
I (nA) |
R (Mฮฉ) |
C (nF) |
ฯ (ms) |
Characteristics |
|---|---|---|---|---|---|
Basic States |
|||||
๐ Silent |
0 |
12 |
2 |
24 |
No input, voltage decays to rest |
๐ Subthreshold |
1 |
15 |
2 |
30 |
V_ss = 15 mV < V_th, no spikes |
Cortical Neurons |
|||||
🔺 Pyramidal Cell |
2 |
12 |
2 |
24 |
Regular spiking, most common cortical neuron |
โก Fast-Spiking Interneuron |
2 |
15 |
0.5 |
7.5 |
Very fast, high firing rate, GABAergic |
โฆ Stellate Cell |
1.5 |
20 |
1.5 |
30 |
Delayed spiking, layer 4 cortex |
Other Brain Regions |
|||||
๐ณ Purkinje Cell |
0.8 |
30 |
4 |
120 |
Cerebellum, very slow ฯ, complex spikes |
โข Granule Cell |
1.5 |
50 |
0.5 |
25 |
Very small cell, high input resistance |
๐ Thalamic Relay |
1.8 |
15 |
1.5 |
22.5 |
Relay mode, passes sensory info to cortex |
๐ด Hippocampal CA1 |
1.5 |
18 |
1.5 |
27 |
Memory formation, place cells |
Peripheral Neurons |
|||||
๐ช Spinal Motor Neuron |
2 |
8 |
5 |
40 |
Large cell body, drives muscles |
๐ Sensory Neuron |
2 |
20 |
0.5 |
10 |
Fast response to stimuli |
Note: Parameters are approximations for educational purposes. Real neurons show significant variability within each type.
Understanding the Leaky Bucket
The bucket visualization makes the math intuitive:
- Tap On: Water (voltage) rises - just like current charging the membrane
- Leak: Water drains proportional to level - higher voltage = faster leak (ohmic)
- Equilibrium: When input = leak, water level stabilizes (steady-state voltage)
- Overflow: When water hits threshold โ bucket dumps โ spike!
The Spike-and-Reset Mechanism
When water (voltage) hits the threshold, the "draining" is instantaneous and complete - like a toilet flush or tipping bucket rain gauge:
Bucket State |
What Happens |
|---|---|
Water rising |
Voltage integrating input current |
Hits threshold |
Triggers a "flush" mechanism |
Instant dump |
All water released at once (V โ Vreset) |
Starts refilling |
Cycle repeats if current continues |
In real neurons, the action potential involves rapid depolarization (+40mV spike) then repolarization (~1-2ms). The LIF model simplifies this by skipping the spike waveform and just recording "spike happened, reset voltage."
Why Higher Resistance (R) Leads to FASTER Threshold Crossing
This seems counterintuitive! The key insight: R is resistance to LEAKING, not to INPUT.
High R (small leak hole) |
Low R (big leak hole) |
|---|---|
Charge stays inside |
Charge escapes quickly |
Voltage builds up |
Voltage drains away |
Reaches threshold FASTER |
May never reach threshold |
The Math: Steady-state voltage Vss = Vrest + R ร I
- R = 5 Mฮฉ, I = 1.5 nA โ Vss = 7.5 mV (below 20mV threshold - no spikes!)
- R = 15 Mฮฉ, I = 1.5 nA โ Vss = 22.5 mV (above threshold - spikes!)
- R = 30 Mฮฉ, I = 1.5 nA โ Vss = 45 mV (well above threshold - fast spikes!)
Think of it as Ohm's Law: V = I ร R. Same current, higher R โ more voltage!
Why Higher Capacitance (C) SLOWS DOWN Threshold Crossing
Capacitance (C) determines how much charge is needed to raise the voltage by 1 unit - like the width/size of the bucket.
High C (wide bucket) |
Low C (narrow bucket) |
|---|---|
Needs lots of water to fill |
Fills quickly with little water |
Voltage rises slowly |
Voltage rises quickly |
More temporal integration |
Quick, responsive |
The Math: Rate of voltage change: dV/dt = I / C
- High C โ slow dV/dt (voltage changes slowly)
- Low C โ fast dV/dt (voltage changes quickly)
Physical Analogy: Same water flow into a wide tank fills slowly; same flow into a narrow tank fills quickly.
Summary: R vs C Effects
Parameter |
What it Controls |
โ Increase Effect |
|---|---|---|
R (Resistance) |
Leak rate (exit resistance) |
Less leak โ FASTER to threshold |
C (Capacitance) |
Storage capacity (tank size) |
More to fill โ SLOWER to threshold |
ฯ = R ร C |
Time constant |
Slower overall response |
Key insight: Fast neurons have high R, low C. Slow integrating neurons have low R, high C.
Mathematical Details
Vss = Vrest + R ร I
Time to reach threshold (from rest):
tspike = ฯ ร ln[RรI / (RรI - Vth + Vrest)]
Firing rate (for constant superthreshold input):
f โ 1 / tspike
Minimum current to fire (rheobase):
Irheo = (Vth - Vrest) / R
Comparison with Real Neurons
Aspect |
LIF Model |
Real Neuron |
|---|---|---|
Spike Shape |
Instantaneous (simplified) |
~1ms duration, specific waveform |
Refractory Period |
Can be added (optional) |
1-2ms absolute, longer relative |
Adaptation |
Not included (in basic model) |
Firing rate decreases over time |
Ion Channels |
Single passive leak |
Multiple active conductances |
Computational Cost |
Very low (one ODE) |
High (Hodgkin-Huxley: 4 ODEs+) |
Extensions of the LIF Model
- LIF with Refractory Period: Add a fixed time after spike where neuron cannot fire
- Adaptive LIF: Threshold increases after each spike (adaptation)
- Exponential IF (EIF): Adds exponential spike onset for more realistic dynamics
- Izhikevich Model: 2D model capturing many spiking patterns
- Hodgkin-Huxley: Full biophysical model with ion channel dynamics
Implementation Notes
V[n+1] = V[n] + (dt/ฯ) ร [-(V[n] - V_rest) + R ร I]
Spike Detection:
if V[n+1] >= V_th:
record_spike()
V[n+1] = V_reset
Time Step:
dt = 0.5 ms (must be << ฯ for stability)