Transformers, ELI5 · Part 5 / 10
Stack it ~96 times
A block hands back the same shape it got — so you stack it. Zoom out, and the whole model is mostly matrix multiplies adding up.
One block hands back the same shape it got. So its output is a legal input to the next block. So you just… do it again.
The residual stream
Picture one wide highway of numbers, start to finish. A block doesn’t replace it — it reads the highway, computes an update, and adds it back on. That running total is the . (That’s why the width never changes.)
Does it just keep growing? No — the nudges go both ways, so the vector steers instead of ballooning.
Layer norm keeps it clean
And before each block reads the stream, rescales it — subtract the , divide by the — so the numbers can’t drift too big or too small.
The whole model, at a glance
Almost every step is a (amber). , , and are just the thin glue between them.
Now watch the real numbers
Same model, made concrete: a tiny real transformer where every number is computed. Each step shows before → after.
Press Play. The grid changes at every step, predicts a word, then appends it and runs again — the loop that writes text.
Next: how that last vector turns into a word.
Sources · 7
- Jurafsky, Daniel, and James H. Martin. Speech and Language Processing (3rd ed. draft, 2026), Chapter 8: "Transformers."
- He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. "Deep Residual Learning for Image Recognition." CVPR, 2016. arXiv:1512.03385.
- Elhage, Nelson, et al. "A Mathematical Framework for Transformer Circuits." Transformer Circuits Thread, 2021.
- Ba, Jimmy Lei, Jamie Ryan Kiros, and Geoffrey E. Hinton. "Layer Normalization." 2016. arXiv:1607.06450.
- Xiong, Ruibin, et al. "On Layer Normalization in the Transformer Architecture." ICML, 2020. arXiv:2002.04745.
- Zhang, Biao, and Rico Sennrich. "Root Mean Square Layer Normalization." NeurIPS, 2019. arXiv:1910.07467.
- Brown, Tom B., et al. "Language Models are Few-Shot Learners." NeurIPS, 2020. arXiv:2005.14165.