The Rabbit Hole / AI / Model architectures
Microsoft · Architecture map Phi-4 A dense 14B model with grouped-query attention and a larger vocabulary than earlier Phi models. The block is Llama-style.
Phi-4, December 2024 · Phi release timeline
Architecture map What to notice How it scores Component articles Compare with another model Sources Inside Phi-4
Parameters 14B
Layers 40
Width 5,120
Mixer Grouped-query Select a component to explore it. Inside grouped-query attention · Transformer layers 1–40 4 query heads per group × 10 K/V groups. Earlier context dimmed · current token bright · dashed regions contain cached entries.
Phi-4: Transformer layers 1–40 · grouped-query attention 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Keys and values for 10 heads, 128 values each, per token per layer. 10 KV groups; the front face shows one representative. 10 KV groups 4 heads / group; the front face shows one representative. 4 heads / group Attention input. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Earlier context is dimmed; outlined columns are current. Current token computation. Attention input 5,120 CL Wq. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Wq 5,120 128 Wk. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Wk 5,120 128 Wv. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Wv 5,120 128 RoPE. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. RoPE RoPE. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. RoPE K cache. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. K cache 128 CL V cache. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Earlier columns are cached; outlined columns are newly computed. Cached positions from earlier decoding steps. Current token computation. V cache 128 CL Q context. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Earlier context is dimmed; outlined columns are current. Current token computation. Q context 128 CL Scaled query–key scores, masking and softmax. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. CL CL ×. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. × Joined heads. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. 40 Wo. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Wo 5,120 5,120 Attention output. 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Earlier context is dimmed; outlined columns are current. Current token computation. Attention output 5,120 CL Model-specific details Transformer layers 1–40 · 40 repetitions One dense gated (SiLU) feed-forward network per layer (hidden size 17920), used by every token. Attention and positions 40 query heads of 128 values share 10 key/value heads; causal attention over a 16,384-token context. The config sets no sliding window. Memory Keys and values for 10 heads, 128 values each, per token per layer. What changes from Phi-3-mini
Forty layers at width 5,120 use 40 query heads sharing ten key/value heads. The vocabulary grows to 100,352 tokens.
RoPE base is 250,000, the context is 16,384 tokens and no sliding window is configured. This is the original dense 14B Phi-4 checkpoint.
How it scores AA Intelligence Index Version 4.3.2 · higher is better · checked 2026-11-01. Separate from Epoch ECI.
Epoch ECI Results for the checkpoint named below, from Epoch AI, Capabilities & benchmarking (CC BY 4.0 ), snapshot of 2026-10-16.
Scored checkpoint Epoch ECI GPQA Diamond SWE-bench Verified Phi-4Open weights (unrestricted) · 2024-12 130 ahead of 42% of 277 scored models 56.1% —
Epoch ECI against release date for all 277 scored models A scatter plot of every scored model. Higher is better. The frontier rises over time. This model is highlighted. Epoch ECI by release date 60 80 100 120 140 160 2024 2025 2026 higher is better LLaMA-65B · 2023-02 · 110 · Open weights (non-commercial) LLaMA-33B · 2023-02 · 107 · Open weights (non-commercial) LLaMA-13B · 2023-02 · 101 · Open weights (non-commercial) LLaMA-7B · 2023-02 · 97 · Open weights (non-commercial) GPT-4 (Mar 2023) · 2023-03 · 126 · API access Cerebras-GPT-13B · 2023-03 · 83 · Open weights (unrestricted) Dolly 2.0-12b · 2023-04 · 90 · Open weights (unrestricted) vicuna-13b-v1.1 · 2023-04 · 95 · Unknown stablelm-tuned-alpha-7b · 2023-04 · 56 · Unknown Falcon-7B · 2023-04 · 95 · Open weights (unrestricted) RedPajama-INCITE-7B-Base · 2023-05 · 91 · Unknown MPT-7B · 2023-05 · 95 · Open weights (unrestricted) PaLM 2-L · 2023-05 · 115 · Unknown PaLM 2-M · 2023-05 · 108 · Unknown PaLM 2-S · 2023-05 · 106 · Unknown Falcon-40B · 2023-05 · 105 · Open weights (unrestricted) Baichuan1-7B · 2023-06 · 91 · Open weights (non-commercial) open_llama_7b · 2023-06 · 92 · Unknown GPT-4 (Jun 2023) · 2023-06 · 123 · API access GPT-3.5 Turbo (Jun 2023) · 2023-06 · 113 · API access MPT-30B · 2023-06 · 101 · Open weights (unrestricted) chatglm2-6b · 2023-06 · 99 · Unknown XGen-7B · 2023-06 · 94 · Open weights (unrestricted) internlm-7b · 2023-07 · 103 · Unknown Claude 2 · 2023-07 · 120 · API access Llama 2-70B · 2023-07 · 114 · Open weights (restricted use) Llama 2-13B · 2023-07 · 106 · Open weights (restricted use) Llama 2-34B · 2023-07 · 105 · Unreleased Llama 2-7B · 2023-07 · 99 · Open weights (restricted use) Stable Beluga 2 · 2023-07 · 117 · Open weights (non-commercial) Claude Instant · 2023-08 · 120 · API access Falcon-180B · 2023-09 · 112 · Open weights (restricted use) Baichuan2-13B · 2023-09 · 103 · Open weights (restricted use) Phi-1.5 · 2023-09 · 92 · Open weights (unrestricted) internlm-20b · 2023-09 · 112 · Unknown Baichuan 2-7B · 2023-09 · 96 · Open weights (restricted use) Qwen-14B · 2023-09 · 113 · Open weights (restricted use) Mistral 7B v0.1 · 2023-09 · 112 · Open weights (unrestricted) Qwen-7B · 2023-09 · 107 · Open weights (restricted use) Yi-34B · 2023-11 · 117 · Open weights (restricted use) DeepSeek Coder 33B · 2023-11 · 96 · Open weights (restricted use) DeepSeek Coder 6.7B · 2023-11 · 90 · Open weights (restricted use) DeepSeek Coder 1.3B · 2023-11 · 64 · Open weights (restricted use) GPT-3.5 Turbo (Nov 2023) · 2023-11 · 119 · API access Claude 2.1 · 2023-11 · 119 · API access Yi 6B · 2023-11 · 105 · Open weights (restricted use) DeepSeek LLM 67B · 2023-11 · 110 · Open weights (restricted use) Qwen-1_8B · 2023-11 · 93 · Unknown Mixtral 8x7B · 2023-12 · 119 · Open weights (unrestricted) Phi-2 · 2023-12 · 108 · Open weights (unrestricted) Gemini 1.0 Pro · 2023-12 · 117 · API access GPT-4 Turbo (Nov 2023) · 2024-01 · 126 · API access GPT-3.5 Turbo (Jan 2024) · 2024-01 · 116 · API access StarCoder 2 15B · 2024-02 · 105 · Open weights (restricted use) StarCoder 2 7B · 2024-02 · 94 · Open weights (restricted use) Gemma 7B · 2024-02 · 112 · Open weights (restricted use) Gemma 2B · 2024-02 · 94 · Open weights (restricted use) StarCoder 2 3B · 2024-02 · 89 · Open weights (restricted use) Mistral Large · 2024-02 · 122 · API access Nemotron-4 15B · 2024-02 · 108 · Unreleased Claude 3 Opus · 2024-02 · 127 · API access Claude 3 Sonnet · 2024-02 · 121 · API access Yi-9B · 2024-03 · 108 · Unknown Claude 3 Haiku · 2024-03 · 118 · API access GPT-4 Turbo (Apr 2024) · 2024-04 · 127 · API access CodeQwen1.5-7B · 2024-04 · 95 · Unknown Mixtral 8x22B · 2024-04 · 122 · Open weights (unrestricted) Llama 3-70B · 2024-04 · 123 · Open weights (restricted use) Llama 3-8B · 2024-04 · 116 · Open weights (restricted use) phi-3-small 7.4B · 2024-04 · 122 · Open weights (unrestricted) phi-3-medium 14B · 2024-04 · 121 · Open weights (unrestricted) phi-3-mini 3.8B · 2024-04 · 117 · Open weights (unrestricted) DeepSeek-V2 (MoE-236B, May 2024) · 2024-05 · 125 · Open weights (restricted use) Falcon 2 11B · 2024-05 · 110 · Open weights (restricted use) GPT-4o (May 2024) · 2024-05 · 129 · API access Gemini 1.5 Pro (May 2024) · 2024-05 · 127 · API access Gemini 1.5 Flash (May 2024) · 2024-05 · 123 · API access Mistral 7B v0.3 · 2024-05 · 109 · Open weights (unrestricted) Qwen2-72B · 2024-06 · 125 · Open weights (unrestricted) DeepSeek-Coder-V2-Lite-Base · 2024-06 · 109 · Unknown Claude 3.5 Sonnet · 2024-06 · 130 · API access Gemma 2 27B · 2024-06 · 122 · Open weights (restricted use) Gemma 2 9B · 2024-06 · 120 · Open weights (restricted use) GPT-4o mini · 2024-07 · 127 · API access Mistral NeMo · 2024-07 · 119 · Open weights (unrestricted) Llama 3.1-405B · 2024-07 · 129 · Open weights (restricted use) Llama 3.1-70B · 2024-07 · 126 · Open weights (restricted use) Llama 3.1-8B · 2024-07 · 117 · Open weights (restricted use) Mistral Large 2 (Jul 2024) · 2024-07 · 128 · Open weights (non-commercial) GPT-4o (Aug 2024) · 2024-08 · 129 · API access Command R+ · 2024-08 · 119 · Open weights (non-commercial) o1-mini · 2024-09 · 136 · API access o1-preview · 2024-09 · 135 · API access Qwen2.5-32B · 2024-09 · 129 · Open weights (unrestricted) Qwen2.5-Coder-32B · 2024-09 · 120 · Open weights (unrestricted) Qwen2.5-Coder-14B · 2024-09 · 116 · Unknown Qwen2.5-Coder (7B) · 2024-09 · 113 · Open weights (unrestricted) Qwen2.5-Coder-3B · 2024-09 · 108 · Unknown Qwen2.5-Coder (1.5B) · 2024-09 · 103 · Open weights (unrestricted) Qwen2.5-Coder-0.5B · 2024-09 · 88 · Unknown Qwen2.5-72B · 2024-09 · 129 · Open weights (unrestricted) Qwen2.5-7B · 2024-09 · 119 · Open weights (unrestricted) Gemini 1.5 Pro (Sept 2024) · 2024-09 · 132 · API access Gemini 1.5 Flash (Sep 2024) · 2024-09 · 129 · API access Llama 3.2 90B · 2024-09 · 126 · Open weights (restricted use) Llama 3.2 1B · 2024-09 · 102 · Open weights (restricted use) Ministral 3B · 2024-10 · 118 · API access Claude 3.5 Sonnet (October 2024) · 2024-10 · 134 · API access Claude 3.5 Haiku · 2024-10 · 127 · API access Mistral Large 2 (Nov 2024) · 2024-11 · 129 · Open weights (non-commercial) GPT-4o (Nov 2024) · 2024-11 · 129 · API access INTELLECT-1 · 2024-11 · 101 · Unknown Amazon Nova Pro · 2024-12 · 124 · API access Llama 3.3 70B · 2024-12 · 127 · Open weights (restricted use) Gemini 2.0 Flash (Dec 2024) · 2024-12 · 135 · API access Grok-2 (Dec 2024) · 2024-12 · 130 · API access o1 · 2024-12 · 142 · API access DeepSeek-V3 · 2024-12 · 132 · Open weights (restricted use) DeepSeek-R1 · 2025-01 · 139 · Open weights (unrestricted) DeepSeek-R1-Distill-Qwen-32B · 2025-01 · 137 · Open weights (unrestricted) DeepSeek-R1-Distill-Qwen-14B · 2025-01 · 135 · Open weights (unrestricted) Gemini 2.0 Flash Thinking (Jan 2025) · 2025-01 · 135 · API access Qwen2.5-Max · 2025-01 · 133 · API access Mistral Small 3 · 2025-01 · 127 · Open weights (unrestricted) o3-mini · 2025-01 · 140 · API access Gemini 2.0 Pro · 2025-02 · 135 · Hosted access (no API) Gemini 2.0 Flash (Feb 2025) · 2025-02 · 135 · API access Claude 3.7 Sonnet · 2025-02 · 141 · API access GPT-4.5 · 2025-02 · 137 · API access QwQ-32B · 2025-03 · 138 · Open weights (unrestricted) Gemma 3 27B · 2025-03 · 130 · Open weights (restricted use) Gemma 3 12B · 2025-03 · 123 · Open weights (restricted use) Gemma 3 4B · 2025-03 · 116 · Open weights (restricted use) Mistral Small 3.1 · 2025-03 · 127 · Open weights (unrestricted) DeepSeek-V3 (Mar 2025) · 2025-03 · 136 · Open weights (restricted use) Gemini 2.5 Pro (Mar 2025) · 2025-03 · 144 · API access Llama 4 Scout · 2025-04 · 130 · Open weights (restricted use) Llama 4 Maverick · 2025-04 · 132 · Open weights (restricted use) Grok 3 · 2025-04 · 138 · API access GPT-4.1 · 2025-04 · 137 · API access GPT-4.1 mini · 2025-04 · 135 · API access GPT-4.1 nano · 2025-04 · 130 · API access o3 · 2025-04 · 147 · API access o4-mini · 2025-04 · 146 · API access Gemini 2.5 Flash (Apr 2025) · 2025-04 · 140 · API access Qwen3-235B-A22B · 2025-04 · 139 · Open weights (unrestricted) Qwen3-8B · 2025-04 · 136 · Open weights (unrestricted) Qwen3-32B · 2025-04 · 138 · Open weights (unrestricted) Qwen3-14B · 2025-04 · 138 · Open weights (unrestricted) Qwen3-30B-A3B · 2025-04 · 136 · Open weights (unrestricted) Gemini 2.5 Pro (May 2025) · 2025-05 · 142 · API access Mistral Medium 3 · 2025-05 · 134 · API access Gemini 2.5 Flash (May 2025) · 2025-05 · 142 · API access Claude Opus 4 · 2025-05 · 143 · API access Claude Sonnet 4 · 2025-05 · 142 · API access DeepSeek-R1 (May 2025) · 2025-05 · 141 · Open weights (unrestricted) Gemini 2.5 Pro (Jun 2025) · 2025-06 · 145 · API access o3-pro · 2025-06 · 147 · API access Magistral Small 1.0 · 2025-06 · 133 · Open weights (unrestricted) Gemini 2.5 Flash (Jun 2025) · 2025-06 · 141 · API access Gemini 2.5 Flash-Lite (Jun 2025) · 2025-06 · 134 · API access Mistral Small 3.2 · 2025-06 · 132 · Open weights (unrestricted) Grok-3 mini · 2025-06 · 140 · API access Grok 4 · 2025-07 · 146 · API access Kimi K2 (Jul 2025) · 2025-07 · 140 · Open weights (restricted use) Qwen3-235B-A22B-Thinking (Jul 2025) · 2025-07 · 144 · Open weights (unrestricted) Qwen3-235B-A22B-Instruct (Jul 2025) · 2025-07 · 139 · Open weights (unrestricted) Qwen3-30B-A3B-Instruct (Jul 2025) · 2025-07 · 137 · Open weights (unrestricted) Qwen3-30B-A3B-Thinking (Jul 2025) · 2025-07 · 140 · Open weights (unrestricted) Claude Opus 4.1 · 2025-08 · 144 · API access gpt-oss-120b · 2025-08 · 140 · Open weights (unrestricted) gpt-oss-20b · 2025-08 · 138 · Open weights (unrestricted) GPT-5 · 2025-08 · 150 · API access GPT-5 mini · 2025-08 · 145 · API access GPT-5 nano · 2025-08 · 139 · API access DeepSeek-V3.1 · 2025-08 · 140 · Open weights (unrestricted) Magistral Small 1.2 · 2025-09 · 131 · Open weights (unrestricted) Grok 4 Fast · 2025-09 · 144 · API access Qwen3-Max · 2025-09 · 142 · API access Gemini 2.5 Flash (Sep 2025) · 2025-09 · 143 · API access Claude Sonnet 4.5 · 2025-09 · 147 · API access DeepSeek-V3.2-Exp · 2025-09 · 145 · Open weights (unrestricted) GPT-5 Pro · 2025-10 · 151 · API access Claude Haiku 4.5 · 2025-10 · 142 · API access Kimi K2 Thinking · 2025-11 · 146 · Open weights (restricted use) GPT-5.1 · 2025-11 · 150 · API access Gemini 3 Pro · 2025-11 · 153 · API access Claude Opus 4.5 · 2025-11 · 150 · API access DeepSeek-V3.2 · 2025-12 · 146 · Open weights (unrestricted) GPT-5.2 Pro · 2025-12 · 156 · API access GPT-5.2 · 2025-12 · 153 · API access Gemini 3 Flash · 2025-12 · 152 · API access GLM-4.7 · 2025-12 · 144 · Open weights (unrestricted) Kimi K2.5 · 2026-01 · 148 · Open weights (unrestricted) GPT-5.3 Codex · 2026-02 · 157 · API access Claude Opus 4.6 · 2026-02 · 155 · API access GLM-5 · 2026-02 · 146 · Open weights (unrestricted) MiniMax-M2.5 · 2026-02 · 147 · Open weights (unrestricted) Qwen3.5 397B-A17B · 2026-02 · 147 · Open weights (unrestricted) Qwen 3.5 Plus (hosted 397B-A17B) · 2026-02 · 146 · Unknown Claude Sonnet 4.6 · 2026-02 · 152 · API access Grok 4.20 · 2026-02 · 152 · API access Gemini 3.1 Pro · 2026-02 · 155 · API access Qwen3.5-35B-A3B · 2026-02 · 142 · Open weights (unrestricted) Qwen3.5-9B · 2026-02 · 139 · Open weights (restricted use) Qwen 3.5 Flash (hosted 35B-A3B) · 2026-02 · 144 · Unknown Gemini 3.1 Flash-Lite · 2026-03 · 144 · API access GPT-5.4 Pro · 2026-03 · 159 · API access GPT-5.4 · 2026-03 · 157 · API access GPT-5.4 Mini · 2026-03 · 149 · API access GPT-5.4 Nano · 2026-03 · 146 · API access MiniMax-M2.7 · 2026-03 · 146 · Open weights (non-commercial) Qwen 3.6 Plus · 2026-03 · 147 · API access Gemma 4 31B IT · 2026-04 · 143 · Open weights (restricted use) Gemma 4 26B A4B · 2026-04 · 142 · Open weights (unrestricted) GLM-5.1 · 2026-04 · 150 · Open weights (unrestricted) Muse Spark · 2026-04 · 152 · API access Qwen 3.6 35B-A3B · 2026-04 · 144 · Open weights (unrestricted) Claude Opus 4.7 · 2026-04 · 156 · API access Grok 4.3 Beta · 2026-04 · 149 · Hosted access (no API) Kimi K2.6 · 2026-04 · 151 · Open weights (unrestricted) Qwen 3.6 Max (Preview) · 2026-04 · 149 · Unknown Qwen3.6 27B · 2026-04 · 146 · Open weights (unrestricted) GPT-5.5 Pro · 2026-04 · 162 · API access GPT-5.5 · 2026-04 · 159 · API access DeepSeek-V4-Pro · 2026-04 · 149 · Open weights (unrestricted) DeepSeek-V4-Flash · 2026-04 · 146 · Open weights (unrestricted) Qwen 3.6 Flash · 2026-04 · 143 · Unknown Mistral Medium 3.5 · 2026-04 · 141 · Open weights (restricted use) GPT-5.5 Instant · 2026-05 · 142 · API access Gemini 3.5 Flash · 2026-05 · 154 · API access Qwen3.7-Max · 2026-05 · 154 · API access Claude Opus 4.8 · 2026-05 · 158 · API access MiniMax-M3 · 2026-06 · 147 · Open weights (restricted use) Qwen3.7-Plus · 2026-06 · 147 · API access Nemotron 3 Ultra · 2026-06 · 146 · Open weights (unrestricted) Claude Fable 5 · 2026-06 · 162 · API access Kimi K2.7 Code · 2026-06 · 150 · Open weights (unrestricted) GLM-5.2 · 2026-06 · 152 · Open weights (unrestricted) Claude Sonnet 5 · 2026-06 · 156 · API access Grok 4.5 · 2026-07 · 154 · API access GPT-5.6 Sol · 2026-07 · 162 · API access GPT-5.6 Terra · 2026-07 · 159 · API access GPT-5.6 Luna · 2026-07 · 156 · API access Muse Spark 1.1 · 2026-07 · 154 · API access Inkling-Small · 2026-07 · 150 · Open weights (unrestricted) Inkling · 2026-07 · 149 · Open weights (unrestricted) Kimi K3 · 2026-07 · 157 · Open weights (non-commercial) Gemini 3.6 Flash · 2026-07 · 154 · API access Gemini 3.5 Flash-Lite · 2026-07 · 145 · API access Claude Opus 5 · 2026-07 · 163 · API access Qwen3.7 Flash · 2026-07 · 145 · API access DeepSeek V4 Flash 0731 · 2026-07 · 154 · Open weights (unrestricted) Qwen 3.8 Max · 2026-08 · 157 · API access Muse Spark 1.2 · 2026-08 · 155 · API access Grok 4.6 · 2026-08 · 156 · API access Gemini 3.7 Flash · 2026-08 · 157 · API access DeepSeek V4 Pro 0813 · 2026-08 · 155 · Open weights (unrestricted) GLM-5.3 · 2026-08 · 156 · API access Qwen 3.8 27B · 2026-08 · 152 · Open weights (unrestricted) GLM-5.3-Flash · 2026-08 · 153 · Open weights (unrestricted) Claude Fable 5.1 · 2026-09 · 165 · API access Qwen3.8 Max (0902) · 2026-09 · 155 · API access Gemini 3.8 Flash · 2026-09 · 157 · API access Muse Spark 1.3 · 2026-09 · 157 · API access GPT-6 Astra · 2026-09 · 166 · API access DeepSeek V4.1 Flash · 2026-09 · 156 · Open weights (unrestricted) Grok 4.7 · 2026-09 · 154 · API access Claude Opus 5.5 · 2026-09 · 167 · API access GPT-6 Sol · 2026-09 · 163 · API access GPT-6 Luna · 2026-09 · 156 · API access Claude Sonnet 5.5 · 2026-09 · 164 · API access GPT-6.1 Sol · 2026-09 · 166 · API access Gemini 4 Argon · 2026-09 · 165 · Limited access Mistral Large 4 · 2026-10 · 147 · Unknown Claude Haiku 5.5 · 2026-10 · 159 · API access Phi-4 · 2024-12 · 130 · ahead of 42% of scored models Phi-4 What to notice: the dashed line is the best score at each point in time, the frontier. Open dots are open-weights models, filled grey dots are models with closed weights. Blue rings are other models in this atlas (click one to open it), and the green line follows this family. Data: Epoch AI, Capabilities & benchmarking , CC BY 4.0.Where a model was tested in several reasoning or effort settings, the best score is shown. A dash means no result for that test.
Explore the components Sources for this map