← Research

Brain-implant drift9 min read

Beyond the Linear Fix? A Cross-Session MLP on SBP + TCR, Scored on Held-Out Sessions

This post is part of an earlier series and is no longer updated. The current answer is on Can a brain implant work without daily re-tuning?.

Part 3 of 3. Part 1 established the drift problem. Part 2 fixed the representation. This part asks whether a nonlinear joint decoder can go further.

Updated 2026-10-25: the shared decoder spec now predicts velocity at the current bin instead of 60 ms ahead (see the correction in Part 2); every number below is re-stated from that run. The conclusion is unchanged and stronger: held out, the MLP is further below the linear decoder on its own inputs.

Rewritten 2026-10-24. The first version of this post reported an MLP that "generalises across all 443 days", with per-session R² between 0.158 and 0.435. That decoder had been trained on every one of the 30 sessions and then scored on those same sessions, so it was never tested on a session it had not seen. Scored on held-out sessions, the result reverses: the MLP does not decode later sessions, and it does worse than a linear decoder given the same inputs. Every number below comes from that held-out evaluation.


Part 2 ended with a working result: Gold r_norm, a per-channel z-score followed by 50 ms Gaussian smoothing, shifts mean cross-day R² from −0.907 to +0.030 and shrinks the negative-transfer regime that made the static Day-0 decoder actively harmful, though past five months it still fails.

The r_norm result used a Ridge decoder trained on a single day. The natural next move is to give the decoder more sessions to learn from and more signal to work with: one MLP trained jointly on many sessions, using both SBP r_norm and threshold-crossing rate (TCR) as input. The question that matters is whether that decoder works on a session it has never seen. That is the only situation a device is ever in.


The Second Feature: Threshold Crossing Rate

SBP is the average power of each electrode's signal after a 300–1000 Hz bandpass filter, the band that holds most spiking activity. TCR counts how many times each electrode's voltage dips below −4.5 × RMS in each 20 ms bin: a hardware-level spike detector, not spike-sorted single units, but a coarser count that fires whenever an electrode sees a large negative deflection.

The output has the same shape as SBP: (T, 96), one value per channel per time bin, on the same time axis. It is sparse: most bins are zero, and active channels fire a handful of times per second. Where SBP tracks the sustained power envelope of local activity, TCR registers individual crossing events.

Normalization applied before training, each session with its own statistics:

  • SBP: r_norm (per-channel z-score + 50 ms Gaussian smoothing), exactly as in Part 2
  • TCR: per-channel z-score within each session (z_norm)

Raw threshold crossings on Day 0, first 5 seconds: sparse event-like counts per channel and time bin, aligned with SBP on the same 20 ms grid.

TCR is sparse: most bins are zero, while active channels show brief bursts of crossings.


The Decoder

The 192 joint channels (96 SBP + 96 TCR) are compressed to 5 principal components, stacked over a 20-bin (400 ms) history, giving 105 inputs per time step. A scikit-learn MLPRegressor with two hidden layers (128, 64) predicts index-finger velocity at the current bin. Bins in the top quarter of speed get 4× weight in the loss so the model does not flatten movement peaks.

Every fit draws 20,000 rows from each training session, skips the first 300 bins of every session, and fits the PCA, the weighting threshold and the decoder on training sessions only. Running it costs about 22,700 multiply-accumulates per 20 ms bin, against 576 for the Ridge decoder of Parts 1 and 2.

How It Is Scored

The 30 sessions are uneven in time: 17 in the first 53 days after the first session (Day 0, 2020-01-27), then a 98-day gap, then 13 over the following year. That gap is the natural test. Day 0 is the first recorded session, not the implant: LINK's recordings start about 349 days after implant.

  • Forward split (the main result): train on the 17 sessions from days 0–53, freeze the decoder, score it on the 13 sessions from days 151–443. Nothing from a later session reaches the fit.
  • Grouped split: hold out each of five contiguous blocks of six sessions in turn, training on the other 24. Sessions on both sides of the held-out stretch are in training, so this is the easier, interpolation question.
  • In-sample: train and score all 30 sessions, the original protocol, kept only to measure how much it inflated the numbers.

Two linear decoders are trained on exactly the same rows: Ridge on the MLP's 105 inputs, which isolates what the nonlinearity adds, and Ridge with the series' decoder spec on 96 SBP r_norm channels (window 5, as in Parts 1 and 2). Each fit is repeated with three seeds.


Results

Mean R² over the scored sessions, mean over three seeds (seed range in brackets):

Wide table: on a narrow screen, scroll sideways to see all columns.

DecoderForward: 13 held-out sessions, days 151–443Grouped: 30 held-out sessionsIn-sample, same 13 sessions
MLP (SBP r_norm + TCR z_norm, PCA 5)−0.152 (−0.167 … −0.129)+0.009 (+0.001 … +0.015)+0.141 (+0.128 … +0.149)
Ridge, same 105 inputs+0.001 (−0.000 … +0.003)+0.004 (+0.003 … +0.004)+0.020 (+0.020 … +0.021)
Ridge, series spec (96-ch SBP r_norm)+0.003 (+0.002 … +0.004)not runnot run

