Drift and Recalibration

Brain signals drift, so a decoder tuned on Monday misreads the brain by Friday. Drag the days and watch a cursor lose its way, then fix it by realigning the neural map.

Learn why implanted-electrode decoders go stale, how researchers realign the brain’s activity to an old decoder without asking the user to redo a calibration, and how a benchmark scores that effort.

Drag Days since calibration to 30. Then press Realign, and then Recalibrate, and compare the wrong-target count. Then we build, piece by piece, what causes the drift, what stays the same underneath, and how each fix works.

You need the idea of a decoder (a program that turns neural activity into a cursor move) and a little linear algebra (a rotation of a plane). We build the rest from zero.

Built from primary sources: Degenhart et al., Nature Biomedical Engineering 2020; Silversmith et al., Nature Biotechnology 2020; Karpowicz et al., NoMAD, Nature Communications 2025; and Karpowicz et al., the FALCON benchmark, NeurIPS 2024. Sources are listed in the Field Guide (Chapter 9). It follows Lesson 20, LFADS and leads to Lesson 22, Measuring a BCI.

Steer a drifting cursor

0

Illustrative toy, not data: the neural space is rotated by 1.1 degrees per day and shifted by 0.012 ring radii per day, 48 reaches to 8 targets with a little seeded noise. Realigning leaves a residual of 3 degrees plus 0.04 degrees per day; recalibrating leaves 2 degrees. These residuals are our assumptions, chosen to show the idea; Chapters 3 to 5 compute real alignments.

Chapter 0

Why a Decoder Goes Stale

See why a brain-computer interface that worked on Monday asks its user to start over, and what that costs

Picture a man with paralysis who controls a computer cursor with his thoughts. On Monday the system works well. He imagines pushing his hand to the right, and the cursor moves right. He types, he browses, he feels in charge.

On Tuesday morning he imagines the same push. The cursor drifts up and to the left. Nothing is wrong with him, and nothing is wrong with the software. Something small has changed inside his skull. He must now stop and teach the system his movements again.

The pieces of the loop

A brain-computer interface (BCI) reads brain activity and turns it into a command. For a cursor, an intracortical array is the usual sensor: a bed of about a hundred tiny needles pushed a millimetre into the motor cortex. Each needle is an electrode, and it listens to the electrical spikes of the few neurons near its tip. Lesson 1 and Lesson 4 cover the hardware.

Each electrode feeds one channel. In every short time bin (say 20 ms) the system counts the spikes on each channel. For a 96-channel array, one bin is a list of 96 counts. That list is the input vector, with shape [96].

A decoder is the program that maps that vector to a command. A simple one multiplies the vector by a matrix of weights and gives the cursor velocity, shape [96] → [2]. Lessons 15 and 16 build such decoders. The weights are the decoder’s memory of what each channel meant on the day it was built.

That day is the calibration. The user watches a cursor move to targets and imagines driving it. The system records which channels fired for which movement and fits the weights. Fitting needs labels: the known intended movement at each moment. This is supervised learning, and it takes real minutes of the user’s time.

The problem in one sentence

The decoder learned a code. The code is the relation between channels and movements. The brain’s recorded code does not stay the same, so the weights go stale. The Nature Communications NoMAD paper puts it plainly: systems often need supervised recalibration (repeating the calibration) “once or even multiple times per day”. Drift is the word for this slow change, and nonstationarity is the statistician’s name for it: the statistics of the signal change with time.

Try the cost yourself. The device below is a simple budget of a day. Slide the number of recalibrations and the minutes each one takes. The minutes are our own picks, because every lab and every user is different, but the arithmetic is exact.

Budget a day of recalibration

The bar is a 12-hour waking day. Yellow blocks are recalibration, the green is time the user can actually use the interface. Drag both sliders and watch the green shrink.

2
8

Illustrative arithmetic, not a measurement: a 12-hour waking day, 365 days a year, and the slider values for the number and length of recalibrations. The only figure from a paper is the phrase “once or even multiple times per day” (Karpowicz et al. 2025).

Even a modest routine adds up to many hours a year. But hours are not the whole cost. A recalibration needs a trained helper nearby, a quiet room, and a user who is rested enough to concentrate. A device meant for home use cannot depend on that.

What a good fix must do

Set the bar before you judge any remedy. A fix for drift should work without new labelled data, because labels cost the user time. It should keep the cursor feel the user already knows, so the decoder should not change under their hands. It should run in real time, one time bin after the next. And it should last for weeks, not hours. Every method in this lesson meets some of these goals and gives up others, and we will score them against this list.

Three ways out

This lesson follows three families of fix. Each trades something different.

Recalibrate faster. Use less labelled data on the new day. This is few-shot learning, and Chapter 7 scores it.

Realign without labels. Leave the decoder alone. Instead, adjust the incoming neural activity so it looks like it did on day 0. This is unsupervised: it needs neural data only, not the user’s intent. Chapters 3 to 5 cover it.

Let the brain adapt. Keep everything fixed and let the user’s own brain settle into the map. Chapter 6 covers this one.

Before the fixes, Chapters 1 and 2 ask two questions. What exactly changes? And what stays the same, so that a fix is even possible?

  1. Where the drift comes from: baseline shifts, lost channels, changed tuning.
  2. The manifold bet: channels change, the brain’s shape does not.
  3. Aligning two spaces by rotation: Procrustes and the stable-electrode trick.
  4. Stabilizing a cursor without labels: Degenhart 2020 in a live loop.
  5. NoMAD: aligning dynamics with a frozen LFADS model.
  6. Plug and play: Silversmith 2020, a fixed decoder and a user who adapts.
  7. FALCON: the benchmark, its splits and its metrics.
  8. Half-lives and failures: how long each method lasts, and when it breaks.
  9. Field guide: numbers, checklist, code, sources.
A decoder is calibrated on Monday and its weights never change. On Friday the cursor misbehaves. What is the most direct cause?

Chapter 1

Where the Drift Comes From

Name the three ways an implanted array changes, and measure what each does to a fixed decoder

