---
type: "post"
id: "reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073"
slug: "reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073"
title: "reasoning-from-scratch: Implement a reasoning LLM in PyTorch from scratch, step by step"
description: "The public GitHub repository reasoning-from-scratch provides the code accompanying Build a Reasoning Model (From Scratch)."
retrieval_nugget: "The public GitHub repository reasoning-from-scratch provides the code accompanying Build a Reasoning Model (From Scratch)."
published_at: "2026-10-26"
updated_at: "2026-10-26"
record_date: "2026-10-26"
date_kind: "published_at"
topics: ["github"]
entities: ["reasoning-from-scratch","Qwen3","DeepSeek-R1","GPT-5 Thinking"]
related_patterns: []
novelty_label: "same_event"
what_changed: "Same event as Build Your Own Reasoning Model: A Full Video Course"
prior_refs: ["memory:aaf7df79-6f44-8e9b-aa10-12da2ecefe22"]
source_url: "https://github.com/rasbt/reasoning-from-scratch"
source_urls: ["https://github.com/rasbt/reasoning-from-scratch"]
schema_version: "newruntime-agent-readable-v0.2"
stable_id: "post:reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073"
status: "published"
visuals: []
editor: {"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]}
routes: {"html":"https://newruntime.com/posts/reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073/","markdown":"https://newruntime.com/posts/reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073.md","json":"https://newruntime.com/posts/reasoning-from-scratch-implement-a-reasoning-llm-in-2d2073.json"}
---

# reasoning-from-scratch: Implement a reasoning LLM in PyTorch from scratch, step by step

## Retrieval answer

The public GitHub repository reasoning-from-scratch provides the code accompanying Build a Reasoning Model (From Scratch).

The public GitHub repository reasoning-from-scratch provides the code accompanying Build a Reasoning Model (From Scratch). It uses a pretrained open-source Qwen3 model as a starting point rather than training a base model from scratch. The repository is licensed under Apache-2.0.

Its notebooks cover text generation, reasoning-model evaluation, inference-time scaling, self-refinement, reinforcement learning, GRPO improvements, and distillation. The repository also includes material for loading pretrained model weights, Qwen3 source code, larger-model use, batching, evaluation approaches, and a chat interface.

The main chapters are designed to run mostly on consumer hardware. Chapters 2 through 4 are stated to work on CPUs and GPUs; a GPU is recommended for reproducing chapters 5 and 6. The source describes the result as a small but functional educational reasoning model. It does not establish that the material trains a frontier-scale model, reproduces DeepSeek-R1 or GPT-5 Thinking, or supplies a production-ready training system.

Editor: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Github](https://newruntime.com/topics/github.md): Explore the github topic hub.
- collection: [Field Notes](https://newruntime.com/posts.json): Open the latest editorial analysis.
- collection: [Source Ledger](https://newruntime.com/source-ledger.json): Inspect the public source evidence graph.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
