Mamba-Spike

December 3, 2025 · View on GitHub

Enhancing the Mamba Architecture with a Spiking Front-End for Efficient Temporal Data Processing

CGI 2024 DOI Python 3.9+ PyTorch License: MIT

This is a PyTorch implementation of the paper "Mamba-Spike: Enhancing the Mamba Architecture with a Spiking Front-End for Efficient Temporal Data Processing" published at CGI 2024.

Overview

Mamba-Spike is a novel neuromorphic architecture that integrates a spiking front-end with the Mamba backbone for efficient and robust temporal data processing.

Key Features:

  • Event-driven processing through Spiking Neural Networks (SNNs)
  • Selective state spaces for efficient sequence modeling
  • Linear-time complexity for processing long temporal sequences
  • Energy-efficient computation through sparse spike representations

Architecture

ComponentDescription
Spiking Front-EndLIF neurons with recurrent connections for event-based encoding
Interface LayerFixed time window accumulation with firing rate normalization
Mamba BackboneSelective state space models with linear-time complexity
Classification HeadLayer normalization with class predictions

Setup

# Create conda environment
conda create -n mambaspike python=3.9
conda activate mambaspike

# Install dependencies
pip install -r requirements.txt

Datasets

The project supports five neuromorphic datasets:

DatasetResolutionClassesDescription
N-MNIST34x3410Neuromorphic MNIST
DVS Gesture128x12811Dynamic hand gestures
CIFAR10-DVS128x12810Neuromorphic CIFAR-10
Sequential MNIST28x2810Temporal MNIST
N-TIDIGITS64 channels11Neuromorphic audio

Data Format: Place preprocessed data in data/preprocessed/ as pickle files:

  • {dataset}_train.pkl - Training data
  • {dataset}_test.pkl - Test data

Each pickle file should contain: {'data': np.ndarray, 'labels': np.ndarray}

Training

python train.py --dataset <dataset_name> --batch-size <size> --lr <learning_rate> --epochs <num>

Training Parameters

ParameterDefaultDescription
--datasetnmnistDataset name
--batch-size32Batch size
--lr0.001Learning rate
--epochs200Training epochs

Evaluation

python evaluate.py --checkpoint results/<experiment>/checkpoint_best.pth

Options:

  • --analyze-temporal - Temporal analysis
  • --compare-paper - Compare with paper results

Results

DatasetMamba-SpikeMambaSLAYERDECOLLE
DVS Gesture97.8%96.8%93.6%95.2%
TIDIGITS99.2%98.7%97.5%98.3%
Sequential MNIST99.4%99.3%--
CIFAR10-DVS92.5%91.8%87.3%89.6%

Project Structure

mambaspike/
├── data/
│   ├── __init__.py
│   └── dataset_loader.py      # Data loading utilities
├── models/
│   ├── __init__.py
│   └── mamba_spike.py         # Model architecture
├── architecture/
│   └── README.md              # Architecture documentation
├── train.py                   # Training script
├── evaluate.py                # Evaluation script
├── requirements.txt           # Dependencies
└── README.md

Citation

@inproceedings{qin2025mambaspike,
  title     = {Mamba-Spike: Enhancing the Mamba Architecture with a Spiking
               Front-End for Efficient Temporal Data Processing},
  author    = {Qin, Jiahao and Liu, Feng},
  booktitle = {Advances in Computer Graphics: 41st Computer Graphics
               International Conference, CGI 2024},
  pages     = {303--315},
  year      = {2025},
  publisher = {Springer},
  series    = {Lecture Notes in Computer Science},
  volume    = {15339},
  doi       = {10.1007/978-3-031-82021-2_23}
}

License

This project is licensed under the MIT License - see LICENSE for details.

Contact

For questions or issues, please open an issue on GitHub or contact the paper authors.