Skip to contentSkip to Content
DocsUser GuideNeuron ModelsDiscrete LIF

Discrete LIF Model

The Discrete Leaky Integrate-and-Fire (LIF) model is the simplest neuron available in SPIRES. It discretizes the classical LIF differential equation using the forward Euler method, producing a computationally efficient update rule suitable for large reservoir networks.

Continuous-Time LIF Equation

The standard LIF neuron is described by a first-order ordinary differential equation for the membrane potential V(t)V(t):

τmdVdt=(V(t)Vrest)+RI(t)\tau_m \frac{dV}{dt} = -(V(t) - V_{\text{rest}}) + R \cdot I(t)

where:

  • τm\tau_m is the membrane time constant (units of time)
  • VrestV_{\text{rest}} is the resting potential
  • RR is the membrane resistance
  • I(t)I(t) is the total input current at time tt

When V(t)V(t) reaches the threshold VthV_{\text{th}}, the neuron emits a spike and the potential is reset to VresetV_{\text{reset}}.

Forward Euler Discretization

SPIRES discretizes the continuous equation using the forward Euler method with time step Δt\Delta t. Dividing both sides by τm\tau_m and introducing a bias term bb, the update rule becomes:

Vn=Vn1+Δt(Vn1Vrestτm+In+b)V_n = V_{n-1} + \Delta t \left( -\frac{V_{n-1} - V_{\text{rest}}}{\tau_m} + I_n + b \right)

At each discrete time step nn:

  1. Update the membrane potential VnV_n using the formula above.
  2. Check threshold: if VnVthV_n \geq V_{\text{th}}, the neuron has spiked.
  3. Reset: set Vn=VresetV_n = V_{\text{reset}} after a spike.
  4. Record the spike event (binary: 1 if spiked, 0 otherwise).

The spike output is used as the signal transmitted to downstream neurons via the recurrent weight matrix WW and to the readout layer via WoutW_{\text{out}}.

Parameters

ParameterSymbolDescriptionTypical Range
Membrane time constantτm\tau_mControls decay rate of membrane potential10—50 ms
Resting potentialVrestV_{\text{rest}}Equilibrium potential with no input-65 mV
ThresholdVthV_{\text{th}}Potential at which the neuron fires-50 mV
Reset potentialVresetV_{\text{reset}}Potential after a spike-65 mV
BiasbbConstant offset current-0.1 to 0.1
Time stepΔt\Delta tEuler integration step size0.1—1.0 ms

The time step Δt\Delta t is set via the dt field in spires_reservoir_config, not inside neuron_params. All other parameters are passed through the neuron_params pointer.

Stability Considerations

The forward Euler method is conditionally stable. For the LIF equation, stability requires:

Δt<2τm\Delta t < 2\,\tau_m

If Δt\Delta t is too large relative to τm\tau_m, the membrane potential can oscillate or diverge. In practice, a ratio of Δt/τm0.1\Delta t / \tau_m \leq 0.1 provides reliable integration accuracy. For reservoir computing applications where exact biophysical fidelity is not critical, Δt/τm0.5\Delta t / \tau_m \leq 0.5 is usually acceptable.

SPIRES API

The discrete LIF model is selected by setting the neuron type enum:

cfg.neuron_type = SPIRES_NEURON_LIF_DISCRETE;

Minimal Configuration

spires_reservoir_config cfg = { .num_neurons = 500, .num_inputs = 1, .num_outputs = 1, .spectral_radius = 0.95, .ei_ratio = 0.8, .input_strength = 0.1, .connectivity = 0.1, .dt = 1.0, .connectivity_type = SPIRES_CONN_RANDOM, .neuron_type = SPIRES_NEURON_LIF_DISCRETE, .neuron_params = NULL, /* use defaults */ };

When neuron_params is NULL, SPIRES uses built-in default values for all neuron parameters. This is suitable for most reservoir computing applications.

Custom Parameters

To override defaults, allocate and populate a parameter struct and assign it to neuron_params:

spires_lif_params params = { .tau_m = 20.0, .v_rest = -65.0, .v_th = -50.0, .v_reset = -65.0, .bias = 0.0, }; cfg.neuron_params = &params;

The neuron_params pointer is caller-owned. SPIRES reads the values during spires_reservoir_create() and copies what it needs internally. You may free or reuse the parameter struct after creation.

When to Use Discrete LIF

The discrete LIF model is the right choice when:

  • Speed matters: Forward Euler is the cheapest integration method. With no history buffers or iterative solves, it has the lowest per-neuron cost.
  • Simplicity is preferred: The model has the fewest parameters and is easiest to reason about.
  • Tasks have short time scales: The exponential memory decay of integer-order LIF is sufficient for problems where relevant history spans tens to hundreds of time steps.
  • You are prototyping: Start with discrete LIF to validate your pipeline, then switch to fractional models if longer memory is needed.

For tasks requiring long-range temporal dependencies, consider the fractional LIF models, which replace exponential decay with power-law decay.

Comparison with Biophysical LIF

The discrete LIF uses explicit (forward) Euler integration, while the Biophysical LIF uses implicit (backward) Euler integration. The key differences are:

PropertyDiscrete LIFBiophysical LIF
Integration methodForward EulerImplicit Euler
StabilityConditional (Δt<2τm\Delta t \lt 2\tau_m)Unconditional
Cost per stepLowestSlightly higher
Biophysical fidelityApproximateMore accurate
EnumSPIRES_NEURON_LIF_DISCRETESPIRES_NEURON_LIF_BIO

For most reservoir computing applications, the difference in accuracy between the two methods is negligible. Choose the discrete LIF for speed, or the biophysical LIF if you need unconditional stability with large time steps.


← Overview | Biophysical LIF →

Last updated on