FORCE Learning

A random network of 300 chaotic units can learn to draw a clean wave in a few seconds. Train only its readout, with recursive least squares, and the wandering settles into a cycle.

See how a chaotic recurrent network, the kind used to model cortex, learns a pattern while it keeps running, and why that matters for models of brain activity.

Press Start learning and watch the warm output line lock onto the blue target. Then press Switch learning off: the network keeps drawing the wave by itself. Then we build, piece by piece, the network, the readout, the feedback loop and the update rule underneath.

You need a little linear algebra (a vector is a list of numbers; a dot product multiplies two lists entry by entry and adds) and the idea of a derivative (how fast something changes). We build the rest from zero.

Based on David Sussillo and L. F. Abbott, “Generating coherent patterns of activity from chaotic neural networks”, Neuron 63(4), pages 544 to 557, 2009 (open access). There are no course slides for this lesson: every idea is re-taught here in our own words and devices, from the paper and its Methods. Part of the Brain-Computer Interfaces series; it follows Task-Trained Networks.

Teach a wandering network a wave

A toy version of the 2009 set-up: 300 units instead of 1,000, each wired to about 30 others (10%), recurrent gain g = 1.5, time constant 10 ms, readout weights updated every 2 ms by recursive least squares with α = 1. The equations are the paper’s; the network is simulated live in your browser. Some random networks fail to learn: New network tries another.

Chapter 0

A Wandering Network and a Simple Wave

See why a network that never repeats itself is a strange place to store a movement, and what you would need to make it draw one

Picture a monkey about to reach for a raisin. An electrode array in its motor cortex, the strip of brain that sends movement commands, records a few hundred cells. Before the hand moves, the cells fire in patterns. One speeds up. Another slows down. A third does both in a single reach.

The cells do not look like the movement. A hand path is smooth and simple. A single cell’s firing is bumpy and hard to read. Churchland and colleagues put it plainly in the abstract of their 2012 paper: single-neuron responses in motor cortex are complex.

A decoder, like the ones in Linear Decoders, can read this activity without explaining it. This lesson asks the other question. Where does the activity come from? One answer is that motor cortex is a recurrent network, a web of cells that talk to each other in loops. On this view the movement is a pattern the web generates, not a message it forwards.

The trouble with a restless network

David Sussillo and Larry Abbott started from a simple idea. When we move a limb, the activity that carries out the move grows from the spontaneous activity the circuit already has. A model of such a circuit needs units with firing rates, random loops between them, and enough gain. Models like that are chaotic.

The paper defines chaotic activity as activity that is irregular and exponentially sensitive to initial conditions. Start the network twice from almost the same state. The two runs separate fast, and they never repeat. Chapter 1 lets you watch it happen.

Here is the puzzle. A movement, such as a reach or a step, must come out the same way every time. So how can a restless network produce a clean, repeatable pattern? You would have to train it. But the paper notes a problem: the usual ways to train a recurrent network generally do not converge when its activity is chaotic.

Feel the problem before the fix

Here is the problem at the smallest scale. Below is a short recording of six units from a chaotic network, each one wiggling in its own way. The blue line is the wave we want. Your job is to add the six wiggles together, each with a weight you choose, so the sum matches the wave. A weight is a number that says how much of one signal to mix in.

Mix six wiggles into a wave

Top: the six purple unit traces. Bottom: the blue target and your warm mix. Drag the six weights. Then try Best six weights, which finds the least possible error.

Illustrative: the traces are six of the 400 units of a simulated chaotic network (gain g = 1.5, no training, no input), recorded for 1.2 s. The target is a sine with a period of 600 ms and a peak of 0.7. “Best” is the exact least-squares answer for six weights.

You will find that you cannot get close. Six chaotic signals do not contain a clean wave, and even the best six weights leave most of the error. With more units the fit gets better. Chapter 2 will use 200 and find a new problem. The fit works only inside the recording and then falls apart.

So we need two more ideas. First, the network must see its own output, so that the wave it draws feeds back and calms the restlessness. Second, we need an update rule that is so fast and so careful that the error stays small from the very first moment. The paper calls the whole recipe FORCE learning, short for First-Order Reduced and Controlled Error.

Why a BCI engineer cares

Three threads of this series pass through this paper. First, LFADS and task-trained networks both use a recurrent network as a model of cortex, and FORCE is the early template for that move. Second, the trained network gives a worked picture of low-dimensional population activity, the idea behind neural manifolds. Third, recursive least squares is a standard update for adaptive filters, like those in Adaptive Kalman. You can reuse the rule elsewhere.

By the end you will have trained such a network in your browser, broken it on purpose, and read its activity with PCA, the tool from the PCA lesson.

  1. A network that never repeats: rate units, random loops, and the gain g that makes chaos.
  2. The readout: one weighted sum, and why fitting it to the past is not enough.
  3. The feedback loop: the output returns to the network, and why that is both needed and dangerous.
  4. Recursive least squares: the update rule, derived, with a worked example.
  5. Train it live: the full console, with every number visible.
  6. The edge of chaos: why a restless network learns better than a quiet one.
  7. Break it on purpose: a weak target, a bad learning rate, a delayed loop.
  8. How many modes does it use? PCA on the trained network.
  9. Back to cortex: what the model says about motor cortex, and what it does not.
  10. The field guide: numbers, code, links onward.
Why is a chaotic recurrent network a hard thing to train with the older recurrent-network algorithms?

Chapter 1

A Network That Never Repeats

Build the rate network from one unit up, then turn a single dial, the gain g, and watch order turn into chaos

Imagine a hall with 300 people. Each person holds a lamp with a dimmer dial. Every person has been told to watch about 30 others, chosen at random. Every 10 milliseconds, each person takes a weighted vote of what those 30 lamps show and eases their own dial toward the result.

No one is in charge. No one gets a script. Yet the lamps flicker, brighten and fade in patterns that look like they are going somewhere. That hall is the network of this lesson.

One unit

Each person is a rate unit, a model of a neuron that tracks how fast the cell fires, not each spike. A unit holds one number, x, its drive. The unit shows the world r = tanh(x), its firing rate. The function tanh squashes any number into the range −1 to 1. A big drive saturates the rate near 1. A drive of zero gives a rate of zero. Read a negative rate as firing below the cell’s usual level.

The drive does not jump to the vote. It eases toward it. That gives each unit a memory of its own recent past, and it is the one equation of this chapter.

τ
The time constant, 10 ms in the paper. A small τ makes a unit react fast. A large τ makes it sluggish.
dxi/dt
How fast the drive of unit i is changing right now, in drive units per millisecond.
−xi
A leak. It pulls the drive back to zero when nothing pushes it, like a ball rolling to the bottom of a bowl.
Σj Jij rj
The weighted vote. Jij says how strongly unit j pushes unit i: positive excites, negative inhibits. rj is the rate of unit j.

