DeepSeekMoE 16B
DeepSeek · DeepSeekMoE · open weights
- MHA
- RoPE
- Pre-norm
- MoE
- Shared expert
- Dense first layers
Facts and where they come from
| Released | 2024-01 | paperarXiv 2401.06066arXiv v1, January 2024 |
|---|---|---|
| Licence | other | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 16B | paperarXiv 2401.06066abstract: we scale up DeepSeekMoE to 16B parameters |
| Active parameters | not disclosed | not disclosed |
| Context length | 4K tokens | config.jsonconfig.jsonmax_position_embeddings |
| Norm placement | pre | codemodelling codetransformers 5.18.0 / repo modelling code for deepseek: input_layernorm before attention, post_attention_layernorm before the MLP |
| Norm type | RMSNorm | codemodelling codetransformers 5.18.0 / repo modelling code for deepseek: input_layernorm before attention, post_attention_layernorm before the MLP |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | RoPE | codemodelling coderotary on the full head (default) |
| Parallel attention and MLP | no | codemodelling codetransformers 5.18.0 / repo modelling code for deepseek: input_layernorm before attention, post_attention_layernorm before the MLP |
Architecture, drawn from the data
MHA 16q/16kv. Each column is one layer: its token mixer above, its feed-forward block below. Paler columns reuse another layer’s keys and values.
Modelled costs
From the cost model, batch size 1. Totals the lab states are in the table above; differences come from rounding, from what a lab counts, or from parts the model does not describe (listed on the about page).
| Parameters (modelled) | 16.4B |
|---|---|
| Active per token (modelled) | 2.83B |
| Without embeddings and output head | 16B total, 2.41B active |
| Published weights (Hugging Face count) | 16.4B |
| KV cache per token, BF16 (layers that grow with context) | 224 KiB |
| KV cache + state at 4K tokens, BF16 | 896 MiB |
| Decode FLOPs per token at 4K context | 6.18 GFLOP |
| Prefill FLOPs for a 4K prompt | 21.7 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 2,048 | config.jsonconfig.jsonhidden_size |
| vocab | 102,400 | config.jsonconfig.jsonvocab_size |
| tied_embeddings | false | config.jsonconfig.jsontie_word_embeddings |
| mixers.full.type | attn | codemodelling codeattention block |
| mixers.full.heads | 16 | config.jsonconfig.jsonnum_attention_heads |
| mixers.full.kv_heads | 16 | config.jsonconfig.jsonnum_key_value_heads |
| mixers.full.head_dim | 128 | codemodelling codetransformers 5.18.0: head_dim = hidden_size / num_attention_heads |
| ffns.dense.type | dense | codemodelling codeMLP block |
| ffns.dense.d_ff | 10,944 | config.jsonconfig.jsonintermediate_size |
| ffns.dense.gated | true | codemodelling codeMLP: gated (SwiGLU/GeGLU) |
| ffns.moe.type | moe | codemodelling codeMoE block |
| ffns.moe.experts | 64 | config.jsonconfig.jsonn_routed_experts |
| ffns.moe.active | 6 | config.jsonconfig.jsonnum_experts_per_tok |
| ffns.moe.d_expert | 1,408 | config.jsonconfig.jsonmoe_intermediate_size |
| ffns.moe.gated | true | codemodelling codeexperts are gated MLPs |
| ffns.moe.shared | 2 | config.jsonconfig.jsonn_shared_experts |
| ffns.moe.d_shared | 1,408 | config.jsonconfig.jsonmoe_intermediate_size |
| layout | 1× full/dense · 27× full/moe | config.jsonconfig.jsonnum_hidden_layers, first_k_dense_replace |
Sources
- config.json @ 521d2bc
- model card
- arXiv 2401.06066
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision