microsoft · text

Phi-3-medium-4k-instruct

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

Phi-3-medium-4k-instruct at Q4_K_M is exactly 8,566,821,248 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
4,096
native (config.json)
License
mit

Shipped quantizations

exact bytes, summed from published files
QuantSizeExact bytesEffective bpwTensorsPublisher
I1-IQ1_S2.75 GiB2,957,997,3761.695mradermacher
I1-IQ1_M3.02 GiB3,242,157,3761.858mradermacher
I1-IQ2_XXS3.46 GiB3,715,757,3762.129mradermacher
I1-IQ2_XS3.84 GiB4,127,405,3762.365mradermacher
I1-IQ2_S4.04 GiB4,338,126,6562.486mradermacher
IQ2_M4.39 GiB4,717,006,2082.703bartowski
I1-IQ2_M4.39 GiB4,717,006,6562.703mradermacher
Q2_K4.79 GiB5,143,000,4482.947bartowski
Q2_K4.79 GiB5,143,000,6402.947mradermacher
I1-Q2_K4.79 GiB5,143,000,8962.947mradermacher
Q2_K_L4.94 GiB5,303,320,4483.039bartowski
I1-IQ3_XXS5.08 GiB5,453,262,6563.125mradermacher
IQ3_XS5.41 GiB5,806,841,7283.328bartowski
IQ3_XS5.41 GiB5,806,841,9203.328mradermacher
I1-IQ3_XS5.41 GiB5,806,842,1763.328mradermacher
Q3_K_S5.65 GiB6,064,889,7283.475bartowski
IQ3_S5.65 GiB6,064,889,9203.475mradermacher
Q3_K_S5.65 GiB6,064,889,9203.475mradermacher
I1-IQ3_S5.65 GiB6,064,890,1763.475mradermacher
I1-Q3_K_S5.65 GiB6,064,890,1763.475mradermacher
IQ3_M6.03 GiB6,473,977,7283.710bartowski
IQ3_M6.03 GiB6,473,977,9203.710mradermacher
I1-IQ3_M6.03 GiB6,473,978,1763.710mradermacher
Q3_K_M6.45 GiB6,923,411,3283.967bartowski
Q3_K_M6.45 GiB6,923,411,5203.967mradermacher
I1-Q3_K_M6.45 GiB6,923,411,7763.967mradermacher
IQ4_XS6.95 GiB7,466,011,0084.278bartowski
I1-IQ4_XS6.95 GiB7,466,011,4564.278mradermacher
Q3_K_L6.98 GiB7,490,297,7284.292bartowski
Q3_K_L6.98 GiB7,490,297,9204.292mradermacher
I1-Q3_K_L6.98 GiB7,490,298,1764.292mradermacher
IQ4_XS7.02 GiB7,537,691,2004.319mradermacher
I1-Q4_07.38 GiB7,925,797,6964.542mradermacher
Q4_K_S7.41 GiB7,954,469,2484.558bartowski
Q4_K_S7.41 GiB7,954,469,4404.558mradermacher
I1-Q4_K_S7.41 GiB7,954,469,6964.558mradermacher
Q4_K_M7.98 GiB8,566,821,2484.909bartowski
Q4_K_M7.98 GiB8,566,821,4404.909mradermacher
I1-Q4_K_M7.98 GiB8,566,821,6964.909mradermacher
Q4_K_L8.09 GiB8,688,664,4484.979bartowski

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
2047
SWA period
1
MLA
no
Experts
Experts per token
use_sliding_window

Questions people ask

How much VRAM does Phi-3-medium-4k-instruct need?
Q4_K_M is exactly 8,566,821,248 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-4k-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-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.