To run it on a computer, take small steps of 1 ms. Each step moves the drive a tenth of the way (the step 1 ms divided by τ = 10 ms) toward where it is heading. Here is one unit worked out with real numbers.

Drive x = 0.50. Three inputs have rates 0.2, −0.6, 0.9 and weights 0.4, 0.7, −0.3. Vote = 0.08 − 0.42 − 0.27 = −0.61.

Change = −0.50 + (−0.61) = −1.11. New drive x = 0.50 + 0.1 × (−1.11) = 0.389. New rate r = tanh(0.389) = 0.371.

The web, and the dial called g

Now wire 300 of these together. The weights J form a 300 × 300 table of numbers, and in the paper only 10% of the entries are nonzero. They are random with an average of zero, so about half excite and half inhibit. Each unit therefore hears roughly 30 others.

One number scales the whole table: the gain g. It sets how loudly the web talks to itself. In the paper each nonzero weight is drawn from a bell curve with variance g² divided by (p × N), where p = 0.1 is the wiring density and N the number of units. That scaling keeps the total vote one unit hears at a steady size as N grows.

The paper states the result. With g below 1 the network is quiet before training: any push dies away. With g above 1 it is chaotic on its own: it never settles and never repeats. It gets more irregular and faster as g grows. The authors usually use g = 1.5.

Feel what chaotic means

The paper defines chaos as activity that is irregular and exponentially sensitive to initial conditions. You can test this directly with twins. Build two copies of the same network. Start them in the same state, then nudge one unit of the second copy by 0.001. Run both. If the network is chaotic, the tiny gap grows until the twins look unrelated.

Run the twin test

Top: one unit in twin A (solid) and twin B (dashed) for 4 s. Bottom: the distance between the two networks, on a log scale. Drag the gain g across 1.

1.50

The network is the paper’s rate model with 400 units, 10% wiring and no input. Finite networks sit near the edge at g = 1.5, so this particular network grows its gap slowly at first. The twins start 0.001 apart in one unit; distance is the length of the difference between all 400 drives. Your browser computes the numbers live.

At g = 0.5 the gap shrinks and both units fall silent. At g = 1.5 the gap grows by orders of magnitude within a few seconds. At higher gain it grows faster, until it is as large as the network’s own activity. Close to g = 1 you cross over.

This is the problem from Chapter 0 in sharper form. A chaotic network is rich: it never makes the same move twice. That is also why it seems useless for producing a fixed wave. The rest of the lesson shows how to use the richness and still get a wave.

What the computer holds

For N = 300 the state is two vectors, x and r, each with 300 numbers. The wiring is a table J: 300 × 300 with about 9,000 nonzero entries. One 1 ms step costs about 9,000 multiply-adds for the vote plus 300 calls to tanh.

pythonimport numpy as np
N, p, g, tau, dt = 300, 0.1, 1.5, 10.0, 1.0
rng = np.random.default_rng(0)
J = g * rng.normal(size=(N, N)) / np.sqrt(p * N) * (rng.random((N, N)) < p)   # sparse, zero mean
x = 0.5 * rng.normal(size=N)                                   # drive of each unit
for step in range(3000):
    r = np.tanh(x)                                      # rates, shape (N,)
    x = x + (dt / tau) * (-x + J @ r)                   # one Euler step

Two failures are worth knowing. If g is too low, the symptom is a flat network: every unit sinks to zero. You measure it by the twin distance, which shrinks. The fix is more gain. If g is too high, units pin at ±1 and the activity becomes too fast and jumpy to train, as Chapter 6 shows.

You run twin copies of a network, nudged by 0.001, and the gap grows by orders of magnitude within seconds. What does that tell you?

Chapter 2

The Readout: One Weighted Sum

Define the output of a network as a weighted sum of its units, fit the weights by least squares, and see why a perfect fit to the past is not enough

A sound engineer sits at a mixing desk with 200 channels. Each channel plays one unit of our network, and each unit wiggles in its own way. She wants one pure tone. She has the first 1.5 seconds of the recording to set her 200 sliders. After that, she must hold the tone while the recording keeps running.

Can she do it? In this chapter you play the engineer, with a computer to do the arithmetic. The result tells us what is missing.

Define the output as a weighted sum

A network has hundreds of rates and no built-in “answer”. So the paper defines one. The output z is a weighted sum of all the rates. The weights form a vector w, one number per unit.

z(t)
The network output at time t: one number. Our goal is to make z(t) equal a target function f(t).
wT
The readout weights, a list of N numbers, written as a row so that the product with r is a dot product: multiply entry by entry, then add.
r(t)
The firing rates of all N units at time t: a list of N numbers between −1 and 1.

The paper is careful about what this is. The readout is a stand-in for complex circuitry between the cortex and the muscles, which is why the authors call it a unit and its numbers weights, not neurons and synapses. It gives us a clean place to say what the network is “doing”.

Why a linear readout? Because it is the only part we will train. The wiring J stays random. So the task is to choose N numbers, and the output depends on them in a simple, straight way. That makes the error a bowl with one lowest point. There are no traps to fall into on the way down.

Least squares, from zero

Record the rates at T moments. Stack them into a table R: T × N, one row per moment and one column per unit. Let f be the list of T target values. The outputs at all moments are R w. We want the weights that make R w as close to f as possible, in the sense of the smallest sum of squared differences.

Setting the slope of that bowl to zero gives the normal equations: (RTR) w = RT f. Here is a tiny case you can check by hand.

Two units, three moments. R rows: (1, 0), (0, 1), (1, 1). Target f = (1, 2, 3).

RTR = [[2, 1], [1, 2]] and RTf = (1 + 3, 2 + 3) = (4, 5).

Solving gives w = (1, 2). Check: 1×1 + 2×0 = 1, 0 + 2 = 2, 1 + 2 = 3. A perfect fit.

With real data you add a small ridge term, a leash that stops the weights from growing huge: (RTR + λI) w = RTf. Without it, units that move together make the answer wild. The code is one line.

python# R: (T, N) rates, f: (T,) target, lam: leash strength
w = np.linalg.solve(R.T @ R + lam * np.eye(N), R.T @ f)   # shape (N,)
z = R @ w                                                  # the fitted output, shape (T,)

Fit the past, then ask for the future

Now run the experiment. The device records a chaotic network and gives the readout 200 of its units. It fits the readout to a sine wave on the first 1.5 seconds. Then it keeps the same weights and lets the network run on for another 1.5 seconds. Nothing returns to the network. The question is simple: does the sine continue?

