Analysis

Published

TurboQuant: a technical analysis of vector and KV-cache quantization

BY

Jin Tan Ruan

Jin Tan Ruan

TurboQuant compresses the key-value cache to reduce memory use during inference. The method rotates cached vectors before quantizing them, then uses a one-bit correction to estimate attention scores. At three bits per value, the encoded data alone takes about one-fifth of the space required at 16 bits. Actual memory savings also depend on metadata and packing, and faster attention calculations alone do not establish how much faster a model generates text.

Fine black grid lines forming overlapping waves on a light background.

Abstract

TurboQuant combines scalar quantization with a residual correction for inner-product estimation. This analysis separates the bit budget, storage overhead, and kernel benchmark conditions. Compression ratios and attention-logit speedups depend on configuration and do not establish an equivalent end-to-end generation speedup.

TurboQuant uses a data-oblivious scalar MSE quantizer and, for inner-product estimation, a QJL residual correction. This article follows the cited paper's v1 construction. PolarQuant is a related polar-coordinate method and is not the scalar MSE stage described here.

Introduction

Every large language model carries a cost that is easy to overlook: the key-value cache. As context windows stretch to hundreds of thousands of tokens, the KV cache - the memory structure that stores attention keys and values from all prior tokens - becomes the dominant memory bottleneck during inference, ahead of both the model weights and the activations.

For a model such as Gemma, Llama, or Mistral serving a 128K-token context, the KV cache alone can consume tens of gigabytes of HBM per request. That memory could otherwise hold another concurrent user, another batch element, or another model entirely. Every gigabyte of KV cache is a gigabyte that is unavailable for throughput.

TurboQuant quantizes vectors without fitting a model-specific codebook. Its reported results use different bit budgets and baselines. The cited H100 speedup concerns 4-bit attention-logit computation against FP32 keys, rather than end-to-end token generation.

Key quantization targets query–key inner products. Value quantization also needs to control reconstruction error because attention combines value vectors using the attention weights. The two objectives require separate accounting.

This article provides a technical walkthrough of how TurboQuant works, why it works, and what it implies for LLM inference infrastructure and beyond.

Problem: Why KV Cache Compression Is Harder Than Weight Quantization

Weight quantization is a sufficiently solved problem. Weights are static: they are quantized once, offline, with ample time for calibration. Techniques such as GPTQ, AWQ, and SqueezeLLM can compress model weights to 4 or even 3 bits with minimal degradation.

KV cache quantization is fundamentally different, and harder, for three reasons, which are set against weight quantization in Figure 1:

  • Quantization must be online. KV entries are generated token-by-token during inference, so a calibration pass cannot be run over data that has not yet been seen. The quantizer must compress each vector as it arrives, with no knowledge of future tokens.

  • The distribution shifts constantly. Unlike weights, which have stable distributions per layer, KV cache vectors exhibit per-token, per-head, per-layer distribution variation. A quantizer tuned to one distribution is suboptimal for the next token.

  • Keys and values have different roles. Query–key inner products determine attention scores, while the weighted value vectors determine the attention output. Small key reconstruction error alone does not establish accurate attention scores or downstream outputs.

Previous approaches such as KIVI (which quantizes keys and values separately with per-channel scaling) achieve reasonable compression at 4 bits but struggle at 3 bits and below. The core limitation is that conventional quantizers require per-block normalization (computing min/max or scale/zero-point for each block of values), which adds overhead and does not address inner product bias.

Weight versus KV-cache quantization
Figure 1. Weight quantization and KV cache quantization compared on the properties described in this section.

Approach: Rotate, Quantize, Correct

TurboQuant's architecture is a two-stage pipeline with a simple structure, shown in Figure 2:

  • Stage 1: scalar MSE quantization. Rotate the normalized input and encode each coordinate with a precomputed scalar codebook. This stage does not perform a polar-coordinate conversion.

  • Stage 2: QJL correction. Encode the reconstruction residual with random-projection sign bits and retain its magnitude for the correction. The estimator is unbiased under the paper's assumptions.

For a corrected-key payload budget B per coordinate, the scalar stage uses B − 1 bits and QJL uses one sign bit. Vector norms, residual magnitude, and storage packing require additional accounting. Value-cache storage is separate.

The following sections describe each stage.

TurboQuant v1 schematic: random rotation and scalar MSE reconstruction, residual QJL sign encoding with retained magnitude, and a corrected inner-product estimate. No polar conversion.
Figure 2. Inner-product TurboQuant in the cited paper's v1 construction. Scalar reconstruction supplies the residual for QJL; the correction uses sign bits and residual magnitude. This schematic explains the mechanism rather than a measured performance result.

Stage 1: scalar MSE quantization

This section describes the rotated-coordinate quantizer in TurboQuant v1. Its codebook is constructed for the known distribution induced by rotation, rather than fitted to a calibration dataset.

The Random Rotation

For normalized input x, form y = Rx using a fixed random orthogonal matrix R.

