Phi-4 GPU requirements: 7.33 GB at 4-bit, 29.3 GB at BF16
Phi-4 needs 29.3 GB of GPU memory for its weights at BF16, 14.7 GB at FP8 and 7.33 GB at 4-bit, plus 3.36 GB of KV cache for a 16K context. The cheapest node that runs it here is 1× RTX A4000 at 4-bit, for $0.03 an hour on spot.
Weights plus a 16K 16-bit KV cache, with 10% of the node's memory kept free. Billed per minute.
- Parameters
- 14.7BDense
- Weights, 4-bit
- 7.33 GBBF16: 29.3 GB
- KV cache, 16K
- 3.36 GBOne sequence, 16-bit cache
- Context window
- 16KNative
How much VRAM Phi-4 needs, format by format.
Weights are parameters × bytes per parameter. Each context column adds the KV cache of one sequence of that length.
| Format | Weights | + 8Kcontext | Cheapest node, 16K |
|---|---|---|---|
| BF16Published weights, fine-tuning | 29.3 GB | 31.0 GB | 1× A40 · $0.06/h |
| FP8Hopper, Ada, Blackwell, MI300 | 14.7 GB | 16.3 GB | 1× L4 · $0.05/h |
| 4-bitAWQ, GPTQ, GGUF Q4 | 7.33 GB | 9.01 GB | 1× RTX A4000 · $0.03/h |
The serving engine adds its own buffers, and an 8-bit KV cache halves the context columns. We keep 10% of a node's memory free when we say a model fits. Speed is a separate question: it follows memory bandwidth and, for a mixture of experts, the active parameters.
GPUs that run Phi-4, cheapest first.
For each format, the smallest node of each GPU model that holds the weights and a 16K context, sorted by spot price. One row per GPU model; larger nodes of the same GPU work too.
| Format | GPU | GPU memory | Spot | On-demand | 730 h spot | Action |
|---|---|---|---|---|---|---|
| 4-bit | 1× RTX A4000Ampere · 10.7 GB needed | 16 GB | $0.03 | $0.05 | $21.90 | Deploy |
| 4-bit | 1× RTX 4070Ada Lovelace · 10.7 GB needed | 12 GB | $0.04 | $0.06 | $29.20 | Deploy |
| 4-bit | 1× RTX 3080 TiAmpere · 10.7 GB needed | 12 GB | $0.04 | $0.07 | $29.20 | Deploy |
| 4-bit | 1× T4Turing · 10.7 GB needed | 16 GB | $0.04 | $0.07 | $29.20 | Deploy |
| FP8 | 1× L4Ada Lovelace · 18.0 GB needed | 24 GB | $0.05 | $0.08 | $36.50 | Deploy |
| FP8 | 1× RTX 4090Ada Lovelace · 18.0 GB needed | 24 GB | $0.06 | $0.09 | $43.80 | Deploy |
| FP8 | 1× RTX PRO 4000 BlackwellBlackwell · 18.0 GB needed | 24 GB | $0.08 | $0.15 | $58.40 | Deploy |
| FP8 | 2× RTX 4070Ada Lovelace · 18.0 GB needed | 24 GB | $0.08 | $0.12 | $58.40 | Deploy |
| BF16 | 1× A40Ampere · 32.7 GB needed | 48 GB | $0.06 | $0.09 | $43.80 | Deploy |
| BF16 | 1× A100 40GBAmpere · 32.7 GB needed | 40 GB | $0.09 | $0.17 | $65.70 | Deploy |
| BF16 | 1× L40Ada Lovelace · 32.7 GB needed | 48 GB | $0.09 | $0.19 | $65.70 | Deploy |
| BF16 | 1× RTX 6000 AdaAda Lovelace · 32.7 GB needed | 48 GB | $0.09 | $0.19 | $65.70 | Deploy |
Spot capacity can be reclaimed with a 2-minute notice; for a live endpoint, use on-demand. How spot works · serving a language model.
What a long context costs in memory.
Grouped-query attention, 10 KV heads of 128 across 40 layers.
| Context | KV cache, 1 sequence | 8 sequences |
|---|---|---|
| 8K tokens | 1.68 GB | 13.4 GB |
Serving several users
KV cacheEvery concurrent request keeps its own cache, so memory for context grows with users × context length. A server batching 8 requests of 16K needs eight times the single-sequence figure — 26.8 GB here.
- Recommended node1× RTX A4000
- Weights at 4-bit7.33 GB
- Context that fits, 1 sequence16K
Paged attention (vLLM, SGLang) allocates the cache in blocks as requests grow, so a node holds more short requests than the worst case suggests.
Phi-4, as published.
- Developer
- MicrosoftSmall model trained for reasoning and maths
- Parameters
- 14.7B
- Architecture
- Dense model, 40 layersGrouped-query attention, 10 KV heads of 128 across 40 layers
- Context window
- 16,384 tokensAs set in the published configuration
- Published format
- BF16, 29.3 GB
- Licence
- MIT
- Released
- 12 December 2024
- Source
- microsoft/phi-4config.json read 26 October 2026
Serve it with vLLM
template: vLLMOn 1× RTX A4000, from the instance terminal:
$ vllm serve microsoft/phi-4 \ --tensor-parallel-size 1 \ --max-model-len 16384
Very recent architectures need a recent vLLM; the model card gives the minimum version and any extra flags.
Phi-4 on a GPU — the questions that come up
How much VRAM does Phi-4 need?
For the weights alone: 29.3 GB at BF16, 14.7 GB at FP8 and 7.33 GB at 4-bit. Add 3.36 GB of KV cache for one 16K-token context, and keep about 10% of the memory free for activations.
Can Phi-4 run on a single GPU?
One RTX 4090 (24 GB): yes, at FP8. One RTX 5090 (32 GB): yes, at FP8. One H100 SXM (80 GB): yes, at BF16. One H200 SXM (141 GB): yes, at BF16. One B200 SXM (180 GB): yes, at BF16. Those answers assume a 16K context and the widest format that still fits.
What is the cheapest way to run Phi-4?
Here, 1× RTX A4000 at 4-bit: $0.03 per hour on spot and $0.05 on-demand, billed per minute — $21.90 for a 730-hour month on spot. That node has 16 GB of GPU memory for the 10.7 GB this setup needs.
How long a context fits on the recommended node?
With the weights at 4-bit on 1× RTX A4000, the remaining memory holds a 16-bit KV cache for about 16,384 tokens of context for one sequence (16K). An 8-bit KV cache doubles that; serving several users at once divides it between them.
Which format should I run it in?
BF16 keeps the published weights untouched and is the format for fine-tuning. FP8 halves the memory and runs in hardware on Hopper, Ada, Blackwell and MI300-class GPUs. 4-bit quantisation (AWQ, GPTQ, GGUF) quarters it, at a quality cost that is larger on small models than on big ones; check it against your own evaluation before relying on it.
How do I deploy it?
Pick the node in the table above and launch it with the vLLM template; the model downloads from Hugging Face (microsoft/phi-4) on first start. Spread the weights over the node with --tensor-parallel-size equal to the GPU count, and set --max-model-len to the context you need. New architectures need a recent vLLM: check the model card for the minimum version.
Sizing another model? GPU requirements for 64 open models · serving a language model · fine-tuning.
Phi-4 on 1× RTX A4000 for $0.03 an hour.
Launch the node with the vLLM template, point it at microsoft/phi-4, stop it when you are done. Prepaid, billed by the minute.
Billed per minute from the moment the instance is reachable. Minimum credit $30, no subscription.