Signal-Quality Routing: Flash-Resident Experts for Microcontroller EEG Decoders

Wearable brain-signal decoders run on microcontrollers that have plenty of slow flash storage, often megabytes, but only about 128 KB of fast working memory (SRAM). Their inputs are dominated by noise. A scalp EEG signal of a few tens of microvolts routinely sits under eye blinks, jaw-muscle bursts and electrode shifts that are one to three orders of magnitude larger. Today's deployed decoders respond to both problems the same way: they shrink one dense network until it fits in SRAM and run the whole thing on every window. This proposal takes a different route. We store several small specialist networks ("experts") in flash, one for each kind of signal corruption. Before any neural computation starts, a very cheap router looks at simple signal-quality statistics of the incoming window and picks one expert. Only that expert is copied into SRAM and executed. The device therefore holds several times more learned parameters than fit in working memory, while each window still costs the SRAM, compute and energy of a single small model.

The two-sentence version is this. A mixture of experts (a model made of several sub-networks, where a small selector sends each input to only one or a few of them) is usually useless on a microcontroller, because the selector's decision arrives mid-network, too late to fetch weights from slow memory. If the selector instead decides once per window from physical noise measurements, the choice is known in advance, weight loading overlaps with computation, and experts can specialize to noise conditions that one tiny dense network handles poorly.

Core Claim

We claim that routing on signal quality is the specific ingredient that makes conditional computation (running only an input-dependent part of a model) pay off on sub-milliwatt biosignal hardware. The benefit comes from two things together. Signal quality can be estimated with a few arithmetic operations per sample, so the routing decision can be made before the network runs. Different corruption regimes also call for different computations: an expert for jaw-clench windows should learn to discount high-frequency bands and temporal channels, while an expert for blink windows should discount frontal low-frequency content. The testable prediction is as follows. At matched active multiply-accumulates, matched peak SRAM and matched energy per window, a pre-routed set of four to eight EEGNet-sized experts beats a single EEGNet trained on the same artifact-augmented data when evaluated under realistic artifacts. It should lose nothing on clean data. Its routing overhead, including flash-to-SRAM copying, should stay below roughly ten percent of per-window energy.

Where This Sits

The motivating evidence comes from edge deployments. An Accurate EEGNet-based Motor-Imagery Brain-Computer Interface for Low-Power Edge Computing puts EEGNet on a Cortex-M4F and finds that SRAM, not flash, is the binding constraint. Its feature maps exceed 1 MB against 128 KB of RAM, which forces fixed downsampling and channel pruning. Q-EEGNet solves the memory problem for one dense topology through 8-bit quantization and column-interleaved execution on the PULP "Mr. Wolf" RISC-V chip. Both leave flash capacity unused and run identical computation on clean and corrupted windows. We reuse their deployment techniques and add input-dependent expert selection.

The method is borrowed from server-scale mixture-of-experts work. Read-ME moves the router in front of a language model so the full expert path is known before execution, which enables prefetching and cache planning (up to 30% serving-latency improvement). We apply the same decoupling at window granularity and in the flash-to-SRAM hierarchy of a microcontroller rather than GPU memory. We also replace the learned token router with physical quality features. SpeechMoE2 shows that feeding global acoustic-domain context into the router helps under noisy conditions. Our router input plays a similar role, but it is computed directly from the raw signal rather than from a learned multi-task embedding.

The closest neural-signal mixtures of experts cannot run on a microcontroller. Uni-NTFM uses sparse expert layers in a 1.9B-parameter EEG model with about 307M active parameters. MoRE-Brain routes fMRI brain regions to experts, and its routers alone can be recalibrated for a new subject. Both route on learned semantic features, not signal quality, and both run on GPUs. We take MoRE-Brain's router-only calibration idea as a secondary experiment.

Mixture of checkpoint experts for explainable seizure detection using wearable devices is the nearest wearable precedent: logistic-regression gates over hand-built features choose among saved training checkpoints. Its experts are snapshots of a single model and are not trained to specialize. Its gate serves accuracy only, and there is no on-device energy measurement. Our experts are trained jointly to specialize, and our router exists as much to schedule memory as to improve accuracy.

Two constraints shape the design. Compute-Optimal Is Not Cluster-Optimal warns that sparsity which saves operations can lose on real memory systems. We therefore report measured energy including weight movement, never operation counts alone. The file also identifies unstable routing under noise as an open problem. If experts switch every window, weight reloading becomes a real cost, so we measure switching rate directly. The mixed-bit-width arrhythmia ASIC shows that conditional precision can reach 10.60 μW. Its conditioning, however, is a static per-layer schedule, whereas ours depends on each input window.

Research Program

The model has three parts. First, a shared temporal-convolution stem runs on every window. It is kept small enough to stay resident in SRAM. Second, there are $K$ expert tails, with $K$ between 4 and 8. Each tail has EEGNet's depthwise-spatial, separable-convolution and classifier structure, and all tails are stored in 8-bit form in flash. Third, a router maps a quality descriptor $q(x)$ to a single expert choice. The descriptor contains, per channel, log band power in four bands, the fraction of samples near amplifier saturation, line length, and first-difference energy. The first-difference feature follows the drift-removal step in the Enhanced Fusion Framework. Computing $q(x)$ costs $O(CT)$ operations for $C$ channels and $T$ samples, which is negligible next to a convolution. The router is a linear layer followed by an argmax. Because the choice is made at time zero, copying expert $k$ from flash into SRAM overlaps with running the stem.

The quantity we optimize and report is energy per window:

$$E = E_q + E_{\text{stem}} + (1-\rho)\,E_{\text{load}} + E_{\text{expert}},$$

