Skip to content
Qubitium edited this page Dec 2, 2026 · 9 revisions

FITQ trellis quantization

🏠 Home · 🧭 Choose a method · 🚀 Quickstart · 🧰 Help

On this page

FITQ (Fewest-Instruction Trellis Quantization) compresses linear weights into 16 × 16 trellis-coded tiles in a Hadamard-rotated basis. It supports seven rates from 2 to 6 bits per weight, including 2.5 and 3.5. Each output row has an FP16 scale in addition to the tile bitstream.

Choose FITQ when you have representative calibration data and want to compare a low-bit trellis checkpoint with alternatives such as EXL3. Both dimensions of every quantized projection must be multiples of 16. FITQ kernels require aligned projections and have no automatic padding.

Quantize, save, and reload

Use FITQConfig or QuantizeConfig(method="fitq", ...). Pass representative calibration texts or tokenized rows as calibration in the example.

from gptqmodel import CalibrationConfig, FITQConfig, GPTQModel

model = GPTQModel.load(
    "ibm-granite/granite-3.1-1b-a400m-instruct",
    quantize_config=FITQConfig(bits=3),
)
model.quantize(CalibrationConfig(dataset=calibration, batch_size=4))
model.save("granite-fitq-t3")

reloaded = GPTQModel.load("granite-fitq-t3")

FITQ uses the calibration inputs to estimate a Hessian and feeds each 16-column block’s quantization error into the remaining columns. GPT-QModel uses a beam search to choose the trellis codes. When the native encoder is unavailable, quantization uses the Torch reference encoder. Leave CalibrationConfig.exclude_attention_sinks unset or set it to False.

Code rates and encoder settings

bits Code Default beam width when keep=None
2 t2 2048
2.5 t2p5 512
3 (default) t3 128
3.5 t3p5 1024
4 t4 1024
5 t5 1024
6 t6 1024

For mixed rates, use a dynamic rule such as dynamic={r"+:.*down_proj.*": {"bits": 3.5}}. Per-module overrides accept only bits. Use exclusion rules to skip modules.

Start with the default encoder settings. scale_grid supplies positive multipliers of the rotated row RMS and defaults to (1.0,). The solver keeps the candidate with the lowest Hessian-weighted error. refit_scales=True also tries a closed-form scale update for the chosen codes. The refit is off by default. Check held-out model quality before using it. See the config reference for all FITQ-specific fields.

Inference backends

Automatic selection prefers fitq_cuda on Linux CUDA or ROCm. Native execution requires NVIDIA SM80 (compute capability 8.0) or newer, or AMD RDNA4 gfx1200/gfx1201, and a buildable native extension. If the native path is unavailable, the layer falls back to Torch.

Backend Execution
fitq_cuda For 1–8 input rows, decodes tiles in registers for GEMV. For 9–64 rows, fuses tile decode with tensor-core GEMM. Above 64 rows, decodes into a BF16 workspace for vendor GEMM.
fitq_torch Portable Torch path for CPU, CUDA, ROCm, XPU, and MPS. Caches a dense FP32 reconstruction in the rotated basis. Budget memory for that cache when loading on a device without native FITQ execution.

Select the portable path explicitly with GPTQModel.load("granite-fitq-t3", backend="fitq_torch"). Both backends accept FP16, BF16, and FP32 activations and use eager execution.

Checkpoint layout

model.save() writes a GPT-QModel safetensors checkpoint with the fitq format. Reload the checkpoint directory with GPTQModel.load(). Standalone .fitq export is unavailable.

Buffer Content
fitq_streams INT32 trellis words in row-major tile order
fitq_s_row One FP16 scale per output row, stored as INT16 bit patterns
fitq_sign_in, fitq_sign_out Packed INT32 sign masks for the input and output rotations
fitq_meta Four INT32 values for the code index, input and output rotation widths, and FP32 decode-unit bits

Sources

Clone this wiki locally