Coordinate distribution

Quantize the rotated Cartesian coordinates directly. PolarQuant's recursive radius-and-angle representation is a different construction.

The key mathematical property is that, after rotation, the angular distributions become predictable and concentrated, following a Beta distribution that tightens as dimensionality increases. For typical head dimensions (d = 128), the coordinates are well-approximated by N(0, ||x||² / d).

Significance

Precompute scalar reconstruction levels for the rotated-coordinate distribution. Original vector norms remain part of the storage and reconstruction contract.

Lloyd-Max Optimal Scalar Quantizers

The scalar stage uses Lloyd–Max reconstruction levels for its MSE objective.

Runtime encoding selects codebook indices. Reconstruction retrieves their levels and rotates back; both operations incur computation.

Stage 2: QJL, Debiasing Inner Products with a Single Bit

This stage is based on "QJL: 1-Bit Quantized JL Transform for KV Cache Quantization with Zero Overhead" (AAAI 2025).

Any MSE-optimal quantizer has a subtle problem: it introduces systematic bias in inner product estimates. If x̂ is the quantized version of x, then ⟨q, x̂⟩ is generally a biased estimator of ⟨q, x⟩, meaning that the expected error does not average to zero. In attention score computation, this bias can shift the softmax distribution in ways that degrade generation quality even when per-vector MSE is small.

TurboQuant's Stage 2 eliminates this bias using the Quantized Johnson-Lindenstrauss (QJL) transform.

The Johnson-Lindenstrauss Lemma

The JL lemma states that a set of points in high-dimensional space can be projected into a much lower-dimensional space while approximately preserving all pairwise distances. Random Gaussian projections achieve this: for vectors in ℝᵈ, a random projection to ℝᵐ (where m << d) preserves inner products up to O(1/√m) error.

How QJL Works

QJL encodes the residual r = x − x_hat from the scalar MSE reconstruction.

  1. The residual is projected through a random Gaussian matrix S, giving Sr.

  2. Only the sign of each projected component is stored: sign(Sr)ᵢ ∈ {+1, -1}.

The cost is one bit per dimension of the projection. The key innovation is an asymmetric estimator: QJL is applied to one vector (the key), while a standard JL transform without quantization is applied to the other (the query). This asymmetry produces an unbiased estimator for the inner product ⟨q, x⟩ with variance O(1/d), where d is the head dimension, with zero additional memory overhead for storing quantization constants.

Why One Bit Is Sufficient

Sign bits alone omit residual magnitude. The correction retains that magnitude to recover the residual's scale.

For residual r and query q, the stated variance bound scales with ||r||² ||q||² / d. It is a property of the estimator, not a guarantee about task accuracy.

Theoretical Guarantees

TurboQuant is supported not only by empirical results but also by provable guarantees that place it on solid information-theoretic footing.

Distortion Rate Bounds

The paper establishes formal information-theoretic lower bounds on the best achievable distortion rate for any vector quantizer at a given bit-width. TurboQuant's achieved distortion matches these lower bounds to within a constant factor of approximately 2.7x.

In concrete terms, at b bits per coordinate, TurboQuant's MSE distortion is provably within a factor of at most √3·π/2 ≈ 2.7 of the information-theoretic lower bound, which is the theoretical minimum achievable by any possible quantizer, including those with unlimited computation and full knowledge of the data distribution. For a training-free, online, data-oblivious algorithm, this is a tight result. (The factor is smaller at low bit-widths; the paper establishes both MSE and inner product distortion bounds using Shannon's lower bound and Yao's minimax principle.)

Unbiased Inner Product Estimation

Under the paper's assumptions, the scalar MSE stage with QJL correction has the following estimator properties:

  • The estimator is unbiased: E[⟨q, x̂⟩_corrected] = ⟨q, x⟩.

  • The estimator has low variance: Var[⟨q, x̂⟩_corrected] = O(||r||² · ||q||² / d).

The residual correction is designed to make the inner-product estimate unbiased under the paper’s assumptions. Unbiasedness is an expectation over the randomized estimator; an individual estimate still has error. It does not establish a fixed cosine similarity or a percentage of retained task accuracy.

Experimental Results

TurboQuant was evaluated on open-source models from the Gemma, Mistral (Ministral-7B-Instruct), and Llama (Llama-3.1-8B-Instruct) families across five standard long-context benchmarks: LongBench, Needle In A Haystack, ZeroSCROLLS, RULER, and L-Eval. The primary baseline was KIVI (ICML 2024), the standard reference for KV cache quantization, which introduced asymmetric 2-bit quantization with ~2.6x memory reduction.

Table listing five reported TurboQuant results with their setting, models, baselines, and reported values: LongBench at 3.5 and 2.5 bits, Needle In A Haystack, five benchmarks at 3 bits versus KIVI, and the H100 kernel speedup.
Figure 3. Scope of the reported results. Each row is a different bit budget, benchmark, model set, and baseline, so the values are not comparable across rows; the H100 kernel speedup is a 4-bit attention-logit kernel against FP32 keys, not an end-to-end generation speedup.

