BitShift-RoPE: Zero-FLOP Relative Positional Encoding for Spiking Neural Network Transformers

Seung-Kyu Hong, Sangheum Hwang, Hyuk-Yoon KwonNeurIPS 2026

TL;DR

Transformers need to know the order of tokens, and Spiking Neural Networks (SNNs) get their ultra-low-power magic from communicating strictly in binary 1s and 0s. Combining the two usually breaks that binary magic, because standard positional encodings introduce floating-point math. BitShift-RoPE solves this by replacing trigonometric rotations with simple cyclic bit-shifts—giving SNN Transformers relative positional awareness for literally zero floating-point operations (FLOPs) and zero extra energy.

What Problem Does This Paper Address?

Imagine trying to build a brain-inspired Transformer. Standard Artificial Neural Networks (ANNs) pass continuous, floating-point numbers around, burning substantial energy on multiplications. Spiking Neural Networks (SNNs) instead communicate via sparse, binary events—"spikes" of 0 or 1 generated by Leaky Integrate-and-Fire (LIF) neurons. Because everything is binary and sparse, the heavy dot-product in self-attention collapses into a dirt-cheap, bitwise AND operation.

Here is the catch: self-attention is position-blind, and injecting positional encoding (PE) into an SNN is a mathematical minefield.

  • If you apply standard Rotary Position Embedding (RoPE)—which rotates vectors using $\sin$ and $\cos$—before the LIF neuron turns numbers into spikes, the neuron's step-function non-linearity destroys the clean relative-distance math.
  • If you apply RoPE after the spikes are generated, you turn crisp 0s and 1s back into floating-point decimals, ruining the hardware efficiency.
  • Recent SNN-specific workarounds (like Gray-PE and Log-PE) output multi-bit integers and rely on XNOR similarity instead of AND. On sparse spike arrays, XNOR(0, 0) = 1, turning a mostly-zero sparse calculation into a massive wall of 1s that clogs up downstream accumulation.

Methods

The authors introduce BitShift-RoPE, applied after spike generation. Instead of rotating continuous vectors in 2D space using floating-point trigonometry, they permute the indices of the 0/1 spike array using a discrete cyclic shift matrix $S$.

Because a cyclic shift matrix is orthogonal ($S^T = S^{-1}$), shifting a query at position $m$ by $S^m$ and a key at position $n$ by $S^n$ causes their attention dot-product to naturally simplify to $Q S^{m-n} K^T$. Just like standard RoPE, absolute positions cancel out, leaving pure relative distance!

Multi-frequency shift mapping across channel groups

To avoid aliasing on long sequences without adding learnable parameters, the feature dimension $D$ is split into $G$ groups. Using an exponential decay constant $C$, earlier groups shift rapidly with token position to capture fine-grained local order, while later groups shift sluggishly to preserve global context.

Figure 1: Overview of BitShift-RoPE. (a) The rotation matrix of standard RoPE is replaced with a discrete cyclic shift matrix S, applied via memory-pointer routing. (b) Multi-frequency context is captured by partitioning the feature dimension D into G groups, each assigned a distinct integer shift count kg. (c) The 2D extension splits the G groups into halves along the X- and Y -axes for image patches.

Two engineering extensions make this shine:

  • 2D Vision Extension: Channel groups are split in half—one half shifts according to $X$-coordinates, the other according to $Y$-coordinates, keeping 2D spatial geometry cleanly separable rather than flattening patches into a naive 1D line.
  • Zero-FLOP Hardware Routing: You don't actually need an arithmetic unit to shift bits. Shift offsets are precomputed once at initialization and cached; at runtime, the shift is just a memory-pointer offset (an indexed gather), leaving queries and keys strictly binary.

Datasets

The authors evaluate BitShift-RoPE across three modalities (no new datasets are introduced, testing instead on established benchmarks):

  • Time-Series Forecasting: Metr-LA, PEMS-BAY, Solar, and Electricity (across horizons of 6, 24, 48, and 96 steps).
  • Text Classification: MR, Subj, SST-2, and SST-5.
  • Image Classification & Segmentation: Static datasets (CIFAR10, CIFAR100, Tiny-ImageNet), neuromorphic event-camera datasets with spatio-temporal dynamics (CIFAR10-DVS, DVS128-Gesture), plus Oxford-IIIT Pet segmentation.

