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.

LLM RAM and VRAM planning layers: model weight memory determined by quantization, runtime overhead and context reserve for attention and concurrency
Memory planning components. Actual peak RAM and VRAM vary by model artifact, runtime, context and concurrency; this is not benchmark data.

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:

  1. Parametric estimate: 14.66B parameters × bits per weight ÷ 8. Fast, but it ignores quantization overhead and everything the runtime allocates.
  2. 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).
  3. 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

Model16-bit weight floor8-bit floor4-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.

ArtifactQuantizationSizeEffective bits / weight
Ollama phi4 (14b)Q4_K_M9.1 GB~5.0
Hugging Face microsoft/phi-4BF16~29.3 GB16

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 useKV cache (f16)KV cache (q8_0)Artifact + f16 KV+20% headroom
4K (Ollama default below 24 GiB VRAM)0.84 GB0.42 GB9.9 GB11.9 GB
16K (Phi-4 maximum)3.36 GB1.68 GB12.5 GB15.0 GB
32K (Phi-4-reasoning maximum)6.71 GB3.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.

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

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