Skip to main content
QUICK REVIEW

[Paper Review] SpikeGPT: Generative Pre-trained Language Model with Spiking Neural Networks

Ruijie Zhu, Qihang Zhao|arXiv (Cornell University)|Feb 27, 2023
Advanced Memory and Neural ComputingEngineering52 citations
TL;DR

SpikeGPT is the first directly trained Spiking Neural Network (SNN) language model, combining Spiking RWKV and SRFFN to achieve competitive generation and understanding with linear-time complexity and significantly reduced energy via neuromorphic-like sparse activations.

ABSTRACT

As the size of large language models continue to scale, so does the computational resources required to run it. Spiking Neural Networks (SNNs) have emerged as an energy-efficient approach to deep learning that leverage sparse and event-driven activations to reduce the computational overhead associated with model inference. While they have become competitive with non-spiking models on many computer vision tasks, SNNs have also proven to be more challenging to train. As a result, their performance lags behind modern deep learning, and we are yet to see the effectiveness of SNNs in language generation. In this paper, inspired by the Receptance Weighted Key Value (RWKV) language model, we successfully implement `SpikeGPT', a generative language model with binary, event-driven spiking activation units. We train the proposed model on two model variants: 45M and 216M parameters. To the best of our knowledge, SpikeGPT is the largest backpropagation-trained SNN model to date, rendering it suitable for both the generation and comprehension of natural language. We achieve this by modifying the transformer block to replace multi-head self attention to reduce quadratic computational complexity O(N^2) to linear complexity O(N) with increasing sequence length. Input tokens are instead streamed in sequentially to our attention mechanism (as with typical SNNs). Our preliminary experiments show that SpikeGPT remains competitive with non-spiking models on tested benchmarks, while maintaining 20x fewer operations when processed on neuromorphic hardware that can leverage sparse, event-driven activations. Our code implementation is available at https://github.com/ridgerchu/SpikeGPT.

Motivation & Objective

  • Demonstrate direct training of a language model using spiking neurons in a Transformer-inspired architecture.
  • Reduce the quadratic self-attention complexity to linear complexity to enable longer sequences and streaming inputs.
  • Achieve competitive natural language generation and understanding while lowering synaptic operations on neuromorphic hardware.
  • Showcase two parameter scales (45M and 216M) and compare against standard Transformer-based baselines.
  • Explore training strategies and architectural components that integrate recurrence and spiking dynamics for NLP tasks.

Proposed method

  • Replace multi-head self-attention with a Spiking RWKV token-mixer that operates recurrently for linear time complexity.
  • Use a Spiking RFFN channel-mixer with residual connections as the feed-forward component.
  • Introduce binary embedding with a Heaviside forward pass and arctangent surrogate gradient for backpropagation.
  • Incorporate a token shift operation to supplement context without full attention.
  • Integrate Leaky Integrate-and-Fire neurons to produce binary spike outputs and enable streaming computation.
  • Pre-train as decoder-only, then fine-tune for NLG and NLU tasks with task-specific top-layer adaptations.

Experimental results

Research questions

  • RQ1Can a generative language model be effectively trained directly with spiking neurons (SNNs) in a Transformer-like architecture?
  • RQ2Does replacing self-attention with a linear, recurrent Spiking RWKV enable competitive language modeling while reducing computational cost?
  • RQ3What are the energy and computational benefits of SpikeGPT on neuromorphic-like sparse activations compared to traditional Transformers?
  • RQ4How do SpikeGPT variants (45M and 216M parameters) perform on standard NLG and NLU benchmarks relative to baselines?
  • RQ5What training strategies (binary embeddings, surrogate gradients, token shift) are effective for SNN-based NLP models?

Key findings

  • SpikeGPT is the largest backpropagation-trained SNN language model to date (216M parameters) and demonstrates competitive performance on generation and comprehension tasks.
  • SpikeGPT reduces quadratic attention complexity to linear by using Spiking RWKV and processes tokens in a streaming, sequential manner.
  • SpikeGPT achieves over 20× fewer synaptic operations (SynOps) than a vanilla Transformer due to sparse, event-driven activations.
  • On Enwik8, SpikeGPT 45M with 1024 sequence length attains train/test BPC of 1.113/1.283 and SpikeGPT 45M with 3072 length attains 0.903/1.262, with SynOps markedly lower than Transformers.
  • With pre-training on OpenWebText2, the 216M SpikeGPT shows competitive perplexity on WikiText-2 and relatively lower performance on WikiText-103 compared to GPT-2 variants, indicating scalability challenges and the need for larger-scale training strategies.
  • SpikeGPT delivers competitive NLG and NLU results while maintaining energy efficiency suitable for neuromorphic hardware.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.