← all repositories
Shikhargupta/Spiking-Neural-Network

Teaching neurons to fire on cue, no backprop required

A from-scratch Python SNN that learns like a brain—via spike timing, not gradients—with an eye toward neuromorphic hardware.

1.2k stars Python ML Frameworks
Spiking-Neural-Network
Velocity · 7d
+0.3
★ / day
Trend
steady
star history

What it does This is a pure-Python spiking neural network built for classification, using spike-time dependent plasticity (STDP) instead of conventional backpropagation. It simulates neurons that accumulate membrane potential from incoming spikes, fire when they cross a threshold, and suppress neighbors through lateral inhibition. The project includes both training (weight learning) and inference (classification) pipelines, tested on small MNIST subsets.

The interesting bit The project treats STDP as a biologically plausible training rule: synapses strengthen if they contributed to a postsynaptic spike (fired shortly before it), and weaken otherwise. The author also introduces a “variable threshold” normalization to prevent high-activation patterns from dominating competitive learning—without it, the README shows training visibly collapses into overlapping, useless representations.

Key highlights

  • Unsupervised STDP learning with winner-take-all lateral inhibition
  • “Generative property” lets you visualize learned weights as 28×28 grayscale images to inspect what each neuron actually learned
  • Variable threshold per sample based on activation count, addressing a real competitive-learning failure mode
  • Modular structure: separate neuron/, synapse/, receptive_field/, and encoding/ components
  • Colleague extended this to an FPGA hardware accelerator, suggesting the design was intentionally kept hardware-friendly

Caveats

  • The README states STDP training “will be implemented next” in the classification section, then later shows training results—timeline/scope is slightly unclear
  • Demonstrated only on tiny MNIST subsets (binary, 3-class, 6-class); no accuracy numbers or comparison baselines provided
  • Author notes parameter sensitivity: learning rate, threshold potential, weight initialization, and spike count all need hand-tuning

Verdict Worth a look if you’re studying neuromorphic computing, STDP mechanics, or need a minimal SNN reference implementation. Skip it if you need production-grade classification—this is educational infrastructure with rough edges, not a competitive ML pipeline.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.