Here $E_q$ is the energy for computing quality features, $E_{\text{stem}}$ and $E_{\text{expert}}$ are the compute energies of the shared stem and the chosen expert, $E_{\text{load}}$ is the energy of copying one expert from flash, and $\rho$ is the fraction of windows that reuse the previous window's expert, so no copy is needed. The comparison point is a dense EEGNet's energy, which roughly equals $E_{\text{stem}} + E_{\text{expert}}$. The overhead that must be won back is therefore $E_q + (1-\rho)E_{\text{load}}$.

Training runs end to end. The discrete choice is relaxed with a straight-through estimator, and a load-balancing penalty prevents all windows from collapsing onto one expert. We compare two router training schemes. In the unsupervised scheme, experts discover regimes on their own. In the supervised scheme, an auxiliary loss uses known artifact-injection labels (clean, ocular, muscular, electrode-pop or dropout). A small penalty on switching between consecutive windows directly increases $\rho$.

Artifacts are injected by adding real artifact segments from the Temple University artifact corpus (TUAR, part of the TUH collection used in Beyond Hearing) to clean trials at controlled signal-to-noise ratios. Artifact recordings are split by patient so that no test artifact is seen in training. DailySense provides naturally occurring free-living artifacts with no injection at all.

Baselines

The naive reference is the dense EEGNet as deployed. On BCIC-IV-2a we use the Q-EEGNet configuration, which reports 70.9% four-class accuracy at 0.627 mJ and 5.82 ms per inference on Mr. Wolf (Q-EEGNet). On Physionet motor imagery we use the Cortex-M4F EEGNet, which reports 65.07% accuracy at 4.28 mJ and 101 ms (Edge EEGNet). We retrain both ourselves under our splits and our artifact conditions, and we also report their published numbers.

The strongest competitor on our specific question is a single dense EEGNet of the same active size, trained on exactly the same artifact-augmented data with the same epochs and hyperparameter search budget. If this model matches ours, the benefit came from augmentation and not from experts. Beating it means a gain under artifacts larger than the spread across five seeds, together with no loss on clean data.

A second dense baseline uses the whole flash budget: one wider model with the same total parameter count as all experts combined, executed by streaming weights layer by layer from flash. It shows what the extra parameters buy without routing, at higher energy. We compare on an accuracy-versus-measured-energy curve.

For accuracy ceilings without edge constraints, we cite EMF at 83.15% (EMF) and EEG-DG at 81.79% (EEG-DG) on BCIC-IV-2a, and PiMT at 87.6% within-subject and about 58% cross-subject F1 on DailySense (Beyond Hearing). We do not expect to match these ceilings on a microcontroller, and they are not success criteria.

Three ablations isolate the key ingredient. The first uses a standard learned router that decides from stem activations instead of quality features, which removes the head start for prefetching. The second uses random fixed routing, which keeps the capacity but removes specialization. The third is a uniform ensemble that runs all $K$ experts and averages them, giving an upper bound at $K$ times the compute.

Why not just…?

Why not just train one small dense network on artifact-augmented data? This is the real threat. A network of EEGNet's size may already learn implicit per-regime behavior. The matched-augmentation dense baseline tests this directly. If it comes within seed noise of our model on held-out-artifact test sets, we will report that experts add nothing at this scale. We would then refocus the flash-resident idea on router-only per-user calibration, where it could still help.

Why not just detect bad windows and skip them? A quality gate that discards corrupted windows saves energy and avoids errors, and it costs almost nothing. It also silences the device during exactly the free-living periods, such as chewing, talking or walking, when wearable decoding matters. We compare accuracy against coverage for rejection thresholds swept across the full range. Our model must dominate that curve at full coverage. We also include rejection of the router's "unusable" regime as an optional mode.

Why not just clean the signal first? Component-based artifact removal is too expensive for these chips. Cheap filters, such as first differencing or band-pass filtering, can be prepended to every baseline, and we do so. That keeps the comparison about per-regime computation rather than about preprocessing.

Why not just use a standard mixture of experts with a learned router? Its routing decision depends on intermediate activations, so weights cannot be fetched early. Read-ME's server results suggest this matters, but that is not evidence for microcontrollers. The learned-router ablation, measured on hardware with load stalls included, answers this question.

Proposed Experiments

We run BCIC-IV-2a and Physionet motor imagery with TUAR artifacts injected at signal-to-noise ratios from clean down to −10 dB. We also run DailySense with its native artifacts, cross-subject, since its reported drop from about 87% to about 58% F1 marks a clear stress test. Metrics are accuracy or kappa (F1 for DailySense), measured energy per window, peak SRAM, flash footprint, latency, expert-switching rate and load balance. Hardware targets are an STM32 Cortex-M4F and a PULP-class RISC-V chip, matching the two cited deployments.

Three results would decide the proposal. First, under held-out artifacts, the routed model beats the matched-augmentation dense EEGNet at equal peak SRAM and within 10% of its measured energy. Second, on clean trials it is not worse by more than seed spread. Third, the supervised quality router either matches the unsupervised one or clearly beats it, which tells us whether experts truly align with noise regimes. We check this alignment by inspecting which artifact types each expert receives.

A secondary check tests router-only calibration in the style of MoRE-Brain. With the experts frozen and only the linear router refit on one short session from a new DailySense subject, we measure whether the cross-subject gap narrows. This is a calibration step small enough to run on the device itself. If the first decisive check fails, the negative result is still useful: it would show that at microcontroller scale, the capacity argument for mixtures of experts does not survive realistic training baselines.