VRAM¶
VRAM (Video RAM) ist der Speicher auf einer GPU. Für KI ist VRAM oft der limitierende Faktor – das Modell muss komplett hineinpassen.
Warum ist VRAM so wichtig?¶
Modell (7B, FP16): ~14 GB
+ KV-Cache (4K): ~1 GB
+ Aktivierungen: ~1 GB
+ Overhead: ~2 GB
─────────────────────────────
Gesamt: ~18 GB
Wenn das nicht in den VRAM passt → Out of Memory Error.
VRAM-Bedarf berechnen¶
Für Inferenz (FP16): $$ \text{VRAM} \approx \text{Parameter} \times 2 \text{ Bytes} + \text{KV-Cache} + \text{Overhead} $$
Für Training (FP16): $$ \text{VRAM} \approx \text{Parameter} \times 16-20 \text{ Bytes} $$ (Gradienten, Optimizer States, Aktivierungen)
Consumer GPUs¶
| GPU | VRAM | Modellgröße (Q4) |
|---|---|---|
| RTX 3060 | 12 GB | ~13B |
| RTX 4070 Ti Super | 16 GB | ~20B |
| RTX 4090 | 24 GB | ~35B |
| RTX 5090 | 32 GB | ~50B |
VRAM sparen¶
- Quantisierung: FP16 → INT4 = 4× weniger
- Offloading: Teil auf CPU-RAM auslagern (langsam!)
- Gradient Checkpointing: Für Training
- Kleinere Batch-Size
Siehe auch¶
- GPU – Die Hardware
- Quantisierung – VRAM reduzieren
- KV-Cache – Ein großer VRAM-Verbraucher