Skip to content
Projects

About

FITQ (Fewest-Instruction Trellis Quantization) — open format specification, C99/Python reference decoders, and conformance vectors

AI & Machine Learning

How these counts are measured

34 stars0 Forks +13 in 24h

Measured star growth

in 24h
+13
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

FITQ — Fewest-Instruction Trellis Quantization

by Morrowmake
Smaller. Faster. Sharper. Everywhere.

Follow @Morrowmake on X FITQ Specification v1 (CC BY 4.0)

FITQ — Fewest-Instruction Trellis Quantization

FITQ is an open, engine-agnostic, hardware-portable weight format for large dense and Mixture-of-Experts (MoE) language models. One .fitq file is designed to run natively across modern GPUs and unified-memory accelerators — built from first principles so any inference engine and any vendor's 8-bit integer matrix units can push both single-user decode and long-context prefill right up to silicon rooflines.

This repository contains the complete, standalone FITQ format specification, a normative C99 reference decoder and test-vector checker, an independent Python + NumPy reference reader, and binary conformance vectors.

Quantizer / converter: The standalone open-source FITQ converter (for quantizing your own models into .fitq checkpoints) is currently being cleaned up and will be released as open source shortly.

Early-format note: FITQ is brand new. Our first-generation reference kernels (launching first in TensorFold) have only been hardware-tested and tuned on NVIDIA Ampere (sm_80 / sm_86) so far. Newer NVIDIA architectures (sm_89–sm_120) and Apple Silicon (Metal) are early/experimental and not yet hardware-tuned, and AMD, Intel, Vulkan, and fast CPU backends do not exist yet. See Current Implementation Status below.


Why FITQ?

Scalar quantization formats (like GGUF K-quants, GPTQ, or AWQ) are fast to unpack, but leave significant model quality on the table below 4 bits per weight. Trellis quantization preserves far more accuracy per bit, yet existing trellis formats pay a heavy runtime tax: high per-weight decode instruction counts or shared-memory lookup tables that stall ALUs, exhaust registers, and bottleneck high-bandwidth GPUs or Apple Silicon.

FITQ was designed to remove that tradeoff by compounding four format-level advantages:

  1. Fast, branchless, lookup-table-free unpacking (~0.97 ops/weight at 3-bit, ~1–2 ops across 2–6 bits): Every FITQ trellis code (t2–t6) decodes 4 weights per step using only 32-bit integer arithmetic — zero lookup tables, zero shared-memory bank conflicts, and no vendor-specific unpack instructions (compare 5.26 ops/weight in EXL3). Decode instructions hide cleanly behind memory loads, keeping single-stream weight reads at or near the memory-bandwidth roofline even on HBM GPUs and modern high-bandwidth Apple Silicon.
  2. Direct INT8 output (2× matrix-unit compute across every major GPU vendor, virtually lossless vs. BF16): Instead of dequantizing weights back to FP16/BF16, FITQ unpacks straight into packed INT8 ready for native 8-bit integer matrix multiplication — where NVIDIA Tensor Cores (mma.sync), Apple Silicon Metal 4 matrix units, AMD RDNA 4 / CDNA (WMMA / MFMA, e.g. Radeon AI PRO R9700: 383 INT8 TOPS vs 191 FP16 TFLOPS), and Intel Xe2 (XMX, e.g. Arc Pro B70: 367 INT8 TOPS vs 183.5 FP16 TFLOPS) all deliver 2× higher throughput than FP16/BF16. Because FITQ applies Hadamard rotations to spread outlier channels evenly across every vector, INT8 matrix math is virtually lossless compared to BF16 — directly doubling matrix compute headroom on prefill, multi-user concurrency, and speculative verify batches without giving up quality (see Current Implementation Status for which backends exist today).
  3. Fine-grained mixed precision (2.0–6.0 bpw + plain8 / int8row / exact): Every linear layer and individual MoE expert can be stored at the exact bit-width its sensitivity warrants (t2, t2p5, t3, t3p5, t4, t5, t6, or plain8), with Hadamard rotations baked cleanly into the format. Because single-user token generation is memory-bandwidth bound — each token must stream the active weights out of VRAM — matching quality at fewer bits per weight directly increases decode speed while freeing VRAM for longer context windows and more concurrent streams.
  4. Self-verifying, portable model folders with generic speculative drafters: Every .fitq file carries per-tensor SHA-256 digests, a provenance-independent weights_sha256, a whole-header signature, and integrity checks over byte-exact copies of config.json, tokenizer files, and LICENSE. Companion speculative drafters pair generically by (model_type, config_sha256), so a single standalone drafter works across every quantization size of the same base model.

Why FITQ Is Fast — 5.4x fewer decode ops, direct INT8


Format Performance Ceiling (vs. EXL3 & FP16 Trellis Formats)

