# Rate Coding or Direct Coding: Which One is Better for Accurate, Robust, and Energy-efficient Spiking Neural Networks?

arXiv: https://arxiv.org/abs/2202.03133 · HTML: https://mlsanity.com/paper/2202.03133/

## Key facts

- Cited by 25 papers in the map (data through 14 Oct 2026).
- Builds on 17 of its 28 references that are in the map.
- First posted on arXiv 31 Jan 2022.

## Builds on (most cited first, 17 of 17)

- [Explaining and Harnessing Adversarial Examples](https://mlsanity.com/paper/1412.6572/) (2014)
- [Towards Deep Learning Models Resistant to Adversarial Attacks](https://mlsanity.com/paper/1706.06083/) (2017)
- [Spatio-Temporal Backpropagation for Training High-performance Spiking Neural Networks](https://mlsanity.com/paper/1706.02609/) (2017)
- [Incorporating Learnable Membrane Time Constant to Enhance Learning of Spiking Neural Networks](https://mlsanity.com/paper/2007.05785/) (2020)
- [Going Deeper With Directly-Trained Larger Spiking Neural Networks](https://mlsanity.com/paper/2011.05280/) (2020)
- [Direct Training for Spiking Neural Networks: Faster, Larger, Better](https://mlsanity.com/paper/1809.05793/) (2018)
- [Training Deep Spiking Neural Networks using Backpropagation](https://mlsanity.com/paper/1608.08782/) (2016)
- [Enabling Deep Spiking Neural Networks with Hybrid Conversion and Spike Timing Dependent Backpropagation](https://mlsanity.com/paper/2005.01807/) (2020)
- [Enabling Spike-based Backpropagation for Training Deep Neural Network Architectures](https://mlsanity.com/paper/1903.06379/) (2019)
- [Temporal Spike Sequence Learning via Backpropagation for Deep Spiking Neural Networks](https://mlsanity.com/paper/2002.10085/) (2020)
- [Revisiting Batch Normalization for Training Low-latency Deep Spiking Neural Networks from Scratch](https://mlsanity.com/paper/2010.01729/) (2020)
- [Supervised learning based on temporal coding in spiking neural networks](https://mlsanity.com/paper/1606.08165/) (2016)
- [HIRE-SNN: Harnessing the Inherent Robustness of Energy-Efficient Deep Spiking Neural Networks by Training with Crafted Input Noise](https://mlsanity.com/paper/2110.11417/) (2021)
- [Inherent Adversarial Robustness of Deep Spiking Neural Networks: Effects of Discrete Input Encoding and Non-Linear Activations](https://mlsanity.com/paper/2003.10399/) (2020)
- [Temporal Coding in Spiking Neural Networks with Alpha Synaptic Function: Learning with Backpropagation](https://mlsanity.com/paper/1907.13223/) (2019)
- [Fast and Efficient Information Transmission with Burst Spikes in Deep Spiking Neural Networks](https://mlsanity.com/paper/1809.03142/) (2018)
- [Visual Explanations from Spiking Neural Networks using Interspike Intervals](https://mlsanity.com/paper/2103.14441/) (2021)

## Built on by (most cited first, 25 of 25)

- [Toward Robust Spiking Neural Network Against Adversarial Perturbation](https://mlsanity.com/paper/2205.01625/) (2022)
- [Enhancing Adversarial Robustness in SNNs with Sparse Gradients](https://mlsanity.com/paper/2405.20355/) (2024)
- [SpikeSim: An end-to-end Compute-in-Memory Hardware Evaluation Tool for Benchmarking Spiking Neural Networks](https://mlsanity.com/paper/2210.12899/) (2022)
- [Towards Effective and Sparse Adversarial Attack on Spiking Neural Networks via Breaking Invisible Surrogate Gradients](https://mlsanity.com/paper/2503.03272/) (2025)
- [Spiking Neural Operators for Scientific Machine Learning](https://mlsanity.com/paper/2205.10130/) (2022)
- [LoAS: Fully Temporal-Parallel Dataflow for Dual-Sparse Spiking Neural Networks](https://mlsanity.com/paper/2407.14073/) (2024)
- [Spiking-Diffusion: Vector Quantized Discrete Diffusion Model with Spiking Neural Networks](https://mlsanity.com/paper/2308.10187/) (2023)
- [Adversarially Robust Spiking Neural Networks Through Conversion](https://mlsanity.com/paper/2311.09266/) (2023)
- [ReSpike: Residual Frames-based Hybrid Spiking Neural Networks for Efficient Action Recognition](https://mlsanity.com/paper/2409.01564/) (2024)
- [SIT: A Bionic and Non-Linear Neuron for Spiking Neural Network](https://mlsanity.com/paper/2203.16117/) (2022)
- [SynA-ResNet: Spike-driven ResNet Achieved through OR Residual Connection](https://mlsanity.com/paper/2311.06570/) (2023)
- [Robust and Efficient Adversarial Defense in SNNs via Image Purification and Joint Detection](https://mlsanity.com/paper/2404.17092/) (2024)
- [Energy-Efficient and Dequantization-Free Q-LLMs: A Spiking Neural Network Approach to Salient Value Mitigation](https://mlsanity.com/paper/2510.19498/) (2025)
- [Neuroscience inspired scientific machine learning (Part-2): Variable spiking wavelet neural operator](https://mlsanity.com/paper/2311.14710/) (2023)
- [When In-memory Computing Meets Spiking Neural Networks -- A Perspective on Device-Circuit-System-and-Algorithm Co-design](https://mlsanity.com/paper/2408.12767/) (2024)
- [Event-driven physics-informed operator learning for reliability analysis](https://mlsanity.com/paper/2511.06083/) (2025)
- [Asynchronous Bioplausible Neuron for SNN for Event Vision](https://mlsanity.com/paper/2311.11853/) (2023)
- [SNNLP: Energy-Efficient Natural Language Processing Using Spiking Neural Networks](https://mlsanity.com/paper/2401.17911/) (2024)
- [Topology Optimization of Random Memristors for Input-Aware Dynamic SNN](https://mlsanity.com/paper/2407.18625/) (2024)
- [Exploring the Sparsity-Quantization Interplay on a Novel Hybrid SNN Event-Driven Architecture](https://mlsanity.com/paper/2411.15409/) (2024)
- [snnTrans-DHZ: A Lightweight Spiking Neural Network Architecture for Underwater Image Dehazing](https://mlsanity.com/paper/2504.11482/) (2025)
- [Word2Spike: Poisson Rate Coding for Associative Memories and Neuromorphic Algorithms](https://mlsanity.com/paper/2509.07361/) (2025)
- [PrivSpike: Employing Homomorphic Encryption for Private Inference of Deep Spiking Neural Networks](https://mlsanity.com/paper/2510.03995/) (2025)
- [Convolutional Spiking-based GRU Cell for Spatio-temporal Data](https://mlsanity.com/paper/2510.25696/) (2025)
- [Stable Spike: Dual Consistency Optimization via Bitwise AND Operations for Spiking Neural Networks](https://mlsanity.com/paper/2603.11676/) (2026)

## Abstract (arXiv)

Recent Spiking Neural Networks (SNNs) works focus on an image classification task, therefore various coding techniques have been proposed to convert an image into temporal binary spikes. Among them, rate coding and direct coding are regarded as prospective candidates for building a practical SNN system as they show state-of-the-art performance on large-scale datasets. Despite their usage, there is little attention to comparing these two coding schemes in a fair manner. In this paper, we conduct a comprehensive analysis of the two codings from three perspectives: accuracy, adversarial robustness, and energy-efficiency. First, we compare the performance of two coding techniques with various architectures and datasets. Then, we measure the robustness of the coding techniques on two adversarial attack methods. Finally, we compare the energy-efficiency of two coding schemes on a digital hardware platform. Our results show that direct coding can achieve better accuracy especially for a small number of timesteps. In contrast, rate coding shows better robustness to adversarial attacks owing to the non-differentiable spike generation process. Rate coding also yields higher energy-efficiency than direct coding which requires multi-bit precision for the first layer. Our study explores the characteristics of two codings, which is an important design consideration for building SNNs. The code is made available at https://github.com/Intelligent-Computing-Lab-Yale/Rate-vs-Direct.