Take a ruler to the problem. Picture four channels, each wired to a neuron that likes one direction of reach. On Monday you tell the decoder who likes what. On Tuesday one neuron has gone quiet, and the decoder trusts it anyway. The cursor now moves backwards. This chapter explains how that happens, and why it is not rare.

A tuned neuron is a voter

A motor-cortex neuron fires more when the arm moves in one direction than in others. That direction is its preferred direction. Fire rate falls smoothly as the movement turns away from it. A cosine curve describes this well. The curve is the neuron’s tuning.

Write the rate of channel i for a reach in direction θ as a baseline plus a cosine bump.

ri
Spikes counted on channel i in one time bin.
b
The baseline: how often the channel fires when the movement is perpendicular to its preferred direction.
g
The gain: how much louder the channel gets when the movement matches its preferred direction.
θ
The direction of the movement.
pi
The preferred direction of the neuron on channel i.

The simplest decoder lets every channel vote. A channel votes for its preferred direction, and its vote is as strong as its rate sits above baseline. The sum of votes is the cursor velocity. Classic motor-cortex work called this the population vector. In symbols, v = (2 / N g) Σ (ri − b) ui, where ui is the unit arrow of direction pi.

Work it by hand. Four channels prefer 0, 90, 180 and 270 degrees. Let b = 5 and g = 4. For a reach to 0 degrees the rates are 9, 5, 1 and 5. Subtract the baseline: 4, 0, −4, 0. The votes are 4 × (1, 0) + (−4) × (−1, 0) = (8, 0). Scale by 2 / (4 × 4) = 0.125 and the cursor velocity is (1, 0). It points exactly right. The decoder works.

Three ways the vote goes wrong

Now let time pass. The decoder keeps its numbers: the preferred directions and the baseline from day 0. Three kinds of change hit it, and they are the three instabilities that Degenhart and colleagues forced on their monkeys to test a fix (Chapter 4).

A baseline shift. A channel’s resting rate moves, so a constant extra count appears on it. The decoder reads the constant as a vote.

A dropout. A neuron dies, or an electrode fails, or the tip moves away from the cell. The channel goes silent. The decoder subtracts its old baseline from zero and reads a strong vote against that channel’s preferred direction. Check it on the example. Silence the 0-degree channel during the same reach. Its vote becomes (0 − 5) × (1, 0) = (−5, 0). The sum is (−5) + 4 = −1, so the velocity is (−0.125, 0). The cursor moves left when the user reaches right.

A tuning change. The electrode now listens to a different neuron, or the same neuron changes what it likes. The channel keeps firing, but for a different direction than the decoder believes. The vote points the wrong way.

Why it happens in real implants

The NoMAD paper lists the causes of such changes: the electrode shifts relative to the tissue, an electrode fails, cells die, and the body reacts to the foreign material. A needle that moves even slightly can lose one neuron and pick up another, because each electrode hears only the cells very near its tip.

Statisticians call the result nonstationarity. In this setting there are two timescales. Within a session, tuning can wander over minutes. Between sessions, the whole set of neurons behind the channels can change. Most of the work in this lesson targets the second kind, because it is the one that forces a new calibration each morning.

Shake the array

Blue rings are eight true reach directions. Warm dots are where a fixed population-vector decoder says each reach went. Raise each instability and see which one hurts most.

0
0
0

Toy model, not data: 24 channels with preferred directions every 15 degrees, baseline 5 and gain 4 spikes per bin, no spiking noise. Baseline shifts are random with the mean you set (spread two thirds of the mean, seeded); dropped channels read zero; retuned channels get a new random preferred direction. The three kinds of change are the ones Degenhart et al. 2020 induced in their experiments, at their own sizes.

Look at what the device teaches. A modest baseline shift does little, because random shifts partly cancel across many channels. Dropouts and retuning do far more, because they remove or reverse a vote. That matches the intuition of Chapter 0: the decoder is a fixed code, and the signal it reads no longer follows the code.

Why not just average it away?

The tempting idea is to hope the errors cancel with more channels. They partly do for random shifts. They do not for systematic ones. When cells die near one side of an array, the lost votes come from one set of preferred directions, and the cursor drifts toward the other side. Systematic loss is the norm, because a shifted needle moves all its neighbours together.

So drift is not noise to filter. It is a slow, structured change in the code itself. Fixing it means finding a quantity that does not change, and using it as a fixed point. That quantity is the subject of Chapter 2.

A population-vector decoder subtracts each channel’s day-0 baseline. A neuron dies, and its channel reads zero. What does the decoder do with that channel?

Chapter 2

The Manifold Bet

Separate what the electrodes see from what the brain does, and bet that only the first one changes

Hold a wire sculpture in front of a lamp. The shadow on the wall is a flat shape. Now move the wall a little, or tilt it. The shadow changes shape, and so does every number you could measure on it. But the sculpture is the same sculpture. If you could work out how the wall moved, you could undo the change and read the sculpture again.

That picture is the idea of this whole lesson. The electrodes are the wall. The brain’s computation is the sculpture. Drift moves the wall.

Many channels, few causes

An array gives about a hundred channels. But the movement the user intends has only a few degrees of freedom: where the hand goes, how fast, whether it grips. The neurons that carry this intent move together. They do not act as a hundred independent dials.

Researchers capture this with a small number of hidden numbers called latent variables. Write them as a vector z with, say, 10 entries. The array is a noisy, blurred view of z. The simplest model of that view is linear.

y
The recorded channel activity in one time bin, shape [N channels].
A
The mixing matrix (also called the loading matrix), shape [N, d]. Row i says how strongly channel i hears each latent variable.
z
The latent state, shape [d], with d far smaller than N.
ε
Noise that belongs to single channels.

Fitting this model to data is factor analysis, a cousin of principal component analysis. Lesson 5 and Lesson 19 build it in full. The set of latent states the brain visits during a task forms a shape in d dimensions. That shape is the neural manifold: the low-dimensional surface the population activity stays on.

