Phi-4 · Q4_K_M · Dense · GGUF v3

Microsoft Phi-4 14B (Q4_K_M) — Exact VRAM, KV Cache & Tensor X-Ray

14B dense model focused on STEM, logic and code synthesis, running briskly on 12 GB and 16 GB GPUs.

⚡ Simulate on Your GPU in Browser (WASM) Benchmark & Sign Ed25519 in Local Cockpit 0.4.0 View File on HuggingFace
Min VRAM (8k · FP16 KV)10.74 GiB32k w/ Q8_0 KV: 12.70 GiB
Binary .GGUF Weights8.43 GiB4.94 effective bits/weight
Parameters (Active / Total)14.66 / 14.66 B243 parsed tensors
KV Cache Growth200.0 MiB/1kQ8_0 KV: 106.2 MiB / 1k tok

1. HuggingFace Binary Provenance

Repositorybartowski/phi-4-GGUF
Inspected Filephi-4-Q4_K_M.gguf (8.43 GiB)
HF Commit SHA19cd65f97c2f
Harvested UTC2026-11-29 15:28:26 UTC
Parsed Header3 555 756 bytes (SHA-256 aff66e668e50b490a793…)

2. Transformer & GQA Architecture

GGUF Architecturephi3 (Dense)
Transformer Layers40 layers (~198.8 MiB / layer)
Dimensions (d_model / FFN)5120 / 17920
Attention Heads (Q / KV)40 Q / 10 KV (GQA 4.0:1, dim 128)
Native Context & Vocab16 384 tokens · vocab 100 352

3. Exact GGML Quantization Mix Inside This Binary

Rather than quantizing every tensor identically, Q4_K_M keeps sensitive embedding, output and attention tensors at higher precision:

GGML TypeTensor CountVolumeWeight ShareDistribution
Q4_K1015.62 GiB66.7%
Q6_K211.79 GiB21.3%
Q5_K401.01 GiB11.9%
F32810.00 GiB0.0%

4. KV-Cache Context Cliff from 2k to 128k Tokens (FP16 vs Q8_0 vs Q4_0)

Enabling Flash Attention with a Q8_0 KV cache cuts context memory nearly in half without altering model weights:

Context Length KV Only (FP16) KV Only (Q8_0) KV Only (Q4_0) Total VRAM (FP16) Total VRAM (Q8_0)
2k (2 048)0.39 GiB0.21 GiB0.11 GiB9.57 GiB9.39 GiB
4k (4 096)0.78 GiB0.42 GiB0.22 GiB9.96 GiB9.60 GiB
8k (8 192)1.56 GiB0.83 GiB0.44 GiB10.74 GiB10.01 GiB
16k (16 384)3.13 GiB1.66 GiB0.88 GiB12.31 GiB10.84 GiB
32k (32 768)6.25 GiB3.32 GiB1.76 GiB15.43 GiB12.50 GiB
64k (65 536)12.50 GiB6.64 GiB3.52 GiB21.68 GiB15.82 GiB
128k (131 072)25.00 GiB13.28 GiB7.03 GiB34.18 GiB22.46 GiB

5. Layer-by-Layer GPU Offload Matrix Across Hardware Tiers

Deterministic memory placement including OS display VRAM reserve and compute buffers:

Hardware Tier Context & KV Layers in VRAM VRAM Used RAM Spillover Memory Verdict
8 GB GPU + 16 GB RAM8k · KV FP1627 / 407.19 GiB3.06 GiBRAM Spillover
8 GB GPU + 16 GB RAM32k · KV FP1617 / 407.16 GiB8.05 GiBRAM Spillover
8 GB GPU + 16 GB RAM32k · KV Q8_022 / 407.27 GiB5.01 GiBRAM Spillover
12 GB GPU + 32 GB RAM8k · KV FP1640 / 4010.26 GiB—100% VRAM
12 GB GPU + 32 GB RAM32k · KV FP1628 / 4010.96 GiB4.25 GiBRAM Spillover
12 GB GPU + 32 GB RAM32k · KV Q8_036 / 4011.13 GiB1.15 GiBRAM Spillover
16 GB GPU + 32 GB RAM8k · KV FP1640 / 4010.26 GiB—100% VRAM
16 GB GPU + 32 GB RAM32k · KV FP1639 / 4014.85 GiB0.36 GiBRAM Spillover
16 GB GPU + 32 GB RAM32k · KV Q8_040 / 4012.28 GiB—100% VRAM
24 GB GPU + 64 GB RAM8k · KV FP1640 / 4010.26 GiB—100% VRAM
24 GB GPU + 64 GB RAM32k · KV FP1640 / 4015.21 GiB—100% VRAM
24 GB GPU + 64 GB RAM32k · KV Q8_040 / 4012.28 GiB—100% VRAM
32 GB GPU + 64 GB RAM8k · KV FP1640 / 4010.26 GiB—100% VRAM
32 GB GPU + 64 GB RAM32k · KV FP1640 / 4015.21 GiB—100% VRAM
32 GB GPU + 64 GB RAM32k · KV Q8_040 / 4012.28 GiB—100% VRAM
48 GB Dual-GPU + 128 GB RAM8k · KV FP1640 / 4010.26 GiB—100% VRAM
48 GB Dual-GPU + 128 GB RAM32k · KV FP1640 / 4015.21 GiB—100% VRAM
48 GB Dual-GPU + 128 GB RAM32k · KV Q8_040 / 4012.28 GiB—100% VRAM
64 GB Unified Memory8k · KV FP1640 / 4010.26 GiB—Unified Memory
64 GB Unified Memory32k · KV FP1640 / 4015.21 GiB—Unified Memory
64 GB Unified Memory32k · KV Q8_040 / 4012.28 GiB—Unified Memory

6. Ready-to-Run Local CLI Commands

With Ollama:
ollama run phi4:14b
With llama-server (Flash Attention + Q8_0 KV Cache sized for 16 GB VRAM):
llama-server -m phi-4-Q4_K_M.gguf -ngl 40 -c 32768 -fa --cache-type-k q8_0 --cache-type-v q8_0

7. Ed25519 Certified Real Hardware Benchmarks

No certified Ed25519 passport recorded for this exact quantization yet (zero synthetic tok/s are ever invented). Run this model in Local Cockpit 0.4.0 to publish the first signed /b/lc-… passport!

8. Related Quantizations & Comparable Models