After the metadata come
tensor_count tensor infos, zero padding to the alignment, and the tensor
data. This page follows
docs/gguf.md;
the types and block sizes come from ggml’s
include/ggml.h,
src/ggml-common.h, src/ggml.c and
src/ggml-quants.c, all read 2026-11-12.
Tensor info
| Field | Type | Meaning |
|---|---|---|
name | string | At most 64 bytes, such as blk.0.attn_q.weight. |
n_dimensions | uint32 | At most 4. |
dimensions | uint64 each | Sizes, as ggml’s ne: the first is the fastest-changing (its stride is the element size), so the order is the reverse of NumPy’s default. |
type | uint32 | ggml type. |
offset | uint64 | Where the tensor’s data starts, counted from the start of the tensor data; a multiple of the alignment. |
The tensor data starts at the first multiple of general.alignment (32
by default) after the tensor infos, and tensors are padded with zeros to the
alignment. A file can therefore be memory-mapped and used in place.
Tensor types
| Value | Type | Block (values, bytes) |
|---|---|---|
| 0 | F32 | 1, 4 |
| 1 | F16 | 1, 2 |
| 2 | Q4_0: 4-bit, one F16 scale | 32, 18 |
| 3 | Q4_1: 4-bit, F16 scale and minimum | 32, 20 |
| 4, 5 | Q4_2, Q4_3: support removed | – |
| 6 | Q5_0 | 32, 22 |
| 7 | Q5_1 | 32, 24 |
| 8 | Q8_0 | 32, 34 |
| 9 | Q8_1 | 32, 36 |
| 10 | Q2_K: “k-quant”, a super-block of 16 blocks of 16 values | 256, 84 |
| 11 | Q3_K | 256, 110 |
| 12 | Q4_K | 256, 144 |
| 13 | Q5_K | 256, 176 |
| 14 | Q6_K | 256, 210 |
| 15 | Q8_K (only used for intermediate quantisation and dot products) | 256, 292 |
| 16 | IQ2_XXS: “i-quant”, indexes into fixed grid tables | 256, 66 |
| 17 | IQ2_XS | 256, 74 |
| 18 | IQ3_XXS | 256, 98 |
| 19 | IQ1_S | 256, 50 |
| 20 | IQ4_NL | 32, 18 |
| 21 | IQ3_S | 256, 110 |
| 22 | IQ2_S | 256, 82 |
| 23 | IQ4_XS | 256, 136 |
| 24–27 | I8, I16, I32, I64 | 1, 1/2/4/8 |
| 28 | F64 | 1, 8 |
| 29 | IQ1_M (no separate scale field) | 256, 56 |
| 30 | BF16 | 1, 2 |
| 31–33 | Q4_0_4_4, Q4_0_4_8, Q4_0_8_8: removed from GGUF files | – |
| 34, 35 | TQ1_0, TQ2_0: ternary quantisation | 256, 54; 256, 66 |
| 36–38 | IQ4_NL_4_4, IQ4_NL_4_8, IQ4_NL_8_8: removed | – |
| 39 | MXFP4: an E8M0 scale byte and 4-bit values | 32, 17 |
| 40 | NVFP4: four sub-block scales and 4-bit values | 64, 36 |
| 41 | Q1_0 | 128, 18 |
| 42 | Q2_0 | 64, 18 |
| 43 | F8_E4M3 | 1, 1 |
A Q4_0 block is an F16 scale d and 16 bytes of 4-bit values; value
i is d × (qi − 8), with the low nibbles holding
values 0–15 and the high nibbles 16–31. The GGUF document does not describe the
other formats; their layouts are the C structures of ggml-common.h,
tabulated below (read 2026-11-13).
Block layouts
Fields in order, from the structs in ggml-common.h; ggml_half
is an IEEE binary16 (2 bytes), little-endian like the rest of the file. A tensor row is
a whole number of blocks laid end to end. QK_K is 256 (a “super-block”);
K_SCALE_SIZE is 12. Sizes match the table above (each is checked by a
static_assert in the header).
| Type | Fields in order | Bytes | Notes from the header |
|---|---|---|---|
| Q4_0 (32 values) | d half; qs[16] nibbles | 18 | Delta, then nibbles. |
| Q4_1 (32) | d half (delta); m half (minimum); qs[16] | 20 | The pair can be read as one half2 dm. |
| Q5_0 (32) | d half; qh[4] (the fifth bit of each of the 32 quants); qs[16] nibbles | 22 | |
| Q5_1 (32) | d, m half; qh[4]; qs[16] | 24 | |
| Q8_0 (32) | d half; qs[32] int8 | 34 | |
| Q8_1 (32) | d half; s half (d × sum(qs[i])); qs[32] int8 | 36 | d and s can be read as half2 ds. |
| Q1_0 (128) | d half; qs[16] (one bit each) | 18 | |
| Q2_0 (64) | d half (scale); qs[16] (2 bits each) | 18 | |
| MXFP4 (32) | e uint8 (an E8M0 scale); qs[16] | 17 | |
| NVFP4 (64) | d[4] uint8 (UE4M3 scales, one per 16-value sub-block); qs[32] (packed 4-bit E2M1 values) | 36 | QK_NVFP4_SUB is 16. |
| TQ1_0 (256) | qs[(256 − 4×256/64)/5] = 48 bytes (5 ternary elements per byte, since 35 = 243 < 256); qh[256/64] = 4 bytes (4 elements per byte); d half | 54 | 1.6875 bits per weight. |
| TQ2_0 (256) | qs[64] (2 bits per element); d half | 66 | 2.0625 bpw. |
| Q2_K (256) | scales[16] (scales and mins, 4 bits each); qs[64]; d half (super-block scale for the quantised scales); dmin half (the same for the mins) | 84 | 16 blocks of 16 elements; weight = a·q + b; 2.625 bits per weight. |
| Q3_K (256) | hmask[32] (high bit); qs[64] (low 2 bits); scales[12] (6 bits each); d half | 110 | 16 blocks of 16; weight = a·q; 3.4375 bpw. The 16 six-bit scales are unpacked from the 12 bytes with masks 0x0f0f0f0f and 0x03030303, and the value used is the scale minus 32; a value is (low 2 bits) − (hmask bit ? 0 : 4). |
| Q4_K (256) | d half; dmin half; scales[12] (6 bits); qs[128] (4-bit quants) | 144 | 8 blocks of 32; weight = a·q + b; 4.5 bpw. Scale and min j: for j < 4, d = q[j] & 63, m = q[j+4] & 63; otherwise d = (q[j+4] & 15) | ((q[j−4] >> 6) << 4), m = (q[j+4] >> 4) | ((q[j] >> 6) << 4). |
| Q5_K (256) | d, dmin half; scales[12]; qh[32] (high bit); qs[128] (low 4 bits) | 176 | 8 blocks of 32; 5.5 bpw; scales as Q4_K. |
| Q6_K (256) | ql[128] (lower 4 bits); qh[64] (upper 2 bits); scales[16] int8; d half | 210 | 16 blocks of 16; weight = a·q; 6.5625 bpw. |
| Q8_K (256) | d float32; qs[256] int8; bsums[16] int16 (sums of the quants in groups of 16) | 292 | Used only for intermediate quantisation and dot products. |
| IQ2_XXS (256) | d half; qs[32] uint16 | 66 | “Almost true” 2-bit; 2.0625 bpw. |
| IQ2_XS (256) | d half; qs[32] uint16; scales[8] | 74 | 2.3125 bpw. |
| IQ2_S (256) | d half; qs[64]; qh[8]; scales[8] | 82 | 2.5625 bpw. |
| IQ3_XXS (256) | d half; qs[96] | 98 | 3.0625 bpw. |
| IQ3_S (256) | d half; qs[64]; qh[8]; signs[32]; scales[4] (IQ3S_N_SCALE = 256/64) | 110 | 3.4375 bpw. |
| IQ1_S (256) | d half; qs[32]; qh[8] uint16 | 50 | 1.5625 bpw. |
| IQ1_M (256) | qs[32] (grid index, low 8 bits); qh[16] (grid index high 3 bits and a grid-shift bit for two groups of 8); scales[8] (3-bit block scales) | 56 | 1.75 bpw. No scale field of its own; the header defines iq1m_scale_t, a union of a half and a uint16, for it. The 16 bits of the half are spread over the four 16-bit words sc[0..3] of scales, four bits from the top of each word: u16 = (sc[0] >> 12) | ((sc[1] >> 8) & 0x00F0) | ((sc[2] >> 4) & 0x0F00) | (sc[3] & 0xF000), so bits 12 to 15 of sc[0] are bits 0 to 3 of the half, those of sc[1] bits 4 to 7, sc[2] bits 8 to 11 and sc[3] bits 12 to 15. The low 12 bits of each word hold four 3-bit block scales (two per 32-value group, at bit 6·(ib mod 2) and +3 of sc[ib/2]). Source: dequantize_row_iq1_m in ggml-quants.c, read 2026-11-13; see dequantisation. |
| IQ4_NL (32) | d half; qs[16] | 18 | Non-linear 4-bit values. |
| IQ4_XS (256) | d half; scales_h uint16; scales_l[4]; qs[128] | 136 |
The i-quant types index fixed grid tables that are part of the program, not of the file. F32, F16, BF16, F64 and the integer types are plain arrays of their element type, and F8_E4M3 one byte per value.