betaFeedback

WorksComputer Science

EEG2MCU: Sensing-to-Execution Co-Design for Wearable EEG Inference

Abstract

Wearable EEG inference is constrained not only by model size, but also by the channel-dependent sensing front end that must process high-dimensional inputs before compact downstream computation. We present EEG2MCU, a sensing-to-execution co-design framework that treats electrode count as a hardware design variable through task-aware montage selection. EEG2MCU retains a compact time-frequency representation and generates only the INT8 regions required by each first-layer tile, avoiding full input materialization. Halo reuse and access-aware placement across Flash, SRAM, and tightly coupled memory further reduce redundant generation and data movement. On a Cortex-M7 MCU, EEG2MCU reduces peak SRAM by 11.38x relative to the baseline, including a 1.71x reduction from the 62-to-19 electrode montage, while reducing latency by 2.57x and energy by 2.48x. It retains 94-96% of full-montage accuracy, demonstrating practical high-dimensional EEG inference under tight embedded-resource constraints.

Introduction

Wearable electroencephalography (EEG) supports continuous neurological monitoring, seizure detection, affective computing, and brain–computer interfaces (BCIs) [1]. In wearable neurotechnology and Internet-of-Medical-Things (IoMT) systems, running inference on the sensing device itself reduces wireless communication, response latency, privacy exposure, and battery drain. Yet EEG models have grown from compact CNNs such as EEGNet and DeepConvNet [2, 3] to convolution–attention, self-supervised, foundation, and state-space architectures [4, 5, 6, 7, 8, 9], widening the mismatch with the SRAM, bandwidth, compute, and energy budgets of wearable-class microcontrollers (MCUs).

Prior work narrows this gap through compact architectures, knowledge distillation, channel reduction, and optimized MCU kernels [10, 11, 12, 13], but optimizes the network only after the sensing interface and model input are fixed. This hides the dominant cost for EEG: a high-density recording spans many electrodes, and the resulting multi-channel time–frequency representation must be generated, stored, moved, and consumed by the front end. A model with a modest parameter count thus becomes undeployable once its first layer encounters a channel-dependent working set that exceeds the memory budget or dominates execution time. We argue that EEG deployment must be optimized from the sensing interface onward, treating electrode dimensionality as a design variable rather than a fixed property of the input.

Our layer-wise analysis reveals a strongly front-loaded profile: the channel-dependent first layer holds the largest activation working set and consumes a disproportionate share of computation and latency, while later layers operate on progressively compressed representations. This is not architecture-specific. CNN, Transformer, and state-space EEG models alike open with a convolutional stem that reads every electrode at full resolution, so all meet the same working set before their backbones diverge. The front end is therefore a feasibility gateway: deployment requires that the peak resident working set fit in SRAM and that end-to-end execution, including representation generation, finish within the EEG window. This makes deployment a joint memory–latency feasibility problem that backbone compression alone cannot solve.

To mitigate this, we propose EEG2MCU, a sensing-to-execution co-design framework (see Figure 1). Our electrode-level sensitivity analysis derives a deployment-oriented montage under spatial-coverage and hardware constraints, reducing the channels acquired and processed; unlike post-acquisition feature pruning, this acts at the sensing interface and so lowers input dimensionality, first-layer computation, and memory traffic at once. We further avoid materializing the expanded time–frequency tensor: the compact short-time Fourier transform (STFT) representation stays resident while we fuse interpolation and INT8 quantization with first-layer execution, generating only the rows the current tile requires. Memory-constrained tiling makes the layer executable under tight SRAM limits, and halo reuse with access-aware placement across Flash, SRAM, and tightly coupled memory cuts redundant generation and data movement. Because the stem is shared, these gains transfer across backbones; models still exceeding the node budget can offload remaining layers to a nearby hub [14]. Our main contributions are as follows:

Figure 1. EEG2MCU system overview. Offline co-design selects a hardware-feasible 19-electrode montage, while the wearable MCU streams the compact STFT through tiled first-layer execution.

  • First-layer MCU characterization. We identify the electrode-dependent first layer as the dominant memory and latency bottleneck across all evaluated EEG model families, reaching 87.1% of end-to-end latency and 80.5% of computation at 62 electrodes.

  • Saliency-guided montage co-design. We treat electrode configuration as an algorithm–hardware design variable; our sensitivity analysis derives a deployment montage under spatial-coverage and MCU constraints, cutting front-end computation 3.26× at 19 of 62 electrodes while retaining 94–96% of full-montage accuracy.

  • Streaming & locality-aware execution. We jointly optimize on-demand generation, INT8 tiling, halo and buffer reuse, and hierarchy-aware scheduling, cutting peak SRAM by 66% (1374.4 KiB to 464.9 KiB) and reducing latency by 10.5% and energy by 13.0% on a Cortex-M7 MCU.

Related Work

EEG Neural Networks: EEG models span task-specific CNNs and attention-based architectures [2, 3, 4, 15] and pretrained foundation and state-space models [5, 6, 9, 16, 17, 18, 19, 20]. Despite their diverse backbones, front-end cost often scales with electrode count CC. In CNNs, early temporal or time–frequency activations grow approximately linearly with CC, creating peak-memory and compute bottlenecks; in patch-based models, NtN_t patches per electrode produce O(CNt)O(CN_t) tokens [6, 16]. Unlike approaches that primarily optimize the model architecture, EEG2MCU co-designs the sensing montage and channel-dependent front end through saliency-guided electrode selection, streamed input generation, and memory-constrained first-layer execution, providing a common optimization across CNN, Transformer, and state-space models.

