Blog Post January 2025

DeepSeek MIT License vs. Attention is All You Need

How DeepSeek trained a frontier-class model on a fraction of the budget — RL-first training, distillation and FP8, compared line by line against the 2017 Transformer.

Queries and edits by Kelly Nyland in collaboration w/ Chat GPT

How did DeepSeek train their model on a fraction of the budget and time?

Here’s how DeepSeek achieved significant efficiency and performance in training their models, according to their MIT License, compared to the original Transformer (as described in Attention Is All You Need):

Resources:

FileREADME_Deepseek.mdPDFAttention is All You Need.pdf

Comparison to the Transformer (Attention Is All You Need)

FeatureTransformer (2017)DeepSeek
Explain this to me in simple terms.Explain this to me in simple terms.
Core Training ApproachSupervised training with labeled data (e.g., machine translation tasks). Reinforcement learning (RL) without initial SFT; fine-tuning via distilled data for scalability.
Think of this robot like a kid learning in school. It needs a teacher to give it specific examples and tell it, “This is the correct answer.” It learns by copying those examples over and over.This robot skips the teacher at first. Instead, it plays games where it gets rewards for good behavior (like solving puzzles). Later, it learns extra tricks by looking at smaller, simpler robots to figure out how to work faster.
Efficiency in TrainingRequired extensive training on GPUs for days; limited by sequential computation (e.g., self-attention).RL drastically reduced training time; distillation produced smaller, efficient models.
Imagine this robot having to study for weeks in a library with super-slow computers. It learns one step at a time, which takes forever, especially for big tasks.This robot learns faster because it skips the library phase and starts playing games to get better right away. Then it shrinks itself down into smaller, smarter versions (like saving a cheat sheet), which makes it much faster.
Model ParallelismAttention layers were parallelized but computationally intensive for long sequences.Optimized parallelism with 128K token contexts and reinforcement-based efficiency.
When the Transformer robot works on a big, messy problem, it can split the task into chunks and work on it at the same time (parallel). But if the problem is really big, like reading a super-long book, it still struggles because each chunk needs extra power.This robot is much better at handling huge problems because it’s designed to work on longer pieces all at once (like reading a long book without getting tired). It uses smarter teamwork to solve tasks more efficiently.
Handling Long-Range DependenciesAddressed via self-attention with complexity, which became costly for long inputs.Improved token-to-token scaling via RL-based reasoning, enabling better handling of long dependencies.
Imagine this robot trying to remember the beginning of a really long story. It keeps forgetting important details because it uses a system that works well for short stories but struggles with long ones.This robot has a better memory system. It uses reasoning (like thinking step by step) to remember important details from the start, middle, and end of long stories. It’s like having a notebook to keep track of everything.
DistillationNo direct emphasis on distilling models for smaller scales.Systematic distillation to create high-performance smaller models like Qwen-1.5B, -7B, and Llama-based.
This robot doesn’t focus on becoming smaller or teaching smaller versions of itself how to do the same job.DeepSeek creates mini-versions of itself (like baby robots) that are just as smart but smaller and faster. These baby robots save space, energy, and time.
GeneralizationFocused on translation and text tasks, with limited extensions to other tasks.Applied CoT reasoning and RL, enabling generalization across math, code, and multilingual benchmarks.
This robot is really good at specific tasks, like translating languages or summarizing text. But if you ask it to solve math problems or write code, it might struggle because it wasn’t trained for that.DeepSeek is like a jack-of-all-trades robot. It’s trained to think through problems step by step (chain of thought), so it can handle math, coding, languages, and even solving tricky puzzles.

Highlights of DeepSeek’s Innovations:

  1. RL-First Training: RL eliminated dependency on human-annotated datasets, a significant cost-saving and flexibility-enhancing feature.
  2. Distillation Pipeline: Creating high-performing smaller models enhanced scalability and deployment opportunities.
  3. Computation Reduction: Improved methods for long-context tasks and token efficiency cut computational resource requirements.

Key Steps Taken by DeepSeek

  1. Large-Scale Reinforcement Learning (RL):

