← All projects
Learning resources

Build A Reasoning Model (From Scratch)

Code for a book that teaches how AI "reasoning" models work by building a small one yourself.

New this week

What it does

This is the official code for Sebastian Raschka's book Build a Reasoning Model (From Scratch). Reasoning models are AI language models that work through a problem step by step before answering.

Chapter by chapter, you start from an existing open model (Qwen3) and add reasoning skills yourself: checking answers, spending more effort at answer time, training with reinforcement learning, and distillation (teaching a small model from a bigger one).

The README says the main chapters are designed to run on ordinary consumer computers. The book itself is sold separately.

Who it's for

Programmers and students who want to understand how modern reasoning AI works by coding it.

Can I use it without coding?

Developers only. You need Python and some coding experience to follow along. New to this? Start here.

Can I run it?

Cost
FreeNothing to pay or sign up for.
Computer
An ordinary computer is fine
Privacy
Runs on your own device: your data stays with you
API key
Not needed

Try it

  1. Download the code as a ZIP file from the project page.
  2. Follow chapter 2 to set up Python, then open each chapter's notebook as you read the book.

Using Claude Code, Cursor or another AI coding assistant? Paste the prompt and it will walk you through the setup.New to this?

Before you install

  • Only download from the official GitHub page. Copies with similar names exist for many popular projects.
  • License (Apache-2.0): Permissive: free to use, change and share, including for business.
  • More on staying safe