N Neurarch Try it See it Changes Bot Pricing API Open app

Models / ilama

Ilama-3.2-1B: GPU memory to fine-tune

Fine-tuning Ilama-3.2-1B at batch 1 and 2048 tokens takes about 26.7 GB of GPU memory for a full fine-tune (borderline on one A100 40 GB), and 5.68 GB with LoRA r=16 on a bf16 base (fits one T4 16 GB). Estimated from the model's structure, reading the config under transformers semantics, not measured. What fits on which card.

Reconstructed from its own config.json with no weights read. 112K 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
1.24B
1,235,812,352 parameters
In the published checkpoint
1.24B
1,235,814,400 scalars · safetensors.total, read 2025-07-22
Delta
-0.00%

custom-code This repository ships its own modeling code (`auto_map`, e.g. `configuration_ilama.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, 2048 tokens over 50,000 samples (assumed; no dataset attached).

Layers
98
Will it forward-pass
Yes
Priced on
A10G (24GB)
Est. one run
$79.79

Memory: what fits on which card

Largest batch per card. Training is sized at 2048 tokens per sample, serving at 4096 tokens per sequence.

Full fine-tune, batch 1 at 2048 tokens
26.7 GB
LoRA r=16, batch 1 at 2048 tokens
5.68 GB
Serve: bf16 weights
2.47 GB
Serve: KV cache, 4096 tokens
0.13 GB
CardFull fine-tuneLoRA r=16Serve bf16, 4096 tokens
T4 16 GB2 cards at batch 1 (42 + 56 layers)batch 3batch 85
L4 24 GB2 cards at batch 1 (72 + 26 layers)batch 6batch 137
A100 40 GBbatch 3, borderlinebatch 10batch 240
A100 / H100 80 GBbatch 15batch 22batch 499
H200 141 GBbatch 33batch 40batch 895

Training: 2048 tokens per sample (2048, or the model's context when shorter; the structure table is at the config's maximum, 131072), AdamW with bf16 autocast, SDPA attention (no score matrix stored), 1.15x headroom on every card. Full fine-tune holds weights, gradients and optimizer state (1.2 x 16 bytes per parameter) plus activations. LoRA is r=16 on every linear layer but the head, base frozen in bf16 (2 bytes per parameter), adapters at full AdamW state, same activations. A two-card split is a contiguous layer cut (pipeline parallel), computed only where one card cannot hold batch 1. "Borderline" means the card holds batch 1 on the estimate but not on the conservative peak (the estimate x 1.43, at or above the measured peak on 95% of held-out runs): measure one step before reserving it. Serving: bf16 weights plus the KV cache of 4096 tokens per sequence; prefill working set, CUDA context and framework reserve not counted.

These are estimates from the graph, not measurements. Against measured runs, held out by architecture, the estimate flagged 113 of the 131 jobs that did not fit their card and said "fits" on the other 18. Every measured run.

Structure

100 nodes. Output shapes are propagated from the input shape, batch dimension excluded, at 131072 tokens: the config's maximum context, not the 2048 the memory above is sized at.

LayerTypeOutput shape
1InputInput1 × 131072
2EmbeddingEmbedding1 × 131072 × 2048
3RoPERoPE1 × 131072 × 2048
4RMSNorm_1_1RMSNorm1 × 131072 × 2048
5Attention_1Grouped Query Attn1 × 131072 × 2048
6Add_1_attnAdd1 × 131072 × 2048
7RMSNorm_1_2RMSNorm1 × 131072 × 2048
8FFN_1SwiGLU1 × 131072 × 2048
9Add_1_ffnAdd1 × 131072 × 2048
10RMSNorm_2_1RMSNorm1 × 131072 × 2048
11Attention_2Grouped Query Attn1 × 131072 × 2048
12Add_2_attnAdd1 × 131072 × 2048
13RMSNorm_2_2RMSNorm1 × 131072 × 2048
14FFN_2SwiGLU1 × 131072 × 2048
15Add_2_ffnAdd1 × 131072 × 2048
16RMSNorm_3_1RMSNorm1 × 131072 × 2048
17Attention_3Grouped Query Attn1 × 131072 × 2048
18Add_3_attnAdd1 × 131072 × 2048
19RMSNorm_3_2RMSNorm1 × 131072 × 2048
20FFN_3SwiGLU1 × 131072 × 2048
21Add_3_ffnAdd1 × 131072 × 2048
22RMSNorm_4_1RMSNorm1 × 131072 × 2048
23Attention_4Grouped Query Attn1 × 131072 × 2048
24Add_4_attnAdd1 × 131072 × 2048
25RMSNorm_4_2RMSNorm1 × 131072 × 2048
26FFN_4SwiGLU1 × 131072 × 2048
27Add_4_ffnAdd1 × 131072 × 2048
28RMSNorm_5_1RMSNorm1 × 131072 × 2048
29Attention_5Grouped Query Attn1 × 131072 × 2048
30Add_5_attnAdd1 × 131072 × 2048
31RMSNorm_5_2RMSNorm1 × 131072 × 2048
32FFN_5SwiGLU1 × 131072 × 2048
33Add_5_ffnAdd1 × 131072 × 2048
34RMSNorm_6_1RMSNorm1 × 131072 × 2048
35Attention_6Grouped Query Attn1 × 131072 × 2048
36Add_6_attnAdd1 × 131072 × 2048
37RMSNorm_6_2RMSNorm1 × 131072 × 2048
38FFN_6SwiGLU1 × 131072 × 2048
39Add_6_ffnAdd1 × 131072 × 2048
40RMSNorm_7_1RMSNorm1 × 131072 × 2048
41Attention_7Grouped Query Attn1 × 131072 × 2048
42Add_7_attnAdd1 × 131072 × 2048
43RMSNorm_7_2RMSNorm1 × 131072 × 2048
44FFN_7SwiGLU1 × 131072 × 2048
45Add_7_ffnAdd1 × 131072 × 2048
46RMSNorm_8_1RMSNorm1 × 131072 × 2048
47Attention_8Grouped Query Attn1 × 131072 × 2048
48Add_8_attnAdd1 × 131072 × 2048
49RMSNorm_8_2RMSNorm1 × 131072 × 2048
50FFN_8SwiGLU1 × 131072 × 2048
51Add_8_ffnAdd1 × 131072 × 2048
52RMSNorm_9_1RMSNorm1 × 131072 × 2048
53Attention_9Grouped Query Attn1 × 131072 × 2048
54Add_9_attnAdd1 × 131072 × 2048
55RMSNorm_9_2RMSNorm1 × 131072 × 2048
56FFN_9SwiGLU1 × 131072 × 2048
57Add_9_ffnAdd1 × 131072 × 2048
58RMSNorm_10_1RMSNorm1 × 131072 × 2048
59Attention_10Grouped Query Attn1 × 131072 × 2048
60Add_10_attnAdd1 × 131072 × 2048
61RMSNorm_10_2RMSNorm1 × 131072 × 2048
62FFN_10SwiGLU1 × 131072 × 2048
63Add_10_ffnAdd1 × 131072 × 2048
64RMSNorm_11_1RMSNorm1 × 131072 × 2048
65Attention_11Grouped Query Attn1 × 131072 × 2048
66Add_11_attnAdd1 × 131072 × 2048
67RMSNorm_11_2RMSNorm1 × 131072 × 2048
68FFN_11SwiGLU1 × 131072 × 2048
69Add_11_ffnAdd1 × 131072 × 2048
70RMSNorm_12_1RMSNorm1 × 131072 × 2048
71Attention_12Grouped Query Attn1 × 131072 × 2048
72Add_12_attnAdd1 × 131072 × 2048
73RMSNorm_12_2RMSNorm1 × 131072 × 2048
74FFN_12SwiGLU1 × 131072 × 2048
75Add_12_ffnAdd1 × 131072 × 2048
76RMSNorm_13_1RMSNorm1 × 131072 × 2048
77Attention_13Grouped Query Attn1 × 131072 × 2048
78Add_13_attnAdd1 × 131072 × 2048
79RMSNorm_13_2RMSNorm1 × 131072 × 2048
80FFN_13SwiGLU1 × 131072 × 2048
81Add_13_ffnAdd1 × 131072 × 2048
82RMSNorm_14_1RMSNorm1 × 131072 × 2048
83Attention_14Grouped Query Attn1 × 131072 × 2048
84Add_14_attnAdd1 × 131072 × 2048
85RMSNorm_14_2RMSNorm1 × 131072 × 2048
86FFN_14SwiGLU1 × 131072 × 2048
87Add_14_ffnAdd1 × 131072 × 2048
88RMSNorm_15_1RMSNorm1 × 131072 × 2048
89Attention_15Grouped Query Attn1 × 131072 × 2048
90Add_15_attnAdd1 × 131072 × 2048
91RMSNorm_15_2RMSNorm1 × 131072 × 2048
92FFN_15SwiGLU1 × 131072 × 2048
93Add_15_ffnAdd1 × 131072 × 2048
94RMSNorm_16_1RMSNorm1 × 131072 × 2048
95Attention_16Grouped Query Attn1 × 131072 × 2048
96Add_16_attnAdd1 × 131072 × 2048
97RMSNorm_16_2RMSNorm1 × 131072 × 2048
98FFN_16SwiGLU1 × 131072 × 2048
99Add_16_ffnAdd1 × 131072 × 2048
100OutputOutput1 × 131072 × 2048

What the verifier says

infoAt 16 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

What changed upstream

The change tracker follows hmellor/Ilama-3.2-1B: every revision it has read, what changed in the config, tokenizer, chat template or weights between them, and an OSV advisory per change.

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 hmellor/Ilama-3.2-1B --plan --share