Fit the first half, test the second

Left of the divider: the window used to fit the weights. Right: the next 1.5 s, which the fit never saw. Add units, then change the leash.

200
0.001

Illustrative set-up on the paper’s rate model: the first 200 units of a 400-unit network, g = 1.5, no feedback, rates sampled every 5 ms (300 samples per window), target a sine with a period of 600 ms and a peak of 0.7. Errors are root-mean-square, so 0 is perfect; the target itself has RMS 0.49. The fit is the exact ridge solution above.

With 200 units the fit window looks close to perfect. The next window is a mess. The units in that second stretch did something new, and the weights have no idea what.

Adding units makes the fit window better but does nothing for the test window. That is the signature of overfitting: the weights memorised the particular wiggles of one stretch. A chaotic network does not repeat its wiggles. The engineer set her sliders for the past, and the future is a different recording.

What the failure tells us

Symptom: tiny error on the fit window and a large error on the next. Measurement: compare the two RMS errors in the read-out. The ratio is the warning light. A fix that only adds data or units will not work, because the activity never revisits the same states.

The real fix changes the game. The network must produce the same wave again and again, so that its activity does repeat, and the weights can lock onto it. For that, the output must return to the network as input. That is the feedback loop of Chapter 3.

A readout fitted on chaotic activity matches the target well on the training window and badly on the next window. What is the best explanation?

Chapter 3

Close the Loop

Feed the output back into the network, and learn why that is both required for the task and dangerous for the training

A singer holds a long note. A small speaker in her ear plays her own voice back, a hair late. If the note wobbles, she hears the wobble and corrects it. Her voice leaves her, returns, and shapes what she sings next. That is a feedback loop.

We give the network the same kind of ear. The output z goes back into every unit. The network now hears itself.

The loop in one equation

Chapter 1’s equation gets one new term. Each unit i receives the output z, multiplied by its own feedback weight, a fixed random number. These weights form a vector wf, one number per unit, drawn between −1 and 1. They never change.

τ, dxi/dt, −xi
As in Chapter 1: the time constant, the speed of change, and the leak.
Σj Jij rj
The vote from the other units through the random wiring J. This part is fixed too.
wf,i z
The new term. The output z from Chapter 2, scaled by the fixed feedback weight wf,i of unit i. The same z reaches every unit; only the scale differs.

How strong is it? The paper makes the feedback weights of order 1, while each recurrent weight is of order 1 over the square root of the number of inputs. Here are illustrative numbers. A feedback weight of 0.5 and an output of 0.7 push a unit by 0.35. The recurrent vote at g = 1.5 pushes it by about 0.75. The two are comparable, so the output has a real say in what the network does.

Two jobs for the loop

The first job is simple. A network with no outside input has nothing else to steer it. The paper states that learning cannot be accomplished in a network that receives no external input without such a loop.

The second job is the quiet hero. A strong, fast signal can switch a network from chaotic to non-chaotic activity. When the fed-back output is close to a clean wave, it drives the network onto a regular path. The network was chaotic before training. During training it is not, so there is a repeatable pattern for the readout to lock onto. The signal must have enough size and speed to do this; Chapter 7 shows what happens when it does not.

The danger: delayed effects

Now the trouble. At time t you change the readout weights w to shrink the error. That changes z at once. But z goes back through wf and changes the drives x. A few milliseconds later the rates r are different, and so is z. A change that looked like a gain now can look like a loss later.

The paper calls these delayed effects. In any recurrent network, the full result of one weight change spreads along the loop and is hard to compute.

Two ways out

Echo-state training (Jaeger and Haas, 2004) removes the problem by cheating. During training, the feedback is clamped to the target f. The network hears a perfect wave, whatever its own output does. The error is still computed from the real output, but it does not travel round the loop. After training you switch to the real z.

The price is stability. A network trained this way never heard its own small mistakes. After the switch, a tiny slip is a situation it has never seen, and the slip can grow. The paper adds that removing the errors from the feedback needs a mechanism that is hard to see in a real brain.

FORCE takes the other road. It feeds back the real output z and keeps the error tiny, so the delayed effects stay tiny too. The output is never far from f, so it is almost clamped, but not quite. Those small differences let learning meet the network’s own fluctuations and cancel them. Chapter 4 builds the update rule that can hold an error that small.

Test the two ways

The paper compares them with one dial. During training the feedback is a mix: γ f + (1 − γ) z. At γ = 0 you have FORCE. At γ = 1 you have echo-state clamping. Pick a setting and train eight random networks. Each network learns for 4 s, then runs alone for 2.5 s with the true output fed back.

Clamp the feedback, or not

Top: the loop, with the mix you chose on the return path. Bottom: one circle per network. A green circle kept the wave after learning stopped; a red one drifted away.

Toy version of the paper’s Figure 4 comparison: 150 units, g = 1.5, a sine with a period of 600 ms and a peak of 0.7, recursive least squares with α = 1, eight fixed random networks per setting. Success means an error below 25% of the target’s RMS during the last 1.7 s of free running. The paper’s own numbers are for 1,000 units; it reports stable results on most trials only for γ below 0.15.

The pattern matches the paper’s. Near γ = 0, most networks hold the wave. As γ rises, fewer of them hold it. The paper shows the typical slip for pure echo-state learning: the output matches the target briefly after learning stops, then deviates.

The loop as code

python# one 1 ms step with feedback; x, r, w_f: (N,)   J: (N, N)   w: (N,)   z, f: scalars
z_fed = gamma * f + (1 - gamma) * z               # gamma = 0 is FORCE, gamma = 1 is clamped
x = x + (dt / tau) * (-x + J @ r + w_f * z_fed)    # the network hears the mix
r = np.tanh(x)
z = w @ r                                          # new output, one number

Failure, as symptom, measurement and fix. Symptom: the output matches during learning, then drifts once learning stops. Measurement: run the network alone and compare the last second to the target, as the device does. Fix: feed back the real output during training, so the network meets its own fluctuations while the weights can still correct them.

Echo-state training clamps the feedback to the target while learning. What is its main weakness?

Chapter 4

Recursive Least Squares: A Learning Rate for Every Direction

Derive the update that keeps the error small from the first step, and check it by hand on two samples

You read a thermometer once a minute and want the average. You could store every reading and divide at the end. Or you could keep one number and fix it each minute: new average = old average + (reading − old average) / n. The second way needs no memory of the past. And the nudge shrinks as n grows, because you trust the average more.

That small trick is recursive least squares (RLS) in one dimension. The paper uses its full version, for a whole vector of weights. The idea stays the same: each new sample fixes the answer a little, by an amount that depends on how sure we already are.

