Chain of thought as extra computation
Explain that each generated token gets a fixed budget of about 2N FLOPs and L sequential layers. Explain why writing intermediate steps buys more serial computation and working memory for hard problems.
Builds on: FLOPs per token: 2N forward, 6N training, Autoregressive generation loop
What the animation says
One token, one climb
Ask a model for a hard answer straight away, and it often gets it wrong. Let it write steps first, and it often gets it right. Same weights. Same prompt. Producing one token is one forward pass: about two times N operations, climbing through the layers in order. A result made in one layer can only be used by the layers above it. Our toy model has four layers, and each layer follows one hop of a chain. This question needs six hops. Can one pass get there?
Depth, not operations
Watch. Hop one, hop two, hop three, hop four, and the layers run out. Billions of operations don't help. The limit is depth: how many steps can happen one after another. Add more positions, like a longer prompt, and the picture gets wider, not taller. Each position reads earlier ones only from the layer below. So every chain of dependencies still climbs at most L layers.
Writing as scratch paper
So write it down. The pass samples its result as a token. On the next pass, that token enters at the bottom, and a fresh four-layer climb starts from it. Here is the toy in code. This forward function does four hops from the last token. This loop appends each result and runs again. Twenty hops take five tokens, with the same weights every time. Tap what carries the result into the next pass.
The real budget
Now a real size: seven billion parameters, thirty-two layers. Answer directly: about fourteen billion operations, and thirty-two layers deep. Write three hundred tokens of steps first: three hundred and one passes, about four trillion operations, and up to nine thousand six hundred thirty-two layers of depth. Every token gets the same budget. Writing steps chains those budgets together, and leaves a scratchpad every later token can read.
A fixed budget per token
Budget with k intermediate tokens
7B model: answer now vs think first
Toy: fixed-depth passes plus scratch tokens
import numpy as np
nxt = np.random.default_rng(0).permutation(1000)
L, start, hops = 4, 7, 20
def forward(tokens):
x = tokens[-1]
for _ in range(L): x = nxt[x]
return x
truth = start
for _ in range(hops): truth = nxt[truth]
toks = [start]
for _ in range(hops // L): toks.append(forward(toks))
print(toks[-1] == truth, len(toks) - 1)
Remember this
On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.
Bytewise
All courses