Neural Networks and AI Models

How a model works and how it is trained, from nothing

For a reader who knows some maths, some science and some programming, and nothing at all about machine learning. It starts with why some jobs cannot be written as rules, works one neuron out by hand, and builds up through layers, loss, gradient descent and backpropagation to the transformer, which nearly every model in use now is made of. It then explains each family in turn: pretraining and fine-tuning, diffusion and flow matching, models that see, language and vision-language models, learning from outcomes, the policies that move an arm, and world models. It ends with what it takes to run a model on a real robot and judge honestly whether it works.

14 chapters59 sections24 h 15 min of reading
0 of 59 sections read
  1. 01

    What Learning From Data Means

    This is the first page of a book about neural networks and the models built from them. Before any of that, it is worth being clear about what the ordinary way of programming a robot actually is, and when it works, because for…

    6 sections · 1 h 20 min

    1. 1.1How rules do the work5 min
    2. 1.2Where rules stop working10 min
    3. 1.3What a model is22 min
    4. 1.4Rules against models8 min
    5. 1.5Why the industry moved21 min
    6. 1.6The words everyone uses15 min
  2. 02

    Inside a Neural Network

    This page lists videos made by other people that explain neural networks. It is for a reader who wants a second explanation beside this chapter, or who learns better from watching than from reading. Nothing in the chapter depends…

    13 sections · 3 h 10 min

    1. 2.1Helpful resources2 min
    2. 2.2Neural networks and neurons11 min
    3. 2.3The grasp example7 min
    4. 2.4One neuron, worked out by hand12 min
    5. 2.5The smallest network9 min
    6. 2.6A network on a robot7 min
    7. 2.7One neuron of that network6 min
    8. 2.8Activation functions26 min
    9. 2.9Layers, depth and width24 min
    10. 2.10Layers, depth and width, worked out11 min
    11. 2.11The shape of the numbers37 min
    12. 2.12What a network can learn27 min
    13. 2.13Questions and answers9 min
  3. 03

    How Training Works

    The page before this one, what a network can learn, showed that a network with enough layers and enough weights can be shaped to fit almost any pattern. That page did not say how anybody finds the right values for those weights…

    4 sections · 1 h 55 min

    1. 3.1The score of being wrong31 min
    2. 3.2Gradient descent29 min
    3. 3.3Backpropagation: how every weight learns its share27 min
    4. 3.4The training loop26 min
  4. 04

    Making Training Work

    The page before this one, the training loop, put the whole of training into a single loop. It showed the loss falling step after step until the curve became flat. Everybody watches that falling curve while a training run is…

    2 sections · 56 min

    1. 4.1Overfitting and generalisation29 min
    2. 4.2Normalisation and stability27 min
  5. 05

    Turning the World Into Numbers

    The page before this one, Normalisation and stability, ended by saying that the numbers given to a network have to be scaled, so that training stays steady. That page assumed that the input was already a list of numbers. Every…

    2 sections · 59 min

    1. 5.1Tokens and embeddings30 min
    2. 5.2Pictures, sound and robot states29 min
  6. 06

    The Transformer

    This page explains attention, which is the step that lets every word in a sentence take account of the other words. Attention is the central part of the transformer, and nearly every model later in this book is built out of…

    4 sections · 1 h 50 min

    1. 6.1Attention29 min
    2. 6.2A transformer block24 min
    3. 6.3Training and running a transformer30 min
    4. 6.4Why the transformer won28 min
  7. 07

    Pretraining and Adapting

    The page before this one, why the transformer won, ended with a machine that can read a very long piece of text and let every part of it look at every other part. That machine needs a very large amount of training data. It needs…

    4 sections · 1 h 55 min

    1. 7.1Self-supervised pretraining29 min
    2. 7.2Scale, data and compute26 min
    3. 7.3Fine-tuning and adapters31 min
    4. 7.4Making a model smaller and faster27 min
  8. 08

    Models That Generate

    The page before this one, making a model smaller and faster, finished a run of pages about getting a trained model ready to use. Every one of those pages assumed one thing without saying it. The assumption was that the model's…

    2 sections · 57 min

    1. 8.1Diffusion: making an answer out of noise31 min
    2. 8.2Flow matching and other generators26 min
  9. 09

    Models That See

    The page before this one, flow matching and other generators, finished the chapter about models that make something new. Those models start with a cloud of random numbers and move it along a learned direction, step by step, until…

    4 sections · 1 h 55 min

    1. 9.1Vision backbones30 min
    2. 9.2Detection and segmentation27 min
    3. 9.3Naming a thing the model was never trained on28 min
    4. 9.4Depth and the third dimension28 min
  10. 10

    Language and Multimodal Models

    The page before this one, Depth and the third dimension, closed the chapter on models that see. It turned a flat picture into a shape with distance in it. This page opens a new chapter, and it changes the input from pictures to…

    4 sections · 2 h

    1. 10.1Large language models31 min
    2. 10.2Post-training a language model31 min
    3. 10.3Vision-language models31 min
    4. 10.4Reasoning and tool use29 min
  11. 11

    Learning From Outcomes

    The page before this one, reasoning and tool use, ended a long run of pages about models that are trained by being shown the right answer. In every one of those methods, a person had to write the right answer down first. This…

    2 sections · 1 h 5 min

    1. 11.1Reinforcement learning: learning by trying35 min
    2. 11.2Rewards, preferences and verifiers30 min
  12. 12

    Models That Act

    The page before this one, rewards, preferences and verifiers, was about the hardest part of learning from outcomes, which is saying what a good outcome is. This page uses a different method. A person does the task properly a few…

    4 sections · 1 h 55 min

    1. 12.1Behaviour cloning and action chunks28 min
    2. 12.2Diffusion and flow policies25 min
    3. 12.3Vision-language-action models36 min
    4. 12.4World models28 min
  13. 13

    Starting a Model of Your Own

    The page before this one, world models, was the last page that opens one family of model and shows what it does inside. Together with every page before it, that page leaves you knowing what a neuron does, what a loss is, what a…

    6 sections · 3 h 15 min

    1. 13.1Before you train anything34 min
    2. 13.2The order of the work30 min
    3. 13.3What to reuse and what to train28 min
    4. 13.4Recipes for models that see and understand35 min
    5. 13.5Recipes for the models that act and predict37 min
    6. 13.6When it does not work33 min
  14. 14

    Using a Model For Real

    The chapter before this one ended with a page on what to do when your model does not work, and the chapter before that finished the book's tour of the model families. Both leave you in the same place. You have a model that has…

    2 sections · 1 h

    1. 14.1Running and evaluating a model34 min
    2. 14.2The map of models27 min
Next bookBook 6: Programming TechniquesThe algorithms robot arm software is built from