Deployment Frameworks: MCU deployment is enabled by optimized libraries and runtimes such as CMSIS-NN, TensorFlow Lite Micro, and PULP-NN [13, 21, 22]. Memory-aware frameworks further improve feasibility: MCUNet co-designs architectures and execution schedules [12], MCUNetV2 uses patch-based execution to reduce early-layer activations [23], DORY automates tiling and transfers across hierarchical memories [24], and TinyOps partitions data between internal and external memory using DMA [25]. MLonMCU supports retargeting and benchmarking across TinyML stacks [26]. Complementing these execution-focused approaches, EEG2MCU co-designs electrode selection, streamed representation generation, and tiled first-layer execution to reduce channel-dependent work and avoid materializing the expanded EEG input across different downstream model families.

Proposed Method

EEG2MCU optimizes the channel-dependent EEG front end across three coupled levels. The sensing level sets how many electrode streams are acquired; the representation level retains the compact STFT and expands it only as the executing operator requires; the execution level partitions the first convolution to available SRAM and schedules it for locality across the MCU memory hierarchy. These levels cannot be optimized independently: reducing electrode count changes the first-layer working set, tiling creates SRAM headroom for faster tensor placement, and streamed generation removes an allocation that would otherwise dominate the memory budget.

Signal Representation and Deployment Backbones

We build on the EEG preprocessing pipeline in [27] and redesign its sensing front end for resource-constrained deployment. As shown in Figure 3, each recording is segmented into non-overlapping 4-s windows, and each channel is bandpass filtered to 1–50 Hz, notch filtered at 50 or 60 Hz (Q=30Q = 30), baseline corrected, and zz-normalized. An STFT [28] with a 256-sample Hann window and 75% overlap gives a power spectrogram ScS_c for each electrode cc, which is kept to 1–50 Hz and log-scaled as S^c=log⁡10(Sc+10−10)\hat{S}_c = \log_{10}(S_c+10^{-10}). We resize the spectrogram to 128×128128 \times128 with endpoint-aligned bilinear interpolation, which keeps the outermost bins on the grid edges.

EEG2MCU preprocessing pipeline

Figure 3. EEG2MCU preprocessing pipeline. Raw multichannel EEG is segmented into 4-s windows, filtered and normalized per channel, and aligned to the 19-electrode deployment montage to form the 19×128×12819 \times128 \times128 model input.

The electrode-dependent cost is concentrated in the first layer, the only layer that reads all CC channels (Figure 2). For deployment, we therefore place a common first layer in front of CNN, Transformer, and Mamba backbones (Figure 4), so the same montage-aware and MCU optimizations apply to all of them. Once this layer fits the MCU memory and latency budget, the remaining layers run with their standard operators. If the full model still exceeds the node budget, the remaining layers run on a nearby resource-rich hub. The wearable runs the first layer and the early backbone layers, where the activations are already compressed. For EfficientFormer this is a 2.75 KiB tensor at the stage-4 FFN boundary, about 110× smaller than the model input; for Mamba it is a 5.0 KiB tensor after the third bidirectional selective-scan block, about 61× smaller.

Per-layer peak memory and MACs for SE-ResNet-8 with 62 electrodes

Figure 2. Per-layer peak memory (top) and MACs (bottom, zero-MAC layers omitted) for SE-ResNet-8 with 62 electrodes, log scale. The first layer dominates both: 1374.4 KiB against the 1024 KiB AXI-SRAM budget, and 80.5% of all MACs, about 21 times the next-largest layer.

Figure 4. Evaluated model families. All models share a common first layer that consumes the full multi-electrode input and constitutes the primary MCU feasibility bottleneck, followed by a CNN/Transformer/Mamba backbone and a classification head.

Low-power communication modalities such as Wi-R can make this transfer inexpensive: reported energy is below 100 pJ/bit, compared with more than 15 nJ/bit for Bluetooth [29]. The hub has much more memory than the MCU, so the remaining layers fit there and the hub completes the inference.

Montage-Aware Streaming Input Generation

Saliency-guided montage co-design. EEG2MCU therefore treats the electrode montage itself as an algorithm–hardware co-design variable. We first determine a hardware-feasible electrode budget according to the memory and latency constraints of the target MCU. Within this budget, electrode-level sensitivity analysis of the full-channel model is combined with spatial coverage constraints to retain sensing locations that are both task-relevant and spatially representative. The deployment montage is selected by maximizing electrode-level relevance subject to spatial coverage:

S∗=arg⁡max⁡S ∑c∈Srcs.t.∣S∣=Cbudget,S∈Ccov,(1)S^{*} = \underset{S}{\arg\max}\ \sum_{c\in S} r_c \quad\text{s.t.}\quad|S| = C_{\mathrm{budget}},\quad S \in\mathcal{C}_{\mathrm{cov}}, \tag*{(1)}

where rcr_c denotes electrode saliency computed from the trained full-channel model using only the training split, and Ccov\mathcal{C}_{\mathrm{cov}} denotes the set of montages satisfying the spatial-coverage constraint. We approximate this selection greedily, prioritizing salient electrodes while maintaining scalp coverage. We set Cbudget=19C_{\mathrm{budget}} = 19 to enable comparison with the standard 19-electrode montage while meeting the 4-s inference window, which all evaluated 62-electrode configurations exceed (Table I). The resulting montage reduces the channel-dependent first-layer workload by 3.26×3.26\times.

On-demand representation generation. Montage reduction decreases front-end computation, but conventional preprocessing still constructs the complete high-resolution time–frequency representation before inference. This creates a large temporary activation whose lifetime extends until the first layer begins execution. As illustrated in Figure 5, EEG2MCU instead retains the compact post-STFT representation and generates only the region required by the currently executing first-layer tile:

Figure 5. Standard (left) versus streamed tiled (right) first-layer execution. Per-tile interpolation and quantization replace full FP32/INT8 input materialization with a bounded INT8 tile buffer.

Csel×Nf×Nt⏟compact FP32⟶h×W×Csel⏟INT8 tile,(2)\underbrace{C_{\mathrm{sel}}\times N_f\times N_t}_{\text{compact FP32}} \longrightarrow \underbrace{h\times W\times C_{\mathrm{sel}}}_{\text{INT8 tile}}, \tag*{(2)}

