Robust Neural Stimulation Response Modeling Through Meta-Learning and Pretraining
Authors: Matthew J Bryan, Daniel C Muir, Felix Schwock, Azadeh Yazdan-Shahmorad, Rajesh P N Rao
Organizations: Neural Systems Laboratory, Paul G. Allen School of Computer Science & Engineering, University of Washington, Seattle, WA, USA · Center for Neurotechnology, University of Washington, Seattle, WA, USA · Computational Neuroscience Center, University of Washington, Seattle, WA, USA · Department of Electrical and Computer Engineering, University of Washington, Seattle, WA, USA · Department of Bioengineering, University of Washington, Seattle, WA, USA
Objective: Model-based closed-loop neural stimulation holds promise for therapeutic applications ranging from Parkinson's disease to sensory restoration, but deployment has been limited by two obstacles: 1) forecasting models for predicting the consequences of stimulation fail catastrophically on a meaningful fraction of sessions, and 2) per-session calibration requirements are often incompatible with clinical constraints. We address both by demonstrating, for the first time, that meta-learning and pretraining can be applied to neural stimulation response modeling. Methods: Temporal basis function models (TBFMs) forecast state-dependent neural responses to stimulation. We extend TBFMs with cross-session pretraining using a novel architecture and algorithm based on model-agnostic meta-learning (MAML), evaluating them on 40 sessions of optogenetic stimulation in primary sensorimotor cortex of two non-human primates. Results: Meta-learning substantially reduces catastrophic forecast failure: for a 1k calibration set size, sessions with test R-squared < 0.05 drop from 16 of 40 (single-session training) to 1 (MAML-pretrained), and prediction intervals become significantly narrower (p < 0.05). Calibration requirements are reduced by 50-90% at matched accuracy, enabling experiments otherwise infeasible within clinical session-time constraints. Conclusion: Our results demonstrate that cross-session structure in stimulation responses is consistent enough to support pretraining, providing the first empirical evidence that meta-learning approaches are viable for neural stimulation. Significance: The robustness and sample efficiency gains directly address known obstacles to deploying model-based stimulation controllers. Our results motivate community efforts to assemble standardized multi-site stimulation datasets and to further explore meta-learning for robust closed-loop stimulation.
Figures & tables
Fig. 1: Stimulation response across the μ ECog array. Heatmap indicates LFP values (Gaussian-smoothed and Z-scored, single session average) at 10ms after the second stim pulse onset. Missing electrodes were given false values for graphing. Stim locations varied between sessions.
Fig. 2: Data windowing Trials are 184ms separated by a 16ms buffer, ∼15k trials per session. See Figure 3 for legend.
Fig. 3: Average response across many trials for a single electrode within one session. The TBFM model predicts the stimulation-evoked activity ( y ) in each trial using the first 20 ms of recorded neural data ( x , known as the “runway”). The initial optical pulse occurs at 40 ms (blue dashed line); we assume there is a 20 ms control-loop delay between measuring the brain state at 20 ms and computing parameters for the stimulation (see Sec. II-B1 ). Note that the TBFM forecasts all channels simultaneously using the runway for all channels, but we depict only one channel here.
Fig. 4: TBFM architecture
Fig. 5: Mean neural response and mean prediction for four binned initial states. Single channel, single session. Stimulation onset is at t= 40ms . y is the mean stimulation response for trials in the given initial state bin, y^ is the mean forecast for the same trials.
Fig. 6: Multi-session TBFM architecture. Xb,t,d Neural activity in a session (each block depicted is one of n sessions), time span t , channel count d∗ , multiple trials per session: b is the batch dimension. r is the runway length, T is the forecast horizon. Zt,l Latent space representation of neural activity for a session, time span t , latent dimensionality l . si per-trial embedding of stimulation parameters, known as the “stimulation descriptor”. csrest per-session context from resting/non-stimulation activity, repeated for all trials of that session. csstim learned per-session stimulation context, repeated for all trials of that session.
Fig. 7: Example deployment . In this simple example we collect larger calibration (randomly timed stimulation) data sets during the initial 20 sessions. During those sessions we create a single-session TBFM for closed-loop experimentation. After 20 sessions, we use a meta-learned shared-session TBFM and test-time adaptation, allowing us to collect far smaller calibration data sets (5k versus 500 calibration examples).
Fig. 8: Distribution of test set R2 across folds and sessions, by calibration set size and training method. Dashed lines indicate median and IQR. Left tails of the distributions are significantly heavier for vanilla (i.e., single-session) models, indicating greater robustness of the coadaptive- and MAML-pretrained models. At the calibration set size of 1k for example, 7 of 40 sessions with coadapted model, and 7 of 40 with MAML models have test set R2<0.15 , compared with 18 of 40 for vanilla models. At 2.5k it is 8, 6 and 11, respectively.
Fig. 9: A-ACF predicts performance of pretrained models. Robustness is indicated by high gains on noisy sessions. Lower A-ACF values on resting data suggest a session’s data are noisier. The median A-ACF value across a session’s channels is predictive of both vanilla (single-session) model and MAML TTA model performance: the trend slope is positive at p<5−5 in all cases. Pretraining flattens the susceptibility of the model to failing catastrophically on high noise (low A-ACF) sessions, and hence we see large improvements in the high noise regime. Vanilla models more frequently fail catastrophically ( R2<0.05 ) on higher noise sessions. At 5k calibration trials (right), the two methods converge, indicating that pretraining’s advantage is specific to low-data regimes where anchoring to cross-session patterns compensates for limited per-session evidence. The slope of the difference in trends is negative at 1−3 for 1k, insignificant in 5k. The 5k result is expected since prior work found this was the optimal training set size for single-session models [ 7 ] .
Fig. 10: Sample efficiency of single session versus MAML pretrained models. The plot shows mean and distribution of test set R2 across held out sessions and Monte Carlo Cross-Validation (MCCV) splits. Confidence intervals (CIs) are for the mean of held-out sessions. The prediction intervals (PIs) capture the variability in performance across sessions and MCCV splits, reflecting both genuine cross-session differences in signal quality and the uncertainty introduced by the particular held-in/held-out assignment. Mean performances of MAML-pretrained models exceed vanilla (single session) models at p<0.05 under the 1-sided Wilcoxon signed-rank test for calibration set sizes ≤2.5k , and p=0.15 for 5k . Prediction intervals are significantly more narrow for MAML-pretrained models under the single-sided Brown-Forsythe test ( p<0.05 ) for calibration set sizes ≤2.5k , indicating more consistent performance and higher robustness. At 5k , it drops to p=0.19 .
Held out subject
Held in subject
G
J
G
0.405 ± 0.052
0.354 ± 0.094
J
0.407 ± 0.047
0.373 ± 0.102
TABLE I: Summary of Within- and Cross-Subject Generalization. Values are held-out session test set performance, mean across folds. Indicated interval is the 95% confidence interval of the mean.
CPU
GPU
Pretrained TBFM
2.798
0.790
Pretrained TBFM compiled
2.095
0.223
Vanilla TBFM
0.174
0.226
Vanilla TBFM compiled
0.115
0.121
AE-LSTM
41.628
34.156
LSSM
10.111
16.939
TABLE II: Average single-trial inference times (milliseconds)
Department of Machine Learning and Neural Computing, Donders Institute for Brain, Cognition and Behaviour, Radboud University, Nijmegen, the Netherlands · Department of Cognitive Neuroscience, Maastricht University, Maastricht, the Netherlands · Maastricht Brain Imaging Center, Maastricht University, Maastricht, the Netherlands
School of Artificial Intelligence, Chongqing University of Technology, Chongqing 401135, China; Chongqing Key Laboratory of Embodied Intelligence Perception and Autonomous Learning for Humanoid Robots; Key Laboratory of Advanced Equipment Intelligence of the Chongqing Education Commission, Chongqing 401135, China · School of Smart Health, Chongqing Polytechnic University of Electronic Technology, Chongqing 401131, China · Department of Language Science and Technology, The Hong Kong Polytechnic University, Hung Hom, Hong Kong SAR, China +1