TL;DR
Lapis introduces a multiplication-free spiking attention mechanism for Spiking Vision Transformers (Spiking ViTs) by computing token relationships directly from spike timing. By measuring the $\ell_1$ distance between first-spike latencies and mapping it to a Laplacian kernel, Lapis aligns attention computation with native neuron membrane leakage dynamics, slashing attention path arithmetic energy by 14.5× while maintaining top-tier accuracy on ImageNet.
What Problem Does This Paper Address?
Spiking Neural Networks (SNNs) offer a brain-inspired, energy-efficient alternative to traditional deep learning by processing information through sparse, binary events called spikes. As Vision Transformers (ViTs) have come to dominate computer vision, researchers have tried to port their core mechanism—self-attention—into the spiking domain.
However, standard self-attention relies heavily on continuous-valued dot-product operations (Query $\times$ Key). Existing spiking attention variants usually force this square peg into a round hole by either binarizing the vectors or replacing multiplications with simple additions or masks. The fundamental issue is that these methods treat spikes merely as a computational constraint. They completely ignore spike timing—the native temporal representation of SNNs—as a way to define how tokens relate to one another.
Methods
The authors propose Lapis, a spiking attention mechanism built entirely around Time-to-First-Spike (TTFS) coding and neuronal membrane dynamics.
Here is how it works step-by-step:
- TTFS Encoding: Activation values are translated into time delays. A higher activation value results in an earlier spike (lower latency), while zero activation means no spike at all.
-
Temporal Distance Scoring: Instead of multiplying Query and Key matrices, Lapis computes the $\ell_1$ distance between their first-spike latency vectors: $$D_{ij} = \|t_i^Q - t_j^K\|_1$$ Because this only measures the absolute differences between firing times, it requires only subtraction, absolute value, and accumulation—zero multiplications.
-
Laplacian Kernel via Membrane Leakage: To turn this temporal distance into an attention affinity score, Lapis applies a Laplacian kernel ($e^{-D/\tau}$). The authors brilliantly note that this exponential decay function exactly matches the physical subthreshold decay (leakage) of a Leaky Integrate-and-Fire (LIF) neuron membrane. The computation of the exponential decay is therefore naturally induced by the leakage process itself.
- Shift-Based Normalization: Standard attention uses Softmax, which requires expensive division. Lapis rounds the row sum of the affinities to the nearest power of two. In fixed-point hardware, dividing by a power of two simplifies to a trivial bit shift operation.
Datasets
The authors evaluated Lapis across three standard computer vision benchmarks:
- CIFAR-10
- CIFAR-100
- ImageNet-1K (for large-scale validation)
Key Insights and Ideas
- Time as the Universal Currency: Instead of forcing SNNs to approximate dense floating-point matrix multiplications, Lapis shifts the relation space entirely to the temporal domain. Token similarity is defined by how closely aligned their firing patterns are in time.
- Algorithm-Hardware Synergy: The choice of a Laplacian kernel isn't just mathematically convenient; it perfectly mirrors the physical/simulated dynamics of an SNN's membrane leakage. This means the hardware's natural state decay is the attention calculation.
- Ditching Softmax Safely: The paper proves (via Lemma 1) that approximating row normalization with power-of-two scaling preserves the relative ordering of token affinities while bounding the error tightly within $[1/\sqrt{2}, \sqrt{2}]$, removing the need for complex digital dividers.
Key Results
Lapis bridges the performance gap between energy-efficient SNNs and dense ANNs while delivering massive energy savings:
- High Accuracy: On CIFAR-10, Lapis-S achieves 96.56% top-1 accuracy, coming within 0.53 points of dense dot-product attention. On the massive ImageNet-1K dataset, Lapis-L achieves an impressive 83.39% top-1 accuracy.
- Massive Energy Reductions: Under a standard 45-nm hardware operation model, Lapis reduces the estimated arithmetic energy of the attention path by 14.5× compared to dense dot-product attention (dropping from 100.01 mJ to 6.92 mJ).
- Ultra-Low Power Deployment: When the model's weights are quantized to 6-bit (Lapis-L W6), the total network energy drops to just 3.28 mJ per image while still retaining 83.25% top-1 accuracy on ImageNet—making it the lowest estimated inference energy among all evaluated models above 83% top-1.
Limitations and Future Work
While Lapis achieves remarkable results, the authors note a few areas for expansion:
- Quantized Training Dependency: Lapis relies on a quantized neural network (QNN) training framework followed by an exact conversion to TTFS spiking networks for inference, rather than training natively from scratch with surrogate gradients.
- Domain Scope: The current work focuses strictly on vision transformers (classification tasks). Adapting this temporal-distance attention mechanism to spiking language models or complex spatiotemporal tasks (like video processing or event-camera data) remains an open and exciting direction.
Summary updated