# rasbt/reasoning-from-scratch

Implement a reasoning LLM in PyTorch from scratch, step by step

Repository: https://github.com/rasbt/reasoning-from-scratch
Canonical: https://ross.abutalabs.com/products/reasoning-from-scratch
Homepage: https://mng.bz/lZ5B
Language: Jupyter Notebook
License: Apache-2.0
License Family: permissive
Topics: ai, artificial-intelligence, deep-learning, large-language-models, llms, machine-learning, python, pytorch, reasoning, reinforcement-learning, chain-of-thought, distillation, grpo, inference-time-scaling, llm, math-reasoning, reasoning-models, rlhf, test-time-compute
Last push: 2026-08-26T01:52:13+00:00

## Health v2 (maintenance only)
Score: 71/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 52, longevity 39
- inputs: {"age_days": 547, "days_push": 8, "days_rel": 107, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5070, forks 777 (observed 2026-08-28T04:09:09.274933+00:00)

## What it is
The official code repository for the book 'Build a Reasoning Model (From Scratch)' by Sebastian Raschka, containing step-by-step PyTorch implementations of a reasoning LLM. It teaches how to add reasoning capabilities like chain-of-thought and RL-based fine-tuning (GRPO, RLHF) to a pre-trained base LLM for educational purposes.

## Use cases
- learn how reasoning LLMs like DeepSeek R1 work internally
- implement chain-of-thought reasoning from scratch in PyTorch
- understand GRPO and RLHF fine-tuning step by step
- build a small functional reasoning model for education
- study inference-time scaling and test-time compute
- accompany a hands-on book on reasoning models

## When to choose
- you want to deeply understand how reasoning models are built, not just use them
- you prefer learning by implementing in PyTorch from scratch
- you are following the Manning book and need its official code
- you want educational, well-tested notebook-based code

## When to avoid
- you need a production-ready reasoning LLM or inference server
- you want pre-trained state-of-the-art models rather than educational implementations
- you need large-scale training infrastructure rather than small-scale learning code

## Facets
- artifact type: learning-resource
- maturity: active
- function: llm-training, machine-learning, reinforcement-learning, llm-inference
- domain: large-language-models, deep-learning, artificial-intelligence, tutorials
- platform: python, cross-platform
- tags: pytorch, reasoning-models, chain-of-thought, rlhf, grpo, from-scratch, book, educational, jupyter-notebooks

## Member repositories
- rasbt/reasoning-from-scratch (main) score 71

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:09.274933+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:02:49.218037+00:00, confidence not recorded.
  - readme: https://github.com/rasbt/reasoning-from-scratch (fetched 2026-08-28T04:09:09.274933+00:00, sha 65397d3261c2)
  - homepage: https://mng.bz/lZ5B (fetched 2026-08-29T08:57:45.229465+00:00, sha aa25817e63ec)
  - site_page: https://www.manning.com/faq (fetched 2026-08-29T08:57:45.239202+00:00, sha 9e27304d7757)
- Data as of 2026-08-30T08:39:29.467469+00:00.