Accuracy

In the reported LongBench setting for Llama-3.1-8B-Instruct, the 3.5-bit result and full-cache baseline both round to 50.06 (Figure 4). At 2.5 bits the reported scores are 49.44 for Llama-3.1-8B and 49.62 for Ministral-7B. These results do not establish equivalence across other tasks, models, or serving conditions.

LongBench score for Llama-3.1-8B-Instruct by cache precision
Figure 4. Reported LongBench scores for Llama-3.1-8B-Instruct under the stated cache settings. The 3.5-bit and full-cache means both round to 50.06; equal rounded means are not a statistical equivalence test. The y-axis starts at 48; the Ministral-7B 2.5-bit result (49.62) is not shown.

On Needle In A Haystack retrieval at up to 104K-token context under 4x compression, TurboQuant scored 0.997, matching full precision (0.997) and outperforming both KIVI (0.981) and PolarQuant (0.995), as shown in Figure 5.

Needle-in-a-haystack retrieval under 4× compression
Figure 5. Needle In A Haystack retrieval at up to 104K-token context under 4x compression. TurboQuant (0.997) matches full precision (0.997) and scores above PolarQuant (0.995) and KIVI (0.981). The y-axis starts at 0.970.

At 3 bits, TurboQuant matched or outperformed KIVI across all benchmarks tested.

Payload accounting and evaluation scope

Figures 6 and 7 show ideal payload ratios derived from 16/B. They exclude side information and system overhead. Compression, attention-estimation error, and downstream task quality require separate measurements under a stated configuration.

Illustrative ideal FP16 payload ratios for 4, 3, and 2.5 bits per coordinate, excluding side information and runtime overhead.
Figure 6. Illustrative payload accounting against FP16: 4.00× at 4 bits, 5.33× at 3 bits, and 6.40× at 2.5 bits per coordinate (16/B). These are arithmetic ratios that exclude norms, residual magnitude, packing, and allocator overhead; total memory saving and attention fidelity require separate measurement.
Ideal payload ratio 16 divided by bit budget: 4.00, 5.33, and 6.40. Exact arithmetic, not measured compression or task accuracy.
Figure 7. Ideal payload ratio 16/B, excluding norms, metadata, packing, and allocator overhead. The values are deterministic arithmetic, so no uncertainty range is implied. Actual memory use and task accuracy must be measured separately.

Hardware Performance on H100

The cited H100 result reports up to an 8x improvement for 4-bit attention-logit computation against FP32 keys. That kernel comparison should be kept separate from storage results at other bit budgets and from end-to-end inference performance.

The speedup has two sources: reduced memory bandwidth (moving 3-4 bits instead of 16 per element) and the ability to fit more of the KV cache in fast SRAM/L2 cache rather than spilling to HBM. For memory-bandwidth-bound attention kernels, this is a substantial gain.

Extension to Vector Search and Nearest Neighbor Retrieval

The full title of the paper is "TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate" rather than "KV Cache Quantization." The KV cache application is the most prominent result, but TurboQuant is fundamentally a general-purpose vector quantizer, and it has direct implications for another large-scale infrastructure problem: approximate nearest neighbor (ANN) search.

The Vector Search Connection

Product quantization fits codebooks to representative training vectors. A shift in the indexed data distribution can affect their usefulness. Codebook fitting, encoding new vectors, and constructing the search index are separate operations.

The method does not require data-dependent codebook training. Encoding, index construction, storage, and search still incur work. Evaluate compression error, recall, build time, and query latency against the existing vector-search pipeline.

A trained PQ index can encode additional vectors with its existing codebook (Figure 8). TurboQuant avoids data-dependent codebook fitting. Update support, rebuilding requirements, recall, and latency still depend on the index implementation and data distribution.

Conceptual comparison of codebook setup, vector encoding and index construction, updates, and workload-dependent quality for data-dependent PQ and data-oblivious TurboQuant.
Figure 8. Quantizer setup, encoding, index construction, and updates are distinct operations. This conceptual comparison is not a benchmark or a claim that TurboQuant supports every index operation without further implementation.

Implications for the AI Infrastructure Stack

Applying the method in an inference or vector-search system requires measuring the complete workload. The mathematical construction alone does not establish a deployment gain.

The Memory Wall Moves

A smaller key-value payload can reduce memory demand, but deployed savings also include norms, metadata, packing, and allocator overhead. The ideal FP16-to-3-bit payload ratio is 16/3, approximately 5.33. This arithmetic is not a measured reduction in total GPU memory or proof of unchanged task accuracy.

Kernel speed and total inference cost

A faster attention-logit kernel may improve inference throughput when that operation is a bottleneck. Total latency and cost also depend on cache layout, other kernels, memory transfers, batch size, and sequence length. Evaluate the complete serving stack before projecting a production gain.

