KV-Cache: Speicher für den Kontext eines lokalen LLM
Der KV-Cache wächst linear mit der Kontextlänge. Bei GQA gilt: 2 × Schichten × KV-Heads × Head-Dim × gecachte Tokens × Sequenzen × Bytes pro Element. FP16 sind 2 Bytes pro Element.
KV-Cache: Speicher für den Kontext eines lokalen LLM
2 × 28 × 4 × 128 × 8192 × 1 × 2
KV-Cache (Rohdaten)
0,4375 GiB
469.762.048 bytes
- Attention-Typ: gqa. Unterstützung: full. GQA-Formel gilt.
- 28 Query-Heads, 4 KV-Heads. Mit Query-Heads wären es 3,06 GiB.
- Kontexttyp: native. Natives Fenster: 32.768. Kein erweitertes Kontextfenster dokumentiert.
- Das Ergebnis ist eine Schätzung, keine Messung.
Geometrie
Geschätzter Bedarf
| Modell | Geometrie | 8,192 FP16 | 32,768 FP16 |
|---|---|---|---|
| Qwen2.5-7B-Instruct | 28 × 4 × 128 | 469.762.048 (0,4375 GiB) | 1.879.048.192 (1,7500 GiB) |
| Qwen2.5-14B-Instruct | 48 × 8 × 128 | 1.610.612.736 (1,5000 GiB) | 6.442.450.944 (6,00 GiB) |
| Qwen2.5-32B-Instruct | 64 × 8 × 128 | 2.147.483.648 (2,00 GiB) | 8.589.934.592 (8,00 GiB) |
| Qwen3-8B | 36 × 8 × 128 | 1.207.959.552 (1,1250 GiB) | 4.831.838.208 (4,5000 GiB) |