where CselC_{\mathrm{sel}} is the selected montage size, NfN_f and NtN_t are the retained frequency bins and time frames, HH and WW are the model input dimensions, and hh is the number of input rows required by the current convolution tile. Spatial interpolation and quantization are fused with tile generation, and the resulting values are written directly into the first-layer input buffer. The full expanded representation therefore exists only

logically and is never simultaneously materialized in SRAM. Note that this formulation is independent of a specific input resolution or electrode count. Conventional materialization requires Mfull=HWCselbaM_{\mathrm{full}} = HWC_{\mathrm{sel}}b_a, whereas streamed execution requires only Mstream=hWCselba+CselNfNtbsM_{\mathrm{stream}} = hWC_{\mathrm{sel}}b_a + C_{\mathrm{sel}}N_fN_tb_s, where h≪Hh \ll H is the currently required tile height, and bab_a and bsb_s are the activation and storage precisions respectively. EEG2MCU therefore exchanges a long-lived expanded activation for a compact persistent representation and a short-lived tile buffer.

Efficient interpolation and fused quantization. Let S^i,j\hat{S}_{i,j} denote the compact FP32 STFT value at frequency bin ii and time bin jj for a given electrode. A location (r,u)(r,u) in the expanded H×WH \times W model input maps to y=rNf−1H−1y = r\frac{N_f-1}{H-1}, and x=uNt−1W−1x = u\frac{N_t-1}{W-1}. Because the source and target dimensions are fixed at deployment, the indices i=⌊y⌋i = \lfloor y\rfloor and j=⌊x⌋j = \lfloor x\rfloor and fy=y−if_y = y-i and fx=x−jf_x = x-j are precomputed during initialization; upper-neighbor indices are clamped at the boundaries. For each electrode, bilinear interpolation is implemented as two successive one-dimensional interpolations:

aj=(1−fy)S^i,j+fyS^i+1,j,vj=(1−fx)aj+fxaj+1.(3)a_j = (1-f_y)\hat{S}_{i,j} + f_y\hat{S}_{i+1,j},\qquad v_j = (1-f_x)a_j + f_xa_{j+1}. \tag*{(3)}

where aja_j is the intermediate frequency-axis interpolation and vjv_j is the final interpolated FP32 value. For each output row and electrode, intermediate values are reused as the output columns advance, reducing arithmetic and source-memory accesses.

The generator follows a row–electrode–column traversal and writes each result directly into a reusable INT8 buffer for the current tile, stored in NHWC (batch–height–width–channel) order as required by the first-layer convolution. Each interpolated value is immediately quantized as

qj=clip⁡(round⁡(vjsin−1)+zin,−128,127),(4)q_j = \operatorname{clip}\left(\operatorname{round}\left(v_j s_{\mathrm{in}}^{-1}\right)+z_{\mathrm{in}},-128,127\right), \tag*{(4)}

where sins_{\mathrm{in}} and zinz_{\mathrm{in}} are the calibrated input scale and zero point. Interpolation remains in floating point until the final rounding, sin−1s_{\mathrm{in}}^{-1} is precomputed to avoid per-element division, and inputs known to be zero are written directly as zinz_{\mathrm{in}}. This producer–consumer pipeline generates only the elements required by the current first-layer tile and consumes them immediately.

Memory-Constrained INT8 First-Layer Execution

After montage reduction and streamed representation generation, the first layer remains the primary activation-memory bottleneck. EEG2MCU therefore partitions this layer spatially and executes the resulting tiles sequentially using optimized CMSIS-NN INT8 kernels [13]. Related tiled and patch-based execution schemes partition entire layer stacks for accelerators, distributed edge devices, or MCUs [23], [24], [30], [31]; EEG2MCU instead applies tiling only to the channel-dependent first layer and directly couples it with the streamed input generator, as illustrated in Figure 6.

EEG2MCU first-layer memory hierarchy and row-wise tiling

Figure 6. EEG2MCU first-layer memory hierarchy and row-wise tiling. Weights are copied once from Flash to AXI-SRAM, the im2col workspace is placed in DTCM, and the minimum feasible tile count is selected under the SRAM budget; halo rows are reused across adjacent tiles.

Row-wise tiling. Consider a convolution with kernel height KK, stride ss, padding pp, input height HinH_{\mathrm{in}}, input width WinW_{\mathrm{in}}, and CinC_{\mathrm{in}} input channels. EEG2MCU partitions the HoutH_{\mathrm{out}} output rows into NN contiguous tiles, which leaves the arithmetic of every output element unchanged. A tile covering output rows [rs,re][r_s,r_e] requires the input rows [srs−p,sre−p+K−1]∩[0,Hin−1][sr_s-p,sr_e-p+K-1]\cap[0,H_{\mathrm{in}}-1]. Because CMSIS-NN applies padding internally rather than requiring a pre-padded input, the clipped rows are supplied as tile-local top and bottom padding. Consequently, only the first and last tiles receive vertical padding, while all interior boundaries fall strictly within the input tensor. Adjacent tiles overlap by K−sK-s input rows, and the maximum input-tile buffer is bounded by

B(N)=(⌈HoutN⌉s+K−s)WinCinba,(5)B(N)=\left(\left\lceil\frac{H_{\mathrm{out}}}{N}\right\rceil s+K-s\right)W_{\mathrm{in}}C_{\mathrm{in}}b_a, \tag*{(5)}

where bab_a denotes the number of bytes per activation. Tiles are processed sequentially using a single reusable input buffer, while each output region is written directly to its final location. Increasing NN therefore reduces the peak input footprint without changing the underlying convolution.