Integration requirements

TurboQuant does not require model fine-tuning or a calibration dataset. Integration still requires compatible cache formats and attention kernels, followed by evaluation on the target model and serving stack.

Online encoding

Per-vector encoding avoids fitting a codebook to future cache entries. Streaming, batching, and speculative-decoding systems still need compatible cache layouts and kernels.

Evaluation in vector-search systems

The method does not require data-dependent codebook training. Encoding, index construction, storage, and search still incur work. Evaluate compression error, recall, build time, and query latency against the existing vector-search pipeline.

End-to-End Compression Pipeline

Taken together, the complete TurboQuant pipeline operates as follows during LLM inference, from key generation through attention computation:

  1. A token arrives and a transformer layer generates K and V. The key vector is normalized and encoded by the scalar MSE stage; its original norm must also be represented.

  2. Let B denote the total corrected-key payload budget per coordinate. After the random rotation, the scalar stage uses B − 1 bits per coordinate.

  3. Reconstruct the scalar-stage approximation in the same coordinate frame and form r = k − k_hat. QJL stores sign(Sr) together with the residual magnitude needed by its correction.

  4. The residual correction uses one additional bit per coordinate, giving (B − 1) + 1 = B payload bits. Norms, residual magnitude, and packing are additional side information. Value-cache quantization must be accounted for separately.

  5. At attention time, the kernel loads the compressed keys, computes ⟨q, k̂⟩ plus the QJL correction, and applies softmax(scores / √d).

  6. Under the estimator’s assumptions, the corrected inner product is unbiased in expectation. Its variance and downstream task error require separate evaluation.

Implementation Landscape

Implementation availability should be checked against a named repository, revision, and supported configuration. This article does not establish a verified integration for a particular serving stack.

GPU kernels need to implement rotation, scalar encoding, residual correction, and reconstruction consistently. Any fusion or speed claim requires a linked implementation and measurements on the stated hardware.

A serving integration must specify cache layout, precision, supported model and attention kernels, and memory accounting. Test output quality and end-to-end latency before deployment.

CPU implementations also need measurements of encoding cost, memory traffic, and search or attention latency. Theoretical compression does not establish a CPU throughput gain.

A data-oblivious codebook removes one fitting step. Packing, side information, kernel compatibility, and evaluation remain implementation responsibilities.

Theoretical Contribution

Beyond the practical results, TurboQuant makes a contribution to quantization theory that merits separate discussion.

Most quantization papers are empirical: they propose a method and report benchmarks. TurboQuant proves formal lower bounds on the best possible distortion rate for any vector quantizer - using Shannon's lower bound and Yao's minimax principle - then constructs an algorithm that nearly matches those bounds. The gap is a small constant factor (√3·π/2 ≈ 2.7 for MSE distortion), and this holds across all bit-widths and dimensions.

The proof technique is novel: it uses the fact that random rotations make coordinates approximately independent and identically distributed, which reduces the vector quantization problem to a collection of independent scalar quantization problems. Scalar quantization has been solved since the 1960s (Lloyd-Max). TurboQuant's insight is that near-optimal vector quantization can be obtained by making the problem resemble many independent scalar quantizations, with the JL-based correction handling the remaining inner product bias.

This approach is fundamentally different from learned quantization (codebook learning, VQ-VAE) or calibration-based methods (GPTQ, AWQ). It is a reduction from a hard problem (online vector quantization) to a solved problem (offline scalar quantization), enabled by random linear algebra.

Limitations and Open Questions

Despite these results, TurboQuant is not without constraints:

  • The random rotation has a cost. A dense matrix multiplication takes O(d²) work per vector. Its runtime depends on dimensions, hardware, kernel implementation, and the rest of the workload.

  • Value quantization has a separate objective. Weighted values contribute to attention output, so MSE-oriented value reconstruction must be evaluated and accounted for independently of corrected-key storage.

  • Interaction with other optimizations is unresolved. How TurboQuant composes with FlashAttention, paged attention (vLLM), speculative decoding, and other inference optimizations is still being explored by the community. The sign-bit QJL correction requires a slightly different attention kernel than standard quantized attention, which may limit drop-in compatibility.

  • Sub-2-bit territory is unexplored. At 2.5 bits, quality degradation is marginal. Below 2 bits, the paper does not provide results. The information-theoretic bounds suggest diminishing returns, but the practical floor for TurboQuant has not been fully mapped.

Conclusion

TurboQuant combines theoretical analysis with experiments on low-bit vector quantization and KV-cache compression.

Reported gains depend on model, kernel, hardware, bitwidth, and benchmark. Treat compression and speed figures as results under those conditions rather than universal guarantees.

Practical evaluation should examine output quality, end-to-end latency, memory use, and compatibility with the serving stack.

The work contributes a data-oblivious approach to compression and motivates further study of the trade-offs in inference systems.

Sources and version notes

Google Research: TurboQuant