How many latent variables do you need? The Degenhart stabilizer used ten for a 96-electrode array. Factor analysis differs from principal component analysis in one useful way: it gives every channel its own noise term ε, so a noisy channel cannot hijack a latent axis. That matters here, because drift often turns single channels noisy or silent.

The bet

Now split the world in two. The manifold (the shape of the latent states, and how they relate to behavior) lives in the brain. The mixing matrix A lives in the hardware: it records which neurons each electrode hears. Drift is a change of A.

So the manifold bet is this: A changes from day to day, but the manifold and its relation to behavior stay put. If it holds, a fix is possible. Find the new A, or the map between the old and new latent coordinates, and a decoder that reads z keeps working.

The FALCON authors state the evidence for the bet in one sentence. Population activity contains low-dimensional structure that shows a consistent relationship with behavior over months to years. Degenhart and colleagues measured one version of it. After an instability, the new manifold captured 76 ± 2% of the variance shared with the baseline manifold. Random manifolds captured 17 ± 1%. The shape had moved, but it was still mostly the same shape.

A worked example

Use two latents and three channels. On day 0, A has rows (1, 0), (0, 1) and (1, 1). A state z = (2, 1) gives channels y = (2, 1, 3).

On day K the electrodes have moved. The new rows are (0.8, 0.6), (−0.6, 0.8) and (0.2, 1.4). The brain does the same thing, so z = (2, 1) again. Now the channels read (2.2, −0.4, 1.8). Every number differs. A decoder that multiplies day-0 weights by this vector reads garbage.

But suppose you know the new A. Solve for z by least squares: z = (ATA)−1 AT y. The two pieces are ATA = [[1.04, 0.28], [0.28, 2.96]] and ATy = (2.36, 3.52). Their solution is exactly (2, 1). The latent state is back, and the day-0 decoder can read it.

Two things in the example are hard in real life. First, the new A is not given. We must estimate it, and without labels (Chapters 3 to 5). Second, a latent space has no fixed axes. A fresh factor analysis may return the same shape rotated, so the coordinates must be matched too. That match is a rotation, and Chapter 3 finds it.

Same sculpture, new wall

A reach direction goes round a full circle. Top: six channel traces on day 0 (blue) and day K (warm). Bottom: the latent state recovered from the channels (teal) against the day-0 circle (blue). Drag the days apart.

25

Toy model, not data: a 2-dimensional latent circle seen through 6 channels with a random seeded mixing matrix and a little seeded noise on every channel; the mixing matrix moves by (days apart) / 60 × 1.2 of a random matrix. Recovery uses the true day-K matrix, which no real system knows: it shows what is possible, and Chapters 3 to 5 estimate it.

Watch the numbers as you drag. The channel traces drift further from day 0 as the days grow. The recovered latent circle stays on the reference. That gap between a changing view and a fixed shape is what every fix in this lesson exploits.

Under the manifold bet, what is assumed to change from day to day, and what is assumed to stay the same?

Chapter 3

Aligning Two Spaces by Rotation

Turn today’s map of the brain until it lies on top of the calibration map, and learn which electrodes to trust

You have two photographs of the same star field. One was taken last night, the other tonight. The camera was tilted a little in between. You cannot say which star is which by looking at pixel positions. But if you turn one photograph until the stars line up, the tilt cancels. This chapter does exactly that with the brain’s latent coordinates.

Electrodes as points in latent space

Chapter 2 gave the model y = A z + noise. Its matrix A has one row per electrode and one column per latent variable. In the Degenhart study this matrix is written Λ (the loading matrix), with N = 75 electrodes feeding the decoder (the array gave about 93 usable electrodes, and the spare ones served as a source for the tuning-change test) and d = 10 latent dimensions. The stabilizer fits a factor analysis model on each new block of neural data and gets a new Λ.

Here is the key picture. Read each row of Λ as the coordinates of one electrode in latent space. Each electrode is a point. Day 0 gives a cloud of points. If the electrodes still hear the same neurons on day K, the new cloud is the old cloud. But the fit may return the latent axes turned by some angle, because the axes of a fresh factor analysis are arbitrary. So the new cloud is the old cloud, rotated.

The orthogonal Procrustes problem

Finding that turn is a classic problem. A rotation (or reflection) that keeps lengths and angles is an orthogonal matrix O, shape [d, d]. We want the O that moves the new points as close as possible to the old points. This is the orthogonal Procrustes problem, named for the myth of the innkeeper who fitted guests to his bed.

O*
The best orthogonal matrix, shape [d, d].
OTO = I
The rule that makes O a pure rotation or reflection: it stretches nothing.
Λ2,s
Today’s loadings, but only the rows (electrodes) in the set s that we trust.
Λ1,s
The day-0 loadings for the same electrodes.

In general the answer comes from a singular value decomposition: write Λ2,sT Λ1,s = U Σ VT, and then O* = U VT. In two dimensions it is easier to see. The best turning angle is atan2(Σ cross, Σ dot), where for each electrode the dot product and the cross product compare its new point with its old point.

Work a small case. Day 0 has three electrodes at (1, 0), (0, 1) and (1, 1). On day K the cloud is turned by 30 degrees: the points are (0.866, 0.5), (−0.5, 0.866) and (0.366, 1.366). The dot products of new with old are 0.866, 0.866 and 1.732, which sum to 3.464. The cross products (newx × oldy − newy × oldx) are −0.5, −0.5 and −1.0, which sum to −2.0. The angle is atan2(−2.0, 3.464) = −30 degrees. Turn the new cloud by −30 degrees and it lies on the old one.

Not every electrode can be trusted

There is a catch. The method assumes the points are the same points, turned. But drift also changes some electrodes themselves: a channel goes dead, or it now hears a different neuron. Those rows are not rotated copies. They are different points. If you include them, they pull the fitted angle away from the truth.

Degenhart and colleagues handled this with two steps. First, remove electrodes whose loading row is nearly zero: those with an l2 norm below T = 0.01 counts per bin are dead. Second, run a greedy search (their Algorithm 1). Align on all remaining electrodes. Find the electrode whose row moved most after alignment. Drop it. Align again. Repeat until B = 60 electrodes are left. The paper shows the alignment is unique as long as the number of stable electrodes is at least the manifold dimension, here ten. Sixty is well above ten.

This is a robust-fitting idea in plain clothes. The stable electrodes are the anchors. The unstable ones are the outliers, found by checking which points refuse to land where the rest do.

Turn the cloud, drop the liars

Each dot is one electrode’s loading. Blue: day 0. Warm: day K, turned by the drift and with some electrodes replaced. Teal: day K after the fitted rotation. Red rings: electrodes that really changed. Compare the two modes.

40
5

Toy model, not data: 20 electrodes in a 2-dimensional latent plane (the paper uses 75 decoder electrodes in 10 dimensions and keeps 60). Changed electrodes are turned 80 degrees further than the rest (a neuron that now fires differently), stable ones get a little seeded noise. The rotation formula and the greedy loop are the ones in the text; the paper’s version also drops dead electrodes with row norm below 0.01 first.

With many changed electrodes, fitting on all of them leaves a large angle error. The greedy drop usually finds most of the liars and the error falls. Notice the limit too: when too few stable electrodes remain, any method fails.

What the aligned loadings do

The rotation is not the end. It feeds a pipeline with fixed pieces. Here is the data flow for one time bin:

  1. Counts in. Spike counts y, shape [75], minus the day-0 baseline.
  2. Latent state. Estimate z with the aligned loadings Λ2 O*, restricted to the stable electrodes. Shape [10].
  3. Fixed decoder. A velocity Kalman filter trained on day 0 maps z to cursor velocity, shape [2]. Its weights never change.

Only step 2 updates. The decoder stays as the engineers built it, and the user keeps the cursor feel they had on day 0. That is the design choice: move the signal, not the code. Chapter 4 runs this loop live.

Why do Degenhart and colleagues align only on a subset of stable electrodes?

Chapter 4

Stabilizing a Cursor Without Labels

Run the alignment live on a monkey’s cursor and read how fast it recovers and how it compares with recalibrating

A monkey sits at a screen and moves a cursor to one of eight targets using only its motor cortex. Halfway through the session, researchers break the recording on purpose. They silence some electrodes, shift the baseline of others, and swap the signals on a few. The cursor wanders off. A few minutes later it is steering again, and nobody has asked the monkey to redo anything.

That is the experiment in Degenhart et al. (Nature Biomedical Engineering, 2020). Chapter 3 gave the mathematics. This chapter reads how the pieces ran in a live loop, and what the numbers say.

The setup

Two male rhesus macaques each had a 96-electrode array in the proximal arm area of primary motor cortex. About 92.9 ± 1.2 electrodes were used per experiment. The task was two-dimensional center-out cursor control with eight possible targets. The decoder had two stages. A factor analysis stabilizer mapped neural activity to a 10-dimensional latent state. A velocity Kalman filter (Lesson on the Kalman filter) turned that latent state into cursor velocity. The Kalman filter stayed fixed. Only the stabilizer updated.

The stabilizer never saw the user’s intent. It updated nominally every 16 trials, using neural activity from the first second of each trial. Monkey L used all the trials collected in a single-day session. Monkey N used a sliding buffer of the most recent 128 trials. During stabilization the targets were random, so no tidy pattern in the task helped the algorithm.

The broken signals

To test the fix, the team added instabilities by software. They are the three kinds of change from Chapter 1, at these sizes:

There were 42 single-day experiments, plus two 5-day experiments, one per monkey. The multi-day runs matter: they let instabilities accumulate across days.

What the numbers say

In the single-day experiments the success rate was 99.9 ± 0.6% at baseline and 98.3 ± 0.4% with the stabilizer. Acquisition time was 0.61 ± 0.02 s at baseline and 0.73 ± 0.02 s with the stabilizer. The target acquisition rate was 1.70 ± 0.05 targets per second at baseline and 1.31 ± 0.05 with the stabilizer. So stabilizing did not give back all of the lost performance. The stabilizer rate was still significantly higher than the rate with the instability alone, and the stabilizer improved performance in 38 of 42 experiments.

The recovery was fast. The time constant was 0.92 ± 0.15 updates, or 88.9 ± 7.9 s of control time. A time constant is the time for the remaining error to shrink by a factor of e (about 2.7). If the recovery is exponential, then after one update about 66% of the error is gone, and after three updates about 96%. In the multi-day experiments the constant was longer: 5.14 ± 1.20 updates, or 384.8 ± 89.3 s. The authors explain why. The sliding buffer mixed new and old instabilities, so the target kept moving.

Recover, then compare

First view: error against stabilizer updates. Drag the update count and read how much of the error each setting has removed. Second view: the paper’s comparison with supervised recalibration.

2

The time constants (0.92 and 5.14 updates) and the comparison bars (20.2 and 5.7 degrees; 37 and 28 of 41 experiments) are from Degenhart et al. 2020. The curve shape is our sketch: we assume the error decays exponentially from an illustrative start of 60 degrees. The paper reports the constants, not this curve.

Against supervised recalibration

The most useful test compared the stabilizer with the old remedy. The team gave a supervised recalibration the best possible help: it knew the true intended direction (an oracle). They ran this test offline, on the trials right after each instability, when control was poor and the neural signal held little intent information. The stabilizer improved angular error in 37 of 41 experiments, by 20.2 degrees on average. Supervised recalibration improved it in 28 of 41, by 5.7 degrees. The paired difference was 14.5 degrees in favour of the stabilizer.

The reason is in the slopes. Supervised recalibration needs the neural data to point in the intended direction, so its performance rose steeply (slope 1.3) with direction signal strength. The stabilizer rose less steeply (0.7). It was less dependent on that signal because it matches the shape of activity, not the link to intent. When the signal is weak, a method that must fit a map from signal to intent has the least to work with.

What this does not show

Be careful with the claim. The instabilities were created by software on a working array, so the real biology of drift is only approximated. The subjects were monkeys. The study did not run a person’s whole day. And the assumption is the one from Chapter 2: the manifold stays the same. The paper’s own measure of this is the 76% against 17% of shared variance. It is strong evidence, not a guarantee.

In the closed-loop test, why was recovery slower in the multi-day experiments (5.14 updates) than in the single-day ones (0.92 updates)?

Chapter 5

NoMAD: Aligning the Dynamics

Freeze a model of the brain’s dynamics, then train a small adapter until today’s states look like day 0

Imagine a choir that has rehearsed one song for weeks. On a new day the singers stand in different places, and a few are replaced. You cannot ask them to learn the song again. But you hold a recording of how the song sounded on day 0. You can ask: how must I mix the microphones today so the choir sounds like that recording? NoMAD does this for neural activity.

Why plain rotation is not enough

Chapter 3 aligned two clouds of electrode points. NoMAD (Nonlinear Manifold Alignment with Dynamics, Karpowicz et al., Nature Communications 2025) aligns something richer: the state of a model of the brain’s dynamics at every moment. The change brings two gains. The alignment can be nonlinear. And it can use time: a neural population does not jump around, it flows along trajectories, and the flow follows rules.

The model of dynamics is LFADS, the latent factor analysis via dynamical systems tool from Lesson 20. In short, a recurrent neural network called the generator carries a hidden state forward in time. An encoder and a controller infer its starting point and its inputs. A readout turns the generator’s state into predicted firing rates. LFADS is trained so that those rates explain the recorded spikes.

The recipe, step by step

NoMAD runs in two phases. The shapes below follow the paper’s description.

  1. Day 0: train. Fit LFADS on the day-0 recordings, with a spiking loss and a behavioral loss. Then train a decoder on the generator states, separately from LFADS. This decoder is the fixed one.
  2. Day K: freeze. Keep every weight of the LFADS recurrent networks fixed. The dynamics rule stays the one learned on day 0.
  3. Day K: adapt three small pieces. A feedforward alignment network (two dense layers with ReLU), the low-dimensional read-in that takes the day-K spikes into the model, and the rates readout. Only these train.
  4. The loss. Two terms. A Poisson reconstruction loss makes the model still explain today’s spikes. A Kullback-Leibler (KL) divergence term compares the distribution of today’s generator states with the distribution of day-0 generator states, each approximated as a multivariate normal. Shrinking it pulls today’s states into the day-0 region.
  5. Use. A sliding window gives one new prediction per time bin, so it works causally, as a real-time system needs.

No behavioral labels enter step 3 or 4. The alignment uses all of the day-K neural data, including periods when the user is idle. That is the unsupervised part.

KL divergence from scratch

The KL divergence measures how much one probability distribution differs from another. It is zero when they are identical and grows as they separate. For two normal distributions it has a closed form.

KL
The divergence of distribution 1 from distribution 0, in nats.
tr(Σ1−1Σ0)
Compares the spreads. It equals k when the spreads match.
(μ1−μ0)TΣ1−1(μ1−μ0)
Compares the centres, measured in units of the spread. It is zero when the centres match.
k
The number of dimensions.
ln(detΣ1/detΣ0)
Compares the volumes of the two clouds.

A one-dimensional check. Distribution 0 is a bell with centre 0 and variance 1. If distribution 1 is a bell with centre 1 and variance 1, the formula gives ½ × 1 = 0.5. If instead distribution 1 has centre 0 and variance 4, it gives ½ [0.25 − 1 + ln 4] = 0.318. Only the centre moved in the first case; only the spread in the second; both cost something.

Train an adapter to match

Blue: day-0 states (the target). Warm: day-K states. Teal: day-K states after the adapter. Press Train to minimize the KL divergence, then switch the cloud shape and train again.

Toy model, not NoMAD: the adapter is only a rotation plus a shift (3 numbers) instead of a two-layer network, the clouds are 2-dimensional Gaussians, and day K is day 0 turned 70 degrees and moved by (1.2, −0.8). We minimize the KL divergence from the day-0 Gaussian to the adapted day-K Gaussian by gradient descent on exact formulas. Point error compares each adapted point with the day-0 point it came from.

Look at the round cloud. The KL falls to zero, yet the adapted points sit turned 70 degrees from where they began. A round cloud looks the same after any rotation, so matching the distribution cannot fix the turn. The stretched cloud has a long axis, and that breaks the tie. (Even then a half-turn would match as well; the shortest turn wins here.)

This is the reason for the word dynamics in NoMAD. A single cloud of states is a weak anchor. The frozen generator is a much stronger one. It sets the rule for how states move from one moment to the next. For the adapted inputs to make the day-0 model run sensibly, they must carry the right temporal structure, and a wrong rotation breaks it.

What the experiments showed

The authors used two monkey datasets, each with a 96-channel array in motor cortex. One was an isometric wrist force task: 20 sessions across 95 days. The other was center-out reaching: 12 sessions across 38 days. They also tested one human participant (T11, BrainGate2, 192 channels) on a short timescale, with closed-loop four-target imagined movement.

In the isometric task, NoMAD held a median R² of 0.91 across 380 day pairs, with no failures. The alternatives were weaker: ADAN reached 0.65 and aligned factor analysis 0.59. A static decoder failed in 223 of the 380 pairs. Chapter 8 compares half-lives.

The authors list limits of their own. The evaluation was offline, so online control is untested. It assumes a stable relation between the manifold and behavior; learning a new skill might break it. The study covered months, not years. The 95-day isometric series came from one monkey. And the alignment is computationally heavy, so it is best run on external hardware.

In NoMAD, which parts train on a new day, and what drives the training?

Chapter 6

Plug and Play: Let the Brain Hold Still

Turn the problem around: keep the decoder fixed and let the user’s own brain settle into one map

You learn a new keyboard layout. For the first hour you hunt for every key. If someone rearranged the keys every morning, you would never get fast. If the layout stayed put for a week, your fingers would learn it and you would stop thinking about it. That is the whole idea of this chapter.

