Build a Reasoning Model (From Scratch) logo

Build a Reasoning Model (From Scratch)

Free

A guide to building a working reasoning model from the ground up, by Sebastian Raschka.

FreeFree tier
Type
Open Source
Company
Manning

About Build a Reasoning Model (From Scratch)

Build a Reasoning Model (From Scratch) is a practical guide to understanding how modern reasoning-oriented LLMs work by building their core methods step by step. The book tells a clear engineering story: start with a conventional pre-trained LLM, learn how text generation works, build reliable evaluation tools, improve reasoning through inference-time methods, then move into training-based approaches such as reinforcement learning and distillation. The progression is deliberate. Early chapters establish the baseline model and explain text generation, KV caching, and evaluation with math verifiers. The middle chapters show how reasoning can be improved without changing model weights, using chain-of-thought prompting, sampling, self-consistency, response scoring, and self-refinement. Later chapters move to changing the model itself through reinforcement learning with verifiable rewards, GRPO improvements, format rewards, and finally distillation from stronger reasoning models into smaller ones. The book is especially useful because it implements the core methods from scratch rather than treating them as black-box library calls. Readers see how self-consistency, self-refinement, Best-of-N, and training-based methods actually work, including their cost and latency trade-offs. It also discusses common failure modes, including cases where refinement can make answers worse.

Key Features

Step-by-step implementation of reasoning methods from scratch
Covers inference-time techniques: chain-of-thought, sampling, self-consistency, Best-of-N, self-refinement
Covers training-based approaches: reinforcement learning with verifiable rewards, GRPO, format rewards, distillation
Includes evaluation with math verifiers and discussion of cost/latency trade-offs
Explains failure modes where refinement can degrade answers
Source code available on GitHub
Available in multiple formats: eBook, print, audio, and online subscription

Pros & Cons

Pros
  • Hands-on, from-scratch implementation approach (no black-box library calls)
  • Covers both inference-time and training-based reasoning methods
  • Written by highly regarded ML author Sebastian Raschka
  • Includes practical discussion of failure modes and trade-offs
  • Source code and book forum available for community support
Cons
  • Not a ready-to-use software tool; it is an educational book
  • Requires strong programming and machine learning background
  • Publication date is June 2026 (future release, not yet available in full)
  • Paid resource (though available free with Manning subscription)

Best For

Learning how modern reasoning-oriented LLMs work internallyBuilding a reasoning model from scratch as a learning exerciseImproving LLM reasoning capabilities through inference-time and training methodsUnderstanding cost and latency trade-offs of different reasoning approachesReference for implementing reinforcement learning for LLM reasoning

FAQ

What is Build a Reasoning Model (From Scratch) about?
It is a practical guide that teaches how reasoning-oriented LLMs work by building their core methods step by step, starting from a conventional pre-trained LLM and progressing through inference-time techniques to training-based approaches like reinforcement learning and distillation.
Who is the author?
The book is written by Sebastian Raschka, a well-known machine learning researcher and author.
What topics are covered in the book?
Topics include text generation, KV caching, evaluation with math verifiers, chain-of-thought prompting, sampling, self-consistency, response scoring, self-refinement, reinforcement learning with verifiable rewards, GRPO, format rewards, and distillation.
Is source code available?
Yes, the source code is available on GitHub and through the book's resources page on Manning.
Who is this book for?
It is intended for developers, researchers, and AI enthusiasts who want to deeply understand how reasoning methods in LLMs work and how to implement them from scratch.