SQuat: Subspace-orthogonal KV Cache Quantization

Hao Wang, Ligong Han, Kai Xu, Akash Srivastava

TL;DR

This paper introduces SQuat, a novel KV cache quantization method that preserves crucial task-related information by ensuring quantized key tensors' residuals are orthogonal to query tensor subspaces. SQuat significantly reduces memory usage and speeds up LLM inference without requiring model fine-tuning, outperforming existing methods on various benchmarks.

What Problem Does This Paper Address?

Large Language Models (LLMs) are computationally expensive, especially during inference. To speed up auto-regressive decoding, LLMs use a Key-Value (KV) cache to store previously computed attention information, avoiding redundant calculations. However, this cache consumes significant GPU memory and can be a bottleneck. Existing methods compress KV tensors to lower bit representations (quantization) to save memory. The problem is that these compression-based methods often lead to quantization errors that accumulate over time, potentially degrading the quality of the generated output and misaligning it with user queries. The authors aim to address this by developing a quantization method that minimizes these errors' impact on the LLM's core functionality.

Methods

SQuat introduces a novel approach to KV cache quantization by focusing on preserving task-relevant information. The core idea is to construct a "subspace" using query tensors from the input prompt. This subspace captures the most critical information for answering the user's query. When quantizing key tensors, SQuat enforces that the difference between the original and quantized key tensors (the residual) is orthogonal to this query subspace. This orthogonality is key to minimizing the impact of quantization errors on the attention mechanism's output.

The method involves:

  1. Query Subspace Construction: Singular Value Decomposition (SVD) is applied to query tensors from prompt tokens to identify a low-dimensional subspace that captures essential task information.
  2. Subspace-Orthogonal Quantization: An iterative algorithm quantizes key tensors. At each step, a block of elements is quantized, and the remaining elements are updated to ensure the quantization residual is orthogonal to the query subspace. This is formulated as a constrained optimization problem.
  3. Theoretical Framework: The authors develop a theoretical framework to ground their approach, proving that preserving orthogonality to the query subspace is crucial for maintaining attention output fidelity.

SQuat requires no model fine-tuning or additional calibration data, making it practical for deployment.

Datasets

The paper evaluates SQuat on several benchmark families:

  • Reasoning Tasks (LM-Eval): Includes GSM8k, MMLU_Pro_Math, MMLU_Pro_Law, IFEval, GPQA, and BBH. These tasks are known for requiring multi-step reasoning.
  • Long-Context Tasks (LongBench): Includes Qasper, QMSum, MultiNews, TREC, TriviaQA, SAMSum, LCC, and RepoBench-P. These tasks focus on document-level question answering and summarization.
  • Semi-Synthetic Setup: Used for Figure 2 to analyze query tensor deviations from subspaces.

The paper does not introduce new datasets but uses established benchmarks to evaluate its method.

Key Insights and Ideas

  • Orthogonality is Key: The most critical insight is that simply minimizing the difference between original and quantized key tensors (as in compression-based methods) is insufficient. Preserving the orthogonality of quantization residuals to the query tensor subspace is crucial for maintaining attention scores and, consequently, model output quality.
  • Query Subspace as a Guide: Query tensors, even from just the prompt, reveal a low-dimensional subspace that effectively guides the quantization process, allowing for informed error minimization.
  • No Fine-Tuning Needed: The method's ability to achieve strong results without any model fine-tuning or calibration data is a significant practical advantage, making it readily applicable to existing LLMs.
  • Theoretical Justification: The paper provides a theoretical foundation for why subspace-orthogonal quantization works, strengthening the empirical findings.

Key Results

SQuat demonstrates significant improvements in efficiency and performance:

  • Memory Reduction: Reduces peak GPU memory usage by 2.17× to 2.82× compared to FP16.
  • Throughput Improvement: Achieves a throughput improvement of 2.45× to 3.60× compared to FP16.
  • Performance: Outperforms existing tuning-free KV cache quantization baselines on both reasoning and long-context tasks, achieving nearly lossless performance compared to FP16. For example, on GSM8k, GPQA, and BBH, SQuat consistently outperforms baselines.
  • Efficiency: SQuat's efficiency is comparable to other methods like KIVI, while offering better performance preservation.

Limitations and Future Work

Limitations: * The paper notes that while SQuat performs well, its configuration (specifically, the choice of hyperparameters like $\lambda$ and $r$) might not always achieve the absolute best score on every single task (e.g., GSM8K in the ablation study). However, the chosen default configuration provides strong and consistent performance across various tasks and models. * The current implementation quantizes key tensors element-by-element or block-by-block. While efficient, further optimization might be possible.

Future Work: * Investigating Latent Attention: Many recent LLMs use compressed latent vectors instead of direct KV caches. Future work could explore quantizing these latent vectors and understanding the impact on model performance. * Theoretical Analysis of Trade-offs: Further theoretical examination of how reducing KV cache size (through quantization or pruning) affects latency, memory usage, and throughput is needed. * Optimal Trade-offs: Identifying optimal trade-offs between compression rates and model performance for specific tasks could lead to more efficient model deployment strategies. * Extending to Other Architectures: While focused on transformers, exploring the applicability of SQuat's principles to other architectures could be beneficial.

Summary updated

BibTeX
@inproceedings{wang2025squat,
  author = {Hao Wang and Ligong Han and Kai Xu and Akash Srivastava},
  title = {{SQuat: Subspace-orthogonal KV Cache Quantization}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=gKdhzBiHay},
}
Figure