cd /news/artificial-intelligence/book-review-build-a-deepseek-model-f… · home topics artificial-intelligence article
[ARTICLE · art-109177] src=andlukyane.com ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Book Review: Build a DeepSeek Model (From Scratch)

The book 'Build a DeepSeek Model (From Scratch)' by Raj Abhijit Dandekar, Rajat Dandekar, Sreedath Panat, and Naman Dwivedi rebuilds DeepSeek's innovations on consumer hardware, covering key-value cache, Multi-Head Latent Attention, DeepSeek-MoE, multi-token prediction, FP8 training, GRPO, and knowledge distillation. The review highlights the book's strength in explaining design trade-offs, such as MLA matching full multi-head attention with a quarter of the KV cache, and notes that distilled Qwen2.5-32B outperforms large-scale RL by over 25 points on AIME 2024.

read4 min views5 publishedAug 24, 2026
Book Review: Build a DeepSeek Model (From Scratch)
Image: Andlukyane (auto-discovered)

Book Review: Build a DeepSeek Model (From Scratch) #

I was offered to read Build a DeepSeek Model (From Scratch) by Raj Abhijit Dandekar, Rajat Dandekar, Sreedath Panat, and Naman Dwivedi in exchange for an honest review. The book takes the innovations behind the DeepSeek model family and rebuilds them one at a time, scaled down to consumer hardware. If you just read papers about models with MoE and various attention mechanisms, it is easy to understand what each component does, but not why it exists. More than that, it is easy to skip the details of the design and implementation, and to miss the trade-offs that led to each choice. This book covers this gap and gives you the ability to explain the design of each component rather than just its function.

The overall structure

The book follows a four-stage structure:

  • Stage 1 derives the key-value cache from the autoregressive loop and covers Multi-Query and Grouped-Query Attention as the two standard ways to reduce the memory cost.
  • Stage 2 replaces both halves of the transformer block: Multi-Head Latent Attention with decoupled RoPE in place of standard attention, andDeepSeek-MoE in place of the feed-forward network. - Stage 3 covers multi-token prediction andFP8 training, assembles a MiniDeepSeek and trains it on TinyStories, and closes with DualPipe parallelism. - Stage 4 goes from policy gradients up to GRPO and reinforcement learning with verifiable rewards, then knowledge distillation.

What I liked

The book usually shows a naive version of a given appraoch, then shows why it fails and builds a better version of it.

Chapter 3 is a great example: before moving to RoPE, positional encoding is developed as a series of failed attempts (raw integers, binary vectors, sinusoids). By the time you are introduced to RoPE, you already know the problems and how they can be addressed.

I liked the observation that a binary encoding is already a multi-frequency signal (low bits oscillate fast, high bits slow), and that sinusoids are simply the continuous version of the same thing. I had used RoPE for a long time without ever seeing it explained from that point of view.

Chapter 4 has a similar approach: auxiliary loss, then load-balancing loss, then a hard capacity cap, with each one shown to interfere with the main training objective before DeepSeek’s bias-term update removes the extra loss term entirely.

Shared experts are motivated through two important problems: knowledge hybridity, where too few experts force each one to be a generalist, and knowledge redundancy, where several experts separately re-learn the same English grammar. Shared experts see every token and absorb the common knowledge, so the routed experts stop suffering from it.

Chapters 3, 4, and 8 each end with a small head-to-head experiment. Chapter 3 trains MHA, MQA, GQA, and MLA with parameter counts held nearly equal, and MLA matches full multi-head attention on validation loss while holding a quarter of the KV cache. Chapter 4 does the same for a standard MoE against DeepSeek-MoE.

The book is also consistent about the limits of its own evidence. The KV cache chapter measures a fivefold speedup on an ordinary CPU laptop and points out that number is not universal. Chapter 7 has a section called “Reading DeepSeek-R1 claims carefully” that separates the strong claims (GRPO with verifiable rewards induces reasoning behavior, and dropping the value model simplifies large-scale RL) from the overclaim that verifiable rewards solve alignment.

Finally, I liked the comparison at the end of Chapter 8. The same Qwen2.5-32B base is trained two ways: large-scale RL from scratch, or a couple of epochs of supervised fine-tuning on DeepSeek-R1’s reasoning traces. The distilled version wins by more than 25 points on AIME 2024, and it wins on every other benchmark as well.

What could have been better

A few small things:

  • The head-to-head experiments run on TinyStories at small scale, so the margins are narrow and the conclusions are directional.
  • The architecture improvements stop at V3 and R1, and attention design has evolved toward the sparse stacks in

DeepSeek-V4.

Conclusion

This book is a good fit for people who read LLM papers and would like to implement modern architectures from scratch. It suits engineers who already work with transformers and want implementation-level understanding of latent attention, sparse expert routing, and the post-training pipeline, and it is a solid follow-on for anyone who has built a GPT from scratch and wants to know what changed after that.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @raj abhijit dandekar 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/book-review-build-a-…] indexed:0 read:4min 2026-08-24 ·