filed under: intelligence close to you
Gyro TQ: How uncalibrated sub-2-bit weight quantization works
Standard low-bit quantizers either collapse below 3 bits per weight or spend hours fitting scales to a calibration text corpus. Gyro TQ compresses 128-weight blocks down to 1.125 to 3.625 bits per weight in a single data-free pass. It pairs a 128-wide block-Hadamard rotation with a 15-bit tail-biting trellis and one shared 8 KiB lookup table that fits inside CPU L1 and GPU shared memory.
1. Why standard low-bit quantization breaks on outliers
Large language model weights are mostly small numbers clustered near zero, punctuated by steep outlier channels 10 to 20 times larger than their neighbors. When a standard block quantizer assigns one scale factor to a block, the largest outlier stretches the rounding grid across the entire group. Gyro TQ solves this geometrically: before quantizing a single bit, it rotates every 128-weight block so outlier spikes spread evenly across all 128 coordinates while preserving exact dot products.
128-weight outlier smoothing and dot-product invariance
- Peak magnitude max|w|
- 9.400
- 2-bit grid step (4 levels)
- 6.267
- 2-bit uniform rounding RMSE
- 0.461
- Raw dot product w · x
- 0.000000
- Rotated dot product (T w) · (T x)
- 0.000000
- Float32 relative error
- 0.00e+0
s = [+1, -1, +1, +1] and H_4 / 2):
-
(a) Raw w
[8.00, 0.20, -0.20, 0.40]
max|w| = 8.00 -
(b) Sign-flipped s * w
[+8.00, -0.20, -0.20, +0.40]
signs [+1, -1, +1, +1] -
(c) Rotated H_4(s * w)/2
[+4.00, +3.90, +4.00, +4.30]
spike spread evenly -
(d) Unrotated
[8.00, 0.20, -0.20, 0.40]
exact inverse
Provenance: Transform definition from SPEC.md §4 (H_128 = H_2^(⊗7) / sqrt(128), self-inverse T^-1 = D_s H_128 = T^T). In-browser Float32 FWHT verification matches the WASM test suite invariant (relative error below 1e-6).
Existing sub-3-bit formats try to protect outlier channels by running a calibration pass over hundreds of sample prompts (an importance matrix, or imatrix) or by solving per-layer Hessians. That calibration step takes hours on large models, ties the quantized file to the domain of the calibration text, and still leaves bulky sub-block scale headers or multi-megabyte lookup tables that stall GPU memory bandwidth during token generation. Because the Hadamard rotation in Figure 1 is orthogonal and self-inverse, Gyro TQ eliminates calibration data completely.
2. The three-step Gyro TQ pipeline
Every Gyro TQ tensor row is partitioned into independent blocks of QK_GYRO = 128 contiguous weights. Encoding and decoding each 128-weight block uses three deterministic stages:
Step 1: Block-Hadamard rotation (T = H_128 D_s)
Each 128-weight block is multiplied by a deterministic pseudorandom sign vector s of +1 and -1 entries, followed by the normalized 128-by-128 Walsh-Hadamard transform H_128. The transform turns spiky coordinates into a tight bell-shaped distribution while preserving exact dot products: (T w) · (T x) = w · x.
Step 2: 15-bit tail-biting circular trellis
Rather than rounding each weight independently, an encoder searches a 32,768-state trellis over a circular bitstream where the ending state wraps back to match the starting state. At decode time, the kernel needs no search at all. It simply slides a 16-bit window by K bits per step and masks to 15 bits (s_t & 0x7FFF).
Step 3: 32-bit golden-ratio hash into a shared 8 KiB codebook
Each 15-bit trellis state is multiplied modulo 232 by the golden-ratio constant 0x9E3779B1. The top 22 bits of that product split into two 11-bit indices (idx0 and idx1, each 0..2047) that address two 2-D weight pairs inside a single 8,192-byte lookup table shared across all nine Gyro TQ formats.
15-bit tail-biting circular trellis and sliding-window state extraction
- Block header scale d (FP16)
- d = 1.0 (bytes 00 3c, 2 B)
- Circular bitstream qs[]
- 16 stream bytes (128 bits, K = 4 new bits/step, 11 shared state bits)
- Bit-window extraction rule
- off = (31 - 0) * 4 = 124 bits (bytes qs[15], qs[0], qs[1])
- 16-bit window and 15-bit state
- 0x8070 masked to 15 bits = 0x0070 (112)
- Codebook pair indices
- idx0 = 450, idx1 = 335
- Decoded step weights (SPEC §10)
- w[0..3] = [0.986816, 0.455322, -0.211914, 0.653809]
Provenance: Byte arrays and decoded outputs are computed live from the exact canonical test blocks in SPEC.md §10.1 (TQK4), §10.2 (TQ2_T), and §10.3 (TQP5).
32-bit golden-ratio hash and 2,048-point 2-D codebook lookup
- Input 15-bit state s
- 0x0070 (112)
- 32-bit product (s * 0x9E3779B1) mod 2^32
- 0x38453D70
- Bits 31..21 for idx0 (top 11 bits)
- 00111000010 (base 2) = 450
- Bits 20..10 for idx1 (next 11 bits)
- 00101001111 (base 2) = 335
- Bits 9..0 (low 10 bits)
- 0101110000 (base 2) = 368 (unused)
- Pair 0: (CB[2*idx0], CB[2*idx0+1])
- CB[900..901] = (0.986816, 0.455322)
- Pair 1: (CB[2*idx1], CB[2*idx1+1])
- CB[670..671] = (-0.211914, 0.653809)
- Scaled 4-weight quad d * pair
- [0.986816, 0.455322, -0.211914, 0.653809]
8 KiB (8,192 B)
32 to 128 KiB per core/SM
256 KiB to 4 MiB+
Provenance: The 4,096 FP16 values embedded in this page match SPEC.md §2.2 (SHA-256 587a5269c0fade0390fd44643f58e8aa91f17138b4739a19a6443016bc2e2f7a).
3. The nine Gyro TQ formats (GGUF types 144 to 152)
All nine formats share the same 128-weight block size, the same 2-byte FP16 scale header d, the same 15-bit state mask, and the same 8 KiB codebook. They differ only in how many new bits K advance the sliding window per trellis step and whether each step emits a 4-weight quad (32 steps per block, using both idx0 and idx1) or a 2-weight pair (64 steps per block, using idx0 only):
| Format | GGUF ID | Family | Step bits K | Steps / block | Weights / step | Payload B | Total block B | Effective bpw |
|---|---|---|---|---|---|---|---|---|
TQK4 |
151 |
Quad (32 steps) | 4 | 32 | 4 | 16 | 18 | 1.125 |
TQK5 |
152 |
Quad (32 steps) | 5 | 32 | 4 | 20 | 22 | 1.375 |
TQ1_T |
145 |
Quad (32 steps) | 6 | 32 | 4 | 24 | 26 | 1.625 |
TQK7 |
146 |
Quad (32 steps) | 7 | 32 | 4 | 28 | 30 | 1.875 |
TQ2_T |
144 |
Quad (32 steps, byte-aligned) | 8 | 32 | 4 | 32 | 34 | 2.125 |
TQP4 |
148 |
Pair (64 steps) | 4 | 64 | 2 | 32 | 34 | 2.125 |
TQP5 |
147 |
Pair (64 steps) | 5 | 64 | 2 | 40 | 42 | 2.625 |
TQP6 |
149 |
Pair (64 steps) | 6 | 64 | 2 | 48 | 50 | 3.125 |
TQP7 |
150 |
Pair (64 steps) | 7 | 64 | 2 | 56 | 58 | 3.625 |
Provenance: Format table from SPEC.md §1.2. Effective bits per weight equals (block_bytes * 8) / 128, which includes the 2-byte FP16 block scale d (0.125 bpw overhead). Notice that TQ2_T and TQP4 both occupy 34 bytes per block (2.125 bpw): TQ2_T uses byte-aligned 8-bit steps over 32 quads for maximum decode speed, whereas TQP4 uses 4-bit steps over 64 pairs for finer trellis granularity.
4. Validation: WASM reference kernels and rotation ablations
Two experimental checks verify the Gyro TQ design: bit-exact conformance of the reference WebAssembly kernels against the specification, and an ablation on a 0.8B tool-calling router showing why Hadamard rotation is essential when quantizing weights without a calibration set.
4.1 Bit-exact WebAssembly kernel verification
The reference WebAssembly implementation compiles the C99 reference decoder and fast Walsh-Hadamard transform into a 20,856-byte binary (gyro_tq.wasm) that runs identically in Node.js, Cloudflare Workers, and browsers. All five verification suites pass with zero discrepancies:
| Verification check | Target / input | Measured result | Status |
|---|---|---|---|
| Codebook SHA-256 digest | CODEBOOK[4096] (8,192 B) |
587a5269...bc2e2f7a |
Exact match (SPEC §2.2) |
Canonical block decode: TQK4 |
18-byte test block (SPEC §10.1) |
0 bit mismatches across 128 floats |
Bit-exact IEEE-754 F32 |
Canonical block decode: TQ2_T |
34-byte test block (SPEC §10.2) |
0 bit mismatches across 128 floats |
Bit-exact IEEE-754 F32 |
Canonical block decode: TQP5 |
42-byte test block (SPEC §10.3) |
0 bit mismatches across 128 floats |
Bit-exact IEEE-754 F32 |
| FWHT round-trip & dot-product invariance | 128-wide random Gaussian vectors | 2.89e-8 max error / 9.41e-8 rel dot error |
Well below 1e-6 F32 bound |
| Single-core WASM throughput (Node v22) | TQ2_T dequant + fused rotated dot |
537.5 M weights/s dequant / 237.4 M MAC/s dot |
Measured on a shared benchmark server CPU (Linux x86_64) |
Provenance: Measured by running node wasm/test_wasm.mjs against wasm/gyro_tq.wasm (compiled from ref/gyro_tq_ref.c and wasm/gyro_tq_wasm.c).
4.2 Why rotation matters: AWQ + Hadamard ablation on a 0.8B tool router
To isolate the effect of block-Hadamard rotation on sub-4-bit weights, we evaluated a fine-tuned Qwen3.5-0.8B router across a 111-turn tool-routing benchmark (49 tool-call turns, 62 plain-response turns, 24 candidate tools). Naive 4-bit round-to-nearest (RTN) quantization without rotation degrades overall routing accuracy by 6.3 percentage points and introduces 7 false tool-to-none hand-offs. Adding a 128-wide block-Hadamard rotation with activation-aware scaling recovers full FP16 overall accuracy (95.5%, matching 106/111 turns) while cutting weight memory by 3.37x:
| Configuration (Qwen3.5-0.8B router) | Weight MB | Overall (111) | Tool-call (49) | No-tool (62) | Tool to none errors | P50 latency |
|---|---|---|---|---|---|---|
FP16 baseline (uncompressed) |
1218.5 MB | 95.5% (106/111) | 95.9% (47/49) | 95.2% (59/62) | 0 | 72.9 ms |
W4-g128 RTN (no rotation, naive rounding) |
361.9 MB | 89.2% (99/111) | 81.6% (40/49) | 95.2% (59/62) | 7 | 73.8 ms |
W4-g128 Hadamard RTN (rotation only) |
361.9 MB | 87.4% (97/111) | 93.9% (46/49) | 82.3% (51/62) | 1 | 72.0 ms |
W4-g128 AWQ + Hadamard (rotated + scaled) |
361.9 MB | 95.5% (106/111) | 93.9% (46/49) | 96.8% (60/62) | 1 | 65.0 ms |
W3-g128 AWQ + Hadamard (sub-3-bit uniform) |
286.3 MB | 73.0% (81/111) | 71.4% (35/49) | 74.2% (46/62) | 12 | 65.3 ms |
Provenance: Measured on NVIDIA L4 GPU in benchmarks/qwen08b_quant_eval/results.json. Notice the last row: when uniform scalar rounding is pushed down to 3 bits (W3-g128), even AWQ + Hadamard drops to 73.0% because independent scalar grids lose too much volume efficiency below 3 bits. That breakdown is why Gyro TQ replaces independent scalar rounding with a 15-bit tail-biting trellis over 2-D codebook pairs.
4.3 Damped AWQ + Hadamard calibration: solving post-rotation variance flattening
When optional calibration activations are available, feeding a standard diagonal importance vector (imatrix) into the trellis after a 128-wide block-Hadamard rotation fails. Because every entry of H_128 has magnitude 1/sqrt(128), the rotated diagonal second moment inside each 128-weight block collapses to the block average. On a heavy-tailed 32 x 768 LLM layer with Pareto channel scales and 16 outlier channels up to 15x, block-Hadamard rotation flattens within-block importance variation from a coefficient of variation of CV = 8.12 down to 0.054.
Gyro TQ resolves this by applying a damped AWQ channel pre-scale s_j = (E[x_j^2])^alpha with exponent alpha in [0.25, 0.30] on the calibration activations X_cal before the block-Hadamard rotation, paired with a per-row calibration-loss selector (min(cal_loss)). Across TQK6 through TQP5, damped AWQ + Hadamard beats both uncalibrated Hadamard and unrotated imatrix:
| Format (bpw) | Uncalibrated unrotated MSE | Uncalibrated Hadamard MSE | Unrotated imatrix MSE | Undamped AWQ (alpha=0.50) | Damped AWQ + Hadamard (alpha=0.25..0.30) | With per-row selector |
|---|---|---|---|---|---|---|
TQK4 (1.125 bpw) |
112.56 | 105.31 | 14.53 | 55.57 | 26.15 (alpha=0.30) | 12.48 (-14.1% vs imatrix) |
TQK6 (1.625 bpw) |
112.56 | 69.41 | 11.45 | 28.95 | 10.71 (-6.5% vs imatrix) | 7.66 (-33.1% vs imatrix) |
TQ2_T (2.125 bpw) |
62.14 | 30.00 | 9.99 | 14.34 | 4.70 (-53.0% vs imatrix) | 4.22 (-57.8% vs imatrix) |
TQP5 (2.625 bpw) |
31.58 | 15.93 | 9.33 | 7.00 | 2.19 (-76.5% vs imatrix) | 2.19 (alpha=0.25) |
Provenance: Measured on disjoint 512-sample calibration and 512-sample validation splits in step3_alpha_sweep.json (SHA256SUMS 68a87b1b...). At TQP5 (alpha = 0.25), validation activation MSE drops to 2.19, which is 76.5% lower than unrotated imatrix, 85.6% lower than uncalibrated Hadamard, and 93.1% lower than uncalibrated unrotated quantization.
4.4 Vector store compression on Flickr8k-1k (EmbeddingGemma 2)
Gyro TQ also compresses dense embedding indexes for local retrieval. On the 1,000-image Flickr8k-1k benchmark encoded with EmbeddingGemma 2 (768d float32 baseline at 3,072 B/vec, and Matryoshka 256d), pairing a 128-wide block-Hadamard rotation with TQ2_T shrinks vectors by 15.1x (to 204 B/vec at 768d) and 45.2x (to 68 B/vec at 256d) while preserving or exceeding float32 retrieval accuracy:
| Index configuration | Bytes / vec | Size vs 768d fp32 | Image R@1 | Image MRR | Caption R@1 | Caption MRR |
|---|---|---|---|---|---|---|
768d fp32 baseline |
3,072 B | 1.0x | 0.80 | 0.8581 | 0.71 | 0.8078 |
768d + Hadamard-128 + TQ2_T (hadamard128_uncal) |
204 B | 15.1x smaller | 0.79 | 0.8519 | 0.74 (+3 pts) | 0.8199 |
768d + Hadamard-128 + TQ2_T (hadamard128_coco10k_imp) |
204 B | 15.1x smaller | 0.81 (+1 pt) | 0.8565 | 0.74 (+3 pts) | 0.8176 |
Matryoshka 256d int4 baseline |
132 B | 23.3x smaller | 0.73 | 0.8116 | 0.66 | 0.7685 |
Matryoshka 256d + TQ2_T (half the bytes of 256d int4) |
68 B | 45.2x smaller | 0.77 (+4 pts vs int4) | 0.8244 | 0.71 (+5 pts vs int4) | 0.7932 |
Provenance: Measured in gyro-tq-local-embed/2026-10-25/results.json (SHA256SUMS 56e8480e...) with disjoint COCO-10k calibration anchors. At 768d + Hadamard-128 + TQ2_T (hadamard128_uncal), cosine similarity reaches 0.9634 and dot-product MSE drops to 0.00045 (5.1x lower than unrotated 0.00231). Code inspection of src/tq_ref.c:362 explains why rotation is essential before importance weighting on embeddings: without Hadamard, w_importance inflates the Viterbi scale-search anchor sigma = sqrt(swxx / sw) by 2x to 3x at TQK4 and underflows non-peak coordinates, whereas Hadamard-128 equalizes block energy and cuts dot-product MSE by 50% to 80%.
4.5 Sub-millisecond 768x6 decision router head in WebAssembly
For lightweight local routing, we quantized a frozen 768x6 decision router head (recipe 20cd2cf5, 18,432 B in float32) and benchmarked full WebAssembly dequantization plus the 6x768 dot product in V8. A complete router evaluation takes 13.84 µs (0.014 ms) per query inside the standalone 9,271-byte WebAssembly module:
| 768x6 decision router head | Weight bytes | Compression | 300-row OOF | 406-row OOF | 116-row held-out evaluation set | Extra tool-to-none errors |
|---|---|---|---|---|---|---|
FP32 baseline (20cd2cf5) |
18,432 B | 1.0x | 297 / 300 (99.0%) | 386 / 406 (95.1%) | 87 / 116 (75.0%) | 0 (baseline) |
TQK6 (1.625 bpw, Hadamard-128) |
936 B | 19.7x smaller | 297 / 300 (99.0%) | 385 / 406 (94.8%) | 88 / 116 (75.9%) | 0 |
TQ2_T (2.125 bpw, calibrated) |
1,224 B | 15.1x smaller | 297 / 300 (99.0%) | 385 / 406 (94.8%) | 87 / 116 (75.0%) | 0 |
TQP5 (2.625 bpw, AWQ + Hadamard) |
1,512 B | 12.2x smaller | 297 / 300 (99.0%) | 388 / 406 (+2 vs float) | 87 / 116 (75.0%) | 0 |
Provenance: Measured in V8 WebAssembly and C11 reference harnesses in gyro-tq-local-embed/2026-10-25/results.json. Full WASM dequantization plus the 6x768 dot product runs in 13.84 µs (0.014 ms) per query with zero additional tool-to-none errors across all three quantized formats.
5. Real-world memory cliffs: what fits in consumer RAM and VRAM
Token generation in local LLMs is memory-bandwidth bound: every generated token must stream all active model weights from RAM or VRAM into the compute units. Crossing a hardware memory boundary forces weights to spill over PCIe or SSD swap and drops throughput by an order of magnitude. By compressing weights to 1.125 to 2.125 bpw with uncalibrated model files, Gyro TQ shifts frontier model classes down by one full hardware tier:
| Model class | FP16 (16 bpw) | Q4_K_M (~4.8 bpw) | Gyro TQ2_T (2.125 bpw) | Gyro TQK4 (1.125 bpw) | Hardware tier reached by Gyro TQ |
|---|---|---|---|---|---|
| 8B dense | 16.0 GB | 4.8 GB | 2.13 GB | 1.13 GB | Fits inside browser WASM / WebGPU memory and 4 GB mobile RAM |
| 32B dense | 64.0 GB | 19.2 GB | 8.50 GB | 4.50 GB | Fits comfortably on a 12 GB or 16 GB consumer GPU with KV cache |
| 70B dense | 140.0 GB | 42.0 GB | 18.59 GB | 9.84 GB | TQ2_T fits on a single 24 GB GPU; TQK4 fits on a 16 GB laptop |
| 120B MoE / dense | 240.0 GB | 72.0 GB | 31.88 GB | 16.88 GB | TQ2_T runs in 36 to 48 GB unified memory; TQK4 fits on a 24 GB GPU |
| 405B frontier | 810.0 GB | 243.0 GB | 107.58 GB | 56.95 GB | TQ2_T fits on a 128 GB workstation; TQK4 fits on a 64 GB Mac |
Provenance: Weight footprints are analytical estimates from bits_per_weight * parameter_count / 8 using exact Gyro TQ block sizes from SPEC.md §1.2 (excluding unquantized embedding/norm tensors and runtime KV cache).
6. What is in the open release, and what is not there yet
We check new formats so we can separate what works today from what still needs engineering:
Open and ready to use today (Apache License 2.0)
The complete Gyro TQ v1.1 format specification (SPEC.md, GGUF types 144..152), the dependency-free C11 reference encoder and decoder (ref/gyro_tq_ref.h and ref/gyro_tq_ref.c), the bit-exact 9,271-byte WebAssembly module (wasm/gyro_tq.wasm), the reproducible verification harness (wasm/test_wasm.mjs), and the 18-column GGUF type registry table are published in this folder and verified to 0 IEEE-754 float32 bit mismatches.
Calibrated rotation recipes (when data-free is not enough)
Uncalibrated block-Hadamard rotation (H_128 D_s) is ready out of the box for weight compression and dense vector indexes. When optional calibration activations are available on heavy-tailed layers, feeding a standard unrotated imatrix into the trellis after rotation fails because Hadamard flattens within-block variance (CV: 8.12 -> 0.054). Use the damped AWQ pre-scale recipe (alpha in [0.25, 0.30] before rotation with a per-row calibration-loss selector, Section 4.3) instead.
Native runtime kernel integration
The open C11 and WebAssembly kernels on this page provide the bit-exact specification reference and fast browser/edge execution (537.5 M weights/s single-core WASM decode, 13.84 µs per 768x6 router query). Fused Metal and CUDA decode kernels inside upstream llama.cpp and heterogeneous memory schedulers (such as our Strata runtime architecture) build on top of this specification and are benchmarked separately.
7. Words used on this page
- Block-Hadamard rotation (
H_128 D_s) - A fast orthogonal mixing transform applied to 128 weights at a time using only additions, subtractions, and a
1/sqrt(128)scale. It spreads any single outlier spike evenly across all 128 positions without changing dot products. - BPW (bits per weight)
- The average number of storage bits consumed by each neural network parameter, including block scale headers. For a 128-weight Gyro TQ block of
Bbytes,bpw = (B * 8) / 128. - Calibration dataset / imatrix
- A sample text corpus run through a model during conventional quantization to measure which weights matter most. Gyro TQ requires no calibration dataset and produces uncalibrated model files directly from the weights.
- Codebook (
CODEBOOK[4096]) - The fixed 8,192-byte lookup table of 2,048 two-dimensional coordinate pairs (4,096 FP16 numbers) shared by every Gyro TQ format. Its 8 KiB footprint stays hot in L1 cache or GPU shared memory.
- Multiplicative hash (
0x9E3779B1) - A single 32-bit unsigned integer multiplication derived from the golden ratio that scatters sequential 15-bit trellis states evenly across pairs of 11-bit codebook indices (
idx0andidx1). - Tail-biting circular trellis
- A sliding-window bitstream where the final step wraps around to the first byte of the block so the starting and ending 15-bit states match, avoiding boundary bit waste.
Want tools that keep your files and keys on your own devices? Pastel Cloud is coming soon. Private spreadsheets first, on your machines, shared only with the people you choose. Join the Pastel Cloud waitlist.