[KongchangAI]
· 3 min read· 1,520 words

MIT PhD Takes You from Scratch to Build DeepSeek: A 25-Hour Hardcore Course

MIT PhD Takes You from Scratch to Build DeepSeek: A 25-Hour Hardcore Course

MIT PhD offers a 20-hour course to reproduce DeepSeek's architecture with hand-written code from matrix multiplication up.

MIT machine learning PhD Raj Dandekar found that most DeepSeek tutorials stay at the API application layer, lacking systematic breakdowns from mathematical derivation to code implementation. He thus launched a 20–25 hour "Build DeepSeek from Scratch" course. It covers an architecture section (MoE, MLA, quantization, multi-token prediction) and a modeling section (DPO, PPO, GRPO), with the ultimate goal of reproducing a mini R1 and running it on a GPU. Dandekar stresses that DeepSeek R1 is the result of over a year of paper accumulation and believes 95% of effort should go into architecture understanding, with application development taking only 5%. A companion book and illustrated notes will be released alongside, suited for learners with Transformer fundamentals and PyTorch experience.

While everyone is discussing how to quickly build applications with the DeepSeek API, an MIT machine learning PhD chose a harder path: tearing open every DeepSeek module, from mathematical derivation to code implementation, for all to see. Raj Dandekar, co-founder of Vizuara AI Labs, released an introduction to his course (with Chinese and English subtitles) on Bilibili, revealing a fact most people overlook—what's truly scarce isn't engineers who can call APIs, but people who can reproduce DeepSeek's architecture by hand.

Why Existing DeepSeek Tutorials Fall Short

Raj Dandekar's background is convincing: he graduated in 2017 with a degree in Mechanical Engineering from IIT Madras, earned his PhD in Machine Learning from MIT in 2022, and then returned to India to co-found Vizuara with the mission of making AI accessible to all. In the video, he states plainly that after DeepSeekAd drew global attention, he began looking for learning materials and found two dominant types of content: superficial news analysis and blog posts, or crash courses teaching you to build applications on top of DeepSeek.

He used a vivid analogy: you want to build a sports car with your own hands, but all you find are five-minute videos showing the car's exterior. The high-view-count DeepSeek videos on YouTube mostly run between 8 and 21 minutes, but none go down to the level of matrix multiplication. Google search results were equally disappointing—so-called "ultimate guides" merely teach you to call the R1 endpoint to build applications. Reddit discussions also failed to provide systematic technical breakdowns.

Can't find the tutorial you want

This supply-demand mismatch exposes an industry reality: as new models iterate on a weekly basis, most people chase quick wins at the application layer while understanding of the underlying architecture is set aside. Dandekar's judgment is that 95% of effort should go into architecture and modeling, with application development taking only 5%—"once you've mastered architecture and modeling, the application layer becomes straightforward."

DeepSeek Didn't Appear Out of Nowhere: Over a Year of Technical Accumulation

One easily overlooked fact is that DeepSeek R1 is not an isolated innovation. Dandekar mapped out the company's paper timeline: DeepSeek LLM was released in January 2024, with DeepSeek Coder in the same month; a vision-language model followed in March 2024; DeepSeek Math, focused on mathematical reasoning, arrived in April 2024; DeepSeek V2 and Coder V2 came out in June 2024; then DeepSeek V3 truly ignited attention, and the R1 paper that finally shook the world wasn't made public until January 2025.

This timeline shows that R1 rests on more than a year of systematic research. Dandekar emphasizes that he was already familiar with standard LLM construction methods, but DeepSeek's several innovations layered on top of the traditional architecture—Mixture of Experts (MoE), Multi-head Latent Attention (MLA), quantization techniques, multi-token prediction—had to be tackled one by one. For MLA alone, he took 50 pages of notes before truly understanding it.

Starting from the details of matrix multiplication

To prepare this course, he spent 10 to 12 hours a day for three consecutive weeks reading papers and organizing notes. This level of intensity itself sends a signal: understanding DeepSeek from scratch is not something you can accomplish by reading a few analysis articles.

Mixture of Experts (MoE) is a sparsely activated architecture: the model contains multiple independent "expert" feed-forward networks, but each forward pass activates only a few experts (e.g., 2) selected by a routing network. This allows the total parameter count to be enormous (e.g., 671B for DeepSeek-V3) while the actual computation is equivalent to a much smaller dense model. The core challenges of MoE are load balancing (avoiding overuse of certain experts) and communication efficiency (experts distributed across multiple GPUs), which DeepSeek addressed through innovations such as an auxiliary-loss-free load balancing strategy.