FITQ's primary performance comparator is EXL3 and other FP16-output trellis quantization formats. Independent of today's early first-generation kernels, FITQ's ~5.4× lower unpack instruction count and direct INT8 output raise the format-level ceiling across prefill, high-concurrency multi-user decode, speculative verify batches, and single-user decode (calculated from published chip specs and sm_80 SASS counts):

FITQ Format Performance Ceiling vs EXL3 and FP16 trellis formats across NVIDIA, AMD, Intel, and Apple Silicon

Hardware Class Format Ceiling Advantage vs EXL3 / FP16 Trellis Formats Underlying Silicon Math
Desktop GPUs (NVIDIA, AMD, Intel) 2.0× prefill, multi-user concurrency & speculative decode matrix-compute ceiling Direct INT8 matrix units vs FP16 trellis dequant: RTX 4090 (660 vs 330), RTX 3090 (284 vs 142), AMD Radeon AI PRO R9700 (383 vs 191), Intel Arc Pro B70 (367 vs 183.5 INT8 TOPS vs FP16 TFLOPS); 1u decode stays bandwidth-bound where tighter bits/weight cuts VRAM reads
High-Bandwidth HBM GPUs (CMP 170HX / A100) 1.63×–2.18× higher 3-bit single-stream decode ceiling + 2.0× prefill & multi-user decode matrix peak sm_80 SASS decode roofline (1.55 vs 5.83 total ops/wt): FITQ saturates 100% of HBM while EXL3 stalls on ALU at 46% (CMP 170HX, 180 W) and 62% (A100 80 GB), while high-concurrency & speculative verify batches also gain 2.0× INT8 Tensor Core headroom
Apple Silicon (M5 Max / M5 Ultra, Metal 4) ~2.0× prefill & multi-user decode INT8 matrix peak + full 1,228 GB/s 3-bit single-user decode headroom < 1 unpack op/weight stays well inside the ~4.85 lane-ops/weight ALU budget at 1,228 GB/s, where ~5+ ops/weight FP16 trellis formats hit an ALU wall

(These are theoretical format ceilings, not measured performance on every chip — see Current Implementation Status below for which backends are hardware-tested today.)


Proven Results (No Fine-Tuning)

Evaluated head-to-head against published baselines by forward KL divergence against exact BF16 references, strictly external one-shot validation (240 external documents), and live execution benchmarks:

FITQ Quality Head-to-Head vs EXL3 and TFQ3

  • Qwen3.8-Flash-Next (114.09 GB vs EXL3 at 114.19 GB — equal disk size): -15.8% lower overall forward KL across 7 / 7 domain types and -16.2% overall (-19.0% per-document average) across 6 / 6 external domains (182 / 240 item wins, -38.2% fewer high-confidence token flips at p ≥ 0.90), while hitting 81.10% on MBPP+, 80.41% on BFCL v3 (+0.59 pp over BF16), and 90.66% on GPQA Diamond 64K.
  • Inkling-2-Mini (15.90 GB vs TFQ3 at 16.76 GB — 5.1% smaller): -26.9% lower overall forward KL across 6 / 6 open domains and -14.7% across 6 / 6 external domains (217 / 240 wins, 98.40% top-1 agreement), ranking #1 on both MBPP+ (75.75%) and BFCL v3 (78.05).

Full benchmark receipts, model cards, and Day-1 serving recipes (launching first on TensorFold) are rolling out over the next 24 hours — follow @Morrowmake for each drop.


Current Implementation Status

Because FITQ is a brand-new format, runtime coverage is still early: most inference kernels are only lightly tuned or untested on hardware, and several hardware backends do not exist yet.

Target / Component Status Notes
Normative C99 decoder (FORMAT.md) & Python reader (reader2/) Tested 19 / 19 spec vectors and 3 / 3 golden .fitq files pass (check_spec.py --plant-fault fails loudly). Correctness references only, not fast inference kernels.
NVIDIA CUDA — Ampere (sm_80 / sm_86, e.g. CMP 170HX, RTX 3090, A100) Hardware-tested & tuned (early) First-generation kernels in TensorFold; verified by contract tests, sanitizers, and live serving benchmarks, with substantial optimization headroom still ahead.
NVIDIA CUDA — Ada / Hopper / Blackwell (sm_89 / sm_90 / sm_120) Compiled only (untested on hardware) Release binaries emit SASS via the Ampere mma.sync path and should run, but have not been hardware-tested or tuned for Ada, Hopper (WGMMA/TMA), or Blackwell yet.
Apple Silicon (Metal) Experimental (not yet tuned) Metal shaders compile cleanly and earlier M4 kernel checks passed, but the backend is not yet end-to-end served or tuned.
AMD (ROCm / RDNA 4 / CDNA), Intel (SYCL / Xe2), Vulkan, fast CPU (AVX-512 / NEON) Not yet implemented No inference kernels exist yet. The format was designed so native 8-bit matrix units on these platforms can target it directly — contributions and third-party engine ports are very welcome.

