Skip to content
StackDecode
LLM Library
Mixture of expertsOpen weightsArchitecture animation

DeepSeek-V2

Introduced MLA to shrink the KV cache and DeepSeekMoE for efficient experts.

At a glance

Made by
DeepSeek
Released
2024
Type
Mixture of experts
Access
Open weights
Parameters
236B
Active per token
21B
Context window
128k tokens
Attention
Multi-head latent attention (MLA)

How it works

MLA compresses keys and values into a small latent vector, cutting the KV cache dramatically. DeepSeekMoE uses many fine-grained experts plus shared experts.

Architecture, step by step

A token travels from text in to prediction out. The boxed layers repeat many times.

× N layersText inTokenizerEmbedding + positionNormSelf-attentionAdd (residual)NormRouter picks top-k expertsSelected experts (MLPs)Add (residual)Final normLM head (vocabulary scores)Softmax, then sample next token

Raw text enters the system, for example "The cat sat on the".

stage:
1/13
part:
Text in
1/13

The green dot is one token travelling through the model. The boxed section repeats for every layer.

What stands out

  • MLA
  • Fine-grained plus shared experts
  • Cheaper to serve than dense models of similar quality

Keep in mind

Custom attention needs specialised inference code.

Related models