Interactive companion
Build a Reasoning Model, one idea at a time
Follow Sebastian Raschka’s Build a Reasoning Model (From Scratch) with short explanations, widgets you can play with, quizzes that explain every answer, and PyTorch labs that check your code in seconds.
How to use this tutorial
This site is a study companion: read the matching book chapter alongside each module (or right after it). The modules explain the ideas in fresh words, let you poke at them, and then make you build them.
1 · Get set up (10 min)
Open this site by double-clicking tutorial/index.html, or serve it with python3 -m http.server. For the labs, run ./labs/setup_venv.sh once, then open the notebooks in Jupyter with the rmfs kernel. Module 1 ends with a setup checklist.
2 · Work module by module
Read Hook and Concept, play with the widgets, take the quiz, then do the lab: fill in each # YOUR CODE HERE and run the grader cell below it until you see ✅. Mark sections complete to track your progress.
3 · Toy first, real later
Every lab runs in toy mode by default (a tiny model, CPU, seconds, no downloads). Switch to MODE = "real" to reproduce the book with Qwen3 0.6B when you have the time and hardware.
4 · Finish with the capstone
Chain your own functions from labs 3–8 into one pipeline, compare every method in one results table, and test yourself with the final quiz and self-assessment.
Suggested paths
- Full course (~17 h): Modules 1 → 8, then the capstone. Do Appendix C after Module 2 if you want to see inside the model, and Appendices D/E and F whenever they come up.
- Inference-time only (~6.5 h): Modules 1, 2, 3, 4, 5. No training needed.
- RL focus (~8 h): Modules 2 and 3 (the verifier is the reward), then 6 → 7 → 8.
Stuck on a term? Every underlined term links to the glossary.
How each lesson works
- Hook – a concrete problem the technique solves.
- Concept – the idea in plain words, with an original diagram and the key formula.
- Play – change a knob in a widget and watch what happens.
- Check – a short quiz with an explanation for every option.
- Build – implement the function yourself in a Jupyter lab with instant, auto-graded feedback.
- Stretch – the book’s exercises and extra challenges, with hints and solutions.
- Recap – takeaways and a cheat-sheet card.
The labs live in the labs/ folder next to this site. See labs/README.md for setup: the labs default to a tiny toy model and run on any laptop CPU in seconds, with an option to use the real Qwen3 0.6B model.