Section 01 · GGF-16
Why Linear K-Quant Q4_K_M Prefills Faster Than Codebook IQ4_XS on Large Prompts
Bit-shifting 4-bit nibbles with affine scales avoids vector table gathers during compute-bound 128K prefill.
During single-token decode, DRAM bandwidth dominates so thoroughly that both IQ4_XS (2.95 GB/tok) and Q4_K_M (3.15 GB/tok) stay close on memory rooflines. However, during massive 64K–256K repository prompt ingestion (prefill), matrix multiplications become compute-bound and ALU dequantization overhead matters.
IQ4_XS relies on non-linear 256-entry lookup tables during unpacking, whereas Q4_K_M uses pure bitwise nibble masking plus affine FP16 scale/min multiply-adds that map directly onto NVIDIA DP4A/Tensor intrinsics and Apple Metal SIMD vector instructions. On 48–64 GB Apple Silicon Macs and RTX 5090 32 GB rigs where the extra 1.00 GiB (21.40 GiB vs 20.40 GiB) is trivial, Q4_K_M gives snappier Time-To-First-Token on multi-file ingestions.
Breaking down Q4_K_M’s 21.40 GiB footprint confirms why it hits slightly higher active byte reads than UD-IQ4_XS (3.15 vs 2.95 GB/tok): standard Q4_K blocks pack 144 bytes per 256 weights (4.50 bpw) plus Q6_K promotions on attn_v and half of ffn_down tensors, bringing model-wide density near 4.85 bpw while maximizing hardware SIMD decoding throughput.
RTX_5090_Q4_K_M_128K = 21.40 GiB + 5.00 GiB (128K FP16 KV) + 0.25 GiB (GDN) + 0.75 GiB = 27.40 GiB <= 30.2 GiB Usable