The simple rule and its flaw

Take one moment. The network has rates r (N numbers). The readout gives wTr. The target is f. The error is the difference, e = wTr − f. The simplest fix moves each weight against its error: w ← w − η e r. This is the delta rule, and η is one learning rate for every weight.

One rate for all is a problem when the rates r move together. Some directions in weight space then matter a lot, because the data pushes hard along them. Others matter little. A rate that is safe for the first kind crawls on the second. A rate that is fast for the second kind overshoots on the first.

Give every direction its own rate

RLS replaces the single η with a matrix P, of size N × N. Think of P as a map of doubt. It is large in the directions of weight space where we have seen no data, and small where we have. The equations are the paper’s equations 4 to 6.

w(t), e−(t)
The new weights, and the error just before the update (the minus sign means “before”). The weights move against the error, but along P r, not along r.
P(t)
The map of doubt, updated at the same moment. Each sample shrinks it along the direction r, so the weights move less there next time.
α, I
The start: no data yet, so doubt is the same in every direction. I is the identity matrix, and α sets how big the first steps are. The paper finds α from 1 to 100 effective.

The paper gives P a precise meaning: it is a running estimate of the inverse of the correlation matrix of the rates, plus a small ridge term. That is exactly the (RTR + αI)−1 of Chapter 2, built one sample at a time. No matrix is ever inverted. Each update costs about N² operations.

Check it by hand

Take two weights, α = 1, weights starting at zero. The secret target weights are (2, −1). The first sample has rates r = (1, 1), so f = 2 − 1 = 1.

Error before: e = 0 − 1 = −1. P r = (1, 1); rTP r = 2; divide by 1 + 2 = 3.

New P = [[2/3, −1/3], [−1/3, 2/3]]. New P r = (1/3, 1/3). New w = (0, 0) + 1 × (1/3, 1/3) = (1/3, 1/3).

Error after: wTr − f = 2/3 − 1 = −1/3. The error fell from 1 to a third in one step.

The second sample has rates r = (1, −1), so f = 2 + 1 = 3.

Error before: e = (1/3 − 1/3) − 3 = −3. P r = (1, −1); rTP r = 2; divide by 3.

New P = [[1/3, 0], [0, 1/3]]. New P r = (1/3, −1/3). New w = (1/3, 1/3) + 3 × (1/3, −1/3) = (4/3, −2/3).

Compare with Chapter 2. With R = [[1, 1], [1, −1]] and α = 1, the ridge answer is (RTR + I)−1RTf = (4/3, −2/3). The match is exact. After two samples the weights sit at the ridge solution, pulled a little toward zero, away from the secret (2, −1). More samples remove that pull.

Why this keeps the error small

The paper proves the property FORCE needs. After each update the error becomes e+ = e− (1 − rT P r). In our example: −3 × (1 − 2/3) = −1. The factor rTP r is always positive. It starts near 1 and falls toward 0 as P shrinks. So early updates wipe out almost all of the error, and later updates change little. The error is small from the very start, and the weights settle.

For the very first update with zero starting weights, the paper shows the error drops to −α f / (α + rTr). With N units, rTr is of order N. As long as α is much less than N, this error is small, and α sets how small.

Now see the difference with your own eyes. The device feeds the same stream of samples to the delta rule and to RLS. The inputs have a correlation you control.

One rate for all, or one for each

The plane shows two weights. The blue dot is the secret answer. Warm: RLS. Grey: the delta rule. Yellow ellipse: RLS’s map of doubt P at its current weights. Raise the correlation, then press Next sample or Run 20.

0.90

Illustrative: two weights, secret answer (2, −1), two inputs with unit variance and the correlation you set, no noise, the same samples for both rules. RLS uses the equations above with α = 0.1 (small next to rTr, which is about 2 here, as α = 1 is small next to N in the paper). The delta rule uses a fixed rate η = 0.1. The yellow ellipse is drawn at one standard deviation of P.

With no correlation, the delta rule does fine. With a correlation of 0.9, it crawls along a narrow valley, while RLS gets much closer with the same samples. The map of doubt has learned the shape of the valley, and its yellow ellipse shrinks fastest across the valley, where the data pushes hardest.

The same step in code

python# one RLS step. r: (N,)  f: scalar  w: (N,)  P: (N, N) symmetric, P = I / alpha at the start
e = w @ r - f                      # error before the update, a scalar
Pr = P @ r                         # (N,)
k = Pr / (1 + r @ Pr)               # the per-direction step, (N,)
P = P - np.outer(k, Pr)            # shrink doubt along r
w = w - e * k                      # same as w - e * (P_new @ r)

Failure, as symptom, measurement and fix. Symptom: with α very small the first steps are huge and the output lurches. Measurement: plot the size of each weight change; it spikes at the start. Fix: raise α. The paper warns that small values are fast but can be unstable, while very large values may not hold the output near the target long enough.

What does the matrix P do in the RLS update?

Chapter 5

Train It Live

Run the whole recipe in front of you and read the four traces that tell you whether learning is working

You now hold every piece. A chaotic network of rate units. A readout that is one weighted sum. A feedback loop that returns the output. An update rule that keeps the error small. This chapter puts them together and lets you run them.

The procedure repeats every 2 milliseconds of network time. Four steps, always in this order.

  1. Run the network for two 1 ms steps with the current output fed back. Result: new drives x and rates r, each a list of 300 numbers.
  2. Read the output. z = wTr, one number.
  3. Measure the error. e = z − f, where f is the target at this moment.
  4. Update the weights by recursive least squares. Use e and r to change w and P, as in Chapter 4.

The cost is real. With 300 units, P holds 300 × 300 = 90,000 numbers. Each update touches all of them about three times. That is roughly 270,000 multiply-adds every 2 ms, and your browser does it live. The paper uses 1,000 units, where P holds a million numbers.

What the paper says to expect

Ordinary training starts with big errors and shrinks them slowly. FORCE does not. In the authors’ words, errors are always small, even from the beginning of training. The goal is therefore not to reduce a big error. It is to reduce the amount of change needed to keep the error small. By the end of training, no change is needed, and the network can generate the wave by itself.

The paper reports numbers for a network of 1,000 units. The network learned a triangle wave in only four cycles of the wave (Figure 2). Training typically converges in about 1000 τ. For τ = 10 ms, that is 10 s of network time. A 1,000-unit network with τ = 10 ms produced sine waves with periods from 60 ms to 8 s (Figure 2I).

Read the four traces

The console below shows four panels. Each one answers a question.