Key Insights and Ideas

  • Cyclic shifts are frequency-domain rotations: Via the Discrete Fourier Transform, a spatial cyclic shift is mathematically diagonalized into complex phase rotations ($e^{-im\theta_r}$). While it spaces frequencies uniformly rather than exponentially like continuous RoPE, it preserves the exact relative shift-difference algebra while keeping values strictly binary.
  • The hidden trap of XNOR: In hardware, an XNOR gate is just as cheap as an AND gate. Yet prior SNN positional encodings run nearly $3\times$ slower on GPUs than vanilla SNNs. Why? Because XNOR outputs 1 when two 0s match. Since SNN tensors are mostly 0s, XNOR destroys sparsity, turning ultra-lightweight sparse additions into heavy dense accumulations. Preserving AND is everything.
  • Non-accumulating rounding error: Rounding continuous exponential decay schedules into integer bit-shifts inevitably introduces quantization error, but the error is bounded by a single shift step per group—independently of absolute sequence position $m$. Errors don't snowball on long sequences.
Table 1: Computational complexity comparison across positional encoding methods, separated by operator type. N: sequence length, D: feature dimension, K: CPG convolution kernel size, b: Gray-code width. Sparse/dense refers to the density of non-zero terms entering the accumulation.

Key Results

Across every SNN backbone tested (Spikformer, Spikingformer, QKFormer, and SpikeBERT), BitShift-RoPE matches or beats existing SNN positional encodings at zero parameter overhead:

  • Time-Series: Achieves the highest average $R^2$ across all backbones (e.g., 0.758 on Spikformer and 0.748 on QKFormer), outperforming Log-PE in 44 out of 48 test conditions.
  • Text: Reaches 69.91% average accuracy on SpikeBERT. Notably, prior relative SNN PEs (Gray-PE and Log-PE) actually degraded performance below the no-PE baseline (66.55% and 66.94% vs. 68.45%), whereas BitShift-RoPE cleanly improves it.
  • Vision: Reaches 84.17% average accuracy on QKFormer across the five vision benchmarks, and jumps +4.8 percentage points over the best baseline on Spikformer for neuromorphic DVS128-Gesture recognition (93.79%).
  • Efficiency: Under the 45nm Horowitz energy model, BitShift-RoPE consumes 0.216 mJ/sample with 24.70M FLOPs—literally identical to a vanilla Spikformer without explicit relative PE. On PyTorch GPU benchmarks, it runs in 4.06 ms (within 1% of the 4.03 ms baseline), whereas Gray-PE and Log-PE balloon to ~10.9 ms.

Limitations and Future Work

  • Memory Footprint at Extreme Contexts: Caching precomputed routing indices takes $\mathcal{O}(N \cdot G)$ memory. For standard lengths ($N = 168$), it is just a few hundred integers, but for foundation-scale SNNs ($N \gg 10^4$), routing tables could strain tight on-chip neuromorphic memory budgets.
  • Rigid Decay Constant: Using a fixed $C = 64.0$ across vision, text, and time-series keeps the method parameter-free, but prevents adapting to domain-specific periodicities (like daily cycles in energy data). Exploring adaptive variants is left for future work.
  • Simulated vs. Silicon Energy: Energy figures come from algorithmic operation-count models rather than physical wall-clock power draws on neuromorphic silicon like Intel's Loihi-2 or IBM's TrueNorth, which the authors highlight as a key next step.

Summary updated

Abstract

Spiking Neural Networks (SNNs) provide energy-efficient computation by using binary, spike-driven additions, but applying transformer architectures remains challenging because SNNs lack an SNN-compatible positional encoding (PE). Current PE methods either rely on floating-point arithmetic, which destroys the fundamental binary nature of SNNs, or fail to accurately capture relative spatial distances. To overcome this, we introduce Bit Shift Rotary Position Embedding (BitShift-RoPE), a relative PE framework that preserves the binary integrity of SNN queries and keys. By replacing the floating-point trigonometric rotations in standard RoPE with discrete cyclic-shift operations via hardware memory-pointer routing, our method achieves zero-FLOP position encoding. We analytically map multi-scale exponential-decay frequencies to integer shift steps and theoretically extend the formulation to 2D orthogonal spaces to capture spatial structure. Crucially, because the binary integrity of the queries and keys is preserved, the subsequent attention calculations rely solely on sparse bitwise AND operations. Our evaluations across time-series forecasting ($R^2$ 0.758), text classification (Acc 69.91\%), and image classification benchmarks (Acc 84.17\%) demonstrate that BitShift-RoPE is consistently at least as good as existing SNN positional encodings while consuming the same energy as the vanilla SNN backbone (0.216 mJ/sample, identical to vanilla Spikformer). The code is available at \url{https://github.com/bigbases/Bit_Shift_RoPE}.
BibTeX
@inproceedings{hong2026bitshift,
  author = {Seung-Kyu Hong and Sangheum Hwang and Hyuk-Yoon Kwon},
  title = {{BitShift-RoPE: Zero-FLOP Relative Positional Encoding for Spiking Neural Network Transformers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=hlVtSHax4T},
}
Figure