phi-2 GGUF size and VRAM requirements
TheBloke/phi-2-GGUF is a mid-size language model with 2.78 billion parameters, built on the phi2 architecture. It is released under the other license and has been downloaded 19,782 times.
Under the hood it uses 32 transformer layers, a hidden size of 2,560, 32 attention heads.
To run TheBloke/phi-2-GGUF locally at a 4,096-token context, its quantized versions need between 3.14 GB (Q2_K, lowest quality) and 4.8 GB (Q8_0, highest quality) of memory, weights plus KV cache and a system margin included.
For most users the best balance is Q8_0, needing about 4.8 GB. That means TheBloke/phi-2-GGUF fits entirely in the VRAM of a 6 GB GPU or larger, running fully on the GPU.
Available GGUF quantizations for TheBloke/phi-2-GGUF include Q2_K, Q3_K_S, Q3_K_M, Q4_0, Q3_K_L, Q4_K_S, Q4_K_M, Q5_0, Q5_K_S, Q5_K_M, Q6_K, Q8_0. The model supports a native context length of up to 2,048 tokens; a longer context grows the KV cache and the memory needed.
GGUF file size and memory by quantization
Compare real GGUF weight sizes, estimated KV cache and total memory for Q4, Q5, Q8 and every quantization published in this repository.
| Quant. | Bits | Quality | Weights | KV | Total | Speed~ | Verdict |
|---|---|---|---|---|---|---|---|
| Q2_K | 3.38 | Fair | 1.09 GB | 1.25 GB | 3.14 GB | 366.0 t/s | Fits in VRAM |
| Q3_K_S | 3.6 | Fair | 1.16 GB | 1.25 GB | 3.21 GB | 343.4 t/s | Fits in VRAM |
| Q3_K_M | 4.26 | Good | 1.38 GB | 1.25 GB | 3.43 GB | 290.2 t/s | Fits in VRAM |
| Q4_0 | 4.61 | Good | 1.49 GB | 1.25 GB | 3.54 GB | 268.0 t/s | Fits in VRAM |
| Q3_K_L | 4.62 | Good | 1.49 GB | 1.25 GB | 3.54 GB | 267.6 t/s | Fits in VRAM |
| Q4_K_S | 4.65 | Good | 1.5 GB | 1.25 GB | 3.55 GB | 265.8 t/s | Fits in VRAM |
| Q4_K_M | 5.15 | Very good | 1.67 GB | 1.25 GB | 3.72 GB | 240.0 t/s | Fits in VRAM |
| Q5_0 | 5.56 | Very good | 1.8 GB | 1.25 GB | 3.85 GB | 222.1 t/s | Fits in VRAM |
| Q5_K_S | 5.56 | Very good | 1.8 GB | 1.25 GB | 3.85 GB | 222.1 t/s | Fits in VRAM |
| Q5_K_M | 5.97 | Very good | 1.93 GB | 1.25 GB | 3.98 GB | 207.2 t/s | Fits in VRAM |
| Q6_K | 6.58 | Excellent | 2.13 GB | 1.25 GB | 4.18 GB | 188.0 t/s | Fits in VRAM |
| Q8_0 | 8.51 | Excellent | 2.75 GB | 1.25 GB | 4.8 GB | 145.2 t/s | Fits in VRAM |
KV cache computed from the model's exact architecture. Speed is a rough estimate bounded by memory bandwidth.
Frequently asked questions
What kind of model is TheBloke/phi-2-GGUF?
TheBloke/phi-2-GGUF is a language model with 2.78 billion parameters, based on the phi2 architecture. It is released under the other license and distributed as GGUF files for local inference.
How much VRAM do you need to run TheBloke/phi-2-GGUF?
You need about 4.8 GB of VRAM to run TheBloke/phi-2-GGUF entirely on the GPU using the Q8_0 quantization (at a 4,096-token context). Smaller quantizations lower the requirement at the cost of quality.
Can I run TheBloke/phi-2-GGUF on an 8 GB GPU?
Yes. With 8 GB of VRAM you can run TheBloke/phi-2-GGUF fully on the GPU using Q8_0 (about 4.8 GB).
Can I run TheBloke/phi-2-GGUF on a 16 GB GPU?
Yes. With 16 GB of VRAM you can run TheBloke/phi-2-GGUF fully on the GPU using Q8_0 (about 4.8 GB).
Can I run TheBloke/phi-2-GGUF on a 24 GB GPU?
Yes. With 24 GB of VRAM you can run TheBloke/phi-2-GGUF fully on the GPU using Q8_0 (about 4.8 GB).
What context length does TheBloke/phi-2-GGUF support?
TheBloke/phi-2-GGUF supports a native context length of up to 2,048 tokens. A longer context grows the KV cache, so it increases the memory needed to run the model.
What is the best quantization for TheBloke/phi-2-GGUF?
For TheBloke/phi-2-GGUF, a strong default is Q4_K_M, which needs about 3.72 GB and keeps most of the quality while roughly halving the memory versus 8-bit. With VRAM to spare, Q5_K_M or Q6_K add a little more quality; if you are tight on memory, a smaller quantization still runs. Pick the highest quantization that fits your VRAM.