Online Transformers with Spiking Neurons for Fast Prosthetic Hand Control

Nathan Leroux, Jan Finkbeiner, Emre Neftci

Abstract

Translating human intent into fluid robotic movement remains a primary challenge in the development of upper-limb prosthetics. While Transformer architectures have set new benchmarks in sequence modeling, their high computational cost and inherent latency have limited their utility in real-time, battery-constrained wearable devices. This paper introduces a novel "Online Transformer" architecture that integrates sliding window attention with Spiking Neural Networks (SNNs). By leveraging the temporal sparsity of Leaky-Integrate and Fire (LIF) neurons and a linearized attention mechanism, the proposed model achieves state-of-the-art accuracy on the NinaproDB8 benchmark with a 3.5ms latency and a 5.3x reduction in computational operations.

Introduction

Modern prosthetic hands rely on surface Electromyography (sEMG)—the recording of electrical activity from residual muscles—to predict intended finger movements. To be effective, these systems must be both accurate and instantaneous. However, a significant trade-off exists in current research: high-performing models like standard Transformers often require large windows of data (typically >150ms) to achieve high accuracy, introducing a perceptible lag for the user. Furthermore, the quadratic computational complexity $O(N^2)$ of self-attention mechanisms poses a significant drain on the limited power supplies of wearable medical devices.

To bridge this gap, this research presents an architecture that combines the long-range dependency modeling of Transformers with the biological efficiency of SNNs, specifically optimized for "online" or stream-based processing.

Methodology

The authors propose three primary architectural innovations to transform the standard Transformer into a real-time, low-power engine for sEMG processing:

1. Online Sliding Window Attention

Standard self-attention is "offline," meaning it processes an entire sequence at once. The researchers implemented a linearized attention mechanism that utilizes a sliding window. Instead of re-calculating the entire sequence, the model processes one token (a discrete slice of the sEMG signal) at a time while maintaining a fixed-size memory ($M$) of past keys and values. This modification reduces the computational complexity from quadratic to linear ($O(MN)$), enabling continuous, low-latency inference.

2. Integration of Spiking Neurons

The model incorporates Leaky-Integrate and Fire (LIF) units, which mimic the behavior of biological neurons. Unlike traditional artificial neurons that output continuous values, LIF units only emit a binary "spike" when their internal membrane potential reaches a specific threshold. This introduces temporal sparsity; the network only performs heavy computation when significant information is present in the signal, drastically reducing the total number of operations.

3. Binarization for Efficiency

To further optimize the model for hardware deployment, the researchers binarized the projections for the Queries, Keys, and Values ($Q, K, V$). By converting expensive floating-point multiplications into simpler bitwise operations, the architecture becomes significantly more amenable to low-power neuromorphic hardware.

Experimental Setup

The architecture was validated using the NinaproDB8 dataset, a standard benchmark for kinematic finger position estimation. The dataset includes:

  • Subjects: 12 participants (10 able-bodied and 2 trans-radial amputees).
  • Input Data: 16 channels of sEMG signals sampled at 2 kHz.
  • Target Output: Continuous regression of 5 Degrees of Actuation (DoA), representing the joint angles of the fingers.

Results and Discussion

The "Online Transformer" demonstrated superior performance across accuracy, speed, and efficiency metrics:

  • State-of-the-Art Accuracy: The model achieved a Mean Absolute Error (MAE) of 6.08°, outperforming the previous leading model, TempConv (6.89°).
  • Ultra-Low Latency: The system achieved a minimum inference window of just 3.5ms. This represents a 30x improvement over the previous state-of-the-art Temporal Convolutional Network, which required a 128ms window. Such low latency is crucial for making a prosthesis feel like a natural extension of the body.
  • Computational Sparsity: By utilizing spiking dynamics, the model reduced the number of Multiply-And-Accumulate (MAC) operations by a factor of 5.3x compared to a non-spiking version of the same architecture.

The Importance of Locality

A key insight from the study is that for muscle signals, "global" context can be counterproductive. The researchers found that there is an optimal memory length for sEMG signals; looking too far into the past actually increases error. This finding validates the sliding window approach, suggesting that local temporal dependencies are the most critical factors in movement intent.

Conclusion and Future Work

This research demonstrates that the high performance of Transformers can be successfully married to the efficiency of Spiking Neural Networks for real-time robotics. While the theoretical efficiency gains are significant, the authors identify several paths for future development. Currently, the model is trained independently for each subject; future iterations could utilize transfer learning to create a "universal" base model that adapts quickly to new users. Additionally, while the mathematical reduction in operations is clear, the next step involves deploying these models on specialized neuromorphic hardware, such as Intel’s Loihi, to realize actual power savings in a wearable form factor. Finally, addressing the "softmax bottleneck"—the non-spiking nature of the attention normalization—remains a priority for achieving a fully spiking, end-to-end architecture.

Summary updated

Abstract

Fast and accurate online processing is essential for smooth prosthetic hand control with Surface Electromyography signals (sEMG). Although transformers are state-of-the-art deep learning models in signal processing, the self-attention mechanism at the core of their operations requires accumulating data for large time-windows. They are therefore not suited for online signal processing. In this paper, we use an attention mechanism with sliding windows that allows a transformer to process sequences element-by-element. Moreover, we increase the sparsity of the network using spiking neurons. We test the model on the NinaproDB8 finger position regression dataset. Our model sets its new state-of-the-art in terms of accuracy on NinaproDB8, while requiring only very short time windows of 3.5 ms at each inference step, and reducing the number of synaptic operations up to a factor of ×5.3 thanks to the spiking neurons. Our results hold great promises for wearable online sEMG processing systems for prosthetic hand control.
BibTeX
@inproceedings{leroux2023online,
  author = {Nathan Leroux and Jan Finkbeiner and Emre Neftci},
  title = {{Online Transformers with Spiking Neurons for Fast Prosthetic Hand Control}},
  booktitle = {BioCAS},
  year = {2023},
  url = {https://openreview.net/forum?id=S7wNNPh3M5},
}
Figure