Quantization and numerical consistency. We use symmetric per-output-channel INT8 weight quantization and calibrated INT8 activations, with CMSIS-NN requantization parameters derived from mc=sinsw,c/soutm_c=s_{\mathrm{in}}s_{w,c}/s_{\mathrm{out}}. During model conversion, we reconcile signed requantization shifts and convolution padding to prevent numerical mismatches between the reference model and tiled MCU execution.

Feasibility-driven tile selection. Finer tiling is not always beneficial because it increases kernel invocations and exposes additional tile-boundary overhead. EEG2MCU therefore selects the minimum number of tiles required to satisfy the runtime-memory constraint,

Nmin⁡=min⁡{N:Mfixed+B(N)≤MSRAM},(6)N_{\min}=\min\{N:M_{\mathrm{fixed}}+B(N)\le M_{\mathrm{SRAM}}\}, \tag*{(6)}

where MfixedM_{\mathrm{fixed}} includes the output activation, convolution workspace, SRAM-resident weights, and other simultaneously resident buffers. The minimum feasible tile count establishes the capacity boundary; additional tiling may be selected to provide SRAM headroom when its measured latency and energy overhead are acceptable. Filtering and STFT are computed once per EEG window, so tiling changes only the first-layer execution schedule and working-set size without modifying the convolution arithmetic.

Locality- and Memory-Hierarchy-Aware Execution

Satisfying the SRAM capacity constraint does not by itself guarantee efficient execution. In the evaluated CMSIS-NN implementation, the first convolution repeatedly accesses its weights and im2col workspace, making latency and energy sensitive to where these tensors reside in the MCU memory hierarchy [13]. EEG2MCU therefore combines halo-preserving traversal with access-aware placement across Flash, SRAM, and tightly coupled memory to reduce redundant computation and data movement.

Halo-preserving spatial traversal. Adjacent convolution tiles share (K−s)(K-s) input rows because their receptive fields overlap. A naive tiled implementation regenerates these shared regions independently, increasing interpolation and quantization overhead with the number of tiles. EEG2MCU instead processes tiles in spatial order and retains overlapping rows as a halo in the reusable input buffer. When advancing to the next tile, only newly required rows are generated, interpolated, and quantized.

This reduces the total number of generated rows to HinH_{\mathrm{in}}, independent of the tile count. Because the retained halo forms part of the next tile’s input, it resides within B(N)B(N) and does not increase peak buffer memory. The resulting execution preserves numerical equivalence with full-tensor inference.

Hierarchy-aware tensor placement. EEG2MCU places tensors by capacity and access intensity rather than default linker placement. First-layer weights are copied once from Flash to SRAM at initialization, avoiding repeated Flash accesses while retaining the Flash image as persistent model storage. The SRAM copy increases MfixedM_{\mathrm{fixed}} in Eq. (6), enabled by the headroom from spatial tiling. The frequently accessed CMSIS-NN im2col workspace resides in zero-wait-state DTCM, larger activations in SRAM, and infrequently accessed constants in Flash. Buffers are cache-line aligned, with SRAM configured as cacheable [34], reducing repeated-access costs. Reported peak memory is the total on-chip footprint; the im2col workspace resides in the 128 KiB DTCM rather than AXI-SRAM, and no off-chip memory is required at any point.

Joint schedule selection. Spatial tiling and memory placement are coupled: finer tiling reduces the activation working set, creating SRAM headroom for faster weight placement, while halo reuse limits the resulting regeneration overhead. EEG2MCU therefore jointly selects the number of tiles NN and execution configuration p=(pw,pd,ph)\mathbf{p}=(p_w,p_d,p_h), where the binary variables indicate SRAM weight residency, DTCM workspace placement, and halo reuse, respectively. Because model dimensions and hardware resources are fixed after deployment, candidate configurations are evaluated offline on the target MCU. The selected configuration minimizes measured end-to-end latency subject to the available memory budget:

(N∗,p∗)=arg⁡min⁡N,p T2e2e(N,p)s.t.Mpeak(N,p)≤MSRAM,(N^*,\mathbf{p}^*)=\underset{N,\mathbf{p}}{\arg\min}\ T_{2e2e}(N,\mathbf{p})\quad\text{s.t.}\quad M_{\mathrm{peak}}(N,\mathbf{p})\le M_{\mathrm{SRAM}},
ChTilesWeight Res.DTCMHaloGen. (ms)Layer 0 (ms)RN 8SEEff.*Mamba*RN 8SEEff.*Mamba*Peak (KiB)
621×\times×\times×\times——————————1,374.4
622×\times×\times×\times30.24913.65492.75554.85492.05629.4791.9801.6788.5806.1850.0
622✓\checkmark×\times×\times——————————1,077.4
624×\times×\times×\times30.24924.35503.45565.55502.75640.1795.3804.9791.8809.5617.5
624✓\checkmark×\times×\times30.24622.35201.45263.55200.75338.1700.2709.9696.8714.5826.7
624✓\checkmark✓\checkmark×\times30.24398.44977.55039.64976.85114.2699.6709.2696.2713.8795.5
624✓\checkmark✓\checkmark✓\checkmark29.34344.44923.54985.64922.85060.2692.0701.6688.6706.2795.5
628✓\checkmark✓\checkmark✓\checkmark29.34346.14925.14987.24924.45061.8692.6702.2689.1706.8671.5
6216✓\checkmark✓\checkmark✓\checkmark29.34349.44928.44990.54927.75065.1693.2702.9689.8707.4609.5
191×\times×\times×\times18.01419.51998.52060.61997.82135.3296.7306.4293.3310.9601.3
191✓\checkmark×\times×\times18.01369.21948.32010.41947.62085.0293.3302.9289.9307.5659.9
191✓\checkmark✓\checkmark×\times17.91351.01930.11992.21929.42066.8278.6288.3275.2292.9665.6
194✓\checkmark✓\checkmark✓\checkmark19.41339.01918.11980.21917.42054.8279.4289.1276.0293.7464.9

