Eighteen chapters, from what a neural network is to training a mixture-of-experts
language model on a GPU and generating images with a published diffusion model. No prior machine-learning knowledge assumed. Rust
assumed at the level of "I can read a for loop".
Every chapter has runnable code in code/ and ends with exercises.
Chapters 1–10 need nothing but Rust. Chapters 11 and 14–18 are much faster with
an NVIDIA GPU, and all of them still run without one.
| # | Chapter | You need | Time |
|---|---|---|---|
| 1 | Introduction — How a Neural Network Actually Works | nothing | 30 min |
| 2 | Setup — From Nothing to a Running Model | a computer | 10 min |
| 3 | The XOR Problem — Your First Trained Network | 1–2 | 30 min |
| 4 | Working With Real Data | 1–3 | 45 min |
Read 1 even if you are in a hurry. Everything after it assumes it.
| # | Chapter | You need | Time |
|---|---|---|---|
| 5 | Regression — Predicting Numbers | 1–4 | 45 min |
| 6 | Classification — Choosing Between Categories | 1–5 | 45 min |
| 7 | The Training Loop — Taking Control | 1–6 | 1 hr |
| 8 | Evaluation — Measuring Honestly | 1–7 | 45 min |
| 9 | Saving, Loading, and Using a Model | 1–8 | 40 min |
| 10 | A Complete Project | 1–9 | 90 min |
Chapter 8 is the one people skip and regret. A model that looks good and is not is worse than one that looks bad.
| # | Chapter | You need | Time |
|---|---|---|---|
| 11 | Training on the GPU with CUDA | 1–10, an NVIDIA GPU | 1 hr |
| 12 | Importing Models From TensorFlow and PyTorch | 1–10 | 45 min |
| 13 | When Things Go Wrong | 1–10 | read once, return often |
| # | Chapter | You need | Time |
|---|---|---|---|
| 14 | Tokens and a Transformer Language Model | 1–10 | 2 hr |
| 15 | Mixture of Experts | 14 | 90 min |
| 16 | Training a Language Model End to End | 14–15 | an afternoon |
| 17 | Fine-Tuning With LoRA | 16 | 45 min |
| # | Chapter | You need | Time |
|---|---|---|---|
| 18 | Generating Images From Text | 1–10, a downloaded model | 45 min |
| You want to | Start at |
|---|---|
| Understand what any of this means | 1 |
| Predict a number from a spreadsheet | 5 |
| Sort things into categories | 6 |
| Know whether your model is actually any good | 8 |
| Ship a trained model | 9 |
| Make it run on your GPU | 11 |
| Run a model someone else trained | 12 |
| Export a model for another runtime | 12 |
| Fix a loss curve that looks wrong | 13 |
| Train a language model | 14 |
| Fit a bigger model in the same memory | 15 |
| Plan a run that takes days | 16 |
| Fine-tune a model to answer questions | 16 |
| Adapt a trained model on a small GPU | 17 |
| Turn a prompt into a picture | 18 |
Each chapter links its full source in code/. Set up a project once,
as chapter 2 describes, and paste a chapter's file into src/main.rs:
cargo run --release--release is not optional for anything past chapter 10. A debug build is ten
to fifty times slower, and chapter 13.8 is a list of people who forgot.
Training a convolutional network, encoder-decoder models, reinforcement learning, multi-GPU and distributed training. The library runs convolutions (chapter 18 is built on them) but no chapter trains one yet; the rest are not implemented, so they are not taught here.
The reference documentation is the source. Every public type carries the reasoning behind it, which is the part that does not fit in a tutorial.