Home/Projects

Research · Neural Decoding

Edge ECoG Finger-Flexion Decoder

A causal, quantized decoder that reads finger movement from brain signals and runs in real time on a low-cost ARM board.

  • 0.53Mean decoding correlation (FP32), up from 0.41
  • 0.51Correlation after INT8 quantization
  • 12.6kParameters: the smallest deep decoder on this benchmark
  • <35 msEnd-to-end streaming latency, zero deadline misses

Overview

Most published ECoG decoders are only ever tested offline, with filters that can see into the future and models too large for an implant-class processor. I wanted to know how well you can decode finger movement when the decoder has to be causal, tiny, and actually running on hardware.

I designed and built the full pipeline myself: preprocessing, model, evaluation protocol, training, scoring, and export. The model is ECoGFlexNet, a ~12,600-parameter temporal convolutional network with channel attention. I trained it on all three subjects of BCI Competition IV Dataset 4 and deployed it to a Radxa Zero 3W single-board computer.

Getting the evaluation right

  • Rebuilt the training and evaluation pipeline to remove data leakage and match the official competition test splits. That fix alone lifted mean correlation from 0.41 to 0.53.
  • Found and corrected four subtle causality defects in the redesign: group delay from causal target smoothing, a look-ahead leak inside the attention block, train and test segments filtered independently, and a staircase artifact from 20 Hz emission.
  • Rejected "best seed" reporting as test-set selection, which would have inflated results by about 0.021. I report a three-seed ensemble as a separate row instead.

Deploying to the edge

  • Quantized to 8-bit integers and exported through ExecuTorch / XNNPACK to an RK3566 (aarch64) board. Correlation held at 0.51.
  • Built an on-device latency harness with four modes (verify, burst, paced, soak). Model median latency is 5.0 ms at about 29.5 MMAC/s.
  • Verified that preprocessing is bit-identical in batch and streaming modes. This is the only work on record for this benchmark that pairs that guarantee with measured deadline-miss statistics.
  • Brought the board up from scratch: flashed Ubuntu, built ExecuTorch for aarch64, resolved a PyTorch ABI mismatch, and traced an SD-card boot failure to the power supply.

Why it matters

The contribution is deployment rigor and efficiency rather than a leaderboard number. A decoder that is honest about causality and proven against real-time deadlines is much closer to something that could run next to a patient.

Code and preprint links will be added here once the manuscript is submitted.