TurboQuant paper: v1 construction and estimator assumptions
Faiss FAQ: trained indexes, added vectors, and distribution changes

Research

Browse all research, analyses, and software.

Browse all research notes and technical analyses.

Abstract

TurboQuant combines scalar quantization with a residual correction for inner-product estimation. This analysis separates the bit budget, storage overhead, and kernel benchmark conditions. Compression ratios and attention-logit speedups depend on configuration and do not establish an equivalent end-to-end generation speedup.

TurboQuant uses a data-oblivious scalar MSE quantizer and, for inner-product estimation, a QJL residual correction. This article follows the cited paper's v1 construction. PolarQuant is a related polar-coordinate method and is not the scalar MSE stage described here.

Introduction

Every large language model carries a cost that is easy to overlook: the key-value cache. As context windows stretch to hundreds of thousands of tokens, the KV cache - the memory structure that stores attention keys and values from all prior tokens - becomes the dominant memory bottleneck during inference, ahead of both the model weights and the activations.

For a model such as Gemma, Llama, or Mistral serving a 128K-token context, the KV cache alone can consume tens of gigabytes of HBM per request. That memory could otherwise hold another concurrent user, another batch element, or another model entirely. Every gigabyte of KV cache is a gigabyte that is unavailable for throughput.

TurboQuant quantizes vectors without fitting a model-specific codebook. Its reported results use different bit budgets and baselines. The cited H100 speedup concerns 4-bit attention-logit computation against FP32 keys, rather than end-to-end token generation.

Key quantization targets query–key inner products. Value quantization also needs to control reconstruction error because attention combines value vectors using the attention weights. The two objectives require separate accounting.

This article provides a technical walkthrough of how TurboQuant works, why it works, and what it implies for LLM inference infrastructure and beyond.

Problem: Why KV Cache Compression Is Harder Than Weight Quantization

Weight quantization is a sufficiently solved problem. Weights are static: they are quantized once, offline, with ample time for calibration. Techniques such as GPTQ, AWQ, and SqueezeLLM can compress model weights to 4 or even 3 bits with minimal degradation.

KV cache quantization is fundamentally different, and harder, for three reasons, which are set against weight quantization in Figure 1:

  • Quantization must be online. KV entries are generated token-by-token during inference, so a calibration pass cannot be run over data that has not yet been seen. The quantizer must compress each vector as it arrives, with no knowledge of future tokens.

  • The distribution shifts constantly. Unlike weights, which have stable distributions per layer, KV cache vectors exhibit per-token, per-head, per-layer distribution variation. A quantizer tuned to one distribution is suboptimal for the next token.

  • Keys and values have different roles. Query–key inner products determine attention scores, while the weighted value vectors determine the attention output. Small key reconstruction error alone does not establish accurate attention scores or downstream outputs.

Previous approaches such as KIVI (which quantizes keys and values separately with per-channel scaling) achieve reasonable compression at 4 bits but struggle at 3 bits and below. The core limitation is that conventional quantizers require per-block normalization (computing min/max or scale/zero-point for each block of values), which adds overhead and does not address inner product bias.

Weight versus KV-cache quantization
Figure 1. Weight quantization and KV cache quantization compared on the properties described in this section.

Approach: Rotate, Quantize, Correct

TurboQuant's architecture is a two-stage pipeline with a simple structure, shown in Figure 2:

  • Stage 1: scalar MSE quantization. Rotate the normalized input and encode each coordinate with a precomputed scalar codebook. This stage does not perform a polar-coordinate conversion.

  • Stage 2: QJL correction. Encode the reconstruction residual with random-projection sign bits and retain its magnitude for the correction. The estimator is unbiased under the paper's assumptions.

For a corrected-key payload budget B per coordinate, the scalar stage uses B − 1 bits and QJL uses one sign bit. Vector norms, residual magnitude, and storage packing require additional accounting. Value-cache storage is separate.

The following sections describe each stage.

TurboQuant v1 schematic: random rotation and scalar MSE reconstruction, residual QJL sign encoding with retained magnitude, and a corrected inner-product estimate. No polar conversion.
Figure 2. Inner-product TurboQuant in the cited paper's v1 construction. Scalar reconstruction supplies the residual for QJL; the correction uses sign bits and residual magnitude. This schematic explains the mechanism rather than a measured performance result.

Stage 1: scalar MSE quantization

This section describes the rotated-coordinate quantizer in TurboQuant v1. Its codebook is constructed for the known distribution induced by rotation, rather than fitted to a calibration dataset.

The Random Rotation

For normalized input x, form y = Rx using a fixed random orthogonal matrix R.

Coordinate distribution

Quantize the rotated Cartesian coordinates directly. PolarQuant's recursive radius-and-angle representation is a different construction.

The key mathematical property is that, after rotation, the angular distributions become predictable and concentrated, following a Beta distribution that tightens as dimensionality increases. For typical head dimensions (d = 128), the coordinates are well-approximated by N(0, ||x||² / d).

Significance

