#199 · Primary category: Education & Research

reasoning-from-scratch

ai artificial-intelligence chain-of-thought deep-learning distillation grpo inference-time-scaling large-language-models llm llms machine-learning math-reasoning python pytorch reasoning reasoning-models reinforcement-learning rlhf test-time-compute

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

Project last updated:08/27/26

GitHub Stars

5.1K

Forks

785

Contributors

5

License

Apache-2.0

Why we included this project

reasoning-from-scratch is the code repository that accompanies Sebastian Raschka's book on building a reasoning model. It starts with a single pre-trained base model, Qwen3, and adds reasoning capabilities chapter by chapter: inference-time scaling, self-refinement, reinforcement learning with GRPO, and distillation, the same approaches used in models like DeepSeek R1 and GPT-5 Thinking. The PyTorch notebooks for each technique run on consumer hardware, so a laptop is enough for the early chapters. The exercises and bonus appendices, covering evaluation, batching, and chat interfaces, also make it a handy reference once you've finished the tutorial. Engineers and researchers who want to see how reasoning models are actually assembled will find this a concrete place to start.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category