Implement a reasoning LLM in PyTorch from scratch, step by step
4.7k
Stars
705
Forks
2
Open issues
4
Contributors
AI Analysis
This repository is the official code companion to a Manning book that teaches how to build a reasoning LLM from scratch using PyTorch, starting with a pre-trained base model and adding reasoning capabilities step by step. It is specifically designed for machine learning practitioners and students who want to understand the internals of reasoning models like DeepSeek R1 and GPT-5 Thinking through hands-on implementation, not for practitioners seeking a production-ready reasoning system or gene...
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Educational code companion for building reasoning LLMs step-by-step in PyTorch
Reasoning-from-scratch is a Jupyter Notebook-based learning resource accompanying a Manning book. It teaches how to implement reasoning capabilities in large language models through hands-on PyTorch code, covering inference-time scaling, reinforcement learning, and model distillation. Built by Sebastian Raschka (author of the LLMs-from-scratch series). Adoption is primarily academic/educational; not positioned as production software or a reusable library.
Created March 2025 as an official code companion to a Manning book on reasoning LLMs. Appears part of Raschka's pedagogical series (which includes the 98k-star LLMs-from-scratch repo). Targets the emerging interest in understanding how reasoning models like DeepSeek R1 and GPT-5 Thinking work.
Reached 4,608 stars in ~15 months with steady engagement (47 stars in last 7 days as of June 2026). Growth appears driven by the book's release and educators/students seeking hands-on reasoning model tutorials. Last commit 12 June 2026 shows active maintenance aligned with book development.
Adoption not verified. README frames this as educational code ('for educational purposes') accompanying a published book. No mention of production deployments, industry usage, or enterprise adoption. 4,600 stars likely reflect student/educator interest rather than production usage. Comparable to other 'learn from scratch' educational repos in the ML space.
Appears to be a collection of progressive Jupyter Notebooks covering: text generation with pre-trained LLMs (Ch2), evaluation methods (Ch3), inference-time scaling (Ch4-5), reinforcement learning with GRPO (Ch6-7), distillation (Ch8), and optional appendices on batching and chat interfaces. Based on README, likely uses PyTorch and Qwen3 as the base model. Structured as chapter-by-chapter tutorials rather than a monolithic library.
README documents cross-platform CI workflows (Linux, macOS, Windows test badges visible), suggesting automated test coverage exists. Specific test framework and coverage percentage not documented in README excerpt.
Last push 12 June 2026 (19 days prior to analysis date) indicates active maintenance. CI/CD pipelines present. Repository marked 'In Progress' for table of contents, suggesting ongoing development. No evidence of stagnation; appears aligned with book production schedule.
ADOPT IF: you are a student, educator, or ML researcher learning how reasoning LLMs work and prefer step-by-step PyTorch code over theory alone. AVOID IF: you need production-ready reasoning model code, a reusable library/framework, or industrial-scale training infrastructure. MONITOR IF: you are tracking the reasoning LLM education space — this repo is well-maintained and may become a standard reference as reasoning models proliferate.
Independent dimensions
Mainstream potential
2/10
Technical importance
6/10
Adoption evidence
3/10
- Educational focus limits scope; code likely simplified for clarity rather than optimized for performance or scale.
- Tightly coupled to a specific book (Manning 'Build a Reasoning Model') — if the book goes out of print or is not updated, repo may accumulate stale dependencies or outdated methods.
- Dependency on Qwen3 and specific pre-trained models; if underlying models are deprecated or require authentication, code examples may break.
- Jupyter Notebooks are less conducive to versioning, CI/CD, and production integration compared to modular Python packages; adoption by practitioners may be limited.
- No evidence of contributions from external maintainers; relies on Raschka's personal maintenance bandwidth.
Likely to remain a stable, well-maintained educational resource for 2–3 years as long as the book is actively marketed. Will probably see steady citations in course syllabi and tutorials. Unlikely to evolve into a production framework; may be superseded if more advanced reasoning techniques emerge and require new pedagogical materials.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Website
- https://mng.bz/lZ5B
- Language
- Jupyter Notebook
- License
- Apache-2.0
- Last updated
- 4d ago
- Created
- 16mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Open pull requests
No open pull requests.
Top contributors
Recent releases
Similar repos
hijkzzz/Awesome-LLM-Strawberry
A curated collection of research papers, blogs, and projects focused on OpenAI...
TsinghuaC3I/Awesome-RL-for-LRMs
This is a curated survey and collection of papers on reinforcement learning...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
4.7k | +69 | Jupyter Notebook | 8/10 | 4d ago |
|
|
98.9k | — | Jupyter Notebook | 9/10 | 1mo ago |
|
|
6.9k | — | — | 7/10 | 7mo ago |
|
|
2.5k | — | TeX | 8/10 | 8mo ago |
|
|
2.3k | — | Jupyter Notebook | 8/10 | 2w ago |
Same author; vastly more mature (98k stars vs 4.6k). LLMs-from-scratch teaches foundational LLM concepts; reasoning-from-scratch is a narrower follow-up focused on post-training reasoning. Different scope, not a direct replacement.
Another curated reasoning+LLM resource (6.9k stars). Appears to be a collection/curation rather than hands-on code tutorials. Reasoning-from-scratch differentiates via step-by-step PyTorch implementation.
Similar genre (educational, training-focused); 2.3k stars. Reasoning-from-scratch has higher adoption and appears more actively maintained (recent push). Both serve niche educational market.
Those repos focus on reproducing specific production models. Reasoning-from-scratch is explicitly simplified for learning, not production-grade. Different use case entirely.
Competes informally with academic resources and papers on reasoning. No direct technical competition; serves as an accessible supplement to published research.

