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

Models / modernbert

ModernBERT-base: GPU memory to fine-tune

Fine-tuning ModernBERT-base at batch 1 and 2048 tokens takes about 3.72 GB of GPU memory for a full fine-tune (fits one T4 16 GB), and 1.24 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. 4.8M 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
149M
149,081,088 parameters
In the published checkpoint
150M
149,655,232 scalars · safetensors.total, read 2025-01-15
Delta
-0.38%

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

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
3.72 GB
LoRA r=16, batch 1 at 2048 tokens
1.24 GB
Serve: bf16 weights
0.30 GB
Serve: KV cache, 4096 tokens
0.28 GB
CardFull fine-tuneLoRA r=16Serve bf16, 4096 tokens
T4 16 GBbatch 12batch 15batch 49
L4 24 GBbatch 20batch 23batch 74
A100 40 GBbatch 37batch 40batch 124
A100 / H100 80 GBbatch 77batch 80batch 250
H200 141 GBbatch 139batch 142batch 441

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

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

LayerTypeOutput shape
1InputInput1 × 8192
2EmbeddingEmbedding1 × 8192 × 768
3RoPERoPE1 × 8192 × 768
4Attention_1Multi-Head Attention1 × 8192 × 768
5Add_1Add1 × 8192 × 768
6LayerNorm_1_1LayerNorm1 × 8192 × 768
7FFN_1GeGLU1 × 8192 × 768
8Attention_2Multi-Head Attention1 × 8192 × 768
9Add_2Add1 × 8192 × 768
10LayerNorm_2_1LayerNorm1 × 8192 × 768
11FFN_2GeGLU1 × 8192 × 768
12Attention_3Multi-Head Attention1 × 8192 × 768
13Add_3Add1 × 8192 × 768
14LayerNorm_3_1LayerNorm1 × 8192 × 768
15FFN_3GeGLU1 × 8192 × 768
16Attention_4Multi-Head Attention1 × 8192 × 768
17Add_4Add1 × 8192 × 768
18LayerNorm_4_1LayerNorm1 × 8192 × 768
19FFN_4GeGLU1 × 8192 × 768
20Attention_5Multi-Head Attention1 × 8192 × 768
21Add_5Add1 × 8192 × 768
22LayerNorm_5_1LayerNorm1 × 8192 × 768
23FFN_5GeGLU1 × 8192 × 768
24Attention_6Multi-Head Attention1 × 8192 × 768
25Add_6Add1 × 8192 × 768
26LayerNorm_6_1LayerNorm1 × 8192 × 768
27FFN_6GeGLU1 × 8192 × 768
28Attention_7Multi-Head Attention1 × 8192 × 768
29Add_7Add1 × 8192 × 768
30LayerNorm_7_1LayerNorm1 × 8192 × 768
31FFN_7GeGLU1 × 8192 × 768
32Attention_8Multi-Head Attention1 × 8192 × 768
33Add_8Add1 × 8192 × 768
34LayerNorm_8_1LayerNorm1 × 8192 × 768
35FFN_8GeGLU1 × 8192 × 768
36Attention_9Multi-Head Attention1 × 8192 × 768
37Add_9Add1 × 8192 × 768
38LayerNorm_9_1LayerNorm1 × 8192 × 768
39FFN_9GeGLU1 × 8192 × 768
40Attention_10Multi-Head Attention1 × 8192 × 768
41Add_10Add1 × 8192 × 768
42LayerNorm_10_1LayerNorm1 × 8192 × 768
43FFN_10GeGLU1 × 8192 × 768
44Attention_11Multi-Head Attention1 × 8192 × 768
45Add_11Add1 × 8192 × 768
46LayerNorm_11_1LayerNorm1 × 8192 × 768
47FFN_11GeGLU1 × 8192 × 768
48Attention_12Multi-Head Attention1 × 8192 × 768
49Add_12Add1 × 8192 × 768
50LayerNorm_12_1LayerNorm1 × 8192 × 768
51FFN_12GeGLU1 × 8192 × 768
52Attention_13Multi-Head Attention1 × 8192 × 768
53Add_13Add1 × 8192 × 768
54LayerNorm_13_1LayerNorm1 × 8192 × 768
55FFN_13GeGLU1 × 8192 × 768
56Attention_14Multi-Head Attention1 × 8192 × 768
57Add_14Add1 × 8192 × 768
58LayerNorm_14_1LayerNorm1 × 8192 × 768
59FFN_14GeGLU1 × 8192 × 768
60Attention_15Multi-Head Attention1 × 8192 × 768
61Add_15Add1 × 8192 × 768
62LayerNorm_15_1LayerNorm1 × 8192 × 768
63FFN_15GeGLU1 × 8192 × 768
64Attention_16Multi-Head Attention1 × 8192 × 768
65Add_16Add1 × 8192 × 768
66LayerNorm_16_1LayerNorm1 × 8192 × 768
67FFN_16GeGLU1 × 8192 × 768
68Attention_17Multi-Head Attention1 × 8192 × 768
69Add_17Add1 × 8192 × 768
70LayerNorm_17_1LayerNorm1 × 8192 × 768
71FFN_17GeGLU1 × 8192 × 768
72Attention_18Multi-Head Attention1 × 8192 × 768
73Add_18Add1 × 8192 × 768
74LayerNorm_18_1LayerNorm1 × 8192 × 768
75FFN_18GeGLU1 × 8192 × 768
76Attention_19Multi-Head Attention1 × 8192 × 768
77Add_19Add1 × 8192 × 768
78LayerNorm_19_1LayerNorm1 × 8192 × 768
79FFN_19GeGLU1 × 8192 × 768
80Attention_20Multi-Head Attention1 × 8192 × 768
81Add_20Add1 × 8192 × 768
82LayerNorm_20_1LayerNorm1 × 8192 × 768
83FFN_20GeGLU1 × 8192 × 768
84Attention_21Multi-Head Attention1 × 8192 × 768
85Add_21Add1 × 8192 × 768
86LayerNorm_21_1LayerNorm1 × 8192 × 768
87FFN_21GeGLU1 × 8192 × 768
88Attention_22Multi-Head Attention1 × 8192 × 768
89Add_22Add1 × 8192 × 768
90LayerNorm_22_1LayerNorm1 × 8192 × 768
91FFN_22GeGLU1 × 8192 × 768
92OutputOutput1 × 8192 × 768

What the verifier says

infoAt 22 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 answerdotai/ModernBERT-base: 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 answerdotai/ModernBERT-base --plan --share

Other modernbert checkpoints

granite-embedding-small-english-r2
47.7M derived · +0.04% against the checkpoint
gte-reranker-modernbert-base
149M derived · -0.35% against the checkpoint