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 :
where:
- is the membrane time constant (units of time)
- is the resting potential
- is the membrane resistance
- is the total input current at time
When reaches the threshold , the neuron emits a spike and the potential is reset to .
Forward Euler Discretization
SPIRES discretizes the continuous equation using the forward Euler method with time step . Dividing both sides by and introducing a bias term , the update rule becomes:
At each discrete time step :
- Update the membrane potential using the formula above.
- Check threshold: if , the neuron has spiked.
- Reset: set after a spike.
- 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 and to the readout layer via .
Parameters
| Parameter | Symbol | Description | Typical Range |
|---|---|---|---|
| Membrane time constant | Controls decay rate of membrane potential | 10—50 ms | |
| Resting potential | Equilibrium potential with no input | -65 mV | |
| Threshold | Potential at which the neuron fires | -50 mV | |
| Reset potential | Potential after a spike | -65 mV | |
| Bias | Constant offset current | -0.1 to 0.1 | |
| Time step | Euler integration step size | 0.1—1.0 ms |
The time step 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:
If is too large relative to , the membrane potential can oscillate or diverge. In practice, a ratio of provides reliable integration accuracy. For reservoir computing applications where exact biophysical fidelity is not critical, 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 = ¶ms;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:
| Property | Discrete LIF | Biophysical LIF |
|---|---|---|
| Integration method | Forward Euler | Implicit Euler |
| Stability | Conditional () | Unconditional |
| Cost per step | Lowest | Slightly higher |
| Biophysical fidelity | Approximate | More accurate |
| Enum | SPIRES_NEURON_LIF_DISCRETE | SPIRES_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.