Panel 1, output and target. Is the warm line on top of the blue line? Panel 2, error. Does it stay small the whole time? Panel 3, size of each weight change. This is the paper’s trace of weight fluctuations. It should start large and fall by orders of magnitude. When it is tiny, the weights have settled. Panel 4, six units. Before learning they wander. During learning they should become regular.

The FORCE console

Choose a target, press Start learning, and watch all four panels. When panel 3 is low and panel 1 is clean, press Switch learning off. Some random networks do not settle; New network tries another.

The paper’s set-up scaled down: 300 units instead of 1,000, g = 1.5, τ = 10 ms, α = 1, readout updated every 2 ms, wiring density 10%. The network, the feedback weights and every update are computed live in your browser. Results differ between random networks, as they do in the paper’s trials.

Most runs go through three phases. In the first second the output is already near the target, because the first updates are large and well aimed. Next the six units lose their wandering and settle into a cycle, and the weight-change trace falls. Last, the changes become tiny, and switching learning off changes nothing you can see.

A worked reading of one run

Here are the numbers from one real run of the console on the sine, in our browser. After 4.6 s of learning the error was 0.02, against a target with RMS 0.51: a miss of about 4%. The weight change per update was 0.0016. After 12 s the error was 0.006 and the change 0.0002. After 24 s the error was 0.001, and the change had fallen below 0.0001.

Read it as a story. The error was never large, so there was no long climb down. What fell was the weight change: it dropped by a factor of about 8 in the first 12 s and by far more after that. By 24 s the update was moving the weights by a rounding error. That is the signal that learning is done.

Your numbers will differ, because the random wiring differs. The shape of the story should not.

What else the paper trained

The paper does not stop at waves. It trains a network to follow one variable of the chaotic Lorenz system. The output matches the target for a while and then the two diverge, as any two chaotic paths must. Even after that, the network’s output still looks like something from a Lorenz system.

It also trains a one-shot sequence that does not repeat, by parking the network at a fixed point first. It trains one network to produce several different outputs, chosen by a constant control input. It trains a 4-bit memory that flips each bit on or off when its input pulses. And it trains a network to reproduce 95 joint angles of human running and walking from motion capture data. The same update rule does all of this.

After learning stops

Keep watching for ten seconds after you switch learning off. The network has no teacher now. The weights are fixed. The output is made by the units alone, and the units are driven by their own output through the loop. If the wave persists, the network has become a self-running oscillator: the pattern lives in the loop, not in anyone’s instructions.

Try the two-sine target. It has two frequencies, so the loop has more to hold. The readout needs larger weights (watch the weight length in the read-out), and in this toy more random networks fail to settle.

Failure, as symptom, measurement and fix

Symptom: you switch learning off and the output wobbles, then drifts away. Measurement: panel 3 was still high when you switched, or the error in panel 2 was never flat. The read-out reports the error over the last second. Fix: learn longer before switching off, or press New network. A small network sometimes has no good solution, which is why the paper uses more units.

In a FORCE run, the error is small almost from the start. What tells you the learning has finished?

Chapter 6

Why a Restless Network Learns Better

Sweep the gain g and see why the best network to train sits just below the point where feedback can no longer calm it

Think of three bodies of water. A still pond has no ripples, so there is nothing for your hand to shape. A stormy sea has waves too big and too fast to steer. A pond on a breezy day has small, lively ripples that a steady hand can turn into a pattern.

A network has the same three states, and the gain g from Chapter 1 picks one. Which one trains best? The paper’s answer surprised many readers: the lively one, just short of the storm.

What the paper found

The old echo-state recipe started with quiet networks, which are inactive until you push them. The authors asked what a chaotic start would add. They scaled the recurrent weights by g and trained the same periodic target, for many values of g. Networks with g below 1 are inactive before training. Networks with g above 1 are chaotic, more irregular and faster as g grows.

They measured three things (Figure 5 of the paper). First, the number of cycles needed to train: it drops dramatically as g rises past 1. Second, the final error: it also falls with g. Third, the length of the readout weight vector, |w|. A large |w| means the solution leans on big positive and negative contributions that cancel. Such solutions are fragile and sensitive to noise. |w| falls with g and is smallest in the chaotic region.

So chaotic networks train faster, give more accurate output and use gentler weights.

Why would chaos help?

The paper does not give a single proof, so here is a plain way to see it. The readout can only build the target from what the units offer. A quiet network offers little to build from: its units sit near zero until pushed. A chaotic network offers hundreds of different, rich signals. With a richer menu, the readout can reach the target with smaller, less delicate weights.

That fits the weight lengths: a rich menu needs less cancelling.

A tiny case of cancelling weights

Why is a long |w| fragile? Take two units that carry almost the same signal: unit 1 has rate s and unit 2 has rate 0.99 s. The output wants to be 1.5 s.

Weights (50, −49): output = 50 s − 49 × 0.99 s = 50 s − 48.51 s = 1.49 s. Weight length about 70.

Weights (0.75, 0.75): output = 0.75 s + 0.74 s = 1.49 s. Weight length about 1.06.

Both give the same output on clean data. Now add noise of 0.02 to the rate of unit 1 alone. The first pair changes the output by 50 × 0.02 = 1.0, which is two thirds of the whole signal. The second pair changes it by 0.75 × 0.02 = 0.015. A network that finds the second kind of solution is robust. A richer chaotic network offers many different signals, so the second kind of solution is easier to find.

The ceiling: the edge of chaos

Does more chaos always help? No. The feedback loop has to calm the network during training (Chapter 3). For any given target and feedback strength, there is a gain beyond which the loop cannot suppress the chaos, and then learning does not converge. In the paper, the g values in Figure 5 stop at 1.56 for this reason. The best g for a target sits at the edge of chaos, just below the point where FORCE fails to suppress it.

Now see the same effect in your browser. The device trains eight random networks at each of seven values of g, on a sine wave. It takes about six seconds.

Sweep the gain

Top: how many of 8 random networks learned the sine at each g. Bottom: the median length |w| of the readout weights, among those that learned. Press the button and watch the bars fill.

Toy version of the paper’s Figure 5: 150 units, a sine with a period of 600 ms and a peak of 0.7, α = 1, 4.2 s of learning, then 2.5 s alone. A run succeeds if its error in the last 1.7 s is under 25% of the target’s RMS. Readout weights start at zero, so a quiet network, which has no activity, gives learning nothing to hold. Counts depend on the random networks drawn and will differ from the paper’s 1,000-unit runs.

Expect a hump. Below g = 1 the networks stay quiet and nothing is learned. Between g = 1.2 and 1.5 most networks succeed, with short weights. Past about 1.8 the success count falls as the feedback loses its grip on the chaos.

In code