Format at a Glance

  • Container: 16-byte little-endian prefix (FITQ magic, container version = 1, header length), followed by a 64-byte-aligned canonical JSON header and 64-byte-aligned tensor payloads.
  • Six storage kinds:
    • packed — Hadamard-rotated trellis-coded linear matrices (t2–t6)
    • packedrow — row-wise trellis-coded lookup tables (t2–t6, row width divisible by 32)
    • plain8 — Hadamard-rotated 8-bit linear matrices
    • int8row — 8-bit per-row lookup tables (embeddings, n-gram tables, 2D vision projections)
    • exact — unmodified tensors in original dtype (norms, routers, small gates)
    • signs — packed ±1 sign vectors for input and output Hadamard rotations
  • Seven trellis code types: t2 (2.0 bpw), t2p5 (2.5 bpw), t3 (3.0 bpw), t3p5 (3.5 bpw), t4 (4.0 bpw), t5 (5.0 bpw), and t6 (6.0 bpw) — all decoding 4 INT8 weights per step using only 32-bit integer arithmetic.
  • Model folders: A converted model is a folder holding a single *.fitq file (such as model.fitq or a publisher-named file like <Model>-FITQ-<bpw>bpw-<Publisher>.fitq) alongside verified copies of config.json, tokenizer files, fitq_stats.json, and LICENSE. Folders with multiple .fitq files are refused cleanly.

Repository Contents

Path Description
FORMAT.md Complete FITQ binary container specification, storage kinds, seven trellis code types (t2–t6), normative C99 reference decoder, and 19 test vectors
check_spec.py Extracts and compiles the C99 decoder from FORMAT.md (-std=c99 -O2 -Wall -Wextra -Werror) and verifies all 19 test vectors, invariants, and fault controls
reader2/ Independent Python 3 + NumPy reader written directly from FORMAT.md
vectors/ Binary .fitq conformance files (rows.fitq, ends.fitq, drafter.fitq) and EXPECTED.json
LICENSE Apache-2.0 licence for code and scripts (Copyright 2026 Morrowmake)
LICENSE-CC-BY-4.0 CC BY 4.0 licence for FORMAT.md and test vectors

Quick Start & Conformance Checks (CPU Only)

Requirements: Python 3.10+, a C99 compiler (cc), and numpy (for reader2).

1. Verify the C99 reference decoder and all 19 spec vectors

python3 check_spec.py FORMAT.md

Verify that a planted 1-bit corruption fails loudly (exits non-zero):

python3 check_spec.py --plant-fault FORMAT.md

2. Verify with the independent Python + NumPy reader

python3 reader2/fitq_golden.py --vectors FORMAT.md
python3 reader2/fitq_golden.py --check vectors/EXPECTED.json

Inspect any .fitq file or model folder directly:

python3 reader2/fitq_read.py vectors/rows.fitq --list

Implementing FITQ in Your Engine

Everything an inference engine needs to load, verify, and decode FITQ files is self-contained in FORMAT.md:

  1. Parse the 16-byte prefix and canonical JSON header (FORMAT.md §3–§4) and verify meta.signature, meta.source_files, and per-tensor payload digests.
  2. Implement the two small integer decoder families (t2–t3 and t3p5–t6, FORMAT.md §6) against the 19 normative C99 vectors via check_spec.py.
  3. Validate end-to-end tensor reconstruction (including Hadamard unrotation, plain8, int8row, packedrow, and generic drafter pairing) against vectors/EXPECTED.json.

FITQ is completely engine-agnostic — nothing in the container format, header schema, or trellis decoders depends on any specific runtime. Our Day-1 serving recipes (targeting TensorFold, with early CUDA and Apple Silicon Metal kernels) are rolling out over the next 24 hours, and additional engine integrations (llama.cpp, vLLM, SGLang, MLX, and others) are welcome. The standalone open-source FITQ quantizer/converter is currently being cleaned up and will be released shortly.


Licences

  • Specification (FORMAT.md) and test vectors (vectors/): Creative Commons Attribution 4.0 International (LICENSE-CC-BY-4.0), Copyright 2026 Morrowmake.
  • Reference C99 decoder, check_spec.py, and reader2/: Apache License 2.0 (LICENSE), Copyright 2026 Morrowmake.

Special Thanks

Developing and validating FITQ required a huge amount of GPU time across real hardware. A sincere thank you to @iotapi322, @CarlSandburg19, @blockshieldcom, @ashxhart and @MiguelCamba for generously letting us use their machines throughout development — this format genuinely would not have been possible without them.

Explore related projects

Loading…