{"product_id":"build-a-deepseek-model-from-scratch","title":"Build a DeepSeek Model (From Scratch)","description":"\u003cp\u003e\u003cspan class=\"a-text-italic\"\u003e\"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.”\u003c\/span\u003e\u003cspan\u003e\u003cbr\u003e—Dmitry Efimov, Amazon\u003cbr\u003e\u003cbr\u003eThe 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.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-italic\"\u003eBuild a DeepSeek Model (From Scratch)\u003c\/span\u003e\u003cspan\u003e 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.\u003cbr\u003e\u003cbr\u003eNext 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.\u003cbr\u003e\u003cbr\u003eYou’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.\u003cbr\u003e\u003cbr\u003eAcross 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.\"\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eWhat's inside\u003c\/span\u003e\u003cspan\u003e\u003cbr\u003e\u003c\/span\u003e\u003c\/p\u003e\n\u003cul class=\"a-unordered-list a-vertical\"\u003e\n\u003cli\u003e\u003cspan class=\"a-list-item\"\u003e\u003cspan\u003eBuild all the key DeepSeek innovations—from scratch!\u003c\/span\u003e\u003c\/span\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cspan class=\"a-list-item\"\u003e\u003cspan\u003eImprove inference with Multi-Head Latent Attention and RoPE\u003c\/span\u003e\u003c\/span\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cspan class=\"a-list-item\"\u003e\u003cspan\u003eEffectively train a Mixture-of-Experts model\u003c\/span\u003e\u003c\/span\u003e\u003c\/li\u003e\n\u003cli\u003e\u003cspan class=\"a-list-item\"\u003e\u003cspan\u003eGRPO reinforcement learning for reasoning\u003c\/span\u003e\u003c\/span\u003e\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e\u003cspan\u003e\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eAbout the reader\u003c\/span\u003e\u003cspan\u003e\u003cbr\u003e\u003cbr\u003eFor intermediate-to-advanced ML engineers, AI researchers, and graduate students comfortable with PyTorch and deep learning fundamentals.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eAbout the author\u003c\/span\u003e\u003cspan\u003e\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eRaj Abhijit Dandekar\u003c\/span\u003e\u003cspan\u003e (MIT), \u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eRajat Dandekar\u003c\/span\u003e\u003cspan\u003e (Purdue), and \u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eSreedath Panat\u003c\/span\u003e\u003cspan\u003e (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. \u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eNaman Dwivedi\u003c\/span\u003e\u003cspan\u003e is an AI researcher.\u003c\/span\u003e\u003c\/p\u003e\n\u003cp\u003e \u003c\/p\u003e\n\u003cdiv id=\"editorialReviews_feature_div\" class=\"celwidget\" data-feature-name=\"editorialReviews\" data-csa-c-type=\"widget\" data-csa-c-content-id=\"editorialReviews\" data-csa-c-slot-id=\"editorialReviews_feature_div\" data-csa-c-asin=\"\" data-csa-c-is-in-initial-active-row=\"false\" data-csa-c-id=\"vsk3fc-bose80-ltsrv0-1wt5eb\" data-cel-widget=\"editorialReviews_feature_div\"\u003e\n\u003cdiv class=\"a-section a-spacing-small a-padding-base\"\u003e\n\u003ch3\u003e\u003cspan\u003eAbout the Author\u003c\/span\u003e\u003c\/h3\u003e\n\u003cdiv class=\"a-section a-spacing-small a-padding-small\"\u003e\n\u003cspan class=\"a-text-bold\"\u003eDr. Raj Abhijit Dandekar\u003c\/span\u003e\u003cspan\u003e is a computer scientist and co-founder of Vizuara AI Labs, an online education platform that has trained over 50,000 students globally. He holds a PhD from MIT and is the lead instructor of the popular YouTube series Build DeepSeek from Scratch.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eDr. Rajat Dandekar, PhD\u003c\/span\u003e\u003cspan\u003e in Mechanical Engineering from Purdue University, specializes in applying machine learning to complex physical systems. He co-founded Vizuara AI Labs.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eNaman Dwivedi\u003c\/span\u003e\u003cspan\u003e is an AI researcher at Vizuara AI Labs, specializing in turning advanced deep learning concepts into hands-on, practical code.\u003cbr\u003e\u003cbr\u003e\u003c\/span\u003e\u003cspan class=\"a-text-bold\"\u003eDr. Sreedath Pana\u003c\/span\u003e\u003cspan\u003e holds a PhD from MIT and is a co-founder of Vizuara AI Labs. He is an inventor and AI engineer known for creating self-cleaning AI-powered solar technology.\u003c\/span\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"a-section a-spacing-small a-padding-small\"\u003e\n\u003cspan\u003e\u003c\/span\u003e\u003cbr\u003e\n\u003c\/div\u003e\n\u003cdiv class=\"a-section a-spacing-small a-padding-small\"\u003e\n\u003cp\u003e\u003cb\u003eEbook License\u003c\/b\u003e\u003c\/p\u003e\n\u003cp\u003eEnd-User Warranty And License Agreement\u003c\/p\u003e\n\u003cp\u003e1. Grant Of License\u003c\/p\u003e\n\u003cp\u003eManning Has Authorized The Download By You Of An Unrestricted Number Of Copies Of The Electronic Book (Ebook) In Any Of The Available Formats. Manning Grants You A Nonexclusive, Nontransferable License To Use The Ebook According To The Terms And Conditions Herein. This License Agreement Permits You To Install The Ebook On Any And All Your Devices For Your Personal Use Only.\u003c\/p\u003e\n\u003cp\u003e2. Restrictions\u003c\/p\u003e\n\u003cp\u003eYou Shall Not: (1) Share, Resell, Rent, Assign, Timeshare, Distribute, Or Transfer All Or Part Of The Ebook Or Any Rights Granted Hereunder To Any Other Person; (2) Duplicate The Ebook, Except For A Single Backup Or Archival Copy; (3) Remove Any Proprietary Notices, Labels, Or Marks From The Ebook; (4) Transfer Or Sublicense Title To The Ebook To Any Other Party.\u003c\/p\u003e\n\u003cp\u003e3. Intellectual Property Protection\u003c\/p\u003e\n\u003cp\u003eThe Ebook Is Owned By Manning And Is Protected By United States And International Copyright And Other Intellectual Property Laws. Manning Reserves All Rights In The Ebook Not Expressly Granted Herein. This License And Your Right To Use The Ebook Terminate Automatically If You Violate Any Part Of This Agreement. In The Event Of Termination, You Must Remove The Original And Any Copies Of The Ebook From All Your Devices.\u003c\/p\u003e\n\u003cp\u003e4. Source Code Supplementary Material\u003c\/p\u003e\n\u003cp\u003eAny Source Code Files Provided As A Supplement To The Book Are Freely Available To The Public For Download. Reuse Of The Code Is Permitted, In Whole Or In Part, Including The Creation Of Derivative Works, Provided That You Acknowledge That You Are Using It And Identify The Source: Title, Publisher And Year.\u003c\/p\u003e\n\u003cp\u003e5. Limited Warranty\u003c\/p\u003e\n\u003cp\u003eManning Warrants That The Ebook Files, A Copy Of Which You Are Authorized To Download, Are Free From Defects In The Operational Sense That They Can Be Read By A Pdf Reader Or Epub Reader, Or Other. Except For This Express Limited Warranty, Manning Makes And You Receive No Warranties, Express, Implied, Statutory Or In Any Communication With You, And Manning Specifically Disclaims Any Other Warranty Including The Implied Warranty Of Merchantability Or Fitness Or A Particular Purpose. Manning Does Not Warrant That The Operation Of The Ebook Will Be Uninterrupted Or Error Free. If The Ebook Was Purchased In The United States, The Above Exclusions May Not Apply To You As Some States Do Not Allow The Exclusion Of Implied Warranties. In Addition To The Above Warranty Rights, You May Also Have Other Rights That Vary From State To State.\u003c\/p\u003e\n\u003cp\u003e6. Limitation Of Liability\u003c\/p\u003e\n\u003cp\u003eIn No Event Will Manning Be Liable For Any Damages, Whether Arising For Tort Or Contract, Including Loss Of Data, Lost Profits, Or Other Special, Incidental, Consequential, Or Indirect Damages Arising Out Of The Use Or Inability To Use The Ebook.\u003c\/p\u003e\n\u003cp\u003e7. General\u003c\/p\u003e\n\u003cp\u003eThis Agreement Constitutes The Entire Agreement Between You And Manning And Supersedes Any Prior Agreement Concerning The Ebook. This Agreement Is Governed By The Laws Of The State Of New York.\u003c\/p\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003c\/div\u003e\n\u003cdiv id=\"detailBullets_feature_div\" class=\"celwidget\" data-feature-name=\"detailBullets\" data-csa-c-type=\"widget\" data-csa-c-content-id=\"detailBullets\" data-csa-c-slot-id=\"detailBullets_feature_div\" data-csa-c-asin=\"\" data-csa-c-is-in-initial-active-row=\"false\" data-csa-c-id=\"97jt08-qhx60r-vkltdy-ezzki6\" data-cel-widget=\"detailBullets_feature_div\"\u003e\n\u003cdiv id=\"detailBulletsWrapper_feature_div\" data-feature-name=\"detailBullets\" data-template-name=\"detailBullets\" class=\"a-section feature detail-bullets-wrapper bucket\" data-cel-widget=\"detailBulletsWrapper_feature_div\"\u003e\u003c\/div\u003e\n\u003c\/div\u003e","brand":"Manning Publications","offers":[{"title":"Paperback","offer_id":51165918789702,"sku":"9781633434325","price":5129.0,"currency_code":"INR","in_stock":true},{"title":"E-Book","offer_id":51165918822470,"sku":"9781633434325","price":3782.0,"currency_code":"INR","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0754\/2797\/1142\/files\/71EzY82LKVL._SL1500.jpg?v=1795677742","url":"https:\/\/cb-india.com\/products\/build-a-deepseek-model-from-scratch","provider":"Computer Bookshop (India) Pvt Ltd","version":"1.0","type":"link"}