Repository navigation
FITQ
🏠 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.
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. Leave CalibrationConfig.exclude_attention_sinks unset or set it to False.
To quantize entirely on a CPU, use FITQConfig(bits=3, device="cpu") in the same workflow. The JIT-built fitq_cpu extension encodes tiles in parallel and selects AVX-512, AVX2, or scalar execution according to the host CPU. If the extension fails to build, the slower Torch reference encoder takes over. The CPU extension accelerates quantization. CPU inference uses fitq_torch.
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.
Automatic selection prefers fitq_cuda on Linux CUDA or ROCm. That backend 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. |
mlx |
Packed Metal inference on compatible MLX-LM architectures. Targets Apple M6 and later. Uses fused trellis decode and GEMV for 1–8 rows, then a temporary decoded workspace and MLX matmul from 9 rows onward. |
All three paths accept FP16, BF16, and FP32 activations. Select the portable eager path explicitly with GPTQModel.load("granite-fitq-t3", backend="fitq_torch").
On NVIDIA GB10 (SM 12.1), fitq_cuda tunes split-K for small token batches and sizes the 9–64-row fused GEMM to the actual row count. With a visible SM 12.1 device and a CUDA 13+ PyTorch build, the JIT build can add a native sm_121 target alongside Torch's resolved targets. The tuning applies automatically. See the GB10 layer benchmarks.
For Apple Metal inference, use GPTQModel.load(checkpoint, backend="mlx") with a model architecture supported by MLX-LM. A single checkpoint-wide rate can use any FITQ rate, including 2.5 and 3.5 bits. The MLX conversion check rejects fractional rates in nonempty dynamic rules. Use fitq_torch for those checkpoints. See MLX setup and FITQ transfer.
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 |
Documentation home · Quickstart · Troubleshooting · Repository · PyPI
Public source 780f1bbfc declares package version 7.15.0. Individual pages identify their source revisions. Choose a method · Dtypes and formats. Maintained by ModelCloud.ai.
🧭 1 · Choose and understand
🚀 2 · Use it
- Installation and Quickstart
- Loading and Inference
- LeapQuant recurrent-state quantization
- Evaluation
- Serving
- Troubleshooting and FAQ
- Memory, Offload, Multi-GPU
- MLX / Apple Silicon
- Tenstorrent / Block Floats
- Hugging Face Integration
- Multimodal and MoE Models
🎛️ Methods and representations
Each guide: choose → examples → math / advanced
- GPTQ / GPTAQ / G2PTQ / ADMM-Q / RTN
- SINQ
- JointQ
- AWQ
- QQQ
- MACaQ / MXFP4
- EXL3
- CPTC
- FITQ
- VPTQ
- Tetra
- TWLA
- Paro
- FP8 and NVFP4
- NF12: lossless BF16 storage
- GGUF families
- BitsAndBytes: NF4 / FP4 / INT8
🧰 Refinement and execution
- GSQ refinement / allocation
- EoRA adapters
- Rotation, Smoothing, Norm Tuning
- Projection Fusion
- TurboQuant KV cache
🧠 3 · Theory and advanced reference