Free tools / LLM memory calculator / Phi-4 14B

Phi-4 14B VRAM and RAM requirements

Phi-4 14B needs about 11 GB of VRAM in Q4_K_M, the quantization Ollama downloads by default, at a 4K context, and about 13 GB at its full 16K context. The weights take about 8.9 GB and the rest is the context cache plus about 1 GB for the GPU runtime. On a CPU server without a GPU it needs about 11 GB of RAM at 4K.

Phi-4 14B is Microsoft's compact model under the MIT license, trained heavily on reasoning and math data.

Open Phi-4 14B in the calculator

Phi-4 14B memory by quantization and context

Memory Phi-4 14B needs for each quantization at 4K, 16K tokens of context. VRAM total adds about 1 GB for the GPU runtime, RAM total about 1.5 GB for the system and Ollama on a CPU server.

QuantizationContextWeightsKV cacheVRAM totalRAM total (CPU)
Q4_K_M4K8.9 GB0.8 GB11 GB11 GB
16K8.9 GB3.4 GB13 GB14 GB
Q5_K_M4K10 GB0.8 GB12 GB13 GB
16K10 GB3.4 GB15 GB15 GB
Q6_K4K12 GB0.8 GB14 GB14 GB
16K12 GB3.4 GB16 GB17 GB
Q8_04K16 GB0.8 GB17 GB18 GB
16K16 GB3.4 GB20 GB20 GB
FP164K29 GB0.8 GB31 GB32 GB
16K29 GB3.4 GB34 GB34 GB

Weights are the parameter count times the bits per weight of each quantization, the KV cache comes from the layer and attention head counts in the model config at FP16, as Ollama stores it by default. The sizes match Ollama downloads within a few percent.

GPUs that fit Phi-4 14B

In Q4_K_M at 4K, the cheapest GPU server that holds Phi-4 14B is the A16 (16 GB) at about $0.658 an hour, generating about 19 tokens per second. A 24 GB card such as the L4 or A10 holds it in Q4_K_M even at the full 16K context. Unquantized FP16 needs about 31 GB, which starts at the 2× A16 (32 GB).

Phi-4 14B setupVRAM neededCheapest GPU servers that fit
Q4_K_M at 4K11 GB
  • A16 16 GB, $0.658/hr, about 19 tok/s
  • RTX 4000 Ada 20 GB, $0.726/hr, about 34 tok/s
  • L4 24 GB, $1.16/hr, about 29 tok/s
Q4_K_M at 16K13 GB
  • A16 16 GB, $0.658/hr, about 19 tok/s
  • RTX 4000 Ada 20 GB, $0.726/hr, about 34 tok/s
  • L4 24 GB, $1.16/hr, about 29 tok/s
Q8_0 at 4K17 GB
  • RTX 4000 Ada 20 GB, $0.726/hr, about 20 tok/s
  • L4 24 GB, $1.16/hr, about 16 tok/s
  • A10 24 GB, $1.17/hr, about 27 tok/s
FP16 at 4K31 GB
  • 2× A16 32 GB, $1.32/hr, about 6 tok/s
  • 2× RTX 4000 Ada 40 GB, $1.47/hr, about 10 tok/s
  • L40S 48 GB, $2.16/hr, about 18 tok/s

Prices are for the cheapest city of each card, billed by the hour. Speed is generation with Ollama, estimated from memory bandwidth and our runs on the LLM speed benchmark. All cards are on the GPU servers page.

Running Phi-4 14B on a CPU server

Yes, a CPU-only server with 12 GB of RAM holds Phi-4 14B in Q4_K_M at 4K, since it needs about 11.2 GB. On 8 shared vCPU expect about 3 tokens per second, slower than reading speed, fine for short answers and batch jobs. At the full 16K context the RAM need grows to about 14 GB.

CPU serverRAMTokens/s in Q4_K_MPrice
8 shared vCPUHetzner16 GBabout 3$62/mo$0.085/hr
2 dedicated vCPUOVHcloud16 GBabout 2$83/mo$0.114/hr

Phi-4 14B in Ollama

ollama run phi4:14b downloads the Q4_K_M build. Every quantization in the table has its own tag, listed next to its row.

  • Q4_K_Mollama run phi4:14b
  • Q5_K_Mollama run phi4:14b-q5_K_M
  • Q6_Kollama run phi4:14b-q6_K
  • Q8_0ollama run phi4:14b-q8_0
  • FP16ollama run phi4:14b-fp16

What to know about Phi-4 14B

  • Phi-4 14B holds up to 16K tokens, so the table stops at 16K.
  • At 16K the context cache adds about 3.4 GB on top of about 8.9 GB of Q4_K_M weights.

Frequently asked questions

How much VRAM does Phi-4 14B need?

About 11 GB in Q4_K_M at a 4K context, about 17 GB in Q8_0 and about 31 GB in FP16. The cheapest GPU that holds it in Q4_K_M is the A16 (16 GB). A longer context adds more: about 13 GB in Q4_K_M at 16K.

Can Phi-4 14B run on a CPU without a GPU?

Yes, a CPU-only server with 12 GB of RAM holds Phi-4 14B in Q4_K_M at 4K, since it needs about 11.2 GB. On 8 shared vCPU expect about 3 tokens per second, slower than reading speed, fine for short answers and batch jobs. At the full 16K context the RAM need grows to about 14 GB.

How much memory does Phi-4 14B need for a 16K context?

About 13 GB of VRAM or 14 GB of RAM in Q4_K_M. The context cache alone takes about 3.4 GB at 16K tokens, next to about 8.9 GB of weights. Ollama uses a 4K context unless you raise num_ctx, so the cache stays small by default.

Similar models

Further reading

VRAM and RAM for other models

Another model, quantization or context? Use the LLM VRAM and RAM calculator