Build a Reasoning Model (From Scratch)
Synopsis
Sebastian Raschka's follow-up to Build a Large Language Model (From Scratch) tackles the techniques behind reasoning models, the systems that generate intermediate steps before giving an answer. Readers start with a small pre-trained open-weight model from the Qwen3 family, learn to generate text efficiently with KV caching, and build automatic evaluation using math verifiers. The middle chapters improve reasoning without changing any weights, implementing chain-of-thought prompting, sampling strategies, self-consistency voting, Best-of-N response scoring and self-refinement while measuring what each costs in compute and latency. The final chapters change the model itself through reinforcement learning with verifiable rewards using GRPO, refinements to that algorithm, format rewards and distillation from stronger reasoning models into smaller ones.
The method is the book's value. Rather than calling a library, Raschka writes each component in plain PyTorch, so readers see where techniques succeed, where they waste compute and where self-refinement can make answers worse. The main chapters are designed to run mostly on consumer hardware, and a public GitHub repository supplies code, exercise solutions and bonus scripts. Readers finish with working intuition for the post-training and test-time methods behind current reasoning models and a framework for reading new research in the area. The book assumes Python fluency and some machine learning background, ideally including the earlier volume, and it stays at teaching scale, so production serving and large-cluster training fall outside its scope.
Scorecard
Editorial score
How it scored
Editorial score: 82.1 / 1005 weighted criteria
- 21.0/30
Influence30%
- 21.3/25
Authority25%
- 18.0/20
Practical value20%
- 14.3/15
Currency15%
- 7.5/10
Readability10%
- 82.1/100
Editorial score
How the rank was computed
Rank No. 86 of 500 comes from a composite of 64.2: observable signals 27.2 of 55 points plus editorial review 37.0 of 45 points.
All 11 inputs
| Input | Points |
|---|---|
| Observable signals | 27.2/55 |
| Reach (Amazon ratings volume) | 7.1/16.5 |
| Consensus across best-of lists | 8.3/13.8 |
| Awards and bestseller evidence | 0.0/8.3 |
| Reader rating, sample-adjusted | 7.0/8.3 |
| Amazon sales rank | 2.0/5.5 |
| Recency | 2.8/2.8 |
| Editorial review | 37.0/45 |
| Author authority | 9.6/11.3 |
| Influence | 9.5/13.5 |
| Practical value | 8.1/9.0 |
| Readability | 3.4/4.5 |
| Currency | 6.4/6.8 |
Each criterion is scored from 1 to 10 and weighted, and the points add up to the editorial score. The rank combines observable signals (55 percent) with this score (45 percent). Read the methodology.
Verdict
A code-first route to understanding reasoning LLMs, implementing inference-time scaling, GRPO training and distillation step by step in PyTorch.
Strengths
- Every core method implemented from scratch in PyTorch
- Runs largely on consumer hardware
- Explicit cost, latency and failure-mode analysis
Keep in mind
Assumes Python fluency and machine learning background; readers seeking production deployment guidance or a conceptual overview without code will find it too specialized.
Key takeaways
- Reasoning can improve without retraining by spending more compute at inference time, through sampling, self-consistency voting and Best-of-N selection.
- Reliable evaluation comes first, because automatic verifiers that check math answers make it possible to measure whether a technique actually helps.
- Reinforcement learning with verifiable rewards, implemented through GRPO, trains models to produce better reasoning chains when correctness can be checked automatically.
- Distillation transfers reasoning behavior from a strong model to a smaller one, trading some capability for much cheaper inference.
Notable facts
- Its companion GitHub repository, rasbt/reasoning-from-scratch, showed about 5,900 stars and more than 900 forks in November 2026. Source (opens in a new tab)
- Manning's listing carries endorsements from reviewers at Google, NVIDIA and LMSYS, including Google's Aman Chadha. Source (opens in a new tab)
About the author
Questions
Do I need to read Build a Large Language Model (From Scratch) first?
What hardware do I need for Build a Reasoning Model (From Scratch)?
Is Build a Reasoning Model (From Scratch) worth reading in 2026?
Related books
- Build a Large Language Model (From Scratch) Sebastian Raschka
- Hands-On Large Language Models Jay Alammar and Maarten Grootendorst
- The Scaling Era Dwarkesh Patel and Gavin Leech
- What Is ChatGPT Doing ... and Why Does It Work? Stephen Wolfram
- Vibe Coding Gene Kim and Steve Yegge
- LLM Engineer's Handbook Paul Iusztin and Maxime Labonne
Sources
As an Amazon Associate, Best AI Books earns from qualifying purchases. Best AI Books is sponsored by Iternal.ai, whose founder and CEO, John Byron Hanby IV, wrote The AI Strategy Blueprint, our #1 ranked book. How we rank books.