Precompute scalar reconstruction levels for the rotated-coordinate distribution. Original vector norms remain part of the storage and reconstruction contract.

Lloyd-Max Optimal Scalar Quantizers

The scalar stage uses Lloyd–Max reconstruction levels for its MSE objective.

Runtime encoding selects codebook indices. Reconstruction retrieves their levels and rotates back; both operations incur computation.

Stage 2: QJL, Debiasing Inner Products with a Single Bit

This stage is based on "QJL: 1-Bit Quantized JL Transform for KV Cache Quantization with Zero Overhead" (AAAI 2025).

Any MSE-optimal quantizer has a subtle problem: it introduces systematic bias in inner product estimates. If x̂ is the quantized version of x, then ⟨q, x̂⟩ is generally a biased estimator of ⟨q, x⟩, meaning that the expected error does not average to zero. In attention score computation, this bias can shift the softmax distribution in ways that degrade generation quality even when per-vector MSE is small.

TurboQuant's Stage 2 eliminates this bias using the Quantized Johnson-Lindenstrauss (QJL) transform.

The Johnson-Lindenstrauss Lemma

The JL lemma states that a set of points in high-dimensional space can be projected into a much lower-dimensional space while approximately preserving all pairwise distances. Random Gaussian projections achieve this: for vectors in ℝᵈ, a random projection to ℝᵐ (where m << d) preserves inner products up to O(1/√m) error.

How QJL Works

QJL encodes the residual r = x − x_hat from the scalar MSE reconstruction.

  1. The residual is projected through a random Gaussian matrix S, giving Sr.

  2. Only the sign of each projected component is stored: sign(Sr)ᵢ ∈ {+1, -1}.

The cost is one bit per dimension of the projection. The key innovation is an asymmetric estimator: QJL is applied to one vector (the key), while a standard JL transform without quantization is applied to the other (the query). This asymmetry produces an unbiased estimator for the inner product ⟨q, x⟩ with variance O(1/d), where d is the head dimension, with zero additional memory overhead for storing quantization constants.

Why One Bit Is Sufficient

Sign bits alone omit residual magnitude. The correction retains that magnitude to recover the residual's scale.

For residual r and query q, the stated variance bound scales with ||r||² ||q||² / d. It is a property of the estimator, not a guarantee about task accuracy.

Theoretical Guarantees

TurboQuant is supported not only by empirical results but also by provable guarantees that place it on solid information-theoretic footing.

Distortion Rate Bounds

The paper establishes formal information-theoretic lower bounds on the best achievable distortion rate for any vector quantizer at a given bit-width. TurboQuant's achieved distortion matches these lower bounds to within a constant factor of approximately 2.7x.

In concrete terms, at b bits per coordinate, TurboQuant's MSE distortion is provably within a factor of at most √3·π/2 ≈ 2.7 of the information-theoretic lower bound, which is the theoretical minimum achievable by any possible quantizer, including those with unlimited computation and full knowledge of the data distribution. For a training-free, online, data-oblivious algorithm, this is a tight result. (The factor is smaller at low bit-widths; the paper establishes both MSE and inner product distortion bounds using Shannon's lower bound and Yao's minimax principle.)

Unbiased Inner Product Estimation

Under the paper's assumptions, the scalar MSE stage with QJL correction has the following estimator properties:

  • The estimator is unbiased: E[⟨q, x̂⟩_corrected] = ⟨q, x⟩.

  • The estimator has low variance: Var[⟨q, x̂⟩_corrected] = O(||r||² · ||q||² / d).

The residual correction is designed to make the inner-product estimate unbiased under the paper’s assumptions. Unbiasedness is an expectation over the randomized estimator; an individual estimate still has error. It does not establish a fixed cosine similarity or a percentage of retained task accuracy.

Experimental Results

TurboQuant was evaluated on open-source models from the Gemma, Mistral (Ministral-7B-Instruct), and Llama (Llama-3.1-8B-Instruct) families across five standard long-context benchmarks: LongBench, Needle In A Haystack, ZeroSCROLLS, RULER, and L-Eval. The primary baseline was KIVI (ICML 2024), the standard reference for KV cache quantization, which introduced asymmetric 2-bit quantization with ~2.6x memory reduction.

Table listing five reported TurboQuant results with their setting, models, baselines, and reported values: LongBench at 3.5 and 2.5 bits, Needle In A Haystack, five benchmarks at 3 bits versus KIVI, and the H100 kernel speedup.
Figure 3. Scope of the reported results. Each row is a different bit budget, benchmark, model set, and baseline, so the values are not comparable across rows; the H100 kernel speedup is a 4-bit attention-logit kernel against FP32 keys, not an end-to-end generation speedup.

Accuracy

In the reported LongBench setting for Llama-3.1-8B-Instruct, the 3.5-bit result and full-cache baseline both round to 50.06 (Figure 4). At 2.5 bits the reported scores are 49.44 for Llama-3.1-8B and 49.62 for Ministral-7B. These results do not establish equivalence across other tasks, models, or serving conditions.