DeepSeek-R1-Zero: They bypassed supervised fine-tuning (SFT) initially, directly employing RL to train their base models. This incentivized reasoning behaviors like chain-of-thought (CoT), self-verification, and reflection.

What is Chain of Thought (CoT)?
What is Supervised Fine-Tuning (SFT)

Efficiency: RL allowed DeepSeek to focus on discovery and reinforcement of reasoning capabilities without additional human-annotated fine-tuning steps, saving time and computational costs.

  1. Optimized Pipeline for Model Training:

Two-Stage RL Process: Used sequential RL phases to refine reasoning and align the model with human preferences.

Cold-Start Data Inclusion: Unlike the initial RL-only phase, DeepSeek-R1 introduced pre-RL fine-tuning (cold-start data) in DeepSeek-R1, resolving issues like repetition and language mixing.

What is Cold-Start?
What are pre-RL methods?
  1. Model Distillation:

Distilling Reasoning Patterns: By distilling larger models’ reasoning patterns into smaller ones, DeepSeek significantly reduced model sizes while maintaining performance. For example:

  • Distilled models (e.g., DeepSeek-R1-Distill-Qwen-32B) showed state-of-the-art results, outperforming OpenAI-o1-mini.
  • Impact: This step reduced both computational and storage costs without sacrificing performance.
  1. Efficient Hardware Utilization:

Their base models supported extremely long context lengths (e.g., 128K tokens), optimized for benchmarks requiring large-scale outputs.

They leveraged multi-stage parallelization techniques to improve efficiency further.

  1. Open-Sourcing & Collaboration:

They open-sourced their distilled models and training pipeline, allowing broader collaboration and rapid iteration within the research community, benefiting from external optimizations.

So why is everyone freaking out?

What is Distillation?

Distillation in the context of DeepSeek refers to a process where a large model’s knowledge is compressed into a smaller, more efficient model, without losing too much of its performance. DeepSeek used this approach to make smaller, faster versions of their powerful models while maintaining high accuracy. Here’s how it works and why it’s significant:

What is Model Distillation?

  1. The Big Model (Teacher):

DeepSeek starts with a large, highly trained model like DeepSeek-R1. This model is powerful but requires a lot of computational resources to run, making it less practical for everyday use.

  1. The Small Model (Student):

The goal is to create a smaller, lighter version of the big model (e.g., DeepSeek-R1-Distill-Qwen-32B) that can run faster and use less memory while still performing well.

  1. The Process:

The large model (teacher) generates predictions on various tasks (e.g., solving math problems, answering questions).

The small model (student) is trained to mimic these predictions by learning from the outputs of the teacher model, rather than directly from the labeled data.

This allows the student to “inherit” the reasoning abilities and insights of the teacher without needing the same massive training data.

Why Distillation is Important for DeepSeek:

  1. Efficiency:

The smaller models are much faster and cheaper to run. They require less memory, making them more accessible for use in real-world applications, such as mobile devices or resource-limited environments.

  1. Scalability:

By offering smaller versions, DeepSeek can deploy their technology to a broader audience, including researchers, businesses, and developers who might not have access to supercomputers.

  1. Knowledge Transfer:

Distillation ensures that the powerful reasoning skills of the big model (developed through Reinforcement Learning) are passed down to smaller models without requiring those smaller models to go through the same expensive training process.

  1. Practical Usability:

Smaller models are easier to integrate into applications like chatbots, coding assistants, or search engines. For example:

A smaller model might run smoothly on your laptop or phone, while the original large model would require expensive cloud infrastructure.

How DeepSeek Distillation Compares to Traditional Transformers:

FeatureTraditional Transformer ModelsDeepSeek Distillation
PurposeFocus on building large, standalone models for each task.Compressing large models into smaller, general-purpose ones.
Resource UsageRequires significant computational power for inference.Smaller models use less power and run faster.
Knowledge TransferRarely focuses on systematically teaching smaller models.Explicitly distills reasoning skills and task knowledge.
Performance TradeoffSmaller models typically lose significant accuracy.DeepSeek’s smaller models maintain competitive accuracy.

