Spiking neural networks · HTM · Predictive coding

Neural circuits, written in PyTorch.

neuroSush is an open-source library for simulating spiking neurons, plastic synapses, HTM / Thousand Brains columns and predictive coding. Every model is tested against its equations.

Open the AtlasRead the source ↗
v0.8.0 · MIT · Python ≥ 3.10 · torch ≥ 2.1
Figure 1 · Leaky integrate-and-fire neuron. τ dV/dt = −(V − V_rest) + RI. τ 20 ms, rest −65 mV, R 10 MΩ, I 2 nA, threshold −50 mV, reset −70 mV, Euler dt 0.5 ms. Computed here; morphology is procedural, not a reconstruction. Propagation speed is illustrative.
live

Synapses

Synapses that learn from spike timing.

Dense, sparse and delayed synapse groups, with STDP, triplet STDP, inhibitory STDP and dopamine-modulated reward learning.

Figure 2 · Pair-based STDP. Δw for one pre/post pair, A+ 0.02, A− 0.01, soft bounds. Spine size encodes weight; the morphology is illustrative.
▲ schematic
Plate Y01 · STDP: who fired first?

Populations

From one cell to a population.

Neuron groups with LIF, ELIF, AdEx, Izhikevich and Hodgkin–Huxley dynamics, dendritic compartments, axonal delays, k-winners-take-all and homeostasis.

Figure 3 · Excitatory–inhibitory population. Layout and spike times are generated in the browser for illustration; see the simulated network in the example.
▲ schematic
Balanced network example ↗

HTM / Thousand Brains

Sparse codes, columns that vote.

Spatial pooler, temporal memory with active dendrites, and Thousand Brains columns that settle on one object by lateral voting, alongside the spiking models.

Figure 4 · Sparse distributed representation. 2% active bits of 1,024; overlap between two SDRs counts shared active bits. Predicted cells precede the next sequence step.
▲ schematic
Plate H01 · Sparse distributed representations

Predictive coding

Predictions down, errors up.

Hierarchical predictive coding in which each level predicts the one below and learns from the residual. Tests check the update equations, not biological equivalence.

Figure 5 · Three-level predictive coding. Error magnitude is drawn schematically; the example trains the library model.
▲ schematic
Predictive coding example ↗

Space and memory

Grid cells and relational memory.

neuroSush v0.8.0 includes experimental TEM models and the spatial toolkit. The Atlas features live teaching plate T01 (position imposed). Results and reproducibility are detailed in the Results report ↗ and Research story ↗.

Grid-cell emergence is not shown; structure is imposed. No live trained-model demo yet.

Figure 6 · Grid-cell firing fields. Illustrative grid-cell lattice (imposed, not learned). Three modules with spacing ratio 1.4. Brain outline is schematic; procedural study, not a reconstruction.
▲ schematic
TEM notes and limits ↗

Library

Six decisions make a network.

Populations → Model → Learning → Inputs → Record → Run. The same six stages structure the Studio.

Define neuron groups and input sources with shape and configuration.

Python
net = Network(seed=0)
source = NeuronGroup(net, 20, [SpikeInput(...), Axon()])
target = NeuronGroup(net, 2, [DendriteStructure(), LIF(...), Fire(), Axon()])

Evidence

Measured, with the method attached.

Performance depends on hardware and workload.

Benchmark method and pitfalls ↗

Atlas · v0.8.0

Teaching plates you can perturb.

Each plate pairs an equation with a live simulation. Change a parameter and watch the variable it governs.

Read the research story and literature review ↗ · Results report ↗

The neuron / talk demo

Studio · preview

Compose a network without writing the boilerplate.

A local app that builds the same six stages as forms and exports runnable neuroSush code. In development; not part of the released package.

Install.

Shell
pip install neurosush

Python ≥ 3.10, PyTorch ≥ 2.1. For CUDA graphs install a CUDA build of PyTorch first.