qyliang · text

GrammarCoder-7B-Base

qyliang/GrammarCoder-7B-Base

GrammarCoder-7B-Base at Q4_K_M is exactly 4,696,210,464 bytes (4.37 GiB / 4.70 GB) — an effective 4.921 bits per weight, not the nominal 4. Its KV cache at 32K is 1.75 GiB.

From the file· summed from 1 file(s)From the file· KV per layer
Parameters
7.6B
Architecture
qwen2
28 layers
Context
131,072
native (config.json)
License
apache-2.0

Shipped quantizations

exact bytes, summed from published files
QuantSizeExact bytesEffective bpwTensorsPublisher
I1-IQ1_S1.78 GiB1,913,361,7282.005mradermacher
I1-IQ1_M1.91 GiB2,051,890,4962.150mradermacher
I1-IQ2_XXS2.13 GiB2,282,771,7762.392mradermacher
I1-IQ2_XS2.31 GiB2,478,716,2242.597mradermacher
I1-IQ2_S2.43 GiB2,606,284,0002.731mradermacher
I1-IQ2_M2.60 GiB2,790,989,0242.925mradermacher
I1-Q2_K_S2.65 GiB2,845,013,3442.981mradermacher
Q2_K2.82 GiB3,026,879,5843.172mradermacher
I1-Q2_K2.82 GiB3,026,879,8403.172mradermacher
I1-IQ3_XXS2.91 GiB3,125,161,1843.275mradermacher
I1-IQ3_XS3.13 GiB3,358,147,8403.519mradermacher
Q3_K_S3.26 GiB3,504,260,0963.672mradermacher
I1-Q3_K_S3.26 GiB3,504,260,3523.672mradermacher
I1-IQ3_S3.27 GiB3,511,084,2883.679mradermacher
I1-IQ3_M3.34 GiB3,585,903,8723.758mradermacher
Q3_K_M3.56 GiB3,820,282,8804.003mradermacher
I1-Q3_K_M3.56 GiB3,820,283,1364.003mradermacher
Q3_K_L3.82 GiB4,100,350,9764.297mradermacher
I1-Q3_K_L3.82 GiB4,100,351,2324.297mradermacher
I1-IQ4_XS3.94 GiB4,231,316,6404.434mradermacher
IQ4_XS3.97 GiB4,263,142,3044.467mradermacher
I1-IQ4_NL4.15 GiB4,450,950,4324.664mradermacher
I1-Q4_04.15 GiB4,457,258,2724.671mradermacher
Q4_K_S4.16 GiB4,470,905,8884.685mradermacher
I1-Q4_K_S4.16 GiB4,470,906,1444.685mradermacher
Q4_K_M4.37 GiB4,696,210,4644.921mradermacher
I1-Q4_K_M4.37 GiB4,696,210,7204.921mradermacher
I1-Q4_14.55 GiB4,887,006,7525.121mradermacher
Q5_K_S4.96 GiB5,329,485,3445.585mradermacher
I1-Q5_K_S4.96 GiB5,329,485,6005.585mradermacher
Q5_K_M5.08 GiB5,459,140,1285.721mradermacher
I1-Q5_K_M5.08 GiB5,459,140,3845.721mradermacher
Q6_K5.84 GiB6,269,752,8966.570mradermacher
I1-Q6_K5.84 GiB6,269,753,1526.570mradermacher
Q8_07.56 GiB8,118,620,6728.507mradermacher
F1614.23 GiB15,275,528,19216.007mradermacher

KV cache by context

computed per layer
ContextKV cache (f16)Flat formulaOverstated byFull / windowed / recurrent
4,0960.22 GiB0.22 GiB28 / 0 / 0
8,1920.44 GiB0.44 GiB28 / 0 / 0
16,3840.88 GiB0.88 GiB28 / 0 / 0
32,7681.75 GiB1.75 GiB28 / 0 / 0
65,5363.50 GiB3.50 GiB28 / 0 / 0
131,0727.00 GiB7.00 GiB28 / 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 4.00 GiB. The real file is 4.37 GiB, because a quantization is a mixture and some tensors are always kept at higher precision.

Architecture

from config.json
Layers
28
Attention heads
28
KV heads
4
Head dim
128
Hidden size
3584
Vocab
154,680
Sliding window
none
SWA period
MLA
no
Experts
Experts per token
use_sliding_window
false

Questions people ask

How much VRAM does GrammarCoder-7B-Base need?
Q4_K_M is exactly 4,696,210,464 bytes (4.37 GiB) in weights. Add the KV cache, which depends on your context length, plus roughly half a gigabyte of runtime overhead.
How large is GrammarCoder-7B-Base's KV cache?
1.75 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 GrammarCoder-7B-Base 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.