Table 1. MCU Execution Breakdown of Streamed Generation and Hierarchy-Aware Execution. “—” denotes configurations whose working set exceeds the SRAM budget and cannot be deployed.

*EfficientFormer and Mamba exceed the 2 MB Flash budget at INT8 and are deployed on-device only up to the stage-4 FFN boundary and the third of six bidirectional selective-scan blocks, respectively; the remaining layers execute on the hub. RN8 and SE are deployed in full.

Hierarchy-aware execution ablates: Weight Res. (SRAM weight residency), DTCM (DTCM workspace routing), and Halo (halo buffer reuse).

No. ElectrodesSE-ResNet8 Acc.SE-ResNet8 F1SE-ResNet8 ParamsEfficientFormer [32] Acc.EfficientFormer [32] F1EfficientFormer [32] ParamsMamba [33] Acc.Mamba [33] F1Mamba [33] Params
620.7810.7821.5M0.7690.7673M0.7850.7722.5M
19 (Std 10–20)0.6190.6181.5M0.6250.6143M0.6850.6682.5M
19 (Saliency-guided)0.7340.7301.5M0.7360.7363M0.7370.7352.5M

Table 2. Model Performance on SEED Across Montage Configurations.

[a]^{[a]}\textbf{Sensing in scope:} sensor dimensionality and representation generation are optimization variables. [b]^{[b]}\textbf{Arb. kern. geometry:} supports convolution kernel sizes beyond a fixed search space. [c]^{[c]}\textbf{Cache/TCM placement:} access-aware tensor assignment across a cached Flash/SRAM/DTCM hierarchy.

WorkNetwork deployedTargetPeak SRAM (KiB)Latency (ms)Energy (mJ)
FEMBA†^\dagger [9]Mamba (22 ch, 7.8M params)GAP9 + ext. L3 mem.—170075
EEG2MCU (ours)SE-ResNet-8 (1.56M)STM32H7 (Cortex-M7)464.91980.2289.1

Each work’s published results on its own network, input, and platform; rows are not directly comparable. “—” denotes not reported. †^\daggerPreprocessing performed offline and excluded from reported latency and energy.

where MpeakM_{\mathrm{peak}} accounts for the simultaneously resident input tile, output activations, weights, workspace, and persistent runtime state under the selected memory placement. This formulation captures the capacity–latency trade-off between spatial decomposition and memory-hierarchy utilization. The selected configuration is fixed at deployment and introduces no runtime search overhead.

Experiments

Experimental Setup

Target platform and measurement: We evaluate our framework on an STM32H7A3ZI (Cortex-M7 at 280 MHz, 1 MB AXI-SRAM, and 2 MB Flash). Inference latency is measured with the hardware DWT cycle counter, and energy is measured with a STLINK-V3PWR kit. Each configuration is executed 5 times; the first iteration is discarded to remove cache warm-up effects, and we report the mean of the remaining iterations.

Benchmark models: We evaluate ResNet-8 (RN8), SE-ResNet-8 (SE), EfficientFormer-V2 (Eff), and Mamba, spanning convolutional, Transformer, and state-space backbones. All share the first layer in Figure 4: a 7 × 7, stride-2 convolution with 64 output channels, followed by batch normalization, ReLU, and 3 × 3 max pooling. SE comprises three residual stages [35] with squeeze-and-excitation blocks [36], global average pooling, and a classifier; RN8 omits the squeeze-and-excitation blocks and is used only for hardware characterization. Eff adopts EfficientFormer-V2-S0 stages [32], with attention-bias tables matched to the first-layer output resolution. Mamba follows bidirectional EEGMamba [33], projecting each temporal position into a token processed by six bidirectional selective-scan blocks (width 160, state size 16), followed by temporal mean pooling and a linear classifier. SE is distilled from a self-supervised SE-ResNet-18 teacher [27] (τ=4\tau=4, λKD=0.5\lambda_{\mathrm{KD}}=0.5) and fine-tuned; Eff and Mamba are trained from scratch. Training is fixed across montages. Accuracy is evaluated on three-class SEED [37] using a random 80/20 split of 4-s windows. All models are quantized to INT8.

Performance Analysis

Effects of montage selection on accuracy: Table II compares 62 electrodes with standard 10–20 and saliency-guided 19-electrode montages. The standard montage loses 13–21% accuracy, whereas ours retains 94–96% of full-montage accuracy and reduces first-layer cost by 3.26×. Unlike the general-purpose 10–20 layout, SEED benefits from lateral-temporal and prefrontal beta/gamma activity; the standard layout retains only four of the 12 most informative lateral-temporal electrodes [37]. In contrast, our method balances training-only saliency with spatial coverage (see Eq. (1)). Lower resolutions lose spectral detail: with SE and 19 electrodes, 64 × 64 and 32 × 32 achieve 69.72% and 66.82% accuracy. Since streamed tiling fits 128 × 128 within SRAM, we retain this resolution.

Comparison with prior deployments. Table 3 compares EEG2MCU with existing MCU deployment frameworks. DORY [24] uses constraint-based layer tiling for GAP-8 DMA-managed scratchpads, streams weights from external L3, and optimizes only beyond the ONNX boundary. TinyEngine [12] supports TinyNAS-generated operator geometries, excluding our stem convolution and explicit padding. TinyOps [25] tiles spatially using external SDRAM, relocating (not eliminating) the working set, while MLonMCU [26] is a benchmarking harness without energy measurements. All four assume a materialized model input, which alone exceeds our MCU’s SRAM (Figure 7); downstream tiling cannot recover this memory. Table 3 also compares EEG deployments measured on each work’s own network, input, and platform. Most EEG models, including NAS-derived architectures [38, 39] and foundation models [18, 19, 20], lack MCU deployment. The closest work, FEMBA [9], deploys quantized Mamba on GAP9 using scratchpad-specific code generation and tiling, streams weights externally, fixes the montage at 22 channels, and does not support on-demand preprocessing. In contrast, EEG2MCU deploys the backbones on a commodity single-core Arm Cortex-M7 without external memory, fuses interpolation and quantization into first-layer tiling to support preprocessing, and co-optimizes electrode count.

FrameworkTargetNo ext. mem.On-demand input gen.Sensing in scope[a]^{[a]}Arb. kern. geometry[b]^{[b]}Cache/TCM placement[c]^{[c]}
DORY [24]GAP-8 + ext. L3×\times×\times×\times×\times✓\checkmark
TinyOps [25]M4/M7 + SDRAM✓\checkmark×\times×\times✓\checkmark×\times
TinyEngine [12]Cortex-M✓\checkmark×\times×\times✓\checkmark✓\checkmark
MLonMCU [26]Retargetable✓\checkmark×\times✓\checkmark✓\checkmark×\times
EEG2MCU (ours)Cortex-M7✓\checkmark✓\checkmark✓\checkmark✓\checkmark✓\checkmark

Table 3. Comparison with MCU Deployment Frameworks and Prior EEG-on-MCU Deployment

Peak SRAM usage across cumulative front-end optimizations

Figure 7. Peak SRAM across cumulative front-end optimizations relative to the 1024 KiB budget, decreasing from 5289.8 KiB for the unfused 62-channel baseline to 464.9 KiB (11.38× reduction) for the optimized 19-channel design. Callouts show the peak-memory breakdown at each stage.

Effects of streamed generation and row-wise tiling: The unfused 62-channel front end materializes FP32 and INT8 inputs, requiring 5289.8 KiB (Figure 7). As shown in Table I, fusing interpolation and quantization removes the FP32 intermediate and reduces the input footprint by 5.0×, although the untiled N=1N=1 schedule still requires 1374.4 KiB, exceeding the 1024 KiB SRAM budget. Streamed tiling reduces the peak to 617.5 KiB at N=4N=4 (55.1%), the smallest feasible tile count predicted by Eq. (6), since N=2N=2 requires 1077.4 KiB with resident weights. It also achieves the lowest latency and energy among feasible schedules. Increasing to N=16N=16 saves another 186 KiB for only 5 ms and 1.3 mJ. At N=4N=4, halo reuse eliminates 10.5% of generated input rows (143 to 128) and reduces streamed-generation latency from 30.2 ms to 29.3 ms

at 62 electrodes, without additional buffering.

Effects of memory-hierarchy-aware execution: Each inference performs HoutWout/2=2048H_{\mathrm{out}}W_{\mathrm{out}}/2 = 2048 column evaluations, repeatedly streaming the 190.0 KiB weight tensor through the 16 KiB L1 data cache [34], roughly 12× the cache capacity. SRAM weight residency eliminates Flash stalls, reducing ResNet-8 energy by 12.0% (795.3 mJ to 700.2 mJ), while DTCM workspace placement removes bus contention without changing Flash traffic. Combined with halo reuse, this access-aware schedule reduces ResNet-8 latency by 10.5% and energy by 13.0% at N=4N=4 for 62 channels. As shown in Figure 8, all three stages increase layer-0 MACs/cycle from 0.598 to 0.678 (+13.4%) and 0.614 to 0.660 (+7.5%) for 62 and 19 channels, respectively. End-to-end SE-ResNet-8 throughput similarly rises from 0.636 to 0.710 (+11.6%) and 0.729 to 0.790 (+8.4%). Weight residency adds 209.2 KiB to peak memory, but N=16N=16 tiling recovers 186 KiB, lowering the peak below the unoptimized baseline with negligible latency and energy overhead.

MACs/cycle under cumulative SRAM weight residency, DTCM placement, and halo reuse

Figure 8. MACs/cycle under cumulative SRAM weight residency, DTCM placement, and halo reuse for 62- and 19-channel inputs: (a) layer-0 convolution and (b) end-to-end SE-ResNet-8.

Effects of montage co-design: Reducing the montage from 62 to 19 electrodes directly lowers activation memory, weight traffic, and MACs (see Figure 9). First-layer weights shrink by 3.26×, while signal-processing-to-layer-0 latency falls by 3.24×, from 4344.4 ms to 1339.0 ms. At N=4N=4, peak memory decreases by 41.6%, from 795.5 KiB to 464.9 KiB, the lowest evaluated footprint. Whole-model throughput increases by 11.3%, from 0.710 to 0.790 MACs/cycle (see Figure 8(b)). Consequently, SE-ResNet-8 latency improves by 2.52× (4985.6 ms to 1980.2 ms) and energy by 2.43× (701.6 mJ to 289.1 mJ). The channel-independent backbone therefore grows from 12.9% to 32.4% of end-to-end latency, although the stem remains dominant.

Figure 9. Montage-aware ResNet-8 scaling at N=4N=4 with all memory optimizations enabled: (a) latency, (b) energy, and (c) peak AXI-SRAM. Versus 62 electrodes, the selected 19-electrode montage reduces these metrics by 2.57×, 2.48×, and 1.71×, respectively (Table I), while meeting the 4 s window and 1024 KiB AXI-SRAM limits.

Conclusion

EEG2MCU addresses the channel-dependent EEG front end, which accounts for 87.1% of latency and 80.5% of computation. Joint electrode selection, streamed INT8 generation, tiling, and memory-aware execution reduce peak SRAM by 11.38×, latency by 2.57×, and energy by 2.48× on a Cortex-M7, retaining 94–96% of full-montage accuracy. The shared stem supports CNN, Transformer, and state-space backbones, but its remaining 67.6% latency share motivates further joint stem–backbone optimization.

References

