Recurrent Spiking Neural Network with LIF Dynamics (SNN-LIF)
Research-grade pretrained weights and inference engine implementing a Recurrent Spiking Neural Network (RSNN) powered by Leaky Integrate-and-Fire (LIF) biophysical membrane dynamics, Fast Sigmoid surrogate gradients, and Neuromorphic Synaptic Operation (SynOp) energy accounting.
Theoretical Formulation
Continuous Leaky Integrate-and-Fire neuron model: $$\tau_m \frac{d V_i(t)}{dt} = -(V_i(t) - V_{\text{rest}}) + R I_i(t)$$
Discretized recurrence under step $\Delta t$: $$V_i[t] = \beta V_i[t-1] + \sum_j W_{ij}^{\text{rec}} S_j[t-1] + \sum_k W_{ik}^{\text{in}} X_k[t] - V_{\text{th}} S_i[t-1]$$ where $\beta = \exp(-\Delta t / \tau_m) \in (0, 1)$ governs subthreshold passive membrane decay.
Surrogate Gradient Backpropagation
To overcome the non-differentiability of the all-or-none spike emission $S_i[t] = \Theta(V_i[t] - V_{\text{th}})$, the network is trained using the Fast Sigmoid surrogate gradient: $$\frac{\partial S}{\partial V} \approx \frac{1}{(1 + \alpha |V - V_{\text{th}}|)^2}, \quad \alpha = 10.0$$
Architecture Specifications
| Layer / Parameter | Value / Dimension |
|---|---|
| Input Receptive Fields | $d_{\text{in}} = 32$ (DVS spatial quadrants $\times$ dual polarity) |
| Recurrent Hidden Neurons | $d_h = 64$ Leaky Integrate-and-Fire units |
| Membrane Time Constant $\tau_m$ | $20.0$ ms ($\beta = 0.9512$) |
| Firing Threshold $V_{\text{th}}$ | $1.00$ V |
| Output Readout Classes | $d_{\text{out}} = 4$ directional classes (Up, Down, Left, Right) |
| Temporal Sparsity | $94.81%$ silent neurons per timestep |
| Weights Format | model.safetensors (Zero-copy native binary buffers) |
Quickstart
import json
import numpy as np
from safetensors.numpy import load_file
from snn_lif import SpikingLIFInferenceEngine
# Load weights and config
tensors = load_file("model.safetensors")
with open("config.json", "r") as f:
config = json.load(f)
engine = SpikingLIFInferenceEngine(tensors, config)
# Simulate 50 timesteps of sparse DVS event inputs
T, in_dim = 50, 32
x_stream = (np.random.rand(T, in_dim) < 0.12).astype(np.float32)
# Run spiking forward pass
logits, raster, synops, sparsity = engine.forward(x_stream)
print(f"Predicted class: {np.argmax(logits, axis=-1)[0]}")
print(f"Neuromorphic SynOps: {synops:,} sparse accumulates")
print(f"Sparsity: {sparsity * 100:.2f}%")
Attribution & Links
- Creator: Ramprasad Atluri (
At1uri) - Interactive Studio:
At1uri/spiking-neural-network-neuromorphic-studio - Benchmark Dataset:
At1uri/neuromorphic-event-stream-benchmarks - Research Vault:
At1uri/spiking-neural-network-vault