python# the only place g enters: it scales the recurrent weights once, at construction
J = g * rng.normal(size=(N, N)) / np.sqrt(p * N) * mask      # mask: 10% ones
# g < 1: activity dies away.  g > 1: chaotic.  too large: feedback cannot calm it.

Failure, as symptom, measurement and fix. Symptom at high g: during learning, the error keeps spiking and the weights never settle. Measurement: look at the unit traces; they stay irregular instead of becoming a cycle. Fix: lower g, or give the feedback more strength or the target more amplitude (Chapter 7).

Why is there an upper limit on the gain g for FORCE learning?

Chapter 7

Break It on Purpose

Shrink the target, mis-set the learning rate and delay the feedback, then read what each failure looks like and how to repair it

A pilot learns a plane by learning how it fails: what a stall feels like, what a too-gentle turn does. A method you can only run when everything goes right is a method you do not yet understand. So we will break FORCE three ways and watch.

Each way maps to something the paper tells us. We use the toy network of the earlier chapters, with eight random copies per setting.

Break 1: a target that is too small

Chapter 3 said the fed-back output must be strong enough to calm the chaos. The paper tests it directly (Figure 2K). If the target is too small, the units stay chaotic even after FORCE learning starts, and learning does not converge.

Here is the arithmetic, with illustrative numbers. A feedback weight of 0.5 times an output of 0.7 pushes a unit by 0.35. The recurrent vote pushes by about 0.75, so the output has a real say. Shrink the target to 0.1, and the push drops to 0.05, fifteen times weaker than the vote. The chaos barely notices.

The paper offers two remedies. Shift the target away from zero by a constant, so the oscillation sits on a pedestal and the fed-back signal is large. Or use the other architectures of its Figure 1, in which learning also happens inside the network, to train small signals centred near zero.

Break 2: the wrong learning rate

In RLS the knob is α, the starting size of the map of doubt (Chapter 4). The paper describes both ends. Small α gives fast learning, but the weights can change so rapidly that the algorithm becomes unstable. Large α means the output may not be kept close to the target long enough, and learning fails. Values from 1 to 100 worked in practice, depending on the task.

The paper’s first-update formula shows why. With weights at zero, the error right after the first update is −α f / (α + rTr). With 300 units and typical rates of about 0.5, rTr is about 75. At α = 1 the first update leaves 1/76 of f, about 1.3%. At α = 100 it leaves 100/175, about 57%. At α = 1000 it leaves about 93%, so the first update barely helps. These are illustrative, but they show that a large α gives up the “small error from the start” that FORCE depends on.

When you tune a new problem, a good order is this. First check the target is big enough. Then set α near 1. Only then look at the feedback path.

Break 3: a late or twisted feedback path

Real feedback is not instant and not clean. A muscle signal returns late, filtered, and distorted. The paper tests this (Figure 6A) and finds FORCE learning remarkably robust to distortions. Nonlinear distortion is fine, as long as it does not squash the output’s fluctuations so much that chaos cannot be suppressed. Even extreme low-pass filtering is tolerated. Delays are harder if they are too long. The key condition is that the feedback has roughly the period and frequency content of the target.

In code, a delay is a queue. The feedback the network hears is the output from d milliseconds ago.

pythonfrom collections import deque
buf = deque([0.0] * d, maxlen=d + 1)        # holds the last d + 1 outputs
buf.append(z)                              # push the newest output
z_heard = buf[0]                          # the network hears the oldest one
x = x + (dt / tau) * (-x + J @ r + w_f * z_heard)

Break all three

Pick a knob and press the button. The device trains eight random networks at every setting of that knob, and fills a grid. Each row is one setting. Each circle is one random network. Green learned the sine and kept it with learning off. Red did not.

Turn a knob until it breaks

Choose a knob. The grid shows its settings from comfortable to extreme. Press Run every row and watch the circles turn green or red.

Toy runs: 150 units, g = 1.5, a sine with a period of 600 ms, the same eight random networks in every row. Target size is the peak of the sine; the default is 0.7. Success means an error under 25% of the target’s RMS in the last 1.7 s with learning off. The paper’s own tests (Figures 2K and 6A) use 1,000 units and report no such counts.

You should see three different shapes. A shrinking target fails fast: the circles turn red from 0.5 downward. Raising α makes a slower slide into red. The delay barely hurts at first and costs a few networks at long delays. The shapes match the paper’s advice: keep the signal big, keep α small to moderate, and keep the feedback roughly in rhythm with the target.

BreakSymptomMeasurementRepair
Target too smallUnits stay chaotic; output never locks onUnit traces in the console stay irregular after 10 sRaise the target size or add a constant shift
α too smallOutput lurches at the startThe weight-change trace spikesRaise α toward 1 to 100
α too largeOutput never gets closeThe error stays large after many secondsLower α
Feedback delayOutput out of step with the targetError rises with delayKeep the feedback close in period to the target
You train a network on a very small sine wave and the units stay chaotic after learning starts. What is the most likely reason?

Chapter 8

How Many Moves Does the Network Use?

Run PCA on a trained network, count the few modes that carry its wave, and see why the update rule suits that shape

A stage has 300 lamps. You film the show for an hour and look for patterns. The whole stage swells together, then the left half dims while the right half brightens. A few such shapes, repeated and mixed, describe most of what every lamp does. The 300 lamps move to a handful of moves.

A trained FORCE network is like that stage. Its 300 units look busy. But once it settles into the wave, the busy-ness has a simple shape. This chapter finds the shape.

PCA in three short paragraphs

At each moment, the 300 rates are one point in a space with 300 axes. As time passes, the point moves and draws a cloud. Principal component analysis (PCA) asks: along which direction is the cloud longest? That direction is the first principal component (PC 1).

Then it asks the same question among directions at right angles to PC 1. That gives PC 2, and so on. Each PC comes with an eigenvalue, the variance of the cloud along it: how long the cloud is in that direction. The full story is in the PCA lesson.

If the first few eigenvalues are large and the rest tiny, the cloud is nearly flat. The activity lives in a low-dimensional subspace. Chapter 5’s trained network runs through a closed loop, one cycle per period of the wave. A loop is a one-dimensional curve, so we should expect a flat cloud.

What the paper found

The authors ran PCA on a trained network (their Figure 3). The eigenvalues show that the activity lies in a space of much lower dimension than the number of units. The output could be rebuilt accurately from only the first 8 PCs.

But the paper adds a warning. Those 8 components are not the whole story, because the network must also be stable. Expressing the readout weights w in the PC basis, learning fixes the top 50 or so projections to single, unique values. The remaining projections differ from one learning trial to another. So many different weight vectors work. That multiplicity makes the search for good weights easy.

