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

Models / qwen2

tiny-Qwen2ForCausalLM-2.5: GPU memory to fine-tune

Fine-tuning tiny-Qwen2ForCausalLM-2.5 at batch 1 and 2048 tokens takes about 1.96 GB of GPU memory for a full fine-tune (fits one T4 16 GB), and 1.92 GB with LoRA r=16 on a bf16 base (fits one T4 16 GB). Estimated from the model's structure, not measured. What fits on which card.

Reconstructed from its own config.json with no weights read. 17.9M 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
2.6M
2,587,048 parameters
In the published checkpoint
2.4M
2,435,016 scalars · safetensors.total, read 2026-09-08
Delta
+6.24%

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
16
Will it forward-pass
Yes
Priced on
A10G (24GB)
Est. one run
$0.14

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
1.96 GB
LoRA r=16, batch 1 at 2048 tokens
1.92 GB
Serve: bf16 weights
5.2 MB
Serve: KV cache, 4096 tokens
0.1 MB
CardFull fine-tuneLoRA r=16Serve bf16, 4096 tokens
T4 16 GBbatch 7batch 7batch 106108
L4 24 GBbatch 10batch 10batch 159182
A100 40 GBbatch 18batch 18batch 265330
A100 / H100 80 GBbatch 36batch 36batch 530701
H200 141 GBbatch 64batch 64batch 935390

Training: 2048 tokens per sample (2048, or the model's context when shorter; the structure table is at the config's maximum, 32768), 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. 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

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

LayerTypeOutput shape
1InputInput1 × 32768
2EmbeddingEmbedding1 × 32768 × 8
3RoPERoPE1 × 32768 × 8
4RMSNorm_1_1RMSNorm1 × 32768 × 8
5Attention_1Grouped Query Attn1 × 32768 × 8
6Add_1_attnAdd1 × 32768 × 8
7RMSNorm_1_2RMSNorm1 × 32768 × 8
8FFN_1SwiGLU1 × 32768 × 8
9Add_1_ffnAdd1 × 32768 × 8
10RMSNorm_2_1RMSNorm1 × 32768 × 8
11Attention_2Grouped Query Attn1 × 32768 × 8
12Add_2_attnAdd1 × 32768 × 8
13RMSNorm_2_2RMSNorm1 × 32768 × 8
14FFN_2SwiGLU1 × 32768 × 8
15Add_2_ffnAdd1 × 32768 × 8
16Final_RMSNormRMSNorm1 × 32768 × 8
17LM_HeadLinear1 × 32768 × 152064
18OutputOutput1 × 32768 × 152064

What the verifier says

No finding on the reconstructed graph. See the checks.

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 trl-internal-testing/tiny-Qwen2ForCausalLM-2.5 --plan --share

Other qwen2 checkpoints

gte-Qwen2-1.5B-instruct
1.78B derived · +0.01% against the checkpoint
gte-Qwen2-7B-instruct
7.61B derived · +0.00% against the checkpoint
Qwen2.5-0.5B-Instruct
494M derived · -0.01% against the checkpoint
Qwen2.5-1.5B-Instruct
1.54B derived · -0.00% against the checkpoint