Frozen after day 53, the MLP scores below zero, worse than predicting the mean velocity, on 11 to 13 of the 13 later sessions depending on the seed. Its best held-out session averages +0.033 (day 197). Trained in-sample on the same 13 sessions, it scores +0.141, so the original protocol overstated it by about 0.29 R².

It also loses to a linear decoder on its own inputs: MLP minus Ridge is −0.153 (95 % CI −0.204 to −0.097, resampling the 13 test sessions). The nonlinearity adds nothing on new sessions; it fits the training sessions and pays for it on the rest.

Held-out R² per session for the forward split: decoders frozen after day 53 (shaded), scored on every later session. Circles: MLP. Crosses: Ridge on the same inputs.

Forward split, seed 0. Most MLP points sit below zero; Ridge on the same inputs stays near zero everywhere.

Why it fails: the representation, not the decoder

Ridge on the same 105 inputs scores only +0.020 even in-sample. The five principal components keep about 20 % of the joint variance on Day 0, and almost none of the velocity signal: the directions of largest variance across 192 channels are not the directions that encode finger movement. Given features with almost no linearly readable signal, the MLP's +0.141 in-sample is a fit to the particular sessions it trained on, and it does not carry over.

The series-spec Ridge on all 96 SBP r_norm channels, pooled over the same 17 training sessions, is positive on 8 of the 13 later sessions (up to +0.131 on day 163) but averages +0.003 (95 % CI −0.057 to +0.052), dragged down by a few large failures (−0.279 on day 395). Pooling early sessions alone does not fix month-plus decoding.

What the traces look like on unseen sessions

Decoded velocity, Day 0 (a training session) and day 151 (held out).

Decoded velocity, Day 0 (a training session) and day 443 (held out).

Stacked decoded finger velocity on five held-out sessions, day 151 to day 443. Gray dotted: true velocity. Colored solid: MLP prediction.

Each row is a held-out session, showing its most movement-rich 800 bins, with the prediction rescaled and smoothed for display. Even so, the predicted line stays close to flat. The first version of this post read the same kind of figure, drawn on training sessions, as proof that movement timing is still decoded more than a year later. On sessions the decoder never saw, that reading does not survive.


Limits

  • Acausal features. Each session is normalized with its own full-session statistics, as in Part 2. A device would need causal normalization, which the streaming post covers for SBP.
  • Not re-tuned held out. The PCA size (5) and the velocity weighting were chosen in the original in-sample run and kept fixed, so the evaluation tests the decoder that was published. An MLP on the full 96-channel windowed features is a different model and a separate experiment.
  • Small sample. Three seeds give a range; the CIs resample the 13 test sessions. With 13 sessions from one animal, the sign of the result is solid but its size is not precise.
  • NHP data. One non-human primate with a Utah array, one 1D finger-velocity task.

The three parts, in one view

Wide table: on a narrow screen, scroll sideways to see all columns.

PartQuestionAnswer
Part 1Is raw SBP stationary across chronic sessions?No. Channels drift unevenly; a Day-0 decoder (held-out R² 0.32 on Day 0) scores below zero on 27 of 29 later sessions.
Part 2Does per-session normalization fix the representation?Partly. r_norm shifts mean off-diagonal R² from −0.907 to +0.030; it holds over days but not beyond a month, and the z-score alone does slightly better.
Part 3Does a nonlinear cross-session decoder go further?No. Frozen after day 53, it scores −0.152 on sessions from days 151–443, below a linear decoder on the same inputs (+0.001). Its earlier "443 days" result was scored on its own training sessions.

Across the three parts, the arc on this dataset is: raw drift and decoder failure; a within-session normalization that repairs short-gap transfer; and, for month-plus gaps, no decoder here that works yet. Pooling sessions and adding a nonlinearity on a compressed representation did not get there. Aligning the representation across sessions is the next thing to test.


References

  • Magland, J. F., Ly, R., Rübel, O., & Dichter, B. K. (2025). Facilitating analysis of open neurophysiology data on the DANDI Archive using large language model tools. Scientific Data, 12, 285. https://doi.org/10.1038/s41597-025-06285-x
  • Rübel, O., Tritt, A., Ly, R., Dichter, B. K., Ghosh, S., Niu, L., Baker, P., Soltesz, I., Ng, L., Svoboda, K., Frank, L., & Bouchard, K. E. (2022). The Neurodata Without Borders ecosystem for neurophysiological data science. eLife, 11, e78362. https://doi.org/10.7554/eLife.78362

The repository includes the analysis notebooks, the neurosignal package and related code, and HTML exports of those notebooks.

Code: github.com/radhakrishnanrishaban/ephys-signal-atlas · neurosignal v0.2.0