README.md

January 3, 2026 Β· View on GitHub

SpiLiFormer: Enhancing Spiking Transformers with Lateral Inhibition

arXiv ICCV 2025 Supplementary
Zeqi Zheng*, Yanchen Huang*, Yingchao Yu, Zizheng Zhu, Junfeng Tang, Zhaofei Yu, Yaochu Jin†
* Equal contribution † Corresponding author 

News

  • Jun. 2025 Our work has been accepted by ICCV 2025 πŸŽ‰.
  • Jan. 2026 We release the code and model checkpoints! πŸš€

Overview

SpiLiFormer (Spiking Transformer with Lateral Inhibition) is a novel brain-inspired spiking transformer architecture designed to enhance the performance and robustness of spiking neural networks (SNNs).

Inspired by the lateral inhibition mechanism in the human visual system, which helps the brain focus on salient regions by suppressing responses from neighboring neurons, SpiLiFormer introduces two new attention modules:

  • FF-LiDiff Attention (Feedforward-pathway Lateral Differential Inhibition): Inspired by short-range inhibition in the retina, this module reduces distraction in shallow network stages by differentially inhibiting attention responses.

  • FB-LiDiff Attention (Feedback-pathway Lateral Differential Inhibition): Inspired by long-range cortical inhibition, this module incorporates feedback to refine attention allocation in deeper network stages.

SpiLiFormer poster

Main Results on ImageNet-1K

MethodsTypeArchitectureInput SizeParam (M)Power (mJ)Time StepTop-1 Acc (%)Download
ViTANNViT-B/1638486.59254.84177.90-
Swin TransformerANNSwin Transformer-B38487.77216.20184.50-
SpikformerSNNSpikformer-8-76822466.3421.48474.81-
QKFormerSNNHST-10-76838464.96113.64485.65-
E-SpikeFormerSNNE-SpikeFormer384173.0-886.2-
SpiLiFormer (Ours)SNNSpiLiFormer-10-76822469.1011.77181.54link
SpiLiFormer (Ours)SNNSpiLiFormer-10-76822469.1044.17485.82link
SpiLiFormer (Ours)SNNSpiLiFormer-10-768*28869.1073.52486.62link
SpiLiFormer (Ours)SNNSpiLiFormer-10-768**38469.10129.45486.66link

SpiLiFormer demonstrates performance superior to current State-of-the-Art (SOTA) SNN models and even some ANN models on ImageNet-1K, while maintaining lower energy consumption and parameter counts.

Main Results on Other Datasets (CIFAR & Neuromorphic)

DatasetsMethodsArchitectureParam (M)Time StepTop-1 Acc (%)
CIFAR-10SpiLiFormer (Ours)SpiLiFormer-4-3847.04496.63
QKFormerHST-4-3846.74496.18
SpikformerSpikformer-4-3849.32495.51
CIFAR-100SpiLiFormer (Ours)SpiLiFormer-4-3847.04481.63
QKFormerHST-4-3846.74481.15
SpikingformerSpikingformer-4-3849.32479.21
CIFAR10-DVSSpiLiFormer (Ours)SpiLiFormer-2-2561.571686.7
QKFormerHST-2-2561.501684.0
SpikformerSpikformer-2-2562.571680.9
N-Caltech101SpiLiFormer (Ours)SpiLiFormer-2-2561.571689.18
QKFormerHST-2-2561.501687.24
S-TransformerS-Transformer-2-2562.571686.3

SpiLiFormer also achieves SOTA performance on static image datasets (CIFAR-10/100) and neuromorphic datasets (CIFAR10-DVS/N-Caltech101)

Quick Start

Requirements

timm==0.6.12
cupy==11.4.0
torch==1.12.1
spikingjelly==0.0.0.0.12
pyyaml
tensorboard

Data Preparation

Train on CIFAR-10

CUDA_VISIBLE_DEVICES=0 python ./cifar10/train.py \
--output ./cifar10/outputs \
--config ./cifar10/cifar10.yml \
-data-dir /your_cifar_10_dataset_filepath \
-T 4

Train on CIFAR-100

CUDA_VISIBLE_DEVICES=0 python ./cifar100/train.py \
--output ./cifar100/outputs/ \
--config ./cifar100/cifar100.yml \
-data-dir /your_cifar_100_dataset_filepath \
-T 4

Train on CIFAR10-DVS

CUDA_VISIBLE_DEVICES=0 python ./cifar10dvs/train.py \
--output-dir ./cifar10dvs/outputs/ \
--data-path /your_cifar_10_dvs_dataset_filepath \
--T 16

Train on N-Caltech101

CUDA_VISIBLE_DEVICES=0 python ./ncaltech101/train.py \
--output-dir ./ncaltech101/outputs/ \
--data-path /your_ncaltech101_dataset_filepath \
--dts_cache /your_ncaltech101_dataset_filepath/dts_cache \
--T 16

Evaluation on ImageNet-1K

SpiLiFormer-10-768, T=1, Input_size=224

CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --nproc_per_node=4 ./imagetnet_1k/train.py \
--output_dir ./imagetnet_1k/ouputs/ \
--log_dir ./imagetnet_1k/ouputs/ \
--data_path /your_imagenet_1k_dataset_filepath \
--model SpiLiFormer_10_768 \
--input_size 224 \
--time_step 1 \
--batch_size 64 \
--accum_iter 1 \
--resume ./your_checkpoint_filepath/spiliformer_7_768_T_1_224.pth \
--eval

SpiLiFormer-10-768, T=4, Input_size=224

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 torchrun --nproc_per_node=8 ./imagetnet_1k/train.py \
--output_dir ./imagetnet_1k/ouputs/ \
--log_dir ./imagetnet_1k/ouputs/ \
--data_path /your_imagenet_1k_dataset_filepath \
--model SpiLiFormer_10_768 \
--input_size 224 \
--time_step 4 \
--batch_size 64 \
--accum_iter 1 \
--resume ./your_checkpoint_filepath/spiliformer_7_768_T_4_224.pth \
--eval

SpiLiFormer-10-768, T=4, Input_size=288

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 torchrun --nproc_per_node=8 ./imagetnet_1k/train.py \
--output_dir ./imagetnet_1k/ouputs/ \
--log_dir ./imagetnet_1k/ouputs/ \
--data_path /your_imagenet_1k_dataset_filepath \
--model SpiLiFormer_10_768 \
--input_size 288 \
--time_step 4 \
--batch_size 64 \
--accum_iter 1 \
--resume ./your_checkpoint_filepath/spiliformer_7_768_T_4_288.pth \
--eval

SpiLiFormer-10-768, T=4, Input_size=384

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 torchrun --nproc_per_node=8 ./imagetnet_1k/train.py \
--output_dir ./imagetnet_1k/ouputs/ \
--log_dir ./imagetnet_1k/ouputs/ \
--data_path /your_imagenet_1k_dataset_filepath \
--model SpiLiFormer_10_768 \
--input_size 384 \
--time_step 4 \
--batch_size 64 \
--accum_iter 1 \
--resume ./your_checkpoint_filepath/spiliformer_7_768_T_4_384.pth \
--eval

Citation

If you use our code or data in this repo or find our work helpful, please consider giving a citation:

@inproceedings{zheng2025spiliformer,
  title={SpiLiFormer: Enhancing Spiking Transformers with Lateral Inhibition},
  author={Zheng, Zeqi and Huang, Yanchen and Yu, Yingchao and Zhu, Zizheng and Tang, Junfeng and Yu, Zhaofei and Jin, Yaochu},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={24539--24548},
  year={2025}
}