COBANet

#exp100 · SNNSIM ·

Implementation map

COBANet in tools/snnsim/models.py implements the built-in --model ping network. This page explains the minimal input→E→I→E motif; optional E→E, I→I, direct drives, adaptation, and trainable leak extend it. Read exp004Parameters & Units alongside these equations.

CodeResponsibility
exp_synapseDecay the previous conductance, then add the current spike kick.
lif_step_expeulerIntegrate voltage under fixed conductances, then apply clamps, refractory gating, spike detection, and reset.
COBANet._step_bodySchedule population updates, recurrence, and readout.
set_sim_dt in config.pySet timestep, duration, and derived step count for legacy execution.

Reuse the execution interface rather than changing model globals around a live network. A small forward command is given in exp003SNNSIM API Reference.

A conductance based neuron equation

The membrane is a capacitor (𝐶𝑚) pierced by ion channels in parallel. Conservation of charge (Kirchhoff) balances the capacitive current 𝐶𝑚d𝑉𝑚/d𝑡 against the total ionic current:

𝐶𝑚d𝑉𝑚d𝑡=ion𝐼ion
(1)

Each channel passes an ohmic current — its conductance 𝑔ion0 times the driving force (𝑉𝑚𝐸ion), the distance of 𝑉𝑚 from the reversal potential 𝐸ion (where the channel’s net current vanishes, set by the Nernst equilibrium):

𝐼ion=𝑔ion(𝑉𝑚𝐸ion)
(2)

Because 𝑔ion0, the current’s sign lives entirely in the driving force. Summing a leak (𝑔𝐿, 𝐸𝐿) and synaptic conductances — excitatory (𝑔𝑒, 𝐸𝑒), inhibitory (𝑔𝑖, 𝐸𝑖) — gives the general conductance-based (COBA) neuron:

𝐶𝑚d𝑉𝑚d𝑡=𝑔𝐿(𝑉𝑚𝐸𝐿)𝑔𝑒(𝑉𝑚𝐸𝑒)𝑔𝑖(𝑉𝑚𝐸𝑖)
(3)

The COBA model

In the minimal PING motif, E receives excitation and inhibition, while I receives excitation only. These equations omit the optional I→I pathway:

𝐶𝑚𝐸d𝑉𝑚𝐸d𝑡=𝑔𝐿𝐸(𝑉𝑚𝐸𝐸𝐿)𝑔𝑒𝐸(𝑉𝑚𝐸𝐸𝑒)𝑔𝑖𝐸(𝑉𝑚𝐸𝐸𝑖)
(4)
𝐶𝑚𝐼d𝑉𝑚𝐼d𝑡=𝑔𝐿𝐼(𝑉𝑚𝐼𝐸𝐿)𝑔𝑒𝐼(𝑉𝑚𝐼𝐸𝑒)
(5)

After integration, a neuron outside its refractory period spikes at threshold 𝑉th and resets to 𝑉reset. A refractory neuron cannot emit a spike:

