microsoft · text

Phi-3-mini-4k-instruct

microsoft/Phi-3-mini-4k-instruct

Phi-3-mini-4k-instruct at Q4_K_M is exactly 2,393,231,456 bytes (2.23 GiB / 2.39 GB) — an effective 5.011 bits per weight, not the nominal 4. Its KV cache at 32K is 12.00 GiB.

From the file· summed from 1 file(s)From the file· KV per layer
Parameters
3.8B
Architecture
phi3
32 layers
Context
4,096
native (config.json)
License
mit

Shipped quantizations

exact bytes, summed from published files
QuantSizeExact bytesEffective bpwTensorsPublisher
IQ1_S0.78 GiB841,608,8961.762legraphista
IQ1_M0.85 GiB917,106,3681.920legraphista
IQ2_XXS0.97 GiB1,042,935,4882.183legraphista
IQ2_XS1.07 GiB1,153,035,8722.414bartowski
IQ2_XS1.07 GiB1,153,035,9682.414legraphista
IQ2_S1.13 GiB1,215,730,7842.545bartowski
IQ2_S1.13 GiB1,215,730,8802.545legraphista
IQ2_M1.23 GiB1,316,394,0802.756bartowski
IQ2_M1.23 GiB1,316,394,1762.756legraphista
IQ2_M1.23 GiB1,316,394,7202.756bartowski
Q2_K_S1.24 GiB1,327,336,6402.779legraphista
Q2_K1.32 GiB1,416,203,3602.965bartowski
Q2_K1.32 GiB1,416,203,4562.965legraphista
Q2_K1.32 GiB1,416,204,0002.965bartowski
Q2_K_L1.41 GiB1,512,396,0003.166bartowski
IQ3_XXS1.41 GiB1,513,002,0803.168bartowski
IQ3_XXS1.41 GiB1,513,002,1763.168legraphista
IQ3_XS1.51 GiB1,625,174,6243.402bartowski
IQ3_XS1.51 GiB1,625,174,7203.402legraphista
IQ3_XS1.51 GiB1,625,175,2643.402bartowski
Q3_K_S1.57 GiB1,681,797,7283.521bartowski
Q3_K_S1.57 GiB1,681,797,8243.521legraphista
IQ3_S1.57 GiB1,681,797,8243.521legraphista
Q3_K_S1.57 GiB1,681,798,3683.521bartowski
IQ3_M1.73 GiB1,855,599,2003.885bartowski
IQ3_M1.73 GiB1,855,599,2963.885legraphista
IQ3_M1.73 GiB1,855,599,8403.885lmstudio-community
IQ3_M1.73 GiB1,855,599,8403.885bartowski
Q3_K_M1.82 GiB1,955,476,0644.094bartowski
Q3_K1.82 GiB1,955,476,1604.094legraphista
Q3_K_M1.82 GiB1,955,476,7044.094bartowski
IQ4_XS1.92 GiB2,059,851,8724.313bartowski
IQ4_XS1.92 GiB2,059,851,9684.313legraphista
IQ4_XS1.92 GiB2,059,852,5124.313bartowski
IQ4_XS1.92 GiB2,059,852,5124.313lmstudio-community
Q3_K_L1.94 GiB2,087,596,6404.371bartowski
Q3_K_L1.94 GiB2,087,596,7364.371legraphista
Q3_K_L1.94 GiB2,087,597,2804.371lmstudio-community
Q3_K_L1.94 GiB2,087,597,2804.371bartowski
IQ4_NL2.03 GiB2,176,176,3204.556legraphista

KV cache by context

computed per layer
ContextKV cache (f16)Flat formulaOverstated byFull / windowed / recurrent
4,0961.50 GiB1.50 GiB32 / 0 / 0
8,1923.00 GiB3.00 GiB32 / 0 / 0
16,3846.00 GiB6.00 GiB32 / 0 / 0
32,76812.00 GiB12.00 GiB32 / 0 / 0
65,53624.00 GiB24.00 GiB32 / 0 / 0
131,07248.00 GiB48.00 GiB32 / 0 / 0

Compare with

same modality, comparable size

Will it run on your card?

full quant x context sweep

Why other calculators give a different number

A parameters × bits ÷ 8 estimate puts Q4_K_M at roughly 2.00 GiB. The real file is 2.23 GiB, because a quantization is a mixture and some tensors are always kept at higher precision.

Architecture

from config.json
Layers
32
Attention heads
32
KV heads
32
Head dim
96
Hidden size
3072
Vocab
32,064
Sliding window
2047
SWA period
1
MLA
no
Experts
Experts per token
use_sliding_window

Questions people ask

How much VRAM does Phi-3-mini-4k-instruct need?
Q4_K_M is exactly 2,393,231,456 bytes (2.23 GiB) in weights. Add the KV cache, which depends on your context length, plus roughly half a gigabyte of runtime overhead.
How large is Phi-3-mini-4k-instruct's KV cache?
12.00 GiB at 32K context with an f16 cache, computed per layer. Quantizing the cache to q8_0 roughly halves it, which is often the difference between a context length fitting and not.
Which quantization of Phi-3-mini-4k-instruct should I use?
Q4_K_M is the usual default. Pick the largest quantization that fits your card at the context you actually need — the table above gives exact sizes for every one published.