Eight small networks, each solving a concrete problem. The first two can be checked with pencil and paper. The third adds a lookup table. The fourth is the shape of a real network, with the same three moves inside it: predict, measure the miss, nudge every weight. The fifth meets real data and learns the hardest lesson: a network can memorize instead of learn. The sixth reads real handwritten digits. The seventh reads text and writes some of its own. The eighth reads the same text with attention: the transformer inside today's language models, at pencil-and-paper size.
A stall sells apples and bananas and charges a bag fee. From receipts alone, one neuron works out the prices. Every number fits on a napkin.
Two switches, one light, on when exactly one switch is up. A single neuron can never learn this. A hidden layer of two can, and the first step is all whole numbers.
Three warning signs in, a probability of rain out. Sigmoid neurons, a lookup table for σ, and cross-entropy loss, which scores a probability by how surprised you are.
The same question with a real diary: temperature, rain today, the month. Two hidden layers, random starting weights, and twelve held-out days to check the network generalizes rather than memorizes.
The real Pima Indians Diabetes dataset, no hidden rule anywhere. A big network trained on a hundred patients drives its training loss to zero while its answers for new patients get worse. Cause the overfitting, then try the four standard cures and see what each one really does.
Real handwritten digits from MNIST, 2,000 to learn from and 500 never seen. A convolutional network slides four tiny filters across each picture, so a stroke learned in one corner is recognized in every corner, and reaches about 94% on new digits. Draw a digit yourself and watch the ten probabilities.
Four sentences about a cat and a dog. A recurrent network reads them character by character, carrying a 12-number memory from one step to the next and guessing the next character each time. The first step of a snippet is a column lookup plus a tanh table, checkable by hand. Then type a few letters and let it continue.
The same four sentences, read by a transformer: the architecture inside GPT-style language models. No memory passed step by step; instead every character looks directly at every character before it and decides how much to borrow from each. Starts with what a transformer is, in plain words, then steps through embeddings, attention, the feed-forward network and the backward pass with real numbers.
Every example has the same controls. Next advances one stage: read the data, forward pass stage by stage, loss, backward pass stage by stage, update. Each stage shows the formula, the same formula with the real numbers substituted, and the result, while the diagram highlights the part of the network being computed.
green is the forward pass, red is the backward pass, yellow is the thing being computed right now.
Each example also ships as a short Python script (nn.py to nn8.py) that prints the same numbers, so the pages can be checked independently. The real datasets for examples 5 and 6 are in the data folder with their provenance.