The earlier chapters kept the decoder fixed and bent the signal to fit it. Silversmith and colleagues (Nature Biotechnology, 2021, online 2020) tried a different idea. Keep the decoder fixed, and let the user’s brain bend to fit it.

A different sensor, a different strategy

The setting differs from Chapters 3 to 5. The participant, a person with paralysis, had a chronic electrocorticography (ECoG) implant: a sheet of 128 channels that rests on the surface of the brain, under the skull, instead of needles in the tissue. The authors chose it because it allowed stable monitoring of signals. (Lesson 3 compares recording types.) This is a single-participant study.

Stable recordings leave the second source of change: the weights of the decoder. In most BCIs they are refit each session. The authors asked what happens if they are not. They used closed-loop decoder adaptation (CDA): while the user controls a cursor, the system nudges the decoder weights toward whatever would have worked better. Their long-term version, ltCDA, carries those weights over from one session to the next across multiple days.

The abstract states the finding in two parts. First, carrying decoder weights across sessions leads to the consolidation of a neural map and to “plug-and-play” control: the user sits down and it works. Second, daily reinitialization of the decoder led to degradation of performance with variable relearning. The authors also report that, once the map had consolidated, they could add control features over days, stacking new dimensions of control on top of the old ones.

One limit applies to the numbers here. The claims above come from the paper’s abstract, which we read on PubMed. The full text was not open to us, so this lesson prints no figure from inside the paper.

Why a fixed target helps a learner

Think of the decoder as a lock and the neural activity as the key the user must cut. Motor learning is the slow work of cutting the key. If the lock changes every day, the user starts over each morning. If the lock is fixed, each day’s practice builds on yesterday’s.

Put a number on it with a toy. Let e be a user’s mismatch: how far the product of decoder and neural map sits from the ideal. In each practice step the user removes a fraction α of the mismatch, so after t steps it is e(1 − α)t. With α = 0.2 and 10 steps, the factor is 0.810 = 0.107. A day that starts at e = 0.8 ends at 0.086.

The learning step has an easy reading. With α = 0.2, three steps leave 0.83 = 51% of the mismatch, and ten leave 11%. Higher α means a faster learner. In the toy, the carried-over decoder helps most when practice is short, because a short day is when a good start matters most.

Now the two policies differ in where day 2 starts. With a fixed decoder, day 2 starts near where day 1 ended, plus a little overnight slip. Say the slip is 0.05: the start is about 0.136, and it ends at 0.015. With a reset decoder, day 2 starts from a fresh mismatch, again about 0.8, and ends at 0.086 as before. The reset user never gets ahead. The fixed-decoder user improves day after day until the slip balances the learning.

Carry over or reset

Each point is one day’s average performance. Teal: the decoder carries over. Warm: the decoder is reset each morning. Change how fast the user learns and how much they slip overnight.

20%
0.05

Illustrative toy, not Silversmith’s data: mismatch starts at 0.8 on day 1, each of 10 practice steps removes the chosen fraction, performance is exp(−mismatch) averaged over the steps, and the reset decoder starts each day from a random mismatch around 0.8 (seeded, redrawn by the button). The paper’s qualitative result is that daily reinitialization was worse with variable relearning; the numbers here are ours.

Push the slip up and watch the advantage shrink. A user who forgets a lot overnight gains little from a carried-over decoder. That is the limit of the idea, and it leads to the next point.

What the user is, and what the algorithm is

Compare this chapter with Chapters 3 to 5. All four approaches hold the decoder fixed. They differ in who closes the gap when the world moves.

ApproachWhat stays fixedWhat does the aligningNeeds
Degenhart stabilizerKalman decoderA Procrustes rotation, fitted by an algorithmNeural data only
NoMADLFADS dynamics and decoderA small trained adapterNeural data only, heavy compute
Plug and play (ltCDA)Decoder weightsThe user’s own learningStable recordings, days of practice

The routes are not rivals. If the recordings move, the user’s learned map breaks, and an algorithm must realign the signal so that the learned map stays valid. If the recordings are steady, the user’s learning can carry a fixed decoder a long way. A good system uses both: an algorithm keeps the input stable, and the brain keeps improving its side.

According to Silversmith and colleagues, what did resetting the decoder every day do compared with carrying its weights over?

Chapter 7

FALCON: Measuring Consistency

Score a decoder on days it has never seen, with a small calibration budget, and read the gap

Two labs each claim a decoder that “stays stable”. One tested on the next day, the other on a month later. One used a cursor task, the other handwriting. One counted success rate, the other error. Whose decoder is better? Nobody can say, because the tests do not match. FALCON is a fix for that.

What FALCON is

FALCON stands for Few-shot Algorithms for Consistent Neural decoding (Karpowicz, Ye, Pandarinath and colleagues, NeurIPS 2024, Datasets and Benchmarks). It is a common test for one question: how well does a decoder work on a day it has barely seen? The authors frame the real-world challenge as keeping high performance on distinct but related data distributions with minimal data from the new setting. Their reason for a benchmark is that earlier work used ad-hoc evaluations, so methods could not be compared.

Five datasets

Each dataset holds many sessions of multi-unit threshold crossings (detected voltage jumps caused by nearby neurons) from intracortical electrodes, plus a behavior to predict.

NameWho and whatChannelsOutputMetric
M1Two monkeys (A and B) reach, grasp and move an object64 or 9616 muscles (EMG)R²
M2A monkey moves virtual fingers962-D finger movementR²
H1A person attempts cued reach and grasp (open loop)1727-D hand and arm velocityR²
H2A person attempts to handwrite sentences192Characters, then wordsWord error rate
B1A songbird sings (Neuropixels probe)85Song spectrogramMean squared error

Held-in, held-out, and what you may use

Each dataset splits into two contiguous blocks of sessions. The held-in sessions are the early ones, with plenty of data: enough to train a strong decoder, as in a normal calibration. The held-out sessions are the later ones, with only a small calibration slice released. A part of each session is withheld for scoring.

That design fits three families of method. A zero-shot method uses no data from a held-out session. A few-shot unsupervised method uses today’s neural data but no behavior (NoMAD and CycleGAN are in this group). A few-shot supervised method uses the small calibration slice with labels. The paper also names a test-time adaptive family that infers labels during normal use.

You submit code, not predictions. The server calls it on streaming neural data one time bin at a time, so it must be causal: it can only use the present and past. It is also open-loop, because no human is steering a cursor with it.

The metrics, by hand

For movement tasks FALCON reports the coefficient of determination, R²: one minus the squared error of the prediction divided by the squared spread of the truth. Take truth values 1, 2, 3. A guess of 1.5, 2, 2.5 has squared error 0.5 against a spread of 2, so R² = 0.75. A guess of always 2 (the mean) gives R² = 0. A guess of 3, 2, 1 gives 1 − 8/2 = −3. R² can be negative: a decoder can do worse than guessing the mean. With several outputs, FALCON takes a variance-weighted average over them.

For handwriting it uses word error rate (WER): the edit distance between the predicted and intended sequence, divided by the intended length. “the hat sat down” against “the cat sat” needs one substitution and one insertion, so WER = 2/3 = 0.67. For birdsong it uses mean squared error on the predicted spectrogram. Scores are computed per session, then averaged, separately for held-in and held-out.

Why test few-shot at all? Calibration is costly. The FALCON authors note, about the H1 dataset, that high-dimensional control is burdensome to calibrate: the many possible endpoints demand calibration procedures that are often several minutes long. A method that cuts that to a short slice on each new day, or to none, has real value. FALCON puts a number on how much.

Oracle and static: the two ends of the ruler

The paper brackets every dataset with two reference decoders. The oracle is trained on abundant data from the held-out session itself, so it estimates the best you could hope for. The static decoder is trained on held-in data and applied unchanged, so it estimates the cost of doing nothing. A real method should land between the two.

Read the baseline table

Each pair of bars is one baseline: blue on held-in days, warm on held-out days. Pick a dataset and look for the gap between the pair.

All values are the means in Table 1 of Karpowicz et al. 2024 (movement: R², higher is better; H2: word error rate, lower is better; B1: mean squared error times 10−4, lower is better). OR: oracle. ZS: zero-shot (static). FSU: few-shot unsupervised. FSS: few-shot supervised. TTA: test-time adaptive. Standard deviations are in the paper and are left out here.

Three lessons stand out. First, every static decoder drops on held-out days; the paper reports drops of up to 0.28 R² for the Wiener filter on M1 and a much larger 1.94 for the recurrent network. Second, the realignment methods help but not enough. On M1-A, NoMAD plus a Wiener filter scores 0.49 on held-out days against 0.34 for the static filter, yet it falls 0.15 from its own held-in score. Third, more data buys a lot: the few-shot supervised network reaches 0.59 on M1-A.

The authors name two limits of the benchmark itself. It is open loop, so it does not test a person steering in real time. And models may exploit trial structure that is built into the data without helping real control.

A decoder scores R² = 0.60 on FALCON’s held-in sessions and 0.25 on held-out sessions. What does that tell you?

Chapter 8

Half-Lives, Failures and When the Bet Breaks

Compare methods by how long they last, and list the ways the manifold bet can fail

A radio mechanic does not ask whether a battery is “good”. She asks how long it lasts. A decoder needs the same question. Does it still work in a week, in a month? This chapter puts a number on lasting, then lists the ways each fix can quietly stop working.

Half-life as a ruler for stability

The NoMAD paper compares methods across many pairs of days. For each pair it trains on one day and tests on the other, then summarizes how performance falls as the gap grows. One summary is the half-life. The paper turns each median R² into a signal-to-noise ratio (SNR) and fits an exponential decay to it. The half-life is the number of days for that SNR to halve.

The arithmetic is simple. The SNR after t days is S0 × 2−t/h, where h is the half-life. With h = 57.9 days, the SNR keeps 2−7/57.9 = 92% of itself after a week. With h = 1.03 days, it keeps 2−7/1.03 = 0.9% of itself. Same week, a hundredfold difference.

The paper also counts failures: day pairs on which a method did not work, meaning the decoded R² fell below zero. It counts them out of all pairs. In the isometric task there were 380 pairs; in the reaching task, 132.

Rank methods by how long they last

Pick a task and a measure. Compare NoMAD with ADAN, aligned factor analysis and a static decoder. Half-life uses a log axis, so each tick is ten times the last.

All numbers are from the NoMAD paper (Karpowicz et al. 2025, offline evaluation across day pairs; a linear Wiener filter decoder). The paper does not report a median R² or a half-life for the static decoder in the text we read, so those bars are left blank rather than guessed.

Read the reaching task. NoMAD keeps a median R² of 0.78 with a half-life of 57.9 days and no failures. ADAN, an adversarial method, reaches 0.29, a half-life of 7.12 days and 15 failures. Aligned factor analysis, a method in the family of the Chapter 4 stabilizer, reaches 0.17 (not significantly better than static, p = 0.153), a half-life of 1.03 days and 53 failures. A static decoder fails on 78 of 132 pairs. On the easier isometric task every aligned method holds up longer, and NoMAD reaches 208.7 days.

Do not read this as a verdict between Degenhart and NoMAD. The tasks, the decoder and the evaluation differ from Degenhart’s closed-loop test, and the comparison runs in the NoMAD paper’s own offline setup. It tells you how much task difficulty matters: a method that lasts months on one behavior can last a day on another.

A static decoder is the plain control. In the paper it fails on 223 of 380 isometric pairs, about 59%, and on 78 of 132 reaching pairs, also about 59%. So a decoder that is never adjusted is wrong on more than half of the day pairs in both tasks. That is the price of doing nothing, and it frames every other bar in the device.

When the bet breaks: symptom, measurement, fix

Every method here rests on the Chapter 2 bet. Here is what happens when the bet fails, how to see it, and what to do.

