Models / bert
jina-embeddings-v2-base-en: GPU memory to fine-tune
Fine-tuning jina-embeddings-v2-base-en at batch 1 and 2048 tokens takes about 2.85 GB of GPU memory for a full fine-tune (fits one T4 16 GB), and 0.93 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. 325K 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.
custom-code This repository ships its own modeling code (`auto_map`), 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).
Memory: what fits on which card
Largest batch per card. Training is sized at 2048 tokens per sample, serving at 4096 tokens per sequence.
| Card | Full fine-tune | LoRA r=16 | Serve bf16, 4096 tokens |
|---|---|---|---|
| T4 16 GB | batch 17 | batch 20 | batch 90 |
| L4 24 GB | batch 28 | batch 31 | batch 136 |
| A100 40 GB | batch 50 | batch 52 | batch 228 |
| A100 / H100 80 GB | batch 103 | batch 106 | batch 459 |
| H200 141 GB | batch 184 | batch 187 | batch 810 |
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
52 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.
| Layer | Type | Output shape | |
|---|---|---|---|
| 1 | Input | Input | 1 × 8192 |
| 2 | Embedding | Embedding | 1 × 8192 × 768 |
| 3 | Positional_Embedding | Learned Pos Embed | 1 × 8192 × 768 |
| 4 | Attention_1 | Multi-Head Attention | 1 × 8192 × 768 |
| 5 | Add_1 | Add | 1 × 8192 × 768 |
| 6 | LayerNorm_1_1 | LayerNorm | 1 × 8192 × 768 |
| 7 | FFN_1 | Feed Forward | 1 × 8192 × 768 |
| 8 | Attention_2 | Multi-Head Attention | 1 × 8192 × 768 |
| 9 | Add_2 | Add | 1 × 8192 × 768 |
| 10 | LayerNorm_2_1 | LayerNorm | 1 × 8192 × 768 |
| 11 | FFN_2 | Feed Forward | 1 × 8192 × 768 |
| 12 | Attention_3 | Multi-Head Attention | 1 × 8192 × 768 |
| 13 | Add_3 | Add | 1 × 8192 × 768 |
| 14 | LayerNorm_3_1 | LayerNorm | 1 × 8192 × 768 |
| 15 | FFN_3 | Feed Forward | 1 × 8192 × 768 |
| 16 | Attention_4 | Multi-Head Attention | 1 × 8192 × 768 |
| 17 | Add_4 | Add | 1 × 8192 × 768 |
| 18 | LayerNorm_4_1 | LayerNorm | 1 × 8192 × 768 |
| 19 | FFN_4 | Feed Forward | 1 × 8192 × 768 |
| 20 | Attention_5 | Multi-Head Attention | 1 × 8192 × 768 |
| 21 | Add_5 | Add | 1 × 8192 × 768 |
| 22 | LayerNorm_5_1 | LayerNorm | 1 × 8192 × 768 |
| 23 | FFN_5 | Feed Forward | 1 × 8192 × 768 |
| 24 | Attention_6 | Multi-Head Attention | 1 × 8192 × 768 |
| 25 | Add_6 | Add | 1 × 8192 × 768 |
| 26 | LayerNorm_6_1 | LayerNorm | 1 × 8192 × 768 |
| 27 | FFN_6 | Feed Forward | 1 × 8192 × 768 |
| 28 | Attention_7 | Multi-Head Attention | 1 × 8192 × 768 |
| 29 | Add_7 | Add | 1 × 8192 × 768 |
| 30 | LayerNorm_7_1 | LayerNorm | 1 × 8192 × 768 |
| 31 | FFN_7 | Feed Forward | 1 × 8192 × 768 |
| 32 | Attention_8 | Multi-Head Attention | 1 × 8192 × 768 |
| 33 | Add_8 | Add | 1 × 8192 × 768 |
| 34 | LayerNorm_8_1 | LayerNorm | 1 × 8192 × 768 |
| 35 | FFN_8 | Feed Forward | 1 × 8192 × 768 |
| 36 | Attention_9 | Multi-Head Attention | 1 × 8192 × 768 |
| 37 | Add_9 | Add | 1 × 8192 × 768 |
| 38 | LayerNorm_9_1 | LayerNorm | 1 × 8192 × 768 |
| 39 | FFN_9 | Feed Forward | 1 × 8192 × 768 |
| 40 | Attention_10 | Multi-Head Attention | 1 × 8192 × 768 |
| 41 | Add_10 | Add | 1 × 8192 × 768 |
| 42 | LayerNorm_10_1 | LayerNorm | 1 × 8192 × 768 |
| 43 | FFN_10 | Feed Forward | 1 × 8192 × 768 |
| 44 | Attention_11 | Multi-Head Attention | 1 × 8192 × 768 |
| 45 | Add_11 | Add | 1 × 8192 × 768 |
| 46 | LayerNorm_11_1 | LayerNorm | 1 × 8192 × 768 |
| 47 | FFN_11 | Feed Forward | 1 × 8192 × 768 |
| 48 | Attention_12 | Multi-Head Attention | 1 × 8192 × 768 |
| 49 | Add_12 | Add | 1 × 8192 × 768 |
| 50 | LayerNorm_12_1 | LayerNorm | 1 × 8192 × 768 |
| 51 | FFN_12 | Feed Forward | 1 × 8192 × 768 |
| 52 | Output | Output | 1 × 8192 × 768 |
What the verifier says
deep-attention-default-init
What changed upstream
The change tracker follows jinaai/jina-embeddings-v2-base-en: 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 jinaai/jina-embeddings-v2-base-en --plan --share