关于
FITQ (Fewest-Instruction Trellis Quantization) — open format specification, C99/Python reference decoders, and conformance vectors
人工智能与机器学习实测星标增长
- 24小时
- +13
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文FITQ — Fewest-Instruction Trellis Quantization
by Morrowmake
Smaller. Faster. Sharper. Everywhere.
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
.fitqcheckpoints) 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:
- Fast, branchless, lookup-table-free unpacking (
~0.97ops/weight at 3-bit,~1–2ops across2–6bits): 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 (compare5.26ops/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. - Direct
INT8output (2×matrix-unit compute across every major GPU vendor, virtually lossless vs.BF16): Instead of dequantizing weights back toFP16/BF16, FITQ unpacks straight into packedINT8ready for native 8-bit integer matrix multiplication — where NVIDIA Tensor Cores (mma.sync), Apple SiliconMetal 4matrix units, AMD RDNA 4 / CDNA (WMMA/MFMA, e.g.Radeon AI PRO R9700:383INT8 TOPS vs191FP16 TFLOPS), and IntelXe2(XMX, e.g.Arc Pro B70:367INT8 TOPS vs183.5FP16 TFLOPS) all deliver 2× higher throughput thanFP16/BF16. Because FITQ applies Hadamard rotations to spread outlier channels evenly across every vector,INT8matrix math is virtually lossless compared toBF16— 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). - 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, orplain8), 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. - Self-verifying, portable model folders with generic speculative drafters:
Every
.fitqfile carries per-tensor SHA-256 digests, a provenance-independentweights_sha256, a whole-header signature, and integrity checks over byte-exact copies ofconfig.json, tokenizer files, andLICENSE. 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.
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):
| 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:
Qwen3.8-Flash-Next(114.09 GBvsEXL3at114.19 GB— equal disk size):-15.8%lower overall forward KL across7 / 7domain types and-16.2%overall (-19.0%per-document average) across6 / 6external domains (182 / 240item wins,-38.2%fewer high-confidence token flips atp ≥ 0.90), while hitting81.10%onMBPP+,80.41%onBFCL v3(+0.59 ppover BF16), and90.66%onGPQA Diamond 64K.Inkling-2-Mini(15.90 GBvsTFQ3at16.76 GB—5.1%smaller):-26.9%lower overall forward KL across6 / 6open domains and-14.7%across6 / 6external domains (217 / 240wins,98.40%top-1 agreement), ranking #1 on bothMBPP+(75.75%) andBFCL 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 (
FITQmagic, containerversion = 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 matricesint8row— 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), andt6(6.0 bpw) — all decoding 4INT8weights per step using only 32-bit integer arithmetic. - Model folders: A converted model is a folder holding a single
*.fitqfile (such asmodel.fitqor a publisher-named file like<Model>-FITQ-<bpw>bpw-<Publisher>.fitq) alongside verified copies ofconfig.json, tokenizer files,fitq_stats.json, andLICENSE. Folders with multiple.fitqfiles 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:
- Parse the 16-byte prefix and canonical JSON header (
FORMAT.md§3–§4) and verifymeta.signature,meta.source_files, and per-tensor payload digests. - Implement the two small integer decoder families (
t2–t3andt3p5–t6,FORMAT.md§6) against the 19 normative C99 vectors viacheck_spec.py. - Validate end-to-end tensor reconstruction (including Hadamard unrotation,
plain8,int8row,packedrow, and generic drafter pairing) againstvectors/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, andreader2/: 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.
探索相关项目
加载中…