References

  1. [1]C. He et al., “Diversity and Suitability of the State-of-the-Art Wearable and Wireless EEG Systems Review,” IEEE Journal of Biomedical and Health Informatics, vol. 27, no. 8, pp. 3830–3843, 2023. [Online]. Available: https://doi.org/10.1109/JBHI.2023.3239053
  2. [2]V. J. Lawhern et al., “EEGNet: a compact convolutional neural network for EEG-based brain–computer interfaces,” Journal of Neural Engineering, vol. 15, no. 5, pp. 056013, Jul 2018. [Online]. Available: https://doi.org/10.1088/1741-2552/aace8c
  3. [3]R. T. Schirrmeister et al., “Deep learning with convolutional neural networks for EEG decoding and visualization,” Human Brain Mapping, vol. 38, no. 11, pp. 5391–5420, 2017. [Online]. Available: https://doi.org/10.1002/hbm.23730
  4. [4]Y. Song et al., “EEG Conformer: Convolutional Transformer for EEG Decoding and Visualization,” IEEE Transactions on Neural Systems and Rehabilitation Engineering, vol. 31, pp. 710–719, 2023. [Online]. Available: https://doi.org/10.1109/TNSRE.2022.3230250
  5. [5]D. Kostas et al., “BENDR: Using Transformers and a Contrastive Self-Supervised Learning Task to Learn From Massive Amounts of EEG Data,” Frontiers in Human Neuroscience, vol. Volume 15 - 2021, 2021. [Online]. Available: https://doi.org/10.3389/fnhum.2021.653659
  6. [6]W. Jiang et al., “Large Brain Model for Learning Generic Representations with Tremendous EEG Data in BCI,” in The Twelfth International Conference on Learning Representations, 2024. [Online]. Available: https://openreview.net/forum?id=QzTpTRvTrParxiv.org/abs/2405.18765
  7. [7]G. Wang et al., “EEGPT: Pretrained Transformer for Universal and Reliable Representation of EEG Signals,” in Advances in Neural Information Processing Systems, A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang, Eds., vol. 37. Curran Associates, Inc., 2024, pp. 39 249–39 280. [Online]. Available: https://doi.org/10.52202/097-17-1239
  8. [8]W. Jiang et al., “NeuroLM: A universal multi-task foundation model for bridging the gap between language and EEG signals,” in The Thirteenth International Conference on Learning Representations, 2025. [Online]. Available: https://openreview.net/forum?id=Io9yFt7XH7arxiv.org/abs/2409.00101
  9. [9]A. T. Tegon et al., “FEMBA on the Edge: Physiologically-Aware Pre-Training, Quantization, and Deployment of a Bidirectional Mamba EEG Foundation Model on an Ultra-Low Power Microcontroller,” IEEE Transactions on Biomedical Engineering, vol. 73, no. 8, pp. 2746–2757, 2026. [Online]. Available: https://doi.org/10.1109/TBME.2026.3683482
  10. [10]T. M. Ingolfsson et al., “EEG-TCNet: An Accurate Temporal Convolutional Network for Embedded Motor-Imagery Brain–Machine Interfaces,” in 2020 IEEE International Conference on Systems, Man, and Cybernetics, 2020, pp. 2958–2965. [Online]. Available: https://doi.org/10.1109/SMC42975.2020.9283028
  11. [11]S. Baghersalmi et al., “M2SKD: Multi-to-Single Knowledge Distillation of Real-Time Epileptic Seizure Detection for Low-Power Wearable Systems,” ACM Trans. Intell. Syst. Technol., vol. 15, no. 5, Oct. 2024. [Online]. Available: https://doi.org/10.1145/3675402
  12. [12]J. Lin et al., “MCUNet: Tiny Deep Learning on IoT Devices,” in Advances in Neural Information Processing Systems, H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, Eds., vol. 33. Curran Associates, Inc., 2020, pp. 11 711–11 722. [Online]. Available: https://dl.acm.org/doi/10.5555/3495724.3496706arxiv.org/abs/2007.10319
  13. [13]M. L. Lai et al., “CMSN: Efficient Neural Network Kernels for Arm Cortex-M CPUs,” 2018. [Online]. Available: https://arxiv.org/abs/1801.06601
  14. [14]M. R. Chowdhury et al., “Design-Space Exploration of Distributed Neural Networks in Low-Power Wearable Nodes,” 2025. [Online]. Available: https://arxiv.org/abs/2509.14540
  15. [15]H. Altaheri et al., “Physics-Informed Attention Temporal Convolutional Network for EEG-Based Motor Imagery Classification,” IEEE Transactions on Industrial Informatics, vol. 19, no. 2, pp. 2249–2258, 2023. [Online]. Available: https://doi.org/10.1109/TII.2022.3197419
  16. [16]C. Yang et al., “BIOT: Biosignal Transformer for Cross-data Learning in the Wild,” in Advances in Neural Information Processing Systems, A. Oh, T. Naumann, A. Globerson, K. Saenko, M. Hardt, and S. Levine, Eds., vol. 36. Curran Associates, Inc., 2023, pp. 78 240–78 260. [Online]. Available: https://doi.org/10.5281/zenodo/3420-3420
  17. [17]W. Cui et al., “Neuro-GPT: Towards A Foundation Model For EEG,” in 2024 IEEE International Symposium on Biomedical Imaging (ISBI), 2024, pp. 1–5. [Online]. Available: https://doi.org/10.1109/ISBI56570.2024.10635453
  18. [18]J. Wang et al., “CBraMod: A Criss-Cross Brain Foundation Model for EEG Decoding,” in The Thirteenth International Conference on Learning Representations, 2025. [Online]. Available: https://openreview.net/forum?id=NPNUNgHF2warxiv.org/abs/2412.07236
  19. [19]Y. E. Ouahidi et al., “REVE: A Foundation Model for EEG - Adapting to Any Setup with Large-Scale Pretraining on 25,000 Subjects,” in The Thirty-ninth Annual Conference on Neural Information Processing Systems, 2025. [Online]. Available: https://openreview.net/forum?id=ZeFMtRBy4Z
  20. [20]J. Wang et al., “EEGMamba: An EEG foundation model with Mamba,” Neural Networks, vol. 192, p. 107816, 2025. [Online]. Available: https://doi.org/10.1016/j.neunet.2025.107816
  21. [21]R. David et al., “TensorFlow Lite Micro: Embedded Machine Learning for TinyML Systems,” in Proceedings of Machine Learning and Systems, A. Smola, A. Dimakis, and I. Stoica, Eds., vol. 3, 2021, pp. 800–811. [Online]. Available: https://proceedings.mlsys.org/paper_files/paper/2021/file/6c44dc73014d66ba49b28d483a8f8b0d-Paper.pdf
  22. [22]A. Garofalo et al., “PULP-NN: accelerating quantized neural networks on parallel ultra-low-power RISC-V processors,” Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, vol. 378, no. 2164, p. 20190155, 12 2019. [Online]. Available: https://doi.org/10.1098/rsta.2019.0155
  23. [23]J. Lin et al., “MCUNetV2: Memory-Efficient Patch-based Inference for Tiny Deep Learning,” in Annual Conference on Neural Information Processing Systems (NeurIPS), 2021. [Online]. Available: https://dl.acm.org/doi/10.5555/3540261.3540441arxiv.org/abs/2110.15352
  24. [24]A. Burrello et al., “Dory: Automatic end-to-end deployment of real-world dnns on low-cost iot mcus,” IEEE Transactions on Computers, vol. 70, no. 8, pp. 1253–1268, 2021. [Online]. Available: https://doi.org/10.1109/TC.2021.3066883
  25. [25]S. Sadiq et al., “TinyOps: ImageNet Scale Deep Learning on Microcontrollers,” in 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2022, pp. 2701–2705. [Online]. Available: https://doi.org/10.1109/CVPRW55364.2022.00304
  26. [26]P. van Kempen et al., “MLonMCU: TinyML Benchmarking with Fast Retargeting,” in Proceedings of the 2023 Workshop on Compilers, Deployment, and Tooling for Edge AI, ser. CODAI ’23. New York, NY, USA: Association for Computing Machinery, 2024, p. 32–36. [Online]. Available: https://doi.org/10.1145/3651533.3618128
  27. [27]M. R. Chowdhury et al., “BRIDGE-EG: Bridging Self-Supervised Pre-training and Efficient Deployment for Cross-Dataset EEG Classification,” 2026. [Online]. Available: https://arxiv.org/abs/2609.12218
  28. [28]J. Allen, “Short term spectral analysis, synthesis, and modification by discrete Fourier transform,” IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 25, no. 3, pp. 235–238, 1977. [Online]. Available: https://doi.org/10.1109/TASSP.1977.1162950
  29. [29]S. Sen, “Wi-R Technology White Paper – Ixana Blog,” 11 2022, [Online; accessed 2026-09-19]. Available: https://ixana.ai/blog/wi-r-technology-white-paper
  30. [30]M. Alwani et al., “Fused-layer CNN accelerators,” in 2016 49th Annual IEEE/ACM International Symposium on Microarchitecture (MICRO), 2016, pp. 1–12. [Online]. Available: https://doi.org/10.1109/MICRO.2016.7783725
  31. [31]Z. Zhao et al., “DeepThings: Distributed Adaptive Deep Learning Inference on Resource-Constrained IoT Edge Clusters,” IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 37, no. 11, pp. 2348–2359, 2018. [Online]. Available: https://doi.org/10.1109/TCAD.2018.2858384
  32. [32]Y. Li et al., “EfficientFormer: Vision Transformers at MobileNet Speed,” in Advances in Neural Information Processing Systems, A. H. Oh, A. Agarwal, D. Belgrave, and K. Cho, Eds., 2022. [Online]. Available: https://openreview.net/forum?id=NXhoX YOMLIGarxiv.org/abs/2206.01191
  33. [33]Y. Gui et al., “EEGMamba: Bidirectional State Space Model with Mixture of Experts for EEG Multi-task Classification,” 2024. [Online]. Available: https://arxiv.org/abs/2407.20254
  34. [34]STMicroelectronics, “AN4893: Level 1 cache on STM32F7 series and STM32H7 series,” Application note. [Online]. Available: https://www.st.com/resource/en/application_note/an4839-level-1-cache-on-stm32f7-series-and-stm32h7-series-stmicroelectronics.pdf
  35. [35]K. He et al., “Deep Residual Learning for Image Recognition,” in 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770–778. [Online]. Available: https://doi.org/10.1109/CVPR.2016.90
  36. [36]J. Hu et al., “Squeeze-and-Excitation Networks,” in 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2018, pp. 7132–7141. [Online]. Available: https://doi.org/10.1109/CVPR.2018.00745
  37. [37]W.-L. Zheng and B.-L. Lu, “Investigating Critical Frequency Bands and Channels for EEG-Based Emotion Recognition with Deep Neural Networks,” IEEE Transactions on Autonomous Mental Development, vol. 7, no. 3, pp. 162–175, 2015. [Online]. Available: https://doi.org/10.1109/TAMD.2015.2431497
  38. [38]A. Tragoudaras et al., “TinyML for EEG Decoding on Microcontrollers,” in 2023 IEEE International Symposium on Circuits and Systems (ISCAS), 2023, pp. 1–5. [Online]. Available: https://doi.org/10.1109/ISCAS46773.2023.10181950
  39. [39]C. Li et al., “EEG-Based Emotion Recognition via Neural Architecture Search,” IEEE Transactions on Affective Computing, vol. 14, no. 2, pp. 957–968, 2023. [Online]. Available: https://doi.org/10.1109/TAFFC.2021.3130387

Paper details

vlnc:W_7mrdjg5e
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents