Models / bert
all-MiniLM-L6-v2: GPU memory to fine-tune
Fine-tuning all-MiniLM-L6-v2 at batch 1 and 512 tokens takes about 0.47 GB of GPU memory for a full fine-tune (fits one T4 16 GB), and 99 MB 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. 254M 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.
What it costs to run
Cost is a roofline estimate on the priced GPU for 10 epochs at batch 32, 512 tokens over 50,000 samples (assumed; no dataset attached).
Memory: what fits on which card
Largest batch per card. Training is sized at 512 tokens per sample, serving at 512 tokens per sequence.
| Card | Full fine-tune | LoRA r=16 | Serve bf16, 512 tokens |
|---|---|---|---|
| T4 16 GB | batch 324 | batch 334 | batch 2938 |
| L4 24 GB | batch 492 | batch 501 | batch 4413 |
| A100 40 GB | batch 828 | batch 837 | batch 7361 |
| A100 / H100 80 GB | batch 1666 | batch 1675 | batch 14733 |
| H200 141 GB | batch 2945 | batch 2954 | batch 25974 |
Training: 512 tokens per sample (2048, or the model's context when shorter), 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 512 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
28 nodes. Output shapes are propagated from the input shape, batch dimension excluded, at 512 tokens: the config's maximum context.
| Layer | Type | Output shape | |
|---|---|---|---|
| 1 | Input | Input | 1 × 512 |
| 2 | Embedding | Embedding | 1 × 512 × 384 |
| 3 | Positional_Embedding | Learned Pos Embed | 1 × 512 × 384 |
| 4 | Attention_1 | Multi-Head Attention | 1 × 512 × 384 |
| 5 | Add_1 | Add | 1 × 512 × 384 |
| 6 | LayerNorm_1_1 | LayerNorm | 1 × 512 × 384 |
| 7 | FFN_1 | Feed Forward | 1 × 512 × 384 |
| 8 | Attention_2 | Multi-Head Attention | 1 × 512 × 384 |
| 9 | Add_2 | Add | 1 × 512 × 384 |
| 10 | LayerNorm_2_1 | LayerNorm | 1 × 512 × 384 |
| 11 | FFN_2 | Feed Forward | 1 × 512 × 384 |
| 12 | Attention_3 | Multi-Head Attention | 1 × 512 × 384 |
| 13 | Add_3 | Add | 1 × 512 × 384 |
| 14 | LayerNorm_3_1 | LayerNorm | 1 × 512 × 384 |
| 15 | FFN_3 | Feed Forward | 1 × 512 × 384 |
| 16 | Attention_4 | Multi-Head Attention | 1 × 512 × 384 |
| 17 | Add_4 | Add | 1 × 512 × 384 |
| 18 | LayerNorm_4_1 | LayerNorm | 1 × 512 × 384 |
| 19 | FFN_4 | Feed Forward | 1 × 512 × 384 |
| 20 | Attention_5 | Multi-Head Attention | 1 × 512 × 384 |
| 21 | Add_5 | Add | 1 × 512 × 384 |
| 22 | LayerNorm_5_1 | LayerNorm | 1 × 512 × 384 |
| 23 | FFN_5 | Feed Forward | 1 × 512 × 384 |
| 24 | Attention_6 | Multi-Head Attention | 1 × 512 × 384 |
| 25 | Add_6 | Add | 1 × 512 × 384 |
| 26 | LayerNorm_6_1 | LayerNorm | 1 × 512 × 384 |
| 27 | FFN_6 | Feed Forward | 1 × 512 × 384 |
| 28 | Output | Output | 1 × 512 × 384 |
What the verifier says
No finding on the reconstructed graph. See the checks.
What changed upstream
The change tracker follows sentence-transformers/all-MiniLM-L6-v2: 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 sentence-transformers/all-MiniLM-L6-v2 --plan --share