LongBench score for Llama-3.1-8B-Instruct by cache precision
Figure 4. Reported LongBench scores for Llama-3.1-8B-Instruct under the stated cache settings. The 3.5-bit and full-cache means both round to 50.06; equal rounded means are not a statistical equivalence test. The y-axis starts at 48; the Ministral-7B 2.5-bit result (49.62) is not shown.

On Needle In A Haystack retrieval at up to 104K-token context under 4x compression, TurboQuant scored 0.997, matching full precision (0.997) and outperforming both KIVI (0.981) and PolarQuant (0.995), as shown in Figure 5.

Needle-in-a-haystack retrieval under 4× compression
Figure 5. Needle In A Haystack retrieval at up to 104K-token context under 4x compression. TurboQuant (0.997) matches full precision (0.997) and scores above PolarQuant (0.995) and KIVI (0.981). The y-axis starts at 0.970.

At 3 bits, TurboQuant matched or outperformed KIVI across all benchmarks tested.

Payload accounting and evaluation scope

Figures 6 and 7 show ideal payload ratios derived from 16/B. They exclude side information and system overhead. Compression, attention-estimation error, and downstream task quality require separate measurements under a stated configuration.

Illustrative ideal FP16 payload ratios for 4, 3, and 2.5 bits per coordinate, excluding side information and runtime overhead.
Figure 6. Illustrative payload accounting against FP16: 4.00× at 4 bits, 5.33× at 3 bits, and 6.40× at 2.5 bits per coordinate (16/B). These are arithmetic ratios that exclude norms, residual magnitude, packing, and allocator overhead; total memory saving and attention fidelity require separate measurement.
Ideal payload ratio 16 divided by bit budget: 4.00, 5.33, and 6.40. Exact arithmetic, not measured compression or task accuracy.
Figure 7. Ideal payload ratio 16/B, excluding norms, metadata, packing, and allocator overhead. The values are deterministic arithmetic, so no uncertainty range is implied. Actual memory use and task accuracy must be measured separately.

Hardware Performance on H100

The cited H100 result reports up to an 8x improvement for 4-bit attention-logit computation against FP32 keys. That kernel comparison should be kept separate from storage results at other bit budgets and from end-to-end inference performance.

The speedup has two sources: reduced memory bandwidth (moving 3-4 bits instead of 16 per element) and the ability to fit more of the KV cache in fast SRAM/L2 cache rather than spilling to HBM. For memory-bandwidth-bound attention kernels, this is a substantial gain.

Extension to Vector Search and Nearest Neighbor Retrieval

The full title of the paper is "TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate" rather than "KV Cache Quantization." The KV cache application is the most prominent result, but TurboQuant is fundamentally a general-purpose vector quantizer, and it has direct implications for another large-scale infrastructure problem: approximate nearest neighbor (ANN) search.

The Vector Search Connection

Product quantization fits codebooks to representative training vectors. A shift in the indexed data distribution can affect their usefulness. Codebook fitting, encoding new vectors, and constructing the search index are separate operations.

The method does not require data-dependent codebook training. Encoding, index construction, storage, and search still incur work. Evaluate compression error, recall, build time, and query latency against the existing vector-search pipeline.

A trained PQ index can encode additional vectors with its existing codebook (Figure 8). TurboQuant avoids data-dependent codebook fitting. Update support, rebuilding requirements, recall, and latency still depend on the index implementation and data distribution.

Conceptual comparison of codebook setup, vector encoding and index construction, updates, and workload-dependent quality for data-dependent PQ and data-oblivious TurboQuant.
Figure 8. Quantizer setup, encoding, index construction, and updates are distinct operations. This conceptual comparison is not a benchmark or a claim that TurboQuant supports every index operation without further implementation.

Implications for the AI Infrastructure Stack

Applying the method in an inference or vector-search system requires measuring the complete workload. The mathematical construction alone does not establish a deployment gain.

The Memory Wall Moves

A smaller key-value payload can reduce memory demand, but deployed savings also include norms, metadata, packing, and allocator overhead. The ideal FP16-to-3-bit payload ratio is 16/3, approximately 5.33. This arithmetic is not a measured reduction in total GPU memory or proof of unchanged task accuracy.

Kernel speed and total inference cost

A faster attention-logit kernel may improve inference throughput when that operation is a bottleneck. Total latency and cost also depend on cache layout, other kernels, memory transfers, batch size, and sequence length. Evaluate the complete serving stack before projecting a production gain.

Integration requirements

TurboQuant does not require model fine-tuning or a calibration dataset. Integration still requires compatible cache formats and attention kernels, followed by evaluation on the target model and serving stack.

Online encoding

Per-vector encoding avoids fitting a codebook to future cache entries. Streaming, batching, and speculative-decoding systems still need compatible cache layouts and kernels.

Evaluation in vector-search systems

