microsoft · text

Phi-3-medium-128k-instruct

microsoft/Phi-3-medium-128k-instruct

Phi-3-medium-128k-instruct at Q4_K_M is exactly 8,566,821,408 bytes (7.98 GiB / 8.57 GB) — an effective 4.909 bits per weight, not the nominal 4. Its KV cache at 32K is 6.25 GiB.

From the file· summed from 1 file(s)From the file· KV per layer
Parameters
14.0B
Architecture
phi3
40 layers
Context
131,072
native (config.json)
License
mit

Shipped quantizations

exact bytes, summed from published files
QuantSizeExact bytesEffective bpwTensorsPublisher
IQ1_S2.75 GiB2,957,997,0561.695legraphista
IQ1_S2.75 GiB2,957,997,0881.695bartowski
IQ1_M3.02 GiB3,242,157,0561.858legraphista
IQ1_M3.02 GiB3,242,157,0881.858bartowski
IQ2_XXS3.46 GiB3,715,757,0562.129legraphista
IQ2_XXS3.46 GiB3,715,757,6322.129bartowski
IQ2_XS3.84 GiB4,127,405,0562.365legraphista
IQ2_XS3.84 GiB4,127,405,0882.365bartowski
IQ2_XS3.84 GiB4,127,405,0882.365bartowski
IQ2_S4.04 GiB4,338,126,3362.486legraphista
IQ2_S4.04 GiB4,338,126,3682.486bartowski
IQ2_S4.04 GiB4,338,126,3682.486bartowski
IQ2_M4.39 GiB4,717,006,3362.703legraphista
IQ2_M4.39 GiB4,717,006,3682.703bartowski
IQ2_M4.39 GiB4,717,006,9122.703bartowski
Q2_K_S4.44 GiB4,771,288,5762.734legraphista
Q2_K4.79 GiB5,143,000,5762.947legraphista
Q2_K4.79 GiB5,143,000,6082.947bartowski
Q2_K4.79 GiB5,143,001,1522.947bartowski
Q2_K_L4.94 GiB5,303,321,1523.039bartowski
IQ3_XXS5.08 GiB5,453,262,3363.125legraphista
IQ3_XXS5.08 GiB5,453,262,3683.125bartowski
IQ3_XXS5.08 GiB5,453,262,3683.125bartowski
IQ3_XS5.41 GiB5,806,841,8563.328legraphista
IQ3_XS5.41 GiB5,806,841,8883.328bartowski
IQ3_XS5.41 GiB5,806,842,4323.328bartowski
Q3_K_S5.65 GiB6,064,889,8563.475legraphista
IQ3_S5.65 GiB6,064,889,8563.475legraphista
Q3_K_S5.65 GiB6,064,889,8883.475bartowski
IQ3_S5.65 GiB6,064,889,8883.475bartowski
Q3_K_S5.65 GiB6,064,890,4323.475bartowski
IQ3_M6.03 GiB6,473,977,8563.710legraphista
IQ3_M6.03 GiB6,473,977,8883.710bartowski
IQ3_M6.03 GiB6,473,978,4323.710bartowski
Q3_K6.45 GiB6,923,411,4563.967legraphista
Q3_K_M6.45 GiB6,923,411,4883.967bartowski
Q3_K_M6.45 GiB6,923,412,0323.967bartowski
IQ4_XS6.95 GiB7,466,011,1364.278legraphista
IQ4_XS6.95 GiB7,466,011,1684.278bartowski
IQ4_XS6.95 GiB7,466,011,7124.278bartowski

KV cache by context

computed per layer
ContextKV cache (f16)Flat formulaOverstated byFull / windowed / recurrent
4,0960.78 GiB0.78 GiB40 / 0 / 0
8,1921.56 GiB1.56 GiB40 / 0 / 0
16,3843.13 GiB3.13 GiB40 / 0 / 0
32,7686.25 GiB6.25 GiB40 / 0 / 0
65,53612.50 GiB12.50 GiB40 / 0 / 0
131,07225.00 GiB25.00 GiB40 / 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 7.31 GiB. The real file is 7.98 GiB, because a quantization is a mixture and some tensors are always kept at higher precision.

Architecture

from config.json
Layers
40
Attention heads
40
KV heads
10
Head dim
128
Hidden size
5120
Vocab
32,064
Sliding window
131072
SWA period
1
MLA
no
Experts
Experts per token
use_sliding_window

Questions people ask

How much VRAM does Phi-3-medium-128k-instruct need?
Q4_K_M is exactly 8,566,821,408 bytes (7.98 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-medium-128k-instruct's KV cache?
6.25 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-medium-128k-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.