Multi-head Latent Attention (MLA) is an attention variant proposed by DeepSeek aimed at compressing the KV cache. Standard multi-head attention (MHA) requires storing full Key and Value vectors for every head of every token, incurring massive memory overhead with long contexts. MLA jointly compresses Key and Value into a low-dimensional latent vector, then dynamically up-projects to recover them during inference, thereby reducing the KV cache by an order of magnitude while maintaining expressiveness. This is one of the key technologies enabling DeepSeek's low-cost inference.

Course Structure: Architecture and Modeling in Parallel

According to the plan disclosed in the introductory video, the full course is expected to run 20 to 25 hours or more, with perhaps 25 to 30+ videos. The content is divided into two major sections, each following the path of "theoretical derivation—code implementation—comparative validation."

The Architecture section covers modules such as MoE, MLA, quantization, and multi-token prediction. Dandekar promises not to stop at theoretical explanation but to hand-write code for each module and compare it with traditional approaches—for example, after building the MLA module, he will conduct a comparative analysis against traditional multi-head attention without latent compression, so learners can intuitively understand the difference the improvement makes.

The Modeling section delves into the reinforcement learning pipeline, including DPO, PPO, and DeepSeek's signature innovation GRPO (Group Relative Policy Optimization). The course's ultimate goal is to reproduce a mini R1 and actually run it on a GPU.

Engineers who can build DeepSeek by hand are extremely rare

Interestingly, Dandekar is simultaneously writing a companion book, planned for release alongside the video course. His illustrated notes made in Canva will also be heavily used in the course to reduce the difficulty of understanding pure text. This combination of multiple formats—video + code + book + diagrams—is rare among AI education products.

GRPO (Group Relative Policy Optimization) is the reinforcement learning algorithm adopted by DeepSeek in R1, a simplification and improvement of PPO. Standard PPO requires a value network (Critic) of the same scale as the policy model to estimate the baseline, bringing extra memory and computation overhead. GRPO discards the Critic and instead samples a group of outputs, using the mean reward within the group as the baseline and computing the advantage function through relative comparison. This not only halves training resources but also encourages the model to explore diverse reasoning paths within the group, and is one of the core training mechanisms behind R1's strong reasoning capabilities.

Why the Ability to Build from Scratch Is Scarce

Dandekar makes a claim in the video: worldwide, the number of engineers who can independently build each DeepSeek component and understand the underlying mathematics is countable on one hand. This claim is grounded in his search experience—whether on YouTube, Google, or Reddit, he could not find systematic Chinese or English courses breaking down DeepSeek's architecture.

This raises a question worth pondering: in an era when open-source models are within easy reach, where exactly lies the value of understanding the underlying architecture? Dandekar's answer is that the barrier to application-layer innovation is rapidly lowering, while engineers who can understand and improve model architecture at the level of matrix multiplication are irreplaceable in any organization. He uses the term "fundamentals-oriented engineer" to define the course's target output—not users who can call packages, but builders who can construct DeepSeek's architecture by hand.

The habit of building from scratch

Vizuara has previously released a "Build an LLM from Scratch" series with over 40 episodes, accumulating a large audience. The DeepSeek series can be seen as an extension and upgrade of that line—leaping from standard LLM architecture to frontier architectures with complex innovations like MoE and MLA. For learners who already understand the fundamentals of Transformers and want to break through to the internal mechanisms of frontier models, this course's positioning is quite clear.

Multi-Token Prediction (MTP) is a training objective modification technique: traditional language models predict only the next token at a time, whereas MTP has the model predict multiple future tokens simultaneously (e.g., predicting one additional token in DeepSeek-V3). This forces the model to learn longer-range dependencies, improves representation quality, and can be used at inference time for speculative decoding to accelerate generation. As an auxiliary training objective, MTP improves model performance without significantly increasing inference cost—an easily overlooked but important innovation in DeepSeek's architecture.

Practical Information and Target Audience

The course is released on Bilibili with Chinese and English subtitles; the introductory video is already online, and the main content will be updated gradually. Dandekar admits that each video requires extensive note-organizing work, which limits the update frequency. The companion book is expected to be released one or two months after the videos.

The ideal learner profile: has a foundation in deep learning, understands Transformer architecture, has PyTorch coding experience, and is willing to invest time in grinding through mathematical derivations and code implementation. If you just want to quickly build a chatbot, the API tutorials on the market are already sufficient; but if you want to understand why DeepSeek can achieve frontier performance at extremely low cost, and reproduce that process by hand, this course currently looks like a rare systematic option.

Most discussions sparked by DeepSeek focus on cost, geopolitics, and open-source strategy, but Dandekar's perspective reminds us: the true legacy of a technological revolution is enabling more people to understand how it was built.

#DeepSeek#MIT course#MoE#MLA#GRPO#from scratch#LLM architecture#mini R1
Share:

Related articles