RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /DeepSeek R1 and Reasoning Models
  6. /Ch. 2
DeepSeek R1 and Reasoning Models

02. DeepSeek R1 Architecture

Chapter 2 of 18 · 15 min
KEY INSIGHT

R1's architecture is optimized for inference efficiency through MLA (memory reduction) and MoE (compute reduction). The RL training creates the reasoning behavior, but the architecture determines whether you can serve it at acceptable cost.

DeepSeek R1's architecture builds on the standard transformer stack but introduces training innovations that make extended reasoning possible. Understanding these internals helps operators debug failures, optimize inference, and make informed deployment decisions.

Multi-Head Latent Attention (MLA)

R1 uses Multi-Head Latent Attention, a variant of multi-head attention that reduces KV cache memory through low-rank decomposition. During standard MHA, each head maintains its own key and value projections. MLA projects these into a shared latent space, then decompresses at attention time. The memory savings are substantial: approximately 50% reduction in KV cache size compared to standard MHA at equivalent quality.

# Conceptual comparison of attention memory footprint
# Standard MHA: 12 layers, 64 heads, 128 head_dim
# Memory per token = 12 * 64 * 128 * 2 * 4 bytes ≈ 786 KB

# MLA with latent_dim = 512
# Memory per token = 12 * 512 * 2 * 4 bytes ≈ 49 KB (94% reduction)

This memory reduction directly impacts your batch sizes and throughput calculations.

DeepSeek MoE Architecture

R1 employs a Mixture of Experts architecture with 256 routed experts per layer, activating 8 per token. The expert routing is load-balanced through auxiliary losses during training, ensuring no single expert becomes a bottleneck. This architecture delivers the quality of a dense model with substantially lower active parameter counts.

The math: R1 has 671B total parameters but only ~37B active parameters per token. During inference, you only compute through the active experts, dramatically reducing FLOPs relative to parameter count.

Reinforcement Learning Training for Reasoning

Unlike models trained purely on next-token prediction, R1 underwent RL training using Group Relative Policy Optimization (GRPO). This approach generates multiple responses per prompt, evaluates their quality through reward signals (correctness, format, helpfulness), and updates the policy based on relative performance.

The RL training is what produces the explicit chain-of-thought behavior. The model learns to verbalize intermediate steps because doing so improves reward outcomes—it's not just mimicking human reasoning examples, it's optimizing for explicit reasoning as a strategy.

EXERCISE

Calculate the active parameter count for a single forward pass through R1. Given A100 throughput of ~300 TFLOPs/s, estimate maximum tokens per second possible. Compare this to your latency requirements.

← Chapter 1
Reasoning Model Landscape
Chapter 3 →
Inference-Time Compute Scaling