1. The map from manifold to behavior changes. Symptom: alignment looks perfect, yet the cursor is still wrong. A user may adopt a new strategy or posture, or learn a new skill. FALCON says this may violate the assumption, and NoMAD lists it as a limit. Measurement: the neural distributions match day 0, but decoder error stays high. Fix: a small amount of labelled recalibration, which is what the few-shot supervised class does.

2. Too few stable electrodes. Symptom: the fitted rotation jumps around from one update to the next. Measurement: the count of electrodes that survive the greedy drop. Degenhart showed that the alignment is unique only if that count is at least the manifold dimension, ten there, and the study kept 60. Fix: alert and recalibrate when the count nears the dimension.

3. The recording type changes the kind of drift. FALCON notes that Neuropixels probes show nonstationarities that differ in type and timescale from older arrays. Measurement: compare held-in and held-out scores per dataset, as in Chapter 7. Fix: test on your own recording type; do not borrow another type’s half-life.

4. The calibration slice misses behaviors. FALCON warns that not every condition is sampled in the few-shot calibration data. A decoder adapted on easy movements may fail on rare ones. Fix: choose calibration tasks that cover the conditions you care about.

5. Offline success hides closed-loop trouble. NoMAD was tested offline, and FALCON is open loop. A person who steers will react to errors and change their own signals. Fix: test in closed loop before trust (Lesson 17 covers closed-loop refit).

Those five fixes are the same drill each time: find a number that would change if the bet failed, watch it, and have a plan for when it moves.

In the reaching task, aligned factor analysis has a half-life of 1.03 days and NoMAD 57.9 days. What does that say?

Chapter 9

Field Guide

Keep the numbers, the checklist, the core code and the sources on one page

You can now follow the whole drift story. An implanted array records a changing view of a steadier brain. A fixed decoder breaks when the view changes. Four ideas repair it: realign the view by a rotation (Degenhart), realign the dynamics with a frozen model (NoMAD), let the user adapt to a carried-over decoder (Silversmith), and recalibrate with little data (scored by FALCON).

The numbers that matter

WhatNumberWhy it matters
Manifold overlap after instability76 ± 2% vs 17 ± 1% for randomThe bet is mostly true (Degenhart 2020)
Stabilizer setup10 latent dimensions, 60 electrodes kept, T = 0.01, update every 16 trialsAlignment is unique if stable electrodes ≥ dimensions
Single-day closed loopSuccess 98.3% vs 99.9%; 1.31 vs 1.70 targets per second; better in 38 of 42Most, not all, of the loss is recovered
Recovery time constant0.92 updates (88.9 s) single-day; 5.14 updates (384.8 s) multi-daySeconds to minutes, no labels
Versus supervised recalibration20.2 vs 5.7 degrees; 37 vs 28 of 41Unlabelled realignment can beat labelled refits when direction signal is weak
NoMAD, isometric taskMedian R² 0.91, half-life 208.7 days, 0 of 380 failuresFrozen dynamics plus a small adapter lasts months (offline)
NoMAD, reaching taskMedian R² 0.78, half-life 57.9 days, 0 of 132 failuresHarder task, shorter life
Plug and play128-channel ECoG, one participantCarrying weights over beat daily resets (abstract-level)
FALCON M1-A, held-out R²Static WF 0.34; NoMAD+WF 0.49; NDT2 few-shot 0.59; oracle NDT2 0.78The ruler: static is the floor, oracle the ceiling
FALCON H2, held-out WERCORP 0.11 vs oracle RNN+LM 0.03Test-time adaptation helps but leaves a 4x gap

The checklist

The core as code

pythonimport numpy as np

def procrustes_rotation(L2, L1):                       # Ch 3: argmin_O ||L2 @ O - L1||_F
    U, _, Vt = np.linalg.svd(L2.T @ L1)               # L1, L2: [n_stable, d]
    return U @ Vt                                       # [d, d], orthogonal

def stabilize(L1, L2, keep=60, eps=0.01):                # Ch 3-4: greedy drop of changed electrodes
    idx = np.flatnonzero(np.linalg.norm(L2, axis=1) >= eps)   # drop silent rows first
    while len(idx) > keep:
        O = procrustes_rotation(L2[idx], L1[idx])
        resid = np.linalg.norm(L2[idx] @ O - L1[idx], axis=1)
        idx = np.delete(idx, resid.argmax())               # the row that moved most
    return procrustes_rotation(L2[idx], L1[idx]), idx

def kl_gauss(mu0, S0, mu1, S1):                         # Ch 5: the NoMAD alignment term, per Gaussian pair
    S1i, dm = np.linalg.inv(S1), mu1 - mu0
    return 0.5 * (np.trace(S1i @ S0) + dm @ S1i @ dm - len(mu0)
                  + np.log(np.linalg.det(S1) / np.linalg.det(S0)))

# one time bin, day K:  y [75]  ->  z = (L2 @ O)^+ (y - b)  [10]  ->  fixed Kalman filter (day 0)  ->  velocity [2]

Where it sits in the field

Realignment is one thread of a larger effort to make implants usable at home. Compare it with adaptive Kalman filters, which adjust the decoder’s noise settings online, and with the refit loops of Lesson 17.

Keep going

Sources

All toy devices are labelled illustrative where they appear.

The takeaway. A BCI decoder does not need to be retrained because the brain changed. It needs to be shown the same shape of brain activity again. Rotate the view, align the dynamics, or let the user adapt, and measure the result on days the decoder has not seen.
You must keep a fixed decoder working on a person’s array for months, with no labels on new days. Which pair of checks fits what this lesson taught?

Now press Teach and explain, from memory, why a fixed decoder fails when the recording changes, what stays the same underneath, and how a rotation or a frozen model puts it back. Then go back to the drifting cursor at the top, set 40 days, and say why Realign and Recalibrate each fix it and what each costs.

Drift and Recalibration (BCI series, lesson 21)
Degenhart 2020 · Silversmith 2020 · NoMAD · FALCON · Back to Gleams