MNESIS — Memory Network Every Spike Is Sacred
This repository contains the full implementation, experiments, and paper source for MNESIS, a recurrent spiking neural network (SNN) with heterogeneous synaptic delays that stores and recalls arbitrary spike patterns as sequential chains of overlapping Spiking Motifs.
Working memory in biological neural circuits relies on precise spike timing rather than sustained firing rates. MNESIS models this by equipping every synapse with
Key results:
- Perfect recall of
$M = 16$ patterns of$T = 1000,\mathrm{ms}$ with$N = 1024$ neurons -
$F_1 = 1.0$ from analytical initialisation alone — no gradient step required - Tolerates 25% bit-flip noise in the trigger window (attractor dynamics)
- Memory capacity scales as
$N^2 D$ , linear in delay depth
Paper: Laurent U. Perrinet (2026). Working Memory in a Recurrent Spiking Neural Network with Heterogeneous Synaptic Delays. AIROV 2026.
tex/Perrinet26mnesis.pdf · https://laurentperrinet.github.io/publication/perrinet-26-icann/
MNESIS/
├── src/ # Source code and Jupyter notebooks
│ ├── mnesis_boilerplate.py # Imports, device setup, Params dataclass, utilities
│ ├── mnesis_chains.py # SpikingPattern generators, HD_SNN class, analytical init
│ └── notebooks (numbered pipeline, run sequentially):
│ ├── 10_MNESIS_generative-model.ipynb # Generative model for synthetic patterns
│ ├── 11_MNESIS_learn-synthetic.ipynb # Training on synthetic patterns
│ ├── 13_MNESIS_testing-inference.ipynb # Sequential retrieval of M patterns
│ ├── 14_MNESIS_testing-noise.ipynb # Robustness to bit-flip noise
│ ├── 15_MNESIS_testing-trigger-duration.ipynb # Effect of trigger-window length
│ ├── 16_MNESIS_testing-trigger-fraction.ipynb # Effect of partial neuron coverage
│ ├── 20_MNESIS_scanning-parameters.ipynb # Parameter scans (D, T, p_A, ...)
│ ├── 25_MNESIS_optuna.ipynb # Hyperparameter optimisation (Optuna)
│ ├── 30_MNESIS_learn-periodic.ipynb # Learning and retrieval of periodic memories
│ ├── 32_MNESIS_learn-travelling-waves.ipynb # Structured spatiotemporal travelling waves
│ ├── 34_MNESIS_learn-Lorenz-attractor.ipynb # Chaotic trajectory encoding and recall
│ ├── 40_MNESIS_learn-SHD.ipynb # Spiking Heidelberg Digits experiments
│ ├── 99_MNESIS_run-all.ipynb # End-to-end notebook orchestrator
│ └── requirements.txt # Python dependencies for notebook runs
├── figures/ # Generated figures (PDF/PNG)
├── tex/ # Paper source
│ ├── Perrinet26mnesis.tex # Main LaTeX source
│ ├── Perrinet26mnesis.pdf # Compiled paper
│ ├── mnesis.bib # Bibliography
│ ├── llncs.cls # Springer LNCS class
│ └── splncs04.bst # BibTeX style
├── cached_data/ # Cached weights and scan results (git-ignored)
├── LICENSE
└── README.md
pip install -r src/requirements.txtCore dependencies: torch, snntorch, numpy, scipy, matplotlib, jupyter.
The notebooks are numbered and designed to be run sequentially. They import shared infrastructure from the Python modules mnesis_boilerplate.py (imports, device detection, Params dataclass, utilities) and mnesis_chains.py (HD_SNN class, pattern generators). Each notebook saves its outputs (model weights, scan results) to cached_data/ so that downstream notebooks can load them without recomputation. Notebook 99 can orchestrate a full multi-notebook run in one place.
cd src
jupyter notebook| # | Notebook / Module | Purpose |
|---|---|---|
| — | mnesis_boilerplate.py |
Shared imports, device detection (MPS / CUDA / CPU), random-seed utilities, Params dataclass, and helper functions reused by all downstream notebooks. |
| — | mnesis_chains.py |
Defines SpikingPattern, StochasticSpikingPattern, and the HD_SNN class with analytical weight initialisation (Hebbian cross-correlation with LIF deconvolution, targeting |
| 10 | 10_MNESIS_generative-model.ipynb |
Implements the generative model for synthetic sparse patterns: draws Gaussian logit maps |
| 11 | 11_MNESIS_learn-synthetic.ipynb |
Trains the network on |
| 13 | 13_MNESIS_testing-inference.ipynb |
Concatenates all |
| 14 | 14_MNESIS_testing-noise.ipynb |
Bit-flip noise on the trigger window ( |
| 15 | 15_MNESIS_testing-trigger-duration.ipynb |
Truncated trigger window (0 to |
| 16 | 16_MNESIS_testing-trigger-fraction.ipynb |
Partial neuron coverage (0 to |
| 20 | 20_MNESIS_scanning-parameters.ipynb |
Systematic one-at-a-time scans over |
| 25 | 25_MNESIS_optuna.ipynb |
Automated hyperparameter search with Optuna over learning dynamics, thresholds, and regularisation. |
| 30 | 30_MNESIS_learn-periodic.ipynb |
Builds periodic targets, trains periodic memories, and evaluates retrieval robustness under increasing input noise. |
| 32 | 32_MNESIS_learn-travelling-waves.ipynb |
Introduces MotionClouds-based travelling-wave patterns and benchmarks retrieval with structured spatiotemporal motifs. |
| 34 | 34_MNESIS_learn-Lorenz-attractor.ipynb |
Encodes Lorenz chaotic trajectories into spike codes and evaluates memory recall on non-periodic continuous dynamics. |
| 40 | 40_MNESIS_learn-SHD.ipynb |
Integrates Spiking Heidelberg Digits data loading/preprocessing for dataset-grounded experiments. |
| 99 | 99_MNESIS_run-all.ipynb |
Scripted orchestrator to run the full notebook pipeline with progress timestamps. |
Results are saved to cached_data/ (excluded from git via .gitignore):
| File pattern | Content |
|---|---|
*_init.pth |
Analytically initialised weights (pseudo-inverse or Hebbian) |
*.pth |
Trained model weights after gradient steps |
*_scan_*.json |
Parameter sweep results (loss, precision, recall per condition) |
*_periodic-with-noise.npz |
Periodic-memory robustness curves across noise levels and time chunks |
*_TW_*.json |
Travelling-wave parameter scans |
*_lorenz_chaotic_*.json |
Lorenz-attractor scan and optimisation outputs |
*_optuna.sqlite3 |
Optuna studies for synthetic, travelling-wave, and Lorenz experiments |
Delete a cached .pth, .json, .npz, or .sqlite3 file to force recomputation; set RECOMPUTE = True at the top of any notebook to invalidate the full cache for that notebook.
Each neuron
with
The LIF membrane is a causal IIR lowpass
The closed-form initialisation follows from the Gram-matrix approximation
The safety margin
-
Loss:
$\mathcal{L} = 1 - F_1$ (harmonic mean of precision and recall, evaluated after the trigger window) —SpikeF1scoreLoss -
Optimiser: SGD by default (
sgd), configurable viaParams.optimizer(also supportsadam,adamw,rmsprop,adadelta) -
Surrogate: fast sigmoid by default, sharpness
$\alpha = 12$ — configurable viaParams.surrogate_name/Params.alpha_surrogate -
Regularisation: dropout
$p = 0.10$ , weight decay$\lambda = 0$ -
LIF dynamics:
$\beta = 0.8$ ,$\vartheta = 0.8$ , zero-reset (subtract) - Hardware: Apple M3 Ultra (MPS) or NVIDIA GPU (CUDA / Jean Zay GENCI)
An AI assistant was used to improve the readability and structure of this codebase — not to create it.
| Experiment | Key result |
|---|---|
| Training (NB 11) |
|
| Sequential retrieval (NB 13) | All 16 patterns retrieved without cross-interference |
| Noise robustness (NB 14) |
|
| Trigger duration (NB 15) |
|
| Neuron coverage (NB 16) |
|
| Delay scan (NB 20) |
|
| Duration scan (NB 20) |
|
| Rate scan (NB 20) | Optimal at |
| Periodic memory (NB 30) | Stable periodic retrieval with dedicated robustness evaluation under progressive bit-flip noise |
| Travelling waves (NB 32) | MotionClouds-derived structured motifs can be stored/recalled with the same HD-SNN framework |
| Lorenz attractor (NB 34) | Extends retrieval tests to non-periodic chaotic trajectories encoded as spike events |
| SHD integration (NB 40) | Adds real-event dataset loading and preprocessing for external benchmark experiments |
| Full orchestrator (NB 99) | Provides a single notebook entry point for sequential multi-notebook execution |
@inproceedings{Perrinet2026MNESIS,
author = {Perrinet, Laurent U.},
title = {Working Memory in a Recurrent Spiking Neural Network
with Heterogeneous Synaptic Delays},
booktitle = {AIROV 2026},
year = {2026},
url = {https://laurentperrinet.github.io/publication/perrinet-26-icann/}
}GPL-3.0 — see LICENSE.
Institut de Neurosciences de la Timone (UMR 7289), Aix Marseille Université / CNRS, Marseille, France. Supported by GENCI-IDRIS (Grant 2025–AD010314955R2).