DeepSeek & the
MoE Revolution
How a Chinese hedge fund lab matched frontier models at 1/10th the cost
agent37.club
January 27, 2025
The day that shook Silicon Valley
- DeepSeek-R1 released — open-weight reasoning model
- Matched OpenAI o1 on AIME (79.8% vs 79.2%) and MATH-500 (97.3% vs 96.4%)
- DeepSeek app hit #1 on the App Store
- NVIDIA stock dropped 17% in one day — $600B in market cap evaporated
- Largest single-day loss for any company in stock market history
The question everyone asked
If a Chinese lab can match GPT-4 for $5.6M in training cost… what does that mean for the $400B capex race?
Who is DeepSeek?
2015 — Liang Wenfeng co-founds High-Flyer, a quantitative hedge fund in Hangzhou, China
2023 (April) — High-Flyer launches an AGI research lab, funded by hedge fund profits
2023 (July) — Lab spins off as DeepSeek
2024 (Jan) — DeepSeekMoE 16B released — first MoE model
2024 (Jun) — DeepSeek-V2 (236B params) — introduces MLA
2024 (Dec) — DeepSeek-V3 (671B params) — frontier performance
2025 (Jan) — DeepSeek-R1 — reasoning model, open-weight
Origin story
Liang Wenfeng, born 1985, Zhejiang University grad. Parents were primary school teachers. Built a quant fund during the 2008 crisis. Used profits to fund an AI lab — not VC-backed, not a big tech subsidiary.
Dense vs Sparse
Why every parameter doesn’t need to fire on every token
Dense Transformers — The Default
- Every token activates every parameter in the model
- GPT-4 (rumored ~1.8T params) — all params fire on every forward pass
- Llama 3.1 405B — 405 billion multiply-adds per token
- Linear scaling: 2× params = 2× compute per token
The problem: You need massive knowledge capacity, but most knowledge is irrelevant for any given token. Why activate the “French poetry” neurons when generating Python code?
// Dense: every layer, every param
for layer in transformer:
x = attention(x)
x = FFN(x) // ALL params used
// 405B model = 405B ops/token
// Cost: O(params) per token
// Quality: great
// Efficiency: terrible
Mixture of Experts — The Key Idea
- Replace each FFN layer with N expert FFNs
- Add a router (gating network) that picks the top-K experts per token
- Only the selected experts compute — the rest sleep
- Total params grow with N, but active params stay fixed at K
Result
Massive knowledge capacity (total params) with a fraction of the compute cost (active params)
// MoE: route to top-K experts
for layer in transformer:
x = attention(x)
// Router picks best experts
scores = router(x) // tiny MLP
top_k = topk(scores, k=8)
// Only K experts compute
x = sum(w[i] * expert_i(x)
for i in top_k)
// 671B total but ~37B active
// 18x parameter efficiency!
MoE by the Numbers
| Model |
Type |
Total Params |
Active Params |
Ratio |
| Llama 3.1 405B |
Dense |
405B |
405B |
1.0× |
| Mixtral 8×7B |
MoE |
47B |
13B |
3.6× |
| DeepSeekMoE 16B |
MoE |
16.4B |
2.8B |
5.9× |
| DeepSeek-V2 |
MoE |
236B |
21B |
11.2× |
| DeepSeek-V3 |
MoE |
671B |
37B |
18.1× |
| GPT-4 (rumored) |
MoE |
~1.8T |
~280B? |
~6.4× |
Google’s research showed MoE models reach target quality 5× faster in training steps than dense equivalents.
The Router — MoE’s Hardest Problem
What the router must do
- A small MLP that takes a token’s hidden state and outputs scores for each expert
- Top-K experts are selected; their outputs are weighted-summed
- Must learn which experts specialize in what during training
The load balancing crisis
- Without intervention, routers collapse — all tokens go to 2-3 “popular” experts
- Most experts sit idle, wasting capacity
- Traditional fix: auxiliary loss that penalizes unbalanced routing
- Problem: auxiliary loss interferes with the actual training objective
// Traditional MoE routing
def route(x, num_experts, k):
// Score each expert
scores = softmax(W_gate @ x)
// Pick top-k
top_k_idx = topk(scores, k)
weights = scores[top_k_idx]
// Auxiliary loss to force balance
// f_i = fraction of tokens to expert i
// Want f_i ≈ 1/N for all experts
aux_loss = N * sum(f_i * P_i)
return top_k_idx, weights, aux_loss
// Too little aux_loss → collapse
// Too much aux_loss → hurts quality
DeepSeek’s MoE Innovations
Two strategies that changed the game
1. Fine-Grained Expert Segmentation
Instead of 8 large experts, use 64+ small experts and activate more of them.
- Each expert is 0.25× the size of a standard FFN
- Activate 8 out of 64 (not 2 out of 8)
- More flexible combinations — like LEGO bricks vs big blocks
- DeepSeek-V3: 256 routed experts, 8 active per token
2. Shared Expert Isolation
Dedicate some experts as always-on shared experts that every token uses.
- Shared experts capture common knowledge (grammar, basic reasoning)
- Routed experts specialize in domain-specific knowledge
- Reduces redundancy — routed experts don’t waste capacity on common patterns
- DeepSeek-V3: 1 shared expert + 8 of 256 routed
Auxiliary-Loss-Free Load Balancing
DeepSeek-V3’s routing breakthrough
- Old approach: Add a penalty term (auxiliary loss) to the training loss to encourage balanced expert usage. Always a compromise — hurts model quality.
- DeepSeek’s insight: Separate which expert gets selected from how much their output counts
- Selection uses a bias term that can be adjusted for balance without touching the loss function
- The expert’s contribution weight is learned independently through normal backprop
Why it matters
No more tuning the aux-loss coefficient. Model quality improves because training isn’t fighting a balance penalty. Experts naturally specialize.
// DeepSeek-V3: decouple selection
// from contribution
// 1. Selection (with bias for balance)
score_i = sigmoid(W @ x)
gate_i = score_i + bias_i
// bias_i adjusted to balance load
// NOT part of gradient computation
// 2. Contribution weight (learned)
weight_i = score_i / sum(scores)
// Selection ≠ weight
// Can balance routing without
// interfering with quality
Multi-Head Latent
Attention
How DeepSeek solved the KV cache problem
The KV Cache Problem
- Standard attention: store Key and Value vectors for every past token
- For a 70B model with 128K context: ~40 GB just for KV cache
- KV cache grows linearly with sequence length and batch size
- This is often the bottleneck for serving at scale — you run out of GPU memory
Previous solutions
- GQA (Grouped Query Attention): share K/V heads across groups — Llama 2/3 use this
- MQA (Multi-Query Attention): single K/V head — aggressive, some quality loss
KV cache per token per layer
| Method | Cache Size |
| MHA (standard) | 2 × d_model |
| GQA (8 groups) | 2 × d_model / n_groups |
| MQA | 2 × d_head |
| MLA | d_compress (much smaller) |
Multi-Head Latent Attention (MLA)
DeepSeek’s solution: compress K and V into a latent vector
- Instead of storing full K and V matrices, compress them into a low-rank latent representation
- Store only the compressed vector in the KV cache
- At inference time, project back to full K/V dimensions
- Compression ratio: store ~1/4 to ~1/8 of the original size
- Performs better than standard MHA — the low-rank constraint acts as regularization
DeepSeek-V2 result: 93.3% reduction in KV cache vs standard MHA, while improving quality on benchmarks.
// Standard MHA
K = W_k @ x // [d_model]
V = W_v @ x // [d_model]
// cache: K + V per token per layer
// MLA: compress first
c = W_compress @ x // [d_c] ≪ [d_model]
// cache: only c per token per layer!
// At attention time, decompress
K = W_uk @ c // reconstruct K
V = W_uv @ c // reconstruct V
// Then standard attention
// d_c ≈ d_model / 8
// Massive memory savings
The DeepSeek Architecture Evolution
| Model |
Date |
Params (Total/Active) |
Key Innovation |
| DeepSeekMoE 16B |
Jan 2024 |
16.4B / 2.8B |
Fine-grained experts + shared experts |
| DeepSeek-V2 |
Jun 2024 |
236B / 21B |
Multi-Head Latent Attention (MLA) |
| DeepSeek-V3 |
Dec 2024 |
685B / 37B |
Aux-loss-free routing + Multi-Token Prediction |
| DeepSeek-R1 |
Jan 2025 |
671B / 37B |
RL-trained reasoning (chain-of-thought) |
The pattern
Each generation stacks innovations: V2 added MLA on top of the MoE design. V3 added auxiliary-loss-free balancing + MTP on top of MLA + MoE. R1 added reasoning RL on top of V3’s architecture. Compounding improvements.
DeepSeek-V3 — Architecture
The numbers
- 671B total parameters (+ 14B MTP module = 685B)
- 37B active parameters per token
- 61 transformer layers
- 256 routed experts + 1 shared expert per MoE layer
- 8 experts activated per token
- 128K context window
- MLA with compressed KV cache
Training details
- Trained on 14.8 trillion tokens
- Training hardware: 2,048 NVIDIA H800 GPUs
- Training time: ~2 months
- FP8 mixed precision training (first at this scale)
- Estimated cost: $5.576 million
- Pipeline parallelism across 2,048 GPUs with custom communication
Multi-Token Prediction (MTP)
DeepSeek-V3’s secret training weapon
- Standard LLM: predict the next 1 token
- MTP: predict the next N tokens simultaneously
- Forces the model to think further ahead during training
- Improves sample efficiency — more signal per training example
- Bonus: the MTP heads can be used for speculative decoding at inference time
The 14B MTP module adds minimal overhead during training but significantly improves benchmark performance across the board.
// Standard: predict token t+1
loss = cross_entropy(
model(tokens[:t]),
tokens[t+1]
)
// MTP: predict t+1, t+2, ... t+n
for i in range(1, n+1):
loss += cross_entropy(
mtp_head_i(model(tokens[:t])),
tokens[t+i]
)
// At inference: MTP heads become
// draft model for speculative decode
// → 1.8x faster generation
The Cost Story
$5.6M vs $100M+ — how is this possible?
Training Cost Comparison
Claude 3
~$60M (estimated)
Llama 3.1 405B
~$40M (Meta internal)
How?
2,048 H800 GPUs × ~2 months × ~$2/GPU-hr = $5.576M in compute. The H800 is NVIDIA’s export-compliant chip for China (reduced interconnect bandwidth). DeepSeek built custom communication libraries to work around the limitations.
Why 18× Cheaper? The Four Factors
1. MoE Architecture
671B total params but only 37B active per token. Training FLOPs scale with active params, not total. ~18× fewer FLOPs per token vs a 671B dense model.
2. FP8 Mixed Precision
First model trained in FP8 at this scale. Halves memory bandwidth requirements vs FP16, enables higher GPU utilization. Custom FP8 training framework.
3. MLA Reduces Memory
Compressed KV cache means more sequences fit in memory simultaneously, improving GPU utilization during training. Less memory pressure = larger batch sizes.
4. Engineering Excellence
Custom communication libraries to work around H800 interconnect limits. Optimized pipeline parallelism. Multi-token prediction for better sample efficiency.
DeepSeek-V3 vs The World
Selected benchmarks (December 2024)
| Benchmark |
DeepSeek-V3 |
GPT-4o |
Claude 3.5 Sonnet |
Llama 3.1 405B |
| MMLU |
88.5 |
87.2 |
88.3 |
85.2 |
| MMLU-Pro |
75.9 |
72.6 |
73.3 |
61.6 |
| MATH-500 |
90.2 |
76.6 |
78.3 |
73.8 |
| HumanEval |
82.6 |
90.2 |
88.0 |
61.0 |
| GPQA |
59.1 |
53.6 |
56.0 |
51.1 |
An open-weight model, trained for $5.6M, matching or beating models that cost 10-20× more to train.
DeepSeek-R1 — The Reasoning Model
What changed from V3 to R1
- Same base architecture (671B MoE)
- Trained with reinforcement learning to produce chain-of-thought reasoning
- Model “thinks aloud” before answering — similar to OpenAI o1
- First open-weight reasoning model at frontier level
Head-to-head vs OpenAI o1
| Benchmark | DeepSeek-R1 | OpenAI o1 |
| AIME 2024 | 79.8% | 79.2% |
| MATH-500 | 97.3% | 96.4% |
| Open-ended puzzles | 11/27 | 18/27 |
The “aha moment”
During RL training, DeepSeek observed the model spontaneously developing self-correction and verification behaviors — without being explicitly taught to do so. The model learned to say “Wait, let me reconsider…”
Plus: distilled versions
DeepSeek distilled R1’s reasoning into smaller models (1.5B to 70B). The 32B distilled model outperforms many full-size models on reasoning tasks.
The Open-Weight Strategy
What DeepSeek releases openly
- Full model weights (permissive license)
- Detailed technical reports with architecture specifics
- Training recipes and hyperparameters
- Distilled smaller models
Why give it away?
- DeepSeek isn’t an API company — no direct revenue model from models
- Open-sourcing builds reputation and attracts talent
- Parent company (High-Flyer) profits from using AI in trading, not selling it
- Geopolitical strategy: harder to restrict what’s already public
Industry impact
DeepSeek’s open releases forced the industry to reckon with MoE efficiency. Influenced Llama 4 architecture decisions. Made frontier-quality reasoning available to everyone.
The ecosystem effect
Thousands of fine-tunes and derivatives. Ollama downloads in millions. Running on consumer hardware via quantization. A new baseline for what “open” means in AI.
Investment
Implications
What does DeepSeek mean for the AI trade?
The Jevons Paradox
“When something gets cheaper, people use more of it.”
The bear case (Jan 27 narrative)
- If frontier models can be trained for $5.6M, why spend $400B on data centers?
- NVIDIA’s moat is undermined — you don’t need as many GPUs
- Hyperscalers are overbuilding
The bull case (Jevons)
- Cheaper AI = more AI deployment everywhere
- More models, more agents, more inference, more edge deployment
- Demand for compute increases when efficiency improves
- Historical: LEDs didn’t reduce electricity use — we just lit up everything
NVIDIA stock recovered within weeks. The market eventually sided with Jevons — efficiency drives adoption, adoption drives compute demand.
What DeepSeek Means for NVIDIA
Threats
- Proves you can do frontier AI on fewer GPUs
- Shows export controls don’t fully constrain China (H800s are enough)
- MoE efficiency could reduce GPU requirements per model
- Custom communication libraries reduce dependency on NVLink
Reinforcements
- Inference demand grows faster than training shrinks
- MoE models need more memory (671B weights must be loaded)
- Every efficiency gain gets redeployed as more inference at scale
- NVIDIA’s CUDA ecosystem moat is deeper than hardware
- Blackwell B200 doubles inference performance — demand remains huge
The Bigger Picture
What DeepSeek proved about AI development
1. Architecture matters more than brute force
MoE + MLA + FP8 + MTP — each innovation multiplied the others. Smart engineering beats throwing more GPUs at the problem.
2. Open research accelerates everyone
DeepSeek’s detailed technical reports gave the entire field a playbook. MLA and auxiliary-loss-free routing are being adopted broadly.
3. Export controls have limits
The H800 (reduced from H100) was supposed to limit China’s AI capabilities. DeepSeek showed that constraints breed innovation.
4. The moat is moving to inference
Training a frontier model is now within reach of well-funded labs. The real moat is serving billions of inference requests at scale and low cost.
MoE Isn’t Free — The Challenges
Memory footprint
- All 671B parameters must be loaded into memory
- Even though only 37B are active per token, the full model sits in VRAM/RAM
- MoE models are harder to run locally than dense models of equal quality
Routing overhead
- Expert selection adds latency
- Scattered memory access patterns are GPU-unfriendly
- If routing isn’t perfectly balanced, some GPUs idle while others bottleneck
Training complexity
- Distributing experts across GPUs requires careful pipeline design
- Communication patterns are more complex than dense models
- Load balancing is hard to get right (hence DeepSeek’s innovation)
Inference serving
- Expert parallelism requires all-to-all communication
- Google’s Switch Transformer paper: “making a serving system for such a model would require significant engineering”
- Batch efficiency drops when different tokens route to different experts
The MoE Landscape — 2025–2026
| Model |
Company |
Architecture |
Status |
| DeepSeek-V3 / R1 |
DeepSeek |
671B MoE, 37B active |
Open-weight |
| GPT-4 / 4o (rumored) |
OpenAI |
~1.8T MoE (unconfirmed) |
Closed |
| Mixtral 8×22B |
Mistral |
141B MoE, 39B active |
Open-weight |
| Qwen 2.5-MoE |
Alibaba |
MoE variants |
Open-weight |
| Llama 4 |
Meta |
MoE architecture |
Released 2025 |
| Gemini |
Google |
MoE (details sparse) |
Closed |
The industry has converged: MoE is the default architecture for frontier models. DeepSeek proved it works. Everyone followed.
Key Takeaways
- MoE decouples knowledge from compute — massive parameter counts with fraction of the FLOPs per token
- DeepSeek innovated at every layer: fine-grained experts, shared experts, MLA, aux-loss-free routing, multi-token prediction, FP8 training
- $5.6M to match GPT-4 — the cost of training frontier models is dropping faster than anyone expected
- Open-weight matters — detailed technical reports let the whole field learn and build on top
- Jevons Paradox applies — efficiency doesn’t reduce compute demand, it increases adoption
- Constraints breed innovation — H800 export restrictions didn’t stop DeepSeek, they forced creative engineering
- MoE is now the default for frontier models — dense architectures are the exception
671B params.
37B active.
$5.6M trained.
The revolution is sparse.
agent37.club