Why RLS fits this shape

In the PC basis, P is diagonal. Each PC then has its own learning rate. The paper shows that after M updates, the rate for the component along PC a is 1 / (M λa + α), where λa is that PC’s eigenvalue. Two stages follow.

While M is less than α/λa, the rate is close to 1/α. This is the control phase: the weights are used to hold the output near the target. After that comes the learning phase, where the rate falls as 1/λa and the weight finds its final value.

Take α = 1. A component with eigenvalue 50 leaves the control phase after 0.02 updates: at once. A component with eigenvalue 0.05 stays in control for 20 updates. Big modes learn first, and small modes spend more time steering. Controlling the small components lets the large ones be learned.

See the few modes

The device trains a 300-unit network, freezes it, records two cycles, and runs PCA on the rates. Training takes a few seconds. Then drag the number of PCs and watch the rebuilt output.

Count the modes

Top: how much of the activity each PC holds. Middle: the real output (warm) and the output rebuilt from the first k PCs (dashed). Bottom: the network’s path in the plane of PC 1 and PC 2.

2

The paper’s Figure 3 on a toy scale: 300 units, g = 1.5, α = 1, 6 s of learning (8 s for the triangle), then learning off. PCA is computed on 240 samples of the rates (two cycles, one sample every 5 ms) by subspace iteration; the top 12 PCs are shown. “Rebuilt” means the readout applied to the mean rates plus the first k PC parts of the activity.

For a sine wave you should find that the first two PCs already hold most of the variance, and that their path is a loop. The loop is the wave, drawn in the network’s own coordinates. In our runs two PCs held about 80% to 85% of the variance. Slide k upward: the rebuilt output closes in on the real one, and by 8 PCs the two are hard to tell apart.

python# r_t: (T, N) rates of the frozen network over two cycles; w: (N,) readout
mu = r_t.mean(axis=0); X = r_t - mu                # centre, (T, N)
lam, V = np.linalg.eigh(X.T @ X / len(X))            # eigenvalues ascending; V columns = PCs
lam, V = lam[::-1], V[:, ::-1]
k = 8
z_k = w @ mu + (X @ V[:, :k]) @ (V[:, :k].T @ w)     # output rebuilt from k PCs, (T,)

Failure, as symptom, measurement and fix. Symptom: the output rebuilt from a few PCs is wavy or off, although they hold nearly all the variance. Measurement: compare the rebuilt output with the real one, as the device does, not only the variance share. Variance share is not importance. Small PCs can carry weights that keep the network stable. Fix: keep more PCs, or check the reduced model by running it.

A trained network has 300 units, and the first 8 principal components rebuild its output well. What does this say?

Chapter 9

Back to Cortex: What the Model Claims

Separate what a trained chaotic network shows about motor cortex from what it only suggests, using three networks that do the same thing in different ways

A weather model can draw a storm. That does not make it weather. A model of cortex has the same limit. It can reproduce a pattern and it can suggest a mechanism. It cannot show that the brain uses that mechanism. This chapter keeps that line sharp.

What the 2009 paper says about cortex

The abstract makes one data claim: the trained networks reproduce data on premovement activity in motor and premotor cortex. The Discussion gives the reasoning. Here are its main points, each in the authors’ spirit.

A drop in variability before movement. To make a one-shot sequence, the authors first park the network at a fixed point, which ends the chaos, and then launch the sequence. Fluctuations of the units fall sharply just before the sequence starts. They note that Churchland and colleagues had reported just such a drop in variability in motor and premotor areas of monkeys right before a reach.

Single cells may mislead. Except in the simplest cases, the activity of the generator units bears little relation to the output. The authors suggest that linking single-neuron responses to motor actions may be misguided. They propose studying network-wide modes found by PCA, which is what Chapter 8 did.

The wiring tells you little. Even after training, the recurrent connectivity is random, and in two of the paper’s three architectures it is never changed at all. It would be very hard to learn how the network works by reading its synapses. The loops matter more than the weights.

An open question, not a result. The authors speculate that a separate feedback network, perhaps basal ganglia or cerebellum, could keep plasticity from disrupting a generator in motor cortex. They also state the limits: RLS needs an error signal and fast plasticity, and nobody knows how the brain computes such an error. The plasticity needed does not match typical long-term potentiation experiments.

Two papers that tested the idea

Churchland and colleagues (Nature 2012) looked at the data. They report that motor cortex responses during reaching contain a brief but strong oscillatory component, which is unexpected for a movement that does not repeat. Its amplitude and phase follow from the preparatory state. It fits a view in which cortex is a dynamical system, the view behind the 2009 model.

Sussillo, Churchland, Kaufman and Shenoy (Nature Neuroscience 2015) closed the loop. They trained recurrent networks to reproduce the muscle activity of reaching monkeys. They used a different optimiser, called Hessian-free, not FORCE. The solution that emerged was a low-dimensional oscillator that closely resembled the recordings. In a rotation analysis called jPCA, the goodness of fit was 0.60 for the neural data and 0.61 for the regularised model. Three rotation planes captured 45% of the variance in the data and 50% in the model. The agreement held only when the model was optimised to find simple solutions.

So FORCE is an early template, not the proof. What lasted is the idea: train a recurrent network to produce the output, then study its population dynamics.

Same job, different cells

Here is the paper’s second point, made concrete. The device trains three random networks on the same sine wave. Their outputs will match. Now look at the same numbered unit in each of them.

Three networks, one wave

Press Train three networks. Top: the three outputs and the target. Middle: unit number n in each network. Bottom: the path of each network in its PC 1 and PC 2 plane. Drag the unit number.

1

Three fixed random networks of 300 units (g = 1.5, α = 1), each trained for 6 s on the same sine with a period of 600 ms, then frozen. Correlation is the Pearson correlation of a unit’s rate with the target over two cycles. The orientation of each loop is arbitrary, since PCA fixes axes only up to sign.

The three outputs lie on top of each other. The same numbered unit does something different in each network: its correlation with the target can be high in one and low or negative in another. But the three loops in the PC plane look alike. That is the point. The wave lives in the population, not in a particular cell.

ClaimWhat supports itCaution
Motor cortex generates movement with its own dynamicsPremovement variability drop (cited by the 2009 paper); oscillatory component (Churchland 2012)Consistent with the model; other models may also fit
Simple recurrent dynamics can produce muscle activitySussillo 2015: jPCA fit 0.60 (neural) vs 0.61 (model)Agreement only when models were pushed toward simple solutions
Single-cell tuning is a poor guide to the mechanismThe device above, and the 2009 argumentA property of the toy model; the argument needs real data
The brain learns with RLSNoneThe authors call it a challenge: fast plasticity and an error signal are unexplained