𝑠[𝑘+1]=𝜒[𝑘+1]𝟙[𝑉candidate[𝑘+1]𝑉th],𝑉𝑚[𝑘+1]={𝑉resetif spiking or refractory𝑉candidate[𝑘+1]otherwise.
(6)

Here 𝑉candidate[𝑘+1] is the integrated candidate voltage and 𝜒[𝑘+1] is 1 when the refractory counter permits a spike, otherwise 0. Thresholding follows the voltage update, not the previous step’s voltage.

Each synaptic conductance is an exponential trace driven by presynaptic spikes — each spike adds its full weight as an instantaneous jump, then the conductance decays with the channel time constant; this minimal motif has no E→E connection:

d𝑔𝑒𝐸d𝑡=𝑔𝑒𝐸𝜏AMPA+𝑊in𝑘𝛿(𝑡𝑡𝑘inp)
(7)
d𝑔𝑖𝐸d𝑡=𝑔𝑖𝐸𝜏GABA+𝑊ie𝑘𝛿(𝑡𝑡𝑘𝑖)
(8)
d𝑔𝑒𝐼d𝑡=𝑔𝑒𝐼𝜏AMPA+𝑊ei𝑘𝛿(𝑡𝑡𝑘𝑒)
(9)

(7) is E’s excitation from the input 𝑊in; (8) its inhibition from I via 𝑊ie; (9) the I population’s excitation from E via 𝑊ei.

Discretization

The conductances (7)–(9) and membrane equations (4)–(5) are continuous ODEs. The implementation places spike kicks on the timestep grid. Between kicks each conductance decays by 𝑒Δ𝑡sim/𝜏syn, and the supplied spike adds its full event conductance at the update boundary — the decay-then-add recurrence 𝑔[𝑘+1]=𝑒Δ𝑡sim/𝜏syn𝑔[𝑘]+𝑠[𝑘]𝑤event (with the pathway-specific 𝜏syn, 𝑤event and spike train of each of (7)–(9)). The membrane is integrated by exponential Euler — the same algebra for both populations (the I neuron drops 𝑔𝑖).

Collecting on 𝑉𝑚 makes it linear, with total conductance 𝑔tot=𝑔𝐿+𝑔𝑒+𝑔𝑖:

𝐶𝑚d𝑉𝑚d𝑡=(𝑔𝐿+𝑔𝑒+𝑔𝑖)𝑉𝑚+(𝑔𝐿𝐸𝐿+𝑔𝑒𝐸𝑒+𝑔𝑖𝐸𝑖)
(10)

Dividing by 𝑔tot gives decay-to-steady-state form, naming 𝜏eff=𝐶𝑚/𝑔tot (shorter than 𝐶𝑚/𝑔𝐿 when synapses are open) and the steady-state voltage 𝑉 (the conductance-weighted mean of the reversals):

𝐶𝑚𝑔totd𝑉𝑚d𝑡=(𝑉𝑚𝑔𝐿𝐸𝐿+𝑔𝑒𝐸𝑒+𝑔𝑖𝐸𝑖𝑔tot)
(11)

A zero-order hold freezes the conductances over one step Δ𝑡sim, leaving (11) constant-coefficient with exact solution

𝑉𝑚[𝑘+1]=𝑉+(𝑉𝑚[𝑘]𝑉)𝑒Δ𝑡sim/𝜏eff
(12)

Per population — I has no 𝑔𝑖, so its 𝑔tot and 𝑉 drop those terms:

𝑔tot𝐸=𝑔𝐿𝐸+𝑔𝑒𝐸+𝑔𝑖𝐸,𝜏eff𝐸=𝐶𝑚𝐸𝑔tot𝐸,𝑉𝐸=𝑔𝐿𝐸𝐸𝐿+𝑔𝑒𝐸𝐸𝑒+𝑔𝑖𝐸𝐸𝑖𝑔tot𝐸
(13)
𝑔tot𝐼=𝑔𝐿𝐼+𝑔𝑒𝐼,𝜏eff𝐼=𝐶𝑚𝐼𝑔tot𝐼,𝑉𝐼=𝑔𝐿𝐼𝐸𝐿+𝑔𝑒𝐼𝐸𝑒𝑔tot𝐼
(14)

with step (12) for each population 𝑃{𝐸,𝐼}: 𝑉𝑚𝑃[𝑘+1]=𝑉𝑃+(𝑉𝑚𝑃[𝑘]𝑉𝑃)𝑒Δ𝑡sim/𝜏eff𝑃.

Equation (12) is exact only while those conductances are held fixed. In a passive interval without threshold events or clamps, subdividing that same fixed-conductance interval preserves the solution in exact arithmetic. It does not establish timestep invariance of a spiking network: conductance updates, threshold crossings, refractory counters, and recurrent scheduling still depend on the grid. Measure timestep sensitivity for the intended protocol rather than assuming firing rates or gamma frequency are invariant. The alternative lif_step uses forward Euler and is selected through COBA_INTEGRATOR.

For each population update, conductances advance first, then the membrane integrates, then spike and reset are evaluated. This ordering defines the frozen-conductance interval. Recurrent inputs use the stored spikes supplied by COBANet._step_body; do not substitute a different same-step schedule while claiming equivalent dynamics.

Checking an implementation change

  1. Preserve the kick convention. exp_synapse computes g * decay + spikes @ W; (g + spikes @ W) * decay attenuates every new kick and changes the model.
  2. Preserve spike timing. Keep integration, refractory-counter update, thresholding, and reset in the implemented order. The returned voltage may already be reset while the emitted spike is still available.
  3. Separate forward and backward changes. --v-grad-dampen modifies autograd through the increment; its local effect is described in exp015Gradient Stabilisation.
  4. Test the intended extension. A minimal PING equation does not describe enabled I→I recurrence, adaptation, noise, or state clamps. Inspect the corresponding branch in the model and extend the existing tests when changing it.

Source reference: tools/snnsim/models.py, tools/snnsim/config.py, and tools/snnsim/tests/test_models.py.

exp004Parameters & Units · exp006Training