phi-4 VRAM & Memory Requirements
Specific checkpoints with sourced architecture and weight files. GGUF Q4_K_M (Unsloth): 9.97 GiB–10.62 GiB at 8,192 tokens, 1 sequence, FP16 KV, llama.cpp.
This result is an estimate, not a measured trace.Not verifiedFile-backed weights
Runs on
Publisher and provenance
- PublisherMicrosoft
- Hugging Face
microsoft/phi-4 - Revision
2db69c1c3e91a05d2c64a3185acfbaf36f744e25 - Total parameters14,659,507,200
- Layers40
- Query heads40
- KV heads10 (gqa)
- Head dimension128
- Recorded context capability16,384
- Completenesscomplete · full
Memory layers in this estimate
Artifact bytes, raw KV, engine extras, and total demand are separate. This is not a runtime trace.
- Weight artifact
- 8.28 GiB (8,890,306,112 bytes)
- Raw KV cache
- 1.56 GiB (1,677,721,600 bytes)
- Engine extras / workspace
- 0.13 GiB–0.77 GiB
- Total estimated demand
- 9.97 GiB–10.62 GiB
Published artifacts
| Quantization | Selected files | Bytes | Engine | Evidence |
|---|---|---|---|---|
| BF16 safetensors bf16 | 29,319,014,400 (27.31 GiB / 29.32 GB) | vllm, sglang, unspecified | file-metadata | |
| GGUF Q6_K (Microsoft) gguf-q6_k | phi-4-Q6_K.gguf | 12,030,251,200 (11.20 GiB / 12.03 GB) | llama.cpp, ollama, unspecified | file-metadata |
| GGUF Q8_0 (Microsoft) gguf-q8_0 | phi-4-Q8_0.gguf | 15,580,500,160 (14.51 GiB / 15.58 GB) | llama.cpp, ollama, unspecified | file-metadata |
| GGUF Q4_K_M (Unsloth) gguf-q4_k_m | phi-4-Q4_K_M.gguf | 8,890,306,112 (8.28 GiB / 8.89 GB) | llama.cpp, ollama, unspecified | file-metadata |
| GGUF Q5_K_M (Unsloth) gguf-q5_k_m | phi-4-Q5_K_M.gguf | 10,412,707,392 (9.70 GiB / 10.41 GB) | llama.cpp, ollama, unspecified | file-metadata |
| INT4 theoretical | No published file | 7,329,753,600 (theoretical) | — | theoretical |
Memory by quantization and context
Concurrent sequences = 1. KV defaults to FP16. The range includes documented runtime extras for the listed engine. These figures use the same core as the interactive calculator.
| Quantization | 2,048 tokens | 8,192 tokens | 32,768 tokens |
|---|---|---|---|
| BF16 safetensors | 28.32 GiB–30.21 GiB | 29.49 GiB–31.41 GiB | 34.18 GiB–41.68 GiB |
| GGUF Q6_K (Microsoft) | 11.72 GiB–12.33 GiB | 12.89 GiB–13.60 GiB | 17.58 GiB–21.41 GiB |
| GGUF Q8_0 (Microsoft) | 15.03 GiB–15.70 GiB | 16.20 GiB–16.97 GiB | 20.89 GiB–25.29 GiB |
| GGUF Q4_K_M (Unsloth) | 8.80 GiB–9.34 GiB | 9.97 GiB–10.62 GiB | 14.65 GiB–17.98 GiB |
| GGUF Q5_K_M (Unsloth) | 10.21 GiB–10.79 GiB | 11.39 GiB–12.06 GiB | 16.07 GiB–19.64 GiB |
| INT4 theoretical Theoretical rows are not downloadable artifacts. | 7.34 GiB–9.83 GiB | 8.51 GiB–11.29 GiB | 13.20 GiB–17.06 GiB |
Raw KV contribution
Standard GQA/MHA raw KV is 2 × layers × kvHeads × headDim × tokens × sequences × bytes per element. This page uses KV heads (10), not query heads (40). Using query heads would overstate this cache by 4×.
- 8,192 tokens, 1 sequence, FP16: 1,677,721,600 bytes (1.5625 GiB)
- 32,768 tokens: 6,710,886,400 bytes (6.2500 GiB)
Related pages
Sources
- phi-4 model card
- config.json — revision 2db69c1c3e91a05d2c64a3185acfbaf36f744e25
- safetensors index — metadata.total_size=29319014400
- Artifact repo microsoft/phi-4-GGUF
- Artifact repo unsloth/phi-4-GGUF
Assumptions that affect this result
- Requested context is within the recorded native window of 16384 tokens.
- Full-resident weight estimates use total parameters, including inactive MoE experts.
- Weight bytes come from the selected weight files only, not from every file in the repository.
- Download file size is not peak GPU memory. Runtime layout, allocator padding, and KV are extra.
- Counted files: phi-4-Q4_K_M.gguf.
- Context budget is the number of cached tokens per sequence (prompt plus reserved generation).
- Concurrent sequences share one model replica; weights are not multiplied by sequence count.
- KV dtype is independent of weight quantization unless you change it.
Calculator
Loading catalog snapshot…
Search or pick a catalog checkpoint to see memory demand.
Search or pick a catalog checkpoint to see memory demand.