Each value in the block is encoded as an integer q between 0 and 2b − 1. The decoder reconstructs the pixel as m + q × s, where m is the block minimum and s is the step size, both stored as 16-bit floats (fp16).
Each panel treats the image's color channels like a weight tensor and squeezes them into a few bits, using a scheme that loosely mirrors a real LLM quantization method. Click any image to inspect that spot up close; the math further down follows the same spot and the same settings.
Focus: center · click any specimen to center on a detail
Every method on this page starts from the same 8-bit RGB image and squeezes it into fewer bits.
The uncompressed image is an array of bytes, one per color channel per pixel. On the 0–255 scale, 0 is fully dark and 255 is fully saturated. That is the raw input.
A naive uniform grid simply rescales that 0–255 range to 2b evenly spaced values. It is easy to compute, but wasteful: if an image happens to have one bright spot and the rest is dark, the whole bit budget is spent describing the gap between them, and the dark regions lose their detail.
Block-wise scaling solves this by carving the image into small squares (8×8 by default). Each block keeps its own minimum value and step size, so a dim block can spend all its codes on the subtle differences between dark pixels. That requires storing a small amount of extra data per block (metadata), which is accounted for in the cost table below.
Error diffusion uses the same blocks, but when rounding a pixel introduces an error, it pushes that error onto the neighbouring pixels that haven't been quantized yet. The average brightness of the patch is preserved, which makes edges and gradients look far sharper than the numbers suggest.
Mixed precision notices that flat regions (like a smooth sky) need fewer bits than busy regions (like starry dust). It assigns more bits to high-variance blocks and fewer to low-variance ones, keeping the total bits the same.
Focus at the selected patch · red channel values on the 0–255 scale
Each value in the block is encoded as an integer q between 0 and 2b − 1. The decoder reconstructs the pixel as m + q × s, where m is the block minimum and s is the step size, both stored as 16-bit floats (fp16).
loading… · single-channel matrices showing codes, reconstructed values, and error
24×24 pixels around the patch, magnified 8×. The frame marks the 8×8 patch inspected below. Pick a channel by clicking its tile.
Totals for the whole image at the current settings. Bits per value is total bits divided by the number of values (width × height × 3).
How this maps to GGUF. Q4_0 stores 32 weights as 4-bit codes plus one 16-bit scale: 32 × 4 + 16 = 144 bits, or 4.5 bits per weight. Q4_K groups 256 weights into a super-block with two 16-bit numbers, then gives each of its eight 32-weight sub-blocks a 6-bit scale and 6-bit minimum: 256 × 4 + 8 × 12 + 32 = 1152 bits, again 4.5 per weight. The scales themselves are quantized, which is how k-quants keep a per-block minimum without paying 32 bits for it. That is the same arithmetic as the table, one level deeper.
Where the metaphor stretches. Here you see the quantized values directly. In an LLM nobody looks at the weights; the error passes through many layers and much of it is absorbed, so a Q4 model degrades far less than these pictures suggest. Blocks here are 2D tiles; in GGUF they are runs of 32 weights along a row.
Error diffusion uses the Floyd–Steinberg kernel. GPTQ applies the same idea to weights but chooses where the error goes using second-order (Hessian) information from calibration data instead of a fixed kernel.
Mixed precision here allocates by pixel variance. Q4_K_M keeps some whole tensors at higher precision, and an importance matrix (imatrix) uses real activations to decide which weights' rounding error matters most.
Working size. Large images are scaled down to at most 900 pixels wide before processing, so all numbers on this page refer to the scaled size.