Grok-1
xAI · Grok · open weights
- GQA
- RoPE
- MoE
Facts and where they come from
| Released | 2024-03 | codemodelling codeGitHub release of the open weights, March 2024 |
|---|---|---|
| Licence | apache-2.0 | config.jsonconfig.jsonREADME metadata: license |
| Total parameters | 314B | labmodel cardREADME: Grok-1 ... 314B parameters |
| Active parameters | not disclosed | not disclosed |
| Context length | 8K tokens | labxai-org/grok-1 run.py (pinned)run.py: sequence_len |
| Norm placement | not disclosed | not disclosednot checked in the modelling code |
| Norm type | not disclosed | not disclosednot checked in the modelling code |
| QK-norm | no | codemodelling codeno q/k normalisation in the attention block |
| Positional encoding | RoPE | codemodelling coderotary on the full head (default) |
Architecture, drawn from the data
GQA 48q/8kv. 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) | 316B |
|---|---|
| Active per token (modelled) | 83.8B |
| Without embeddings and output head | 315B total, 83B active |
| KV cache per token, BF16 (layers that grow with context) | 256 KiB |
| KV cache + state at 8K tokens, BF16 | 2 GiB |
| Decode FLOPs per token at 4K context | 174 GFLOP |
| Prefill FLOPs for a 4K prompt | 693 TFLOP |
KV cache against context
Every architecture field
| Field | Value | Source |
|---|---|---|
| d_model | 6,144 | labxai-org/grok-1 run.py (pinned)run.py: emb_size = 48 * 128 |
| vocab | 131,072 | labxai-org/grok-1 run.py (pinned)run.py: vocab_size = 128 * 1024 |
| tied_embeddings | true | labxai-org/grok-1 run.py (pinned)data/transcribed/grok-1.json: tie_word_embeddings |
| mixers.full.type | attn | codemodelling codeattention block |
| mixers.full.heads | 48 | labxai-org/grok-1 run.py (pinned)run.py: num_q_heads |
| mixers.full.kv_heads | 8 | labxai-org/grok-1 run.py (pinned)run.py: num_kv_heads |
| mixers.full.head_dim | 128 | labxai-org/grok-1 run.py (pinned)run.py: key_size |
| ffns.moe.type | moe | codemodelling codeMoE block |
| ffns.moe.experts | 8 | labxai-org/grok-1 run.py (pinned)run.py: num_experts |
| ffns.moe.active | 2 | labxai-org/grok-1 run.py (pinned)run.py: num_selected_experts |
| ffns.moe.d_expert | 32,768 | labxai-org/grok-1 run.py (pinned)model.py ffn_size(emb_size, widening_factor=8): int(8 * 6144) * 2 // 3, rounded to a multiple of 8 |
| ffns.moe.gated | true | codemodelling codeexperts are gated MLPs |
| layout | 64× full/moe | labxai-org/grok-1 run.py (pinned)run.py: num_layers |
Sources
- config.json @ 5de83eb
- model card
- xai-org/grok-1 run.py (pinned) · xai-org/grok-1 run.py (pinned)
- modelling code · transformers 5.18.0 modelling code, or the model repository's own modelling file at the pinned revision