The neural notebook
Book IV / The complete learning journey

A neural network,
one calculation
at a time.

From your first trainable neuron to a complete tiny language model. Change a number, follow its consequences, and understand every step.

Public beta · 66 chapters · final browser acceptance incomplete

The learning loop: input, parameters, output, loss and an update back to the parametersINPUTPARAMETERSOUTPUTLOSS← A REAL UPDATEx₁x₂w₁w₂ŷ
Calculation produces an output. Learning changes the parameters.
The curriculum

Fifteen connected ideas.
One computation you can follow.

Part I · 5 chapters

Neural Network Foundations

Distinguish fixed computation from trained parameters; see shapes and losses.

5/5 source lessons

Part III · 3 chapters

Embeddings

Treat token IDs as indices and learn distributed vectors from a loss.

3/3 source lessons

Part IV · 3 chapters

Sequence Models

Model ordered states and understand recurrent gradient limitations.

3/3 source lessons

Part V · 5 chapters

Self-Attention

Compute single-head attention with exact masks and faithful probabilities.

5/5 source lessons

Part VI · 3 chapters

Multi-Head Attention

Separate independent heads and reconstruct the projected output.

3/3 source lessons

Part VII · 4 chapters

Transformer Blocks

Assemble residual, normalization and MLP mechanics.

4/4 source lessons

Part VIII · 3 chapters

Positional Information

Describe and compute positional signals and RoPE.

3/3 source lessons

Part IX · 3 chapters

Tokenization

Convert Unicode text to reversible token IDs using deterministic algorithms.

3/3 source lessons

Part X · 4 chapters

Language Modeling

Compute causal likelihoods and next-token training losses.

4/4 source lessons

Part XI · 4 chapters

Autoregressive Inference

Trace prefill, decoding, probabilities and controlled sampling.

4/4 source lessons

Part XII · 3 chapters

KV Cache

Verify cached decoding and understand costs and invalidation.

3/3 source lessons

Part XIII · 4 chapters

Training Language Models

Explain data flow, optimizer steps, checkpoints and limitations.

4/4 source lessons

Part XIV · 4 chapters

Fine-Tuning and Alignment

Inspect adaptation methods, preference objectives and their limits.

4/4 source lessons

Part XV · 8 chapters

Modern LLM Architectures

Evaluate architectural variants and integrated systems with explicit caveats.

8/8 source lessons