The method does not require data-dependent codebook training. Encoding, index construction, storage, and search still incur work. Evaluate compression error, recall, build time, and query latency against the existing vector-search pipeline.

End-to-End Compression Pipeline

Taken together, the complete TurboQuant pipeline operates as follows during LLM inference, from key generation through attention computation:

  1. A token arrives and a transformer layer generates K and V. The key vector is normalized and encoded by the scalar MSE stage; its original norm must also be represented.

  2. Let B denote the total corrected-key payload budget per coordinate. After the random rotation, the scalar stage uses B − 1 bits per coordinate.

  3. Reconstruct the scalar-stage approximation in the same coordinate frame and form r = k − k_hat. QJL stores sign(Sr) together with the residual magnitude needed by its correction.

  4. The residual correction uses one additional bit per coordinate, giving (B − 1) + 1 = B payload bits. Norms, residual magnitude, and packing are additional side information. Value-cache quantization must be accounted for separately.

  5. At attention time, the kernel loads the compressed keys, computes ⟨q, k̂⟩ plus the QJL correction, and applies softmax(scores / √d).

  6. Under the estimator’s assumptions, the corrected inner product is unbiased in expectation. Its variance and downstream task error require separate evaluation.

Implementation Landscape

Implementation availability should be checked against a named repository, revision, and supported configuration. This article does not establish a verified integration for a particular serving stack.

GPU kernels need to implement rotation, scalar encoding, residual correction, and reconstruction consistently. Any fusion or speed claim requires a linked implementation and measurements on the stated hardware.

A serving integration must specify cache layout, precision, supported model and attention kernels, and memory accounting. Test output quality and end-to-end latency before deployment.

CPU implementations also need measurements of encoding cost, memory traffic, and search or attention latency. Theoretical compression does not establish a CPU throughput gain.

A data-oblivious codebook removes one fitting step. Packing, side information, kernel compatibility, and evaluation remain implementation responsibilities.

Theoretical Contribution

Beyond the practical results, TurboQuant makes a contribution to quantization theory that merits separate discussion.

Most quantization papers are empirical: they propose a method and report benchmarks. TurboQuant proves formal lower bounds on the best possible distortion rate for any vector quantizer - using Shannon's lower bound and Yao's minimax principle - then constructs an algorithm that nearly matches those bounds. The gap is a small constant factor (√3·π/2 ≈ 2.7 for MSE distortion), and this holds across all bit-widths and dimensions.

The proof technique is novel: it uses the fact that random rotations make coordinates approximately independent and identically distributed, which reduces the vector quantization problem to a collection of independent scalar quantization problems. Scalar quantization has been solved since the 1960s (Lloyd-Max). TurboQuant's insight is that near-optimal vector quantization can be obtained by making the problem resemble many independent scalar quantizations, with the JL-based correction handling the remaining inner product bias.

This approach is fundamentally different from learned quantization (codebook learning, VQ-VAE) or calibration-based methods (GPTQ, AWQ). It is a reduction from a hard problem (online vector quantization) to a solved problem (offline scalar quantization), enabled by random linear algebra.

Limitations and Open Questions

Despite these results, TurboQuant is not without constraints:

  • The random rotation has a cost. A dense matrix multiplication takes O(d²) work per vector. Its runtime depends on dimensions, hardware, kernel implementation, and the rest of the workload.

  • Value quantization has a separate objective. Weighted values contribute to attention output, so MSE-oriented value reconstruction must be evaluated and accounted for independently of corrected-key storage.

  • Interaction with other optimizations is unresolved. How TurboQuant composes with FlashAttention, paged attention (vLLM), speculative decoding, and other inference optimizations is still being explored by the community. The sign-bit QJL correction requires a slightly different attention kernel than standard quantized attention, which may limit drop-in compatibility.

  • Sub-2-bit territory is unexplored. At 2.5 bits, quality degradation is marginal. Below 2 bits, the paper does not provide results. The information-theoretic bounds suggest diminishing returns, but the practical floor for TurboQuant has not been fully mapped.

Conclusion

TurboQuant combines theoretical analysis with experiments on low-bit vector quantization and KV-cache compression.

Reported gains depend on model, kernel, hardware, bitwidth, and benchmark. Treat compression and speed figures as results under those conditions rather than universal guarantees.

Practical evaluation should examine output quality, end-to-end latency, memory use, and compatibility with the serving stack.

The work contributes a data-oblivious approach to compression and motivates further study of the trade-offs in inference systems.

Sources and version notes

Google Research: TurboQuant

TurboQuant paper: v1 construction and estimator assumptions
Faiss FAQ: trained indexes, added vectors, and distribution changes

Research

Browse all research notes and technical analyses.

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

Research and collaboration

Have a research question?

Tell us what you’d like to test.

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

Research and collaboration

Have a research question?

Tell us what you’d like to test.

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

Research and collaboration

Have a research question?

Tell us what you’d like to test.

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]

  • //

    [#hebula]

    &

    [#research]