Example: Why Distillation Matters

Let’s say you have a teacher (the big DeepSeek model) who’s amazing at explaining math, languages, and science. This teacher creates cheat sheets (distilled models) for students, so they can learn everything faster without having to study as much as the teacher did. Even though the students are smaller, they’re still incredibly smart and can handle most problems almost as well as the teacher.

What makes DeepSeek V3 special?

Source

DeepSeek-V3 vs. Models Like GPT

1. Faster Thinking with DualPipe

DeepSeek-V3 uses a unique scheduling system called DualPipe, which improves how it processes data. Traditional models like GPT process tasks sequentially, like a factory where one step has to finish before the next begins. DualPipe overlaps steps in the process—like starting the next step before the first one is fully done. This reduces “idle time,” making the model faster and more efficient at handling large workloads.

2. More Efficient Memory Use (FP8 Training)

DeepSeek-V3 employs FP8 (8-bit floating point) training, which significantly reduces the memory and energy needed for its calculations. This is like compressing information without losing its accuracy. In contrast, GPT uses higher precision formats like FP16, which require more resources. This innovation allows DeepSeek-V3 to perform complex tasks at a fraction of the computational cost.

3. Handling Long Contexts

DeepSeek-V3 can work with much longer inputs—up to 128K tokens—compared to GPT, which struggles with much shorter contexts (typically 32K). Imagine trying to write a summary of a novel versus a short story. DeepSeek-V3 keeps track of all the important details in the novel, whereas GPT might forget parts of the story.

4. Modular Expertise

Instead of treating all tasks the same way, DeepSeek-V3 uses Mixture of Experts (MoE) layers. This means it activates specific “experts” within the model based on the problem, like consulting a mathematician for a math problem or a coder for programming. GPT doesn’t have this modular design, so it has to rely on the same general knowledge for everything, which can limit its efficiency and performance on specialized tasks.

5. Predicting More at Once

While GPT predicts one word at a time, DeepSeek-V3 predicts two tokens at once using a technique called Multi-Token Prediction (MTP). This speeds up how quickly it generates text and improves its efficiency without sacrificing accuracy.

6. Smarter Feedback Loop

DeepSeek-V3 uses advanced reinforcement learning techniques like self-rewarding to improve itself. For example, when solving a math problem, it doesn’t just rely on a human to tell it if the answer is correct; it can evaluate its own solution using internal checks. GPT typically requires human feedback to refine its performance.

7. Optimized for Future Hardware

DeepSeek-V3 is designed to fully utilize next-gen hardware like NVIDIA’s H800 GPUs. It also introduces improvements in communication between GPUs, making it more scalable and efficient for larger systems. This forward-thinking design ensures that it can continue to perform well as technology advances.

8. Superior Performance Across Benchmarks

DeepSeek-V3 consistently outperforms GPT and other models on a range of tests:

Math and Coding: It achieves significantly higher accuracy on complex math and programming tasks.

Long-Context Understanding: It excels at reading and reasoning through long documents or multi-step problems.

Language Diversity: Its training data includes more languages and specialized tasks, giving it a broader range of knowledge.

Key Differentiators from GPT

FeatureDeepSeek-V3GPT (e.g., GPT-3/4)
ArchitectureMixture-of-Experts (MoE)Dense Transformer
EfficiencyDualPipe, FP8 training, fine-grained quantizationBF16 or FP32, standard parallelism
Inference SpeedMulti-Token Prediction (MTP), speculative decodingNext-token prediction
Long-ContextHandles 128K tokens via YaRNTypically limited to 32K
Data OptimizationFIM strategy, diverse multilingual corpusNext-token prediction corpus
Training CostsOptimized for lower GPU hoursHigher computational costs
Math and CodeOutperforms on GSM8K, HumanEvalCompetitive but underperforms
AlignmentSelf-rewarding, constitutional AIPPO with human feedback

Other stuff I’ve written lately: