QKFormer: Hierarchical Spiking Transformer using Q-K Attention

Chenlin Zhou, Han Zhang, Zhaokun Zhou, Liutao Yu, Liwei Huang +5 more
2/3/2026

No official code found. Best implementation: zhouchenlin2096/QKFormer (150 stars, last commit 2026-04-16).

Abstract

Spiking Transformers, which integrate Spiking Neural Networks (SNNs) with Transformer architectures, have attracted significant attention due to their potential for energy efficiency and high performance. However, existing models in this domain still suffer from suboptimal performance. We introduce several innovations to improve the performance: i) We propose a novel spike-form Q-K attention mechanism, tailored for SNNs, which efficiently models the importance of token or channel dimensions through binary vectors with linear complexity. ii) We incorporate the hierarchical structure, which significantly benefits the performance of both the brain and artificial neural networks, into spiking transformers to obtain multi-scale spiking representation. iii) We design a versatile and powerful patch embedding module with a deformed shortcut specifically for spiking transformers. Together, we develop QKFormer, a hierarchical spiking transformer based on Q-K attention with direct training. QKFormer shows significantly superior performance over existing state-of-the-art SNN models on various mainstream datasets. Notably, with comparable size to Spikformer (66.34 M, 74.81%), QKFormer (64.96 M) achieves a groundbreaking top-1 accuracy of 85.65% on ImageNet-1k, substantially outperforming Spikformer by 10.84%. To our best knowledge, this is the first time that directly training SNNs have exceeded 85% accuracy on ImageNet-1K. The code and models are publicly available at https://github.com/zhouchenlin2096/QKFormer

View on arXivView PDF

Code Implementations(1)

Offical code of "QKFormer: Hierarchical Spiking Transformer using Q-K Attention" (NeurIPS 2024)

15018PythonJul 21, 20236 months ago
3rd-generation-of-artificial-neural-networksbrain-inspiredenergy-efficiencyevent-drivenneuromorphic-computing+3 more

Similar Papers

Cite this paper

@article{zhou2026qkformer,
  title  = {QKFormer: Hierarchical Spiking Transformer using Q-K Attention},
  author = {Chenlin Zhou and Han Zhang and Zhaokun Zhou and Liutao Yu and Liwei Huang and Xiaopeng Fan and Liuliang Yuan and Zhengyu Ma and Huihui Zhou and Yonghong Tian},
  year   = {2026},
  eprint = {2403.16552},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2403.16552},
  url    = {https://arxiv.org/abs/2403.16552},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.16552.svg)](https://codeofpaper.com/paper/2403.16552)

Discussion