Failure, as symptom, measurement and fix. Symptom: a toy model gets quoted as a finding about the brain. Measurement: ask what data would tell the model from a rival, such as the jPCA fit and the variability drop. Fix: state the claim as “consistent with” until a test separates the two.

Three trained networks draw the same wave, yet the same numbered unit behaves differently in each. What does this suggest for studying cortex?

Chapter 10

The Field Guide

Keep the numbers, the terms, a checklist and the whole method in one short piece of code

FORCE learning trains a chaotic recurrent network without taming the chaos first. The network keeps a fixed random wiring. Its output is one weighted sum of the unit rates. That output returns to the units through fixed random weights. A recursive least squares rule changes only the readout weights, so fast and so carefully that the error stays small from the first moment. The fed-back output pulls the network from chaos onto a repeatable path, and the weights settle. Then learning stops and the loop runs alone.

The numbers

QuantityValueWhere it comes from
Units, wiring densityN = 1,000; 10% of weights nonzeroSussillo and Abbott 2009, Methods, Figures 2 to 5
Recurrent gaing = 1.5 typical; below 1 inactive, above 1 chaotic2009, Results, Chaotic Spontaneous Activity
Time constantτ = 10 ms2009, Methods
RLS start sizeα = 1 in most figures; 1 to 100 effective2009, Results and Methods
Training timeAbout 1000 τ = 10 s; a triangle wave in four cycles2009, Figure 2
Period range of one networkSine waves from 60 ms to 8 s (1,000 units)2009, Figure 2I
Echo-state mixStable on most trials only for γ below 0.152009, Figure 4A
Upper gain limit in one testFigure 5 ends at g = 1.56 because learning stopped converging2009, Figure 5
Modes in a trained network8 PCs rebuild the output; about 50 readout projections are fixed by learning2009, Figure 3
Motion-capture demonstration95 joint angles of human motion capture; generator of 5,000 units2009, Figure 8 and Methods
Rotation fit, data vs modelR² 0.60 (neural) vs 0.61 (model); 3 planes hold 45% vs 50%Sussillo et al. 2015, Figure 3
This lesson’s toyN = 300 (150 in batch runs), g = 1.5, α = 1, update every 2 msIllustrative, computed in your browser

The terms

TermPlain meaning
Rate unitA model cell with a drive x and a rate r = tanh(x).
Gain gThe scale of the random recurrent weights. It decides quiet or chaotic.
ChaoticIrregular, and tiny differences grow exponentially.
ReadoutThe output z = wTr, one weighted sum of the rates.
FeedbackThe output returns to every unit through fixed random weights wf.
FORCEFirst-Order Reduced and Controlled Error: fast, strong updates that keep the error small from the start.
RLS and PRecursive least squares. P is a running inverse of the rate correlations, a learning rate for each direction.
Edge of chaosThe largest g at which feedback can still calm the network.
PCA principal component: a direction of large variance in the activity.

A checklist before you train one

  1. Gain. Pick g above 1, about 1.5, and below the point where feedback fails to calm the network.
  2. Target size. Make the peak large enough to push the units. Add a constant shift if you need a small wave.
  3. Feedback. Use fixed random weights of order 1, and feed back the real output, not the target.
  4. Start. Set the readout weights to zero and P to the identity divided by α.
  5. Rate. Choose α from 1 to 100. Update often compared with τ.
  6. Watch two traces. The error and the size of each weight change. Stop when the second is tiny.
  7. Test alone. Switch learning off and run for many cycles. Score the error, not just the fit.
  8. Use many seeds. Some random networks fail. Report how many.

The whole method as code

pythonimport numpy as np
rng = np.random.default_rng(3)
N, p, g, tau, dt, alpha = 300, 0.1, 1.5, 10.0, 1.0, 1.0
J  = g * rng.normal(size=(N, N)) / np.sqrt(p * N) * (rng.random((N, N)) < p)  # fixed, sparse, (N, N)
wf = rng.uniform(-1, 1, N)                  # fixed feedback weights, (N,)
w  = np.zeros(N); P = np.eye(N) / alpha          # readout and its learning-rate matrix
x  = 0.5 * rng.normal(size=N); r = np.tanh(x); z = 0.0
f  = lambda t: 0.7 * np.sin(2 * np.pi * t / 600.0)   # the target, period 600 ms

for step in range(9000):                     # one step = 1 ms
    t = step * dt
    x += dt / tau * (-x + J @ r + wf * z)       # the network hears its own output
    r = np.tanh(x)
    z = w @ r                                   # the output, a scalar
    if 300 <= step < 6000 and step % 2 == 0:       # learn every 2 ms, then stop
        e  = z - f(t)                           # error before the update
        Pr = P @ r
        k  = Pr / (1 + r @ Pr)
        P -= np.outer(k, Pr)                    # shrink doubt along r
        w -= e * k                              # move the readout
# after step 6000 the loop runs alone; compare z with f(t) over the last 1,500 steps

We ran this code with seeds 0 to 4. Four of the five networks held the sine after learning stopped, with a root-mean-square error below 0.03; the fifth stayed 0.18 away from the target. That is the same pattern you saw in the console.

Where it sits in the field

FORCE is an early, simple way to turn a random recurrent network into a model of a pattern. The same idea of a recurrent network that generates dynamics returns in LFADS, where a recurrent generator explains single-trial spiking, and in task-trained networks, where larger networks are trained on the whole task. The low-dimensional picture of Chapter 8 is the heart of neural manifolds and of latent-variable models.

One link to a lesson you already know: RLS is a Kalman filter for a weight vector that does not move. The map of doubt P is its covariance. The recurrent network itself is described in Recurrent Neural Networks.

Keep going

Sources

The lesson was built from the sources below. Numbers labelled as the paper’s come from the text of the first. Toy numbers are labelled illustrative.

The takeaway. You do not have to tame a chaotic network before you teach it. Close a loop from its output, update the readout fast and carefully so the error stays small, and the restlessness settles into a pattern that the loop itself keeps alive.

Now press Present or Teach and explain FORCE out loud, from memory. Say what the network is and why a fit to the past fails. Say why the loop is needed and dangerous, what P does, and how you tell that learning has finished. Then go back to the instrument at the top and train the triangle wave.

Credit: the method and its figures belong to David Sussillo and L. F. Abbott. This lesson re-teaches them in our own words and devices. There are no course slides behind it, and it is not affiliated with the authors or the journal.

FORCE Learning: Chaotic Recurrent Networks That Behave Like Cortex
Sussillo and Abbott 2009 · Open-access text · Back to Gleams