SDiT: Spiking Diffusion Model with Transformer

Shu Yang, Hanzhi Ma, Chengting Yu, Aili Wang, Er-Ping LiarXiv 2024 · DOI

Abstract

SDiT (Spiking Diffusion Transformer) is a novel generative model that marries the energy efficiency of Spiking Neural Networks (SNNs) with the structural power of Transformers. By replacing the traditional U-Net backbone with a spiking transformer architecture and introducing a specialized "Reconstruction Module," SDiT achieves state-of-the-art image generation performance for SNNs with significantly lower computational overhead than traditional artificial neural networks.

Introduction

Diffusion models have revolutionized the field of generative AI, enabling high-fidelity image synthesis. However, these models typically rely on power-hungry Artificial Neural Networks (ANNs), posing challenges for deployment on edge devices or energy-constrained environments. Spiking Neural Networks (SNNs) offer a bio-inspired alternative, communicating via discrete pulses (spikes) that enable high energy efficiency on neuromorphic hardware.

Despite their potential, SNNs have historically struggled with complex generative tasks. Previous SNN-based GANs and VAEs often fail to match the quality of their ANN counterparts. The primary obstacles include a "representation gap" where standard transformer mechanisms are too complex for SNNs, and information loss during the discrete firing process, which often results in blurry or noisy outputs. SDiT addresses these issues by introducing a transformer-based diffusion architecture tailored for spiking neurons.

Architecture and Methodology

The Spiking Diffusion Transformer (SDiT) departs from the conventional convolutional U-Net backbone in favor of a more scalable transformer-based structure. The architecture is built around several key innovations designed to maintain efficiency while enhancing representational power.

Transformer Backbone and RWKV Attention

SDiT utilizes a transformer-based structure for denoising, which the authors argue is more effective for SNNs than traditional U-Nets. To maintain efficiency, the model employs RWKV (Receptance Weighted Key Value) attention. This mechanism provides linear computational complexity and integrates naturally with the temporal, step-based nature of SNNs, avoiding the heavy overhead of standard softmax self-attention.

The Reconstruction Module

A core contribution of this work is the "Reconstruction Module," designed to combat the information loss inherent in threshold-based firing. The authors introduce learnable "Reconstruction Tokens" that are concatenated with the input. These tokens are processed through the spiking layers and then utilized in a dedicated module to supplement the output, effectively recovering fine details that would otherwise be lost during the neuron's firing process. The blocks utilize Leaky Integrate-and-Fire (LIF) neurons and LayerNorm to maintain event-driven properties while allowing for deep training via surrogate gradients.

Experimental Results

The SDiT model was evaluated on three benchmark datasets: MNIST, Fashion-MNIST, and CIFAR-10. The results demonstrate that SDiT sets a new empirical baseline for SNN-based generative research.

Performance comparison of SDiT against baseline SNN models on MNIST, Fashion-MNIST, and CIFAR-10.

Image Quality and Efficiency

As shown in the performance comparison, SDiT achieves state-of-the-art Fréchet Inception Distance (FID) scores. On MNIST, SDiT reached an FID of 5.54, significantly outperforming the previous best SNN model (SDDPM) at 29.48. Similar gains were observed on Fashion-MNIST (5.49 vs. 21.38) and CIFAR-10 (22.17 vs. 120.50).

Beyond image quality, SDiT demonstrates superior efficiency. Compared to the ANN-based Diffusion Transformer (DiT), SDiT reduced parameters from 13.86M to 11.67M and slashed Multiply-Accumulate (MAC) operations from 3.48G to 1.32G. This reduction highlights the potential for low-power generation on neuromorphic hardware.

Discussion and Future Work

While SDiT represents a significant leap forward for SNNs, challenges remain. The performance gap on complex datasets like CIFAR-10 compared to the absolute state-of-the-art in ANNs suggests that training spiking transformers on limited data is still difficult. Additionally, current implementations still rely on ANN-based embedding layers. Future research will focus on developing "pure" SNN architectures and scaling the model to handle high-resolution image generation (e.g., 512x512), which remains an open challenge for the neuromorphic community.

Summary updated

BibTeX
@misc{yang2024sdit,
  author = {Shu Yang and Hanzhi Ma and Chengting Yu and Aili Wang and Er-Ping Li},
  title = {{SDiT: Spiking Diffusion Model with Transformer}},
  year = {2024},
  eprint = {2402.11588},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.11588},
}
Figure