Spiking Neural Network vs Dense MLP: quantifying the sparsity advantage for motor control on RTX 5060.
A Spiking Neural Network (SNN) with Leaky Integrate-and-Fire neurons achieves 98.3% sparsity on a motor control task — only ~17 of 1000 neurons fire per timestep. On neuromorphic hardware (Loihi 2, SpiNNaker 2), this translates to ~122× energy savings vs a dense MLP. On a GPU, the SNN is ~280× slower (sequential timestep loop), which proves that hardware and algorithm must co-design for neuromorphic advantage.
| Paradigm | Compute Model | Energy per Op | Active Units |
|---|---|---|---|
| Dense MLP | Matrix multiply (MAC) | ~100 pJ/MAC (GPU) | 100% (always) |
| SNN (LIF) | Event-driven spikes | ~1 pJ/spike (Loihi 2) | ~1.7% (sparse) |
In a dense network, every neuron computes for every input. The energy
cost is fixed: E = FLOPs × energy_per_MAC.
In an SNN, neurons only fire when their membrane potential crosses a
threshold. The energy cost is proportional to spike count, not
neuron count: E = spikes × energy_per_spike.
V[t+1] = alpha * V[t] + (1 - alpha) * I[t] (leaky integration)
if V[t+1] >= V_th: spike = 1, V = 0 (fire and reset)
where alpha = exp(-dt / tau_m) (membrane decay)
| Aspect | Detail |
|---|---|
| Task | 1-DOF robotic arm: predict torque from joint angle |
| Input | Joint angle theta in [-pi, pi] |
| Output | Torque tau = sin(theta) * theta^2 |
| Dense MLP | 1 → 1000 (ReLU) → 1, single forward pass |
| SNN | 1 → 1000 (LIF, T=50) → 1, rate-coded input |
| Hardware | NVIDIA RTX 5060 (SM-120, 8 GB GDDR7) |
| CPU | AMD Ryzen 5 5600X (6C/12T, 3.7 GHz) |
| RAM | 32 GB DDR4-3200 |
| Framework | PyTorch (custom LIF implementation) |
Why custom PyTorch instead of NengoDL? NengoDL requires TensorFlow, which does not support CUDA 13.0. A custom LIF implementation in PyTorch is more portable, more transparent, and demonstrates understanding of the neuron model at the mathematical level.
Hardware: AMD Ryzen 5 5600X / 32 GB DDR4 / NVIDIA RTX 5060 (SM 12.0, 8.5 GB GDDR7) Environment: WSL2 (Ubuntu 22.04), CUDA 13.0, PyTorch 2.13.0 Workload: B=4096, N=1000 hidden, T=50 timesteps, 20 iterations per run
| Metric | Dense MLP | SNN (LIF) | Ratio |
|---|---|---|---|
| Latency (ms/batch) | 0.208 ± 0.038 | 57.37 ± 1.81 | 276× |
| Throughput (samples/s) | 21.2M ± 2.7M | 71.4K ± 2.2K | 297× |
| Sparsity | 0.0% | 98.34% ± 0.05% | — |
| Active neurons | 1000 / 1000 | 17 / 1000 | 60× fewer |
| FLOPs/batch | 16,384,000 | 13,467,000 ± 400K | 1.2× |
| Energy (neuromorphic est.) | 1,638,400,000 pJ | 13,467,000 pJ | 122× |
| Run | MLP (ms) | SNN (ms) | Sparsity | Active | Latency Ratio | Energy Adv. |
|---|---|---|---|---|---|---|
| 1 | 0.179 | 57.17 | 98.3% | 17 | 319.9× | 118× |
| 2 | 0.217 | 58.74 | 98.3% | 17 | 271.2× | 118× |
| 3 | 0.179 | 56.64 | 98.3% | 17 | 317.0× | 119× |
| 4 | 0.181 | 57.38 | 98.4% | 16 | 316.3× | 125× |
| 5 | 0.203 | 61.92 | 98.4% | 16 | 305.5× | 125× |
| 6 | 0.218 | 55.99 | 98.4% | 16 | 256.3× | 129× |
| 7 | 0.182 | 56.40 | 98.3% | 17 | 310.1× | 119× |
| 8 | 0.217 | 56.90 | 98.3% | 17 | 262.0× | 121× |
| 9 | 0.306 | 56.94 | 98.4% | 16 | 185.9× | 126× |
| 10 | 0.194 | 55.65 | 98.3% | 17 | 287.5× | 118× |
| Avg | 0.208 | 57.37 | 98.34% | 16.6 | 283× | 122× |
| Std | 0.038 | 1.81 | 0.05% | 0.5 | 38× | 4× |
98.3% sparsity but only 1.2× fewer FLOPs? This is the most important insight in this benchmark.
The SNN simulates T=50 timesteps sequentially. Even though only ~17 of 1000 neurons fire per timestep, the GPU executes 50 full iterations of the loop:
SNN FLOPs = 2 × B × (N × 0.017) × 50 timesteps ≈ 13.5M
MLP FLOPs = 2 × B × N × 1 pass = 16.4M
The 98.3% sparsity reduces FLOPs per timestep by ~60×, but the 50 timesteps nearly cancel that advantage on GPU. It's almost a draw.
On neuromorphic hardware, timesteps are free. The Loihi 2 is asynchronous — neurons that don't fire consume zero energy and zero time. There, the 98.3% sparsity translates directly to 122× less energy. The GPU charges for empty timesteps; neuromorphic silicon does not.
Staff Engineer takeaway: Sparsity is an algorithmic property. Energy savings are a hardware property. The 98.3% sparsity is real and reproducible (std 0.05%). The 122× energy advantage only materializes on event-driven silicon that doesn't charge for idle neurons.
-
Sequential timestep loop. T=50 timesteps, each depending on the previous membrane state. GPUs cannot parallelize across time.
-
Sparse operations are GPU-inefficient. GPUs are optimized for large, dense matrix multiplications. A spike matrix with 98.3% zeros wastes 98.3% of GPU compute units.
-
Kernel launch overhead. 50 timesteps = 50× more kernel launches than the MLP's single forward pass.
-
Memory bandwidth waste. The GPU reads the full weight matrix every timestep, even though only 1.7% of neurons are active.
| Component | Version |
|---|---|
| GPU | NVIDIA (any CUDA-capable) |
| Python | 3.10+ |
| PyTorch | 2.1+ with CUDA |
git clone https://github.com/JohnScheuer/neuromorphic-snn-sim.git cd neuromorphic-snn-sim pip install -r requirements.txt # Run individual benchmarks python dense_baseline.py python snn_sim.py # Run head-to-head comparison python benchmarks/compare_latency.py
-
Sparsity is real and reproducible: 98.34% ± 0.05%. Only ~17 of 1000 LIF neurons fire per timestep. The low standard deviation across 10 runs confirms this is a stable algorithmic property, not noise.
-
GPU is the wrong hardware for SNNs (~280× slower). The sequential timestep loop and sparse operations make SNNs dramatically slower on GPUs. This is a hardware-algorithm mismatch, not a fundamental limitation of SNNs.
-
The sparsity paradox: 98% sparse but only 1.2× fewer FLOPs. The 50 timesteps nearly cancel the sparsity advantage on GPU. On neuromorphic hardware (where idle timesteps are free), the full 122× energy advantage materializes.
-
Neuromorphic hardware unlocks the energy advantage. On Loihi 2 (~1 pJ/spike), 98.3% sparsity = ~122× less energy than a dense forward pass at ~100 pJ/MAC. The algorithm is ready; the silicon is catching up.
-
Not all workloads benefit from sparsity. LLMs are dense (every token attends to every other token). SNNs excel at control, robotics, event-based vision, and sensor fusion — workloads where inputs are naturally sparse and temporal.
-
Co-design is mandatory. Algorithm (SNN) + Hardware (neuromorphic) + Workload (sparse/temporal) must align. Optimizing one without the others yields no real-world advantage.
neuromorphic-snn-sim/
├── README.md
├── requirements.txt
├── LICENSE
├── .gitignore
├── dense_baseline.py # Dense MLP (PyTorch)
├── snn_sim.py # SNN with LIF neurons (PyTorch)
└── benchmarks/
└── compare_latency.py # Head-to-head comparison
João Felipe de Souza — Staff ML Systems Engineer github.com/JohnScheuer
