Build a DeepSeek Model (From Scratch)
-
- Vorbestellbar
-
- Erwartet am 29. Dez. 2026
-
- CHF 43.00
-
- Vorbestellbar
-
- CHF 43.00
Beschreibung des Verlags
"An outstanding resource for anyone who wants to understand LLMs not just conceptually, but at the level where architectural details and training decisions really matter.”
—Dmitry Efimov, Amazon
The open-weight DeepSeek model upended the LLM world with frontier-level performance at a fraction of the training cost. This book gives you an insider’s understanding of the model’s advances and architectural breakthroughs as you build a small-scale version piece by piece. By the final chapter, you’ll have a working mini-DeepSeek running on your laptop, along with an “I built it myself” understanding of its internals.
Build a DeepSeek Model (From Scratch) takes a problem-solution approach to each of DeepSeek’s major innovations. You’ll see how Multi-Head Latent Attention (MLA) compresses the memory of earlier tokens the model keeps on hand as it generates text, sharply reducing its memory needs. You’ll also explore its Mixture of Experts architecture—a collection of small specialist networks that expand the model’s capacity while activating only a fraction of the model for each token. You’ll start with a basic Mixture-of-Experts layer, then introduce DeepSeek’s improvements: smaller experts for finer specialization, shared experts for common knowledge, and better distribution of work among them.
Next comes Multi-Token Prediction, which trains the model to anticipate several upcoming tokens rather than just the next one, helping it learn more from the same training text. This is followed by a deep dive into how DeepSeek’s approach to FP8 quantization trades lower numerical precision for faster computation and lower memory use, without hurting model quality.
You’ll explore DeepSeek’s approach to training by building a full training pipeline and learn how it manages the communications overhead associated with training MoE models. The book closes with readable accounts of DeepSeek’s reasoning training and distillation: how Group Relative Policy Optimization (GRPO) helps the model learn from successful attempts at a problem, and how smaller models learn by comparing several of its own attempts at a problem and favoring the better ones. You’ll even find head-to-head comparisons that let you measure the gains of key features in concrete terms.
Across eight substantial chapters, the story unfolds in clear, plain English and mathematical walkthroughs, illuminating diagrams, and PyTorch code you write yourself. Reviewer Sakshi Mahendru of Palo Alto Networks summarized his feelings: "An incredible pedagogical feat that captures the exact essence of the DeepSeek paper and makes it digestible by grounding architectural theory in from-scratch empirical experiments."
What's inside
• Build all the key DeepSeek innovations—from scratch!
• Improve inference with Multi-Head Latent Attention and RoPE
• Effectively train a Mixture-of-Experts model
• GRPO reinforcement learning for reasoning
About the reader
For intermediate-to-advanced ML engineers, AI researchers, and graduate students comfortable with PyTorch and deep learning fundamentals.
About the author
Raj Abhijit Dandekar (MIT), Rajat Dandekar (Purdue), and Sreedath Panat (MIT) co-founded Vizuara Labs, which offers dozens of training courses on AI agents and applications that make AI research and development accessible and practical. Naman Dwivedi is an AI researcher.