Expand description
Walsh–Hadamard transform helpers for TurboQuant-style KV compression.
Host FWHT + group quant; Metal FERROX_CTK=turbo4 stores the 4-bit
groups (WHT optional on host upload). turbo8 aliases ggml Q8_0 on Metal.
Algorithm follows the public TurboQuant line (randomized Hadamard +
per-group scale).
In-place FWHT on x of length n = 2^k. Output is unnormalized
(each butterfly is a+b, a-b); callers that need orthonormal
Hadamard divide by sqrt(n).
Functions§
- dequantize_
turbo4_ groups - Inverse of
quantize_turbo4_groups(ignores WHT; dequant only). - fwht_
inplace - In-place Fast Walsh–Hadamard Transform.
x.len()must be a power of two. - fwht_
orthonormal_ inplace - Orthonormal FWHT:
fwht_inplacethen scale by1/sqrt(n). - quantize_
turbo4_ groups - Per-group absmax quantize after optional WHT (turbo4-style sketch).