Phi-4 infrastructure
Phi-4 Hardware Requirements: RAM and VRAM for the 14B Model
Phi-4 is a single dense 14.7B-parameter model with a 16K context window, which makes it unusually easy to size: there is one weight footprint, one attention layout and a hard ceiling on context. This page works through the same three layers AIG uses for every model — parametric estimate → actual artifact fit → workload planning — using Phi-4's published configuration.

Phi-4 hardware requirements: quick answer
At 4-bit, Phi-4's weights alone need about 7.3 GB. The file you actually download from Ollama (Q4_K_M) is 9.1 GB. Add the KV cache — about 0.8 GB at 4K context (Ollama's default below 24 GiB of VRAM), or 3.4 GB at the full 16K — and Phi-4 occupies roughly 10–12.5 GB once loaded. Plan for a 16 GB GPU or a 24 GB unified-memory Mac. A 12 GB GPU works only at short context with little headroom.
Sizing framework: three layers
Each layer adds information the previous one does not have:
- Parametric estimate: 14.66B parameters × bits per weight ÷ 8. Fast, but it ignores quantization overhead and everything the runtime allocates.
- Actual model artifact fit: the size of the exact GGUF, safetensors or other file you will load. For Phi-4 this is about 24% larger than the 4-bit floor (see Layer 2).
- Conservative workload planning: artifact + KV cache for your context length + runtime overhead + OS reserve + one KV cache per concurrent request. This is the number that decides whether the hardware works.
Layer 1: Parametric weight estimates
| Model | 16-bit weight floor | 8-bit floor | 4-bit floor |
|---|---|---|---|
Phi-4 14.66B parameters | ~29.3 GB | ~14.7 GB | ~7.3 GB |
Phi-4-reasoning 14.66B parameters · same weights footprint, 32K context | ~29.3 GB | ~14.7 GB | ~7.3 GB |
Phi-4-mini-instruct 3.84B parameters · a different, smaller model | ~7.7 GB | ~3.8 GB | ~1.9 GB |
CALCULATED. Parameter count × bit width ÷ 8, using the counts reported by each model's Hugging Face repository. Real quantized files are larger — see Layer 2.
Run Layer 1 for your own Phi-4 configuration
Starts on Phi-4's 14.66B parameters at 4-bit — the 7.3 GB floor in the table above. Change the precision, or raise the context reserve to the KV-cache figure from Layer 3 for the context length you plan to use.
Why context reserve is manual: exact attention-cache memory cannot be inferred safely from parameter count alone. For a real deployment, measure the specific model and runtime at the context length and batch size you intend to use.
Your next step
This planning estimate is within a base Mac mini's advertised memory tier, but real quantized files, cache and macOS usage may still prevent the model from fitting. Check the exact configuration.
Check this against a Mac mini configuration →Open the full RAM and VRAM calculator → for the method, the caveats, and how it differs from the artifact-based compatibility checker.
Layer 2: Actual model artifact sizes
Ollama's default phi4 tag is a Q4_K_M quantization at 9.1 GB. That works out to about 5 bits per weight rather than 4: K-quant formats store per-block scales, and keep some tensors at higher precision. The BF16 safetensors in Microsoft's repository are about 29.3 GB, matching the 16-bit floor.
| Artifact | Quantization | Size | Effective bits / weight |
|---|---|---|---|
Ollama phi4 (14b) | Q4_K_M | 9.1 GB | ~5.0 |
Hugging Face microsoft/phi-4 | BF16 | ~29.3 GB | 16 |
DOCUMENTED (sizes) and CALCULATED (bits per weight = size × 8 ÷ parameter count). Ollama lists other quantizations of Phi-4 on its tags page; check the exact tag you will pull.
Check the 9.1 GB Phi-4 artifact on my hardware →Layer 3: Workload planning — what adds to the artifact
Phi-4 has 40 layers and uses grouped-query attention with 10 key/value heads of dimension 128. At the default 16-bit cache precision, every token in context therefore costs 2 (K and V) × 40 × 10 × 128 × 2 bytes = 200 KiB of KV cache. Because Phi-4 is a standard dense transformer, this per-token figure is reliable; hybrid-attention models are harder to estimate.
| Context in use | KV cache (f16) | KV cache (q8_0) | Artifact + f16 KV | +20% headroom |
|---|---|---|---|---|
| 4K (Ollama default below 24 GiB VRAM) | 0.84 GB | 0.42 GB | 9.9 GB | 11.9 GB |
| 16K (Phi-4 maximum) | 3.36 GB | 1.68 GB | 12.5 GB | 15.0 GB |
| 32K (Phi-4-reasoning maximum) | 6.71 GB | 3.36 GB | ~15.8 GB* | ~19.0 GB* |
CALCULATED from config.json. *Assumes a Phi-4-reasoning artifact the same size as Phi-4's 9.1 GB Q4_K_M, since the two share an architecture and parameter count; check the actual file. Runtime allocations beyond the KV cache are covered by the headroom column, not modelled separately.
- Plan from the effective context: Ollama's context-length documentation gives hardware-tier defaults: 4K below 24 GiB, 32K from 24 to 48 GiB, and 256K at 48 GiB and above (its FAQ still says 4,096). Ollama caps the requested context at the model's supported limit, so Phi-4 is capped at 16K even when the hardware tier selects 32K or 256K. You can set
OLLAMA_CONTEXT_LENGTHornum_ctxexplicitly for your workload; check the effective context and GPU offload withollama psand size for that context. The documentation does not say how Apple-silicon unified memory is counted, so verify the effective context on a Mac too. - Concurrency: each parallel slot gets its own cache. Ollama documents that memory scales with
OLLAMA_NUM_PARALLEL × OLLAMA_CONTEXT_LENGTH, so four parallel 16K requests add about 13.4 GB of f16 cache on top of the weights. - KV cache quantization: setting
OLLAMA_KV_CACHE_TYPE=q8_0roughly halves cache memory (the q8_0 column). Ollama requires Flash Attention for quantized cache and applies the setting to every loaded model. - Reasoning output is context too: Phi-4-reasoning writes long chains of thought before answering, and those tokens fill the cache like prompt tokens do. Size it from its 32K window, not Phi-4's 16K.
- OS and application reserve: on Apple silicon the OS, apps and model share one memory pool, so a 16 GB Mac cannot give Phi-4 anything close to 16 GB.
Can Phi-4 run on a 12 GB or 16 GB GPU?
16 GB: yes, at 4-bit. The full 16K context needs about 12.5 GB loaded, leaving roughly 3.5 GB for runtime buffers and the display. 12 GB: only at short context. At the 4K context Ollama defaults to on cards under 24 GiB, Phi-4 needs about 9.9 GB, which fits but leaves about 2 GB of headroom; raising the context or running parallel requests will push layers onto the CPU. 8 GB: not at 4-bit — the 9.1 GB artifact alone exceeds it, so you would need a 3-bit quantization or partial CPU offload. 24 GB: comfortable for the full context, or for 8-bit weights (~14.7 GB floor) at short context. Ollama caps this hardware tier's 32K default at Phi-4's 16K limit; set num_ctx lower if you want more memory headroom.
How much RAM does Phi-4 need on a Mac?
On Apple silicon the model, cache, macOS and your other applications all draw on unified memory. With a 10–12.5 GB loaded footprint, a 16 GB Mac is tight once a browser and editor are open; 24 GB is the practical starting point and 32 GB leaves room for other work. Compare configurations in the best Mac for local LLMs guide.
Can Phi-4 run without a GPU?
Yes. Ollama and llama.cpp run Phi-4 on the CPU with system RAM, using the same memory figures as above: 16 GB of RAM is the minimum and 32 GB is realistic alongside the OS. Expect it to be much slower than GPU or Apple-silicon inference. Token generation on the CPU is limited mainly by memory bandwidth, and every generated token reads all ~9 GB of weights. See the local AI RAM requirements guide for CPU-only sizing.
Phi-4 vs Phi-4-mini: which do you need?
They are separate models, not quantizations of one another. Phi-4-mini-instruct has 3.84B parameters and a 128K context window, so its 4-bit weights need about 1.9 GB. That puts it within reach of 8 GB machines, but long contexts will cost more cache than the weights do. Choose the 14B Phi-4 when answer quality matters and you have 16 GB or more to spare; choose Phi-4-mini when memory is the constraint.
Sources
- Microsoft Phi-4 model card— 14B dense decoder-only architecture, 16K context, MIT license, 14,659,507,200 parameters
- Phi-4 config.json— 40 layers, 40 attention heads, 10 key/value heads, hidden size 5120 — used for the KV-cache figures
- Microsoft Phi-4-reasoning model card— Same parameter count as Phi-4; 32K maximum context
- Microsoft Phi-4-mini-instruct model card— 3.84B parameters; 128K context
- Ollama — Phi-4— 9.1 GB Q4_K_M default artifact and 16K context listing, checked October 24, 2026
- Ollama FAQ — context, concurrency and K/V cache— Memory scaling with parallel slots and q8_0 K/V cache; still states a 4,096-token default
- Ollama — Context length— VRAM-based default context: 4K below 24 GiB, 32K at 24–48 GiB, 256K at 48 GiB and above
- Ollama v0.40.10 — model context limit— Caps requested context at the model's training context before starting the runner
Agent Infrastructure Recommendation Kit
Sizing hardware for a Phi-4 deployment?
The Agent Infrastructure Recommendation Kit carries these memory numbers into a documented local-vs-cloud decision — artifact fit, context and concurrency reserves, and the verification steps to run before you buy.
Get the Recommendation Kit — $19