veloxquant_mlx.cache.spectral_cache module¶
SpectralQuantKVCache: KV cache backed by SpectralQuant.
Matches the KVCache interface used by TurboQuantKVCache. Keys are compressed with SpectralQuant (spectral rotation + selective QJL + per-group codebooks). Values are compressed identically.
- class veloxquant_mlx.cache.spectral_cache.SpectralQuantKVCache(config)[source]¶
Bases:
KVCacheKV cache backed by SpectralQuant for both key and value compression.
Keys are compressed with a SpectralQuantizer using the key eigenvectors. Values are compressed with a separate SpectralQuantizer using the value eigenvectors (which have d_s ≈ 50 rather than ≈ 4).
Call calibrate(rotations) after construction to inject the per-layer rotation matrices from calibrate_spectral_rotation(). Without calibration the quantizers fall back to random orthogonal rotation (equivalent to TurboQuant without QJL).
- Parameters:
config (
Any) – KVCacheConfig with method=’spectral’.