AI by Hand ✍️

AI by Hand ✍️

Size

RNNs by Hand, in Excel

Prof. Tom Yeh's avatar
Prof. Tom Yeh
Sep 27, 2026
∙ Paid

Library › RNNs by Hand, in Excel

  1. Recurrence

  2. Size

  3. Outputs

  4. Depth

  5. Seq2Seq

  6. Tokens

  7. Autoregressive

  8. Loss

  9. Small Language Model

In the last article, every input and every memory had size one. In this article, we grow them. The hidden size, h, is how many numbers the hidden state holds. The input size, d, is how many numbers each step reads. We also read a batch, several sequences at once. Within this article, we keep the weights fixed, so each example differs from the last in one way only.

d=1, h=2, seq=5

We give the memory a second number, in green. Every step still does the same thing. At step t, it reads its input xₜ and the hidden state from the step before, hₜ₋₁. What grows is the weights. Wx, b and Wy each gain an entry, one per memory number. Wh becomes a matrix. Why a matrix? Because each new memory number reads both old ones. Follow the arrows in the download; each one now carries the whole memory to the next step.

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2026 Tom Yeh · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture