Log inStart free
LESSON 36.06 · 6 STAGES · 3 CONTROLS · 2 CHECKSPRO · PREVIEW

Parallel training of SSMs with scans

Watch a scan find every state of an SSM in a few levels.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 2 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 36.06 · SCAN BAYLOOP · 8 STEPS IN A ROW · h8 = 0.160
01
Stage 1 of 6 · Loop over tokens
In training, every token is known at once. The loop still finds the state after each token, one after another: 8 steps.
Explain it simply

The teal u cells are the inputs, one per word. Beside each one, the h loop cell holds the state after that word. Each state needs the one before it, so the loop takes 8 steps in a row. A GPU with thousands of cores would wait on one cell at a time.

8 input cells over a row of 8 state cells joined by arrows. The states are 0.039, 0.378, 0.347, 0.289, 0.215, 0.327, 0.198, 0.160.

input u, state h (loop and scan), bĀ, a, costgap to the looppair copied downcombine
u (input)h loop×Ā, + B̄uthecatsatonthemat.the0.10.90.30.20.10.50.00.10.0390.3780.3470.2890.2150.3270.1980.160u (input)h loop×Ā, + B̄uthecatsatonthemat.the0.10.90.30.20.10.50.00.10.0390.3780.3470.2890.2150.3270.1980.160
Toy: one 36.C2 SSM state, 8 or 16 story tokens, not trained
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ht=Aˉ ht−1+Bˉ ut\sy{h}{data}{h_t} = \sy{Ab}{param}{\bar A}\,\sy{hp}{data}{h_{t-1}} + \sy{Bb}{param}{\bar B}\,\sy{u}{data}{u_t}
t=2:  ht=0.607⋅0.039+0.393⋅0.9≈0.378t = 2:\ \ h_t = 0.607\cdot 0.039 + 0.393\cdot 0.9 \approx 0.378

Each state keeps Ā of the last state and adds B̄ times the input.

Common mix-ups

MYTHEach state must wait for the state before it.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
2 CHECKS · PRO
Q01With 16 tokens, how many levels does the doubling scan need?

Make your guess, then test it in the diagram. All 2 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 2 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.