- Updated: June 18, 2026
- 7 min read
Hurwitz Quaternion Multiplicative Quantization for KV Cache Compression
Direct Answer
Hurwitz Quaternion Multiplicative Quantization (HQMQ) is a calibration‑free technique that compresses the key‑value (KV) cache of large language models by representing 4‑element vectors as quaternions and quantizing their direction through a product of a fixed Hurwitz group codebook and a lightweight per‑layer random codebook. The method delivers up to 5× KV‑cache reduction while preserving near‑fp16 perplexity, making it a practical solution for extending context windows and lowering memory footprints in production LLM deployments.
Background: Why This Problem Is Hard
Modern large language models (LLMs) rely on an attention mechanism that stores intermediate key and value tensors for every token in a KV cache. As context lengths grow to 64k or 128k tokens, the cache can dominate GPU memory, forcing engineers to truncate prompts, offload to slower storage, or provision prohibitively large hardware.
Existing compression approaches face three intertwined challenges:
- Calibration overhead: Many quantization schemes require a calibration pass on representative data to tune scale factors, adding latency to deployment pipelines.
- Outlier sensitivity: KV tensors often contain heavy‑tailed distributions; static integer quantizers (e.g., int4) collapse under outliers, causing perplexity spikes of 10⁴+.
- Codebook efficiency: Traditional product quantization needs large codebooks to achieve low bit‑rates, inflating storage and lookup costs.
These limitations make it difficult for enterprises to run long‑context LLMs on commodity GPUs while maintaining the quality required for downstream tasks such as retrieval‑augmented generation, multi‑turn agents, or real‑time chat.
What the Researchers Propose
The authors introduce Hurwitz Quaternion Multiplicative Quantization (HQMQ), a two‑stage, calibration‑free quantizer that exploits the geometric properties of quaternions:
- Quaternion framing: Every consecutive group of four scalar values in a KV tensor is interpreted as a quaternion, a four‑dimensional unit vector on the 3‑sphere (S³).
- Hurwitz group base: The first codebook consists of the 24 vertices of the 24‑cell (the Hurwitz group 2T). These points are evenly spaced with a 60° angular separation, providing a uniform directional scaffold.
- Secondary random codebook: For each (layer, head) pair, a small set of S random unit quaternions is generated once and stored. Multiplying a Hurwitz base quaternion by a secondary quaternion yields
24 × Seffective directions while only storingSparameters. - Median‑multiplier outlier handling: A per‑batch median multiplier extracts extreme values (C=3) without any calibration step, preserving robustness for outlier‑heavy architectures.
By treating quantization as a multiplicative operation on the 3‑sphere, HQMQ sidesteps the need for learned scale factors and achieves a high‑density codebook with minimal storage overhead.
How It Works in Practice
The HQMQ pipeline can be broken down into three logical stages that fit cleanly into existing model serving stacks:
1. Pre‑processing and Quaternion Mapping
- KV tensors are sliced into 4‑element chunks.
- Each chunk is normalized to unit length, yielding a quaternion q.
2. Multiplicative Quantization
- Find the nearest Hurwitz base quaternion qₚ (24 candidates).
- Search the per‑layer random codebook for the secondary quaternion qₛ that minimizes the angular distance to qₚ⁻¹ · q.
- Store the indices (one 5‑bit value for qₚ, plus ⌈log₂ S⌉ bits for qₛ) alongside a shared magnitude scalar derived from the median‑multiplier step.
3. De‑quantization at Inference
- Reconstruct the unit quaternion by multiplying the retrieved qₚ and qₛ.
- Rescale using the stored magnitude to recover the original KV values.
- Feed the de‑quantized KV cache back into the attention module without any additional runtime overhead.
What sets HQMQ apart is that the heavy lifting—searching the Hurwitz group and the random codebook—occurs once during cache compression. At inference time, the lookup is a simple table fetch and a quaternion multiplication, both of which are cheap on modern GPUs.
Evaluation & Results
The authors benchmarked HQMQ on five contemporary open‑source LLMs, covering dense multi‑head attention (MHA), grouped query attention (GQA), and sparse mixture‑of‑experts (MoE) architectures:
| Model | Architecture | Cache Size (128k tokens) | Baseline (fp16) | HQMQ @ ~5 bits | Int4 (naïve) | KIVI‑4 (calibrated) |
|---|---|---|---|---|---|---|
| Mistral‑7B | Dense MHA | 43 GB | Perplexity 8.12 | 8.14 (+0.02) | +10 000 ppl | 8.20 (+0.08) |
| Llama‑3‑8B | Dense GQA | 38 GB | Perplexity 7.95 | 7.98 (+0.03) | +9 800 ppl | 8.02 (+0.07) |
| Qwen2.5‑7B | Dense GQA | 36 GB | Perplexity 7.88 | 7.90 (+0.02) + Med3× | +12 300 ppl | 7.96 (+0.08) |
| Qwen3‑8B | Dense GQA | 40 GB | Perplexity 7.80 | 7.82 (+0.02) | +11 500 ppl | 7.87 (+0.07) |
| gpt‑oss‑20b | Sparse MoE | 55 GB | Perplexity 7.70 | 7.73 (+0.03) | +13 200 ppl | 7.78 (+0.08) |
Key takeaways from the experiments:
- Perplexity preservation: Across all models, HQMQ stays within 0.02–0.10 perplexity points of fp16, a margin indistinguishable in most downstream tasks.
- Bit‑rate efficiency: HQMQ achieves comparable quality to calibrated KIVI‑4 while using roughly 16 % fewer bits (3.79 bits vs. ~4.5 bits).
- Compression ratio: For a 128k‑token Llama‑3‑70B cache, HQMQ reduces storage from 43 GB to 8.5 GB, a 5.05× shrinkage.
- Outlier robustness: The median‑multiplier step (C=3) eliminates the catastrophic degradation seen in naïve int4 quantization, especially for MoE models.
Beyond perplexity, the authors evaluated zero‑shot performance on benchmarks such as CoQA, TruthfulQA, and GSM8K. HQMQ matched fp16 accuracy within 1 point on CoQA, 0.6 points on TruthfulQA, and 2.3 points on GSM8K, confirming that the compression does not erode reasoning or factual recall.
Why This Matters for AI Systems and Agents
For engineers building AI agents, retrieval‑augmented pipelines, or long‑form generation services, KV cache size is a hard constraint that directly translates into hardware cost and latency. HQMQ offers three concrete benefits:
- Extended context windows on existing GPUs: By shrinking the cache, developers can double or triple the number of tokens processed without upgrading hardware, enabling richer multi‑turn dialogues and deeper document analysis.
- Lower operational expenditure: A 5× reduction in memory footprint reduces the number of required GPU instances, cutting cloud spend and carbon footprint.
- Simplified deployment pipelines: The calibration‑free nature eliminates a separate data‑collection step, allowing continuous integration workflows to push new model versions faster.
These advantages align directly with the capabilities of the Enterprise AI platform by UBOS, where KV‑cache compression can be toggled as a plug‑in to existing model serving stacks. Teams that already use ChatGPT and Telegram integration for real‑time assistants will see immediate latency improvements when the underlying LLM runs with HQMQ‑compressed caches.
What Comes Next
While HQMQ sets a new baseline for KV‑cache efficiency, several avenues remain open for exploration:
- Adaptive codebook sizing: Dynamically adjusting the secondary random codebook size
Sper layer could further balance compression against quality for heterogeneous workloads. - Hardware‑aware implementations: Custom CUDA kernels that fuse quaternion multiplication with de‑quantization could shave microseconds off per‑token latency.
- Cross‑modal extensions: Applying multiplicative quaternion quantization to vision‑language models or multimodal token caches may unlock similar memory savings.
- Integration with orchestration tools: Embedding HQMQ into the Workflow automation studio would let data scientists experiment with compression ratios as part of automated model evaluation pipelines.
Future research could also investigate whether the Hurwitz group’s 24‑cell geometry can be replaced or augmented by other highly symmetric point sets on S³, potentially increasing the effective codebook without extra storage.
For startups looking to prototype long‑context agents, the UBOS for startups page outlines a low‑cost entry point that now includes optional HQMQ support, making it feasible to launch sophisticated assistants on a single GPU.
Conclusion
Hurwitz Quaternion Multiplicative Quantization delivers a calibration‑free, outlier‑robust, and storage‑efficient solution for KV‑cache compression. By leveraging the algebraic structure of quaternions and the uniformity of the Hurwitz group, the method achieves near‑fp16 quality at roughly 3.8 bits per value, translating into up to 5× memory savings. The results demonstrate that high‑dimensional geometric quantization can replace traditional integer schemes without sacrificing downstream performance, opening the door for longer context windows, cheaper inference, and more responsive AI agents.
As LLMs continue to scale, techniques like HQMQ will become essential building blocks in the AI infrastructure stack, enabling enterprises to extract maximal value from existing hardware while keeping operational costs in check.
References
- Swain, K., Han, S., Weidele, D. K. I., Martino, M., Cox, D., & Torralba, A. (2026). Hurwitz Quaternion Multiplicative Quantization for KV Cache Compression. arXiv preprint arXiv:2605.27646.
- Additional background on quaternion algebra and the Hurwitz group can be found in standard mathematical texts on hypercomplex numbers.
Illustration
The diagram below visualizes the 24‑cell geometry (the Hurwitz group) on the 3‑sphere, illustrating how each base quaternion combines with a random secondary quaternion to span the full codebook.

Take Action
Ready to experiment with KV‑cache compression in your own deployments? Visit the UBOS homepage to explore our platform, or check out the pricing plans for a solution that scales with your needs.
Andrii Bidochko
CTO UBOS
Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.