Skip to main content

Module iq_tables

Module iq_tables 

Source
Expand description

Codebook/grid tables for the IQ1_S / IQ1_M / IQ2_XXS / IQ2_XS / IQ2_S / IQ3_XXS / IQ3_S quantization formats.

These numeric tables are part of the formats themselves – a file quantized with them cannot be decoded without these exact values, and they cannot be independently re-derived. They are reproduced from the MIT-licensed ggml project’s ggml-common.h (the format’s defining source; see docs/THIRD_PARTY_NOTICES.md). The code that uses them is written independently in lib.rs against ggml’s published dequant semantics.

Generated from the upstream format tables – do not hand-edit.

Constants§

IQ1S_GRID
2048 8-value rows, each u64 packing 8 signed int8 values.
IQ2S_GRID
1024 8-value rows, each u64 packing 8 unsigned byte magnitudes. Indexed by IQ2_S’s 10-bit grid code.
IQ2XS_GRID
512 8-value rows, each u64 packing 8 unsigned byte magnitudes. Indexed by IQ2_XS’s 9-bit grid code.
IQ2XXS_GRID
256 8-value rows, each u64 packing 8 unsigned byte magnitudes.
IQ3S_GRID
512 4-value rows, each u32 packing 4 unsigned byte magnitudes. Indexed by IQ3_S’s 9-bit grid code.
IQ3XXS_GRID
256 4-value rows, each u32 packing 4 unsigned byte magnitudes.
KMASK_IQ2XS
Per-element sign-mask bits used by every IQ2/IQ3 sign decoding path.
KSIGNS_IQ2XS
7-bit sign patterns (bit 7 = parity) shared by IQ2_XXS/IQ2_XS/IQ3_XXS. IQ2_S and IQ3_S skip this table: they store a full 8-bit sign byte per 8 elements instead of a 7-bit index into it.