N Neurarch Architectures Models Checks Data Docs Open the app

Models / phi3

Phi-4-mini-instruct

Reconstructed from its own config.json with no weights read. 461K downloads on Hugging Face.

Our count against the checkpoint

The left number comes from the graph. The right one is the number of scalars in the published weight files. Nothing on this page was tuned to make them agree.

Derived from structure
3.84B
3,836,018,688 parameters
In the published checkpoint
3.84B
3,836,021,760 scalars · safetensors.total, read 2025-12-10
Delta
-0.00%

custom-code This repository ships its own modeling code (`auto_map`, e.g. `configuration_phi3.py`), so `config.json` names a class in the repo rather than an architecture `transformers` defines. The graph below is what those config keys mean under `transformers` semantics, which is not necessarily what the repo's own file builds. A gap here is a statement about what we read, not about the checkpoint.

What it costs to run

Cost is a roofline estimate on the priced GPU for 10 epochs at batch 32 over 50,000 samples (assumed; no dataset attached). GPU fit is fp32 weights plus gradients plus two Adam moments (16 bytes per parameter) with 1.3x headroom; activations are not included and grow with batch size.

Layers
194
Will it forward-pass
Yes
Priced on
A10G (24GB)
Est. one run
$79013.86
CardMemory
T4 (16GB)weights + activationsdoes not fit
A100 (40GB)weights + activationsdoes not fit
H100 (80GB)weights + activationsfits

Structure

196 nodes. Output shapes are propagated from the input shape, batch dimension excluded.

LayerTypeOutput shape
1InputInput1 × 131072
2EmbeddingEmbedding1 × 131072 × 3072
3RoPERoPE1 × 131072 × 3072
4RMSNorm_1_1RMSNorm1 × 131072 × 3072
5Attention_1Grouped Query Attn1 × 131072 × 3072
6Add_1_attnAdd1 × 131072 × 3072
7RMSNorm_1_2RMSNorm1 × 131072 × 3072
8FFN_1SwiGLU1 × 131072 × 3072
9Add_1_ffnAdd1 × 131072 × 3072
10RMSNorm_2_1RMSNorm1 × 131072 × 3072
11Attention_2Grouped Query Attn1 × 131072 × 3072
12Add_2_attnAdd1 × 131072 × 3072
13RMSNorm_2_2RMSNorm1 × 131072 × 3072
14FFN_2SwiGLU1 × 131072 × 3072
15Add_2_ffnAdd1 × 131072 × 3072
16RMSNorm_3_1RMSNorm1 × 131072 × 3072
17Attention_3Grouped Query Attn1 × 131072 × 3072
18Add_3_attnAdd1 × 131072 × 3072
19RMSNorm_3_2RMSNorm1 × 131072 × 3072
20FFN_3SwiGLU1 × 131072 × 3072
21Add_3_ffnAdd1 × 131072 × 3072
22RMSNorm_4_1RMSNorm1 × 131072 × 3072
23Attention_4Grouped Query Attn1 × 131072 × 3072
24Add_4_attnAdd1 × 131072 × 3072
25RMSNorm_4_2RMSNorm1 × 131072 × 3072
26FFN_4SwiGLU1 × 131072 × 3072
27Add_4_ffnAdd1 × 131072 × 3072
28RMSNorm_5_1RMSNorm1 × 131072 × 3072
29Attention_5Grouped Query Attn1 × 131072 × 3072
30Add_5_attnAdd1 × 131072 × 3072
31RMSNorm_5_2RMSNorm1 × 131072 × 3072
32FFN_5SwiGLU1 × 131072 × 3072
33Add_5_ffnAdd1 × 131072 × 3072
34RMSNorm_6_1RMSNorm1 × 131072 × 3072
35Attention_6Grouped Query Attn1 × 131072 × 3072
36Add_6_attnAdd1 × 131072 × 3072
37RMSNorm_6_2RMSNorm1 × 131072 × 3072
38FFN_6SwiGLU1 × 131072 × 3072
39Add_6_ffnAdd1 × 131072 × 3072
40RMSNorm_7_1RMSNorm1 × 131072 × 3072
41Attention_7Grouped Query Attn1 × 131072 × 3072
42Add_7_attnAdd1 × 131072 × 3072
43RMSNorm_7_2RMSNorm1 × 131072 × 3072
44FFN_7SwiGLU1 × 131072 × 3072
45Add_7_ffnAdd1 × 131072 × 3072
46RMSNorm_8_1RMSNorm1 × 131072 × 3072
47Attention_8Grouped Query Attn1 × 131072 × 3072
48Add_8_attnAdd1 × 131072 × 3072
49RMSNorm_8_2RMSNorm1 × 131072 × 3072
50FFN_8SwiGLU1 × 131072 × 3072
51Add_8_ffnAdd1 × 131072 × 3072
52RMSNorm_9_1RMSNorm1 × 131072 × 3072
53Attention_9Grouped Query Attn1 × 131072 × 3072
54Add_9_attnAdd1 × 131072 × 3072
55RMSNorm_9_2RMSNorm1 × 131072 × 3072
56FFN_9SwiGLU1 × 131072 × 3072
57Add_9_ffnAdd1 × 131072 × 3072
58RMSNorm_10_1RMSNorm1 × 131072 × 3072
59Attention_10Grouped Query Attn1 × 131072 × 3072
60Add_10_attnAdd1 × 131072 × 3072
61RMSNorm_10_2RMSNorm1 × 131072 × 3072
62FFN_10SwiGLU1 × 131072 × 3072
63Add_10_ffnAdd1 × 131072 × 3072
64RMSNorm_11_1RMSNorm1 × 131072 × 3072
65Attention_11Grouped Query Attn1 × 131072 × 3072
66Add_11_attnAdd1 × 131072 × 3072
67RMSNorm_11_2RMSNorm1 × 131072 × 3072
68FFN_11SwiGLU1 × 131072 × 3072
69Add_11_ffnAdd1 × 131072 × 3072
70RMSNorm_12_1RMSNorm1 × 131072 × 3072
71Attention_12Grouped Query Attn1 × 131072 × 3072
72Add_12_attnAdd1 × 131072 × 3072
73RMSNorm_12_2RMSNorm1 × 131072 × 3072
74FFN_12SwiGLU1 × 131072 × 3072
75Add_12_ffnAdd1 × 131072 × 3072
76RMSNorm_13_1RMSNorm1 × 131072 × 3072
77Attention_13Grouped Query Attn1 × 131072 × 3072
78Add_13_attnAdd1 × 131072 × 3072
79RMSNorm_13_2RMSNorm1 × 131072 × 3072
80FFN_13SwiGLU1 × 131072 × 3072
81Add_13_ffnAdd1 × 131072 × 3072
82RMSNorm_14_1RMSNorm1 × 131072 × 3072
83Attention_14Grouped Query Attn1 × 131072 × 3072
84Add_14_attnAdd1 × 131072 × 3072
85RMSNorm_14_2RMSNorm1 × 131072 × 3072
86FFN_14SwiGLU1 × 131072 × 3072
87Add_14_ffnAdd1 × 131072 × 3072
88RMSNorm_15_1RMSNorm1 × 131072 × 3072
89Attention_15Grouped Query Attn1 × 131072 × 3072
90Add_15_attnAdd1 × 131072 × 3072
91RMSNorm_15_2RMSNorm1 × 131072 × 3072
92FFN_15SwiGLU1 × 131072 × 3072
93Add_15_ffnAdd1 × 131072 × 3072
94RMSNorm_16_1RMSNorm1 × 131072 × 3072
95Attention_16Grouped Query Attn1 × 131072 × 3072
96Add_16_attnAdd1 × 131072 × 3072
97RMSNorm_16_2RMSNorm1 × 131072 × 3072
98FFN_16SwiGLU1 × 131072 × 3072
99Add_16_ffnAdd1 × 131072 × 3072
100RMSNorm_17_1RMSNorm1 × 131072 × 3072
101Attention_17Grouped Query Attn1 × 131072 × 3072
102Add_17_attnAdd1 × 131072 × 3072
103RMSNorm_17_2RMSNorm1 × 131072 × 3072
104FFN_17SwiGLU1 × 131072 × 3072
105Add_17_ffnAdd1 × 131072 × 3072
106RMSNorm_18_1RMSNorm1 × 131072 × 3072
107Attention_18Grouped Query Attn1 × 131072 × 3072
108Add_18_attnAdd1 × 131072 × 3072
109RMSNorm_18_2RMSNorm1 × 131072 × 3072
110FFN_18SwiGLU1 × 131072 × 3072
111Add_18_ffnAdd1 × 131072 × 3072
112RMSNorm_19_1RMSNorm1 × 131072 × 3072
113Attention_19Grouped Query Attn1 × 131072 × 3072
114Add_19_attnAdd1 × 131072 × 3072
115RMSNorm_19_2RMSNorm1 × 131072 × 3072
116FFN_19SwiGLU1 × 131072 × 3072
117Add_19_ffnAdd1 × 131072 × 3072
118RMSNorm_20_1RMSNorm1 × 131072 × 3072
119Attention_20Grouped Query Attn1 × 131072 × 3072
120Add_20_attnAdd1 × 131072 × 3072
121RMSNorm_20_2RMSNorm1 × 131072 × 3072
122FFN_20SwiGLU1 × 131072 × 3072
123Add_20_ffnAdd1 × 131072 × 3072
124RMSNorm_21_1RMSNorm1 × 131072 × 3072
125Attention_21Grouped Query Attn1 × 131072 × 3072
126Add_21_attnAdd1 × 131072 × 3072
127RMSNorm_21_2RMSNorm1 × 131072 × 3072
128FFN_21SwiGLU1 × 131072 × 3072
129Add_21_ffnAdd1 × 131072 × 3072
130RMSNorm_22_1RMSNorm1 × 131072 × 3072
131Attention_22Grouped Query Attn1 × 131072 × 3072
132Add_22_attnAdd1 × 131072 × 3072
133RMSNorm_22_2RMSNorm1 × 131072 × 3072
134FFN_22SwiGLU1 × 131072 × 3072
135Add_22_ffnAdd1 × 131072 × 3072
136RMSNorm_23_1RMSNorm1 × 131072 × 3072
137Attention_23Grouped Query Attn1 × 131072 × 3072
138Add_23_attnAdd1 × 131072 × 3072
139RMSNorm_23_2RMSNorm1 × 131072 × 3072
140FFN_23SwiGLU1 × 131072 × 3072
141Add_23_ffnAdd1 × 131072 × 3072
142RMSNorm_24_1RMSNorm1 × 131072 × 3072
143Attention_24Grouped Query Attn1 × 131072 × 3072
144Add_24_attnAdd1 × 131072 × 3072
145RMSNorm_24_2RMSNorm1 × 131072 × 3072
146FFN_24SwiGLU1 × 131072 × 3072
147Add_24_ffnAdd1 × 131072 × 3072
148RMSNorm_25_1RMSNorm1 × 131072 × 3072
149Attention_25Grouped Query Attn1 × 131072 × 3072
150Add_25_attnAdd1 × 131072 × 3072
151RMSNorm_25_2RMSNorm1 × 131072 × 3072
152FFN_25SwiGLU1 × 131072 × 3072
153Add_25_ffnAdd1 × 131072 × 3072
154RMSNorm_26_1RMSNorm1 × 131072 × 3072
155Attention_26Grouped Query Attn1 × 131072 × 3072
156Add_26_attnAdd1 × 131072 × 3072
157RMSNorm_26_2RMSNorm1 × 131072 × 3072
158FFN_26SwiGLU1 × 131072 × 3072
159Add_26_ffnAdd1 × 131072 × 3072
160RMSNorm_27_1RMSNorm1 × 131072 × 3072
161Attention_27Grouped Query Attn1 × 131072 × 3072
162Add_27_attnAdd1 × 131072 × 3072
163RMSNorm_27_2RMSNorm1 × 131072 × 3072
164FFN_27SwiGLU1 × 131072 × 3072
165Add_27_ffnAdd1 × 131072 × 3072
166RMSNorm_28_1RMSNorm1 × 131072 × 3072
167Attention_28Grouped Query Attn1 × 131072 × 3072
168Add_28_attnAdd1 × 131072 × 3072
169RMSNorm_28_2RMSNorm1 × 131072 × 3072
170FFN_28SwiGLU1 × 131072 × 3072
171Add_28_ffnAdd1 × 131072 × 3072
172RMSNorm_29_1RMSNorm1 × 131072 × 3072
173Attention_29Grouped Query Attn1 × 131072 × 3072
174Add_29_attnAdd1 × 131072 × 3072
175RMSNorm_29_2RMSNorm1 × 131072 × 3072
176FFN_29SwiGLU1 × 131072 × 3072
177Add_29_ffnAdd1 × 131072 × 3072
178RMSNorm_30_1RMSNorm1 × 131072 × 3072
179Attention_30Grouped Query Attn1 × 131072 × 3072
180Add_30_attnAdd1 × 131072 × 3072
181RMSNorm_30_2RMSNorm1 × 131072 × 3072
182FFN_30SwiGLU1 × 131072 × 3072
183Add_30_ffnAdd1 × 131072 × 3072
184RMSNorm_31_1RMSNorm1 × 131072 × 3072
185Attention_31Grouped Query Attn1 × 131072 × 3072
186Add_31_attnAdd1 × 131072 × 3072
187RMSNorm_31_2RMSNorm1 × 131072 × 3072
188FFN_31SwiGLU1 × 131072 × 3072
189Add_31_ffnAdd1 × 131072 × 3072
190RMSNorm_32_1RMSNorm1 × 131072 × 3072
191Attention_32Grouped Query Attn1 × 131072 × 3072
192Add_32_attnAdd1 × 131072 × 3072
193RMSNorm_32_2RMSNorm1 × 131072 × 3072
194FFN_32SwiGLU1 × 131072 × 3072
195Add_32_ffnAdd1 × 131072 × 3072
196OutputOutput1 × 131072 × 3072

What the verifier says

infoAt 32 stacked attention layers, residual-branch outputs add up; unscaled init lets activation variance grow with depth. GPT-2/LLaMA-family models scale the residual projections by depth (N(0, 0.02 / √(2L))). Fix: Scale residual output projections by depth: nn.init.normal_(w, std=0.02 / math.sqrt(2 * n_layers))
deep-attention-default-init

Do this to your own model

Same numbers, on a model in your repo, in one command. No account.

pip install neurarch-trace
neurarch-trace microsoft/Phi-4-mini-instruct --plan --share

Other phi3 checkpoints

Phi-3.5-mini-instruct
3.82B derived · +0.00% against the checkpoint
Phi-3-mini-128k-instruct
3.82B derived · +0.00% against the checkpoint
Phi-3-mini-4k-instruct
3.82B derived · +0.00% against the checkpoint
phi-4
14.66B derived · +0.00% against the checkpoint