Papers
Topics
Authors
Recent
Search
2000 character limit reached

1-Bit Quantized JL Transform

Updated 26 March 2026
  • The paper introduces a 1-bit Quantized JL transform that leverages a Gaussian JL projection followed by sign-bit quantization to create compact binary sketches preserving inner product structure.
  • It provides unbiased inner-product estimators with controlled variance and distortion, achieving near-optimal performance with minimal storage via a two-stage process.
  • Practical implementations demonstrate significant KV cache compression and accelerated inference through GPU-optimized batch processing and hybrid quantization strategies.

A 1-bit Quantized Johnson–Lindenstrauss (QJL) transform is a data-oblivious compression technique that creates ultra-compact binary sketches of high-dimensional vectors while preserving geometric structure for inner product estimation. QJL leverages a random Gaussian projection (Johnson–Lindenstrauss transform) followed by sign-bit (1-bit) quantization, allowing unbiased and low-variance estimation of inner products and 2\ell_2 norms. It achieves near-optimal distortion at minimal storage and computational cost, with particular efficacy in compressing neural network Key-Value (KV) caches and enabling efficient large-scale search and inference (Zandieh et al., 2024, Zandieh et al., 28 Apr 2025).

1. Mathematical Foundations and Construction

QJL comprises a two-stage process: first, a Johnson–Lindenstrauss (JL) projection matrix reduces a dd-dimensional real vector xRdx \in \mathbb{R}^d to a sketch of dimension mm via random projection SRm×dS \in \mathbb{R}^{m \times d} with i.i.d.\ Gaussian entries SijN(0,1)S_{ij} \sim \mathcal{N}(0,1). Second, each entry of the projected vector z=Sxz = Sx is quantized to x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m, and the norm ν(x)=x2\nu(x) = \|x\|_2 is separately stored in reduced precision.

The core sketch is thus:

  • x~=HS(x)=sign(Sx)\tilde x = H_S(x) = \mathrm{sign}(Sx),
  • Storage per vector: dd0 bits for signs, plus dd1 bits (e.g.~16) for dd2.

For downstream usage where inner products with a query dd3 must be estimated, QJL provides an asymmetric estimator:

dd4

where dd5 is a compressed vector and dd6 is the (shared, fixed) projection matrix (Zandieh et al., 2024, Zandieh et al., 28 Apr 2025).

2. Theoretical Guarantees: Unbiasedness and Distortion

QJL provides unbiased estimators for bilinear forms:

  • For any dd7, dd8.
  • The distortion bound satisfies (with high probability)

dd9

for xRdx \in \mathbb{R}^d0, where xRdx \in \mathbb{R}^d1 is the total number of stored keys.

Variance is controlled by both projection dimension and vector norm:

  • For self-reconstruction (e.g., in TurboQuant's second stage), xRdx \in \mathbb{R}^d2 for each xRdx \in \mathbb{R}^d3 when xRdx \in \mathbb{R}^d4 (Zandieh et al., 28 Apr 2025).
  • This property extends to all queries xRdx \in \mathbb{R}^d5 by union bound; relative error scales as xRdx \in \mathbb{R}^d6.

The unbiasedness arises from the rotational invariance of Gaussian projections, with the expectation of sign-product coinciding with the true inner-product up to a known constant.

3. Algorithmic Workflow and Implementation

The construction and application of the QJL transform can be summarized as follows:

Stage Operation Computational Cost
Sketch Construction xRdx \in \mathbb{R}^d7, xRdx \in \mathbb{R}^d8, xRdx \in \mathbb{R}^d9 mm0 mul-add, mm1 sign extraction
Query Processing (Inner Product) mm2; mm3 mm4 for mm5, mm6 per key

CUDA implementations use memory packing for sign vectors and parallel reductions for batch processing. Shared memory caches mm7 for amortized cost, resulting in high throughput: e.g., for mm8, projection latency mm9ms, per-key estimation SRm×dS \in \mathbb{R}^{m \times d}0s/key (Zandieh et al., 2024).

Integration into inference pipelines typically involves:

  1. Fix SRm×dS \in \mathbb{R}^{m \times d}1 (with PRNG seed for reproducibility).
  2. For each new vector SRm×dS \in \mathbb{R}^{m \times d}2, store SRm×dS \in \mathbb{R}^{m \times d}3.
  3. At query time, compute SRm×dS \in \mathbb{R}^{m \times d}4 once and reuse across all comparisons.
  4. Proceed with inner product estimation, softmax, and value-weighted aggregation (e.g., in transformer attention) (Zandieh et al., 2024, Zandieh et al., 28 Apr 2025).

4. Applications in Neural Network Quantization

QJL's primary application is the quantization of key/value caches in LLMs and attention-based networks:

  • For KV cache compression, QJL enables more than SRm×dS \in \mathbb{R}^{m \times d}5 reduction in memory (3 bits vs 16 bits) while maintaining or improving accuracy on long-context benchmarks (Zandieh et al., 2024).
  • On datasets such as LongBench and models including longchat-7B, Llama-2, and Llama-3, the QJL sketch preserves F1 and accuracy within 0.1% of full-precision baseline at 3-bit quantization.
  • QJL enables 2SRm×dS \in \mathbb{R}^{m \times d}6 acceleration of token generation over exact computation for long sequences, while traditional methods (e.g., KVQuant) may be SRm×dS \in \mathbb{R}^{m \times d}7 slower due to added memory and access overhead (Zandieh et al., 2024).

TurboQuant incorporates QJL as a second-stage residual quantizer, following an MSE-optimal quantization step. MSE-optimal quantizers introduce bias in inner product estimation; the 1-bit QJL stage corrects for this by quantizing the residual to produce an unbiased estimator with provably bounded variance. The overall distortion rate matches the best achievable up to a small constant (factor SRm×dS \in \mathbb{R}^{m \times d}8), achieving SRm×dS \in \mathbb{R}^{m \times d}9 convergence with bits-per-vector SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)0 (Zandieh et al., 28 Apr 2025).

5. Comparative Memory and Computational Efficiency

QJL eliminates the per-block memory overheads typical in traditional blockwise or per-channel quantization schemes, which require storing scales and zero-points. For typical block sizes (e.g., SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)1), per-entry overhead in classic quantization is SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)2 bits for SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)3, whereas QJL's per-entry overhead is SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)4, vanishing as SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)5 grows with SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)6 (SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)7). This directly contributes to the observed SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)8 reduction in KV cache memory footprint on practical workloads (Zandieh et al., 2024).

Computation is equally efficient: for SijN(0,1)S_{ij} \sim \mathcal{N}(0,1)9, QJL decouples query and storage complexity, focusing most cost on a single JL projection per query, making it scalable for large inference batches or retrieval tasks.

6. Practical Considerations and Integration

  • Random Seed Management: For consistent reconstruction, z=Sxz = Sx0 must be fixed and shared, typically by storing a PRNG seed rather than z=Sxz = Sx1 itself.
  • Projection Dimension z=Sxz = Sx2: Chosen according to target error z=Sxz = Sx3, largest number of stored vectors z=Sxz = Sx4, and application-specific tolerance. z=Sxz = Sx5 balances accuracy and memory.
  • CUDA Implementation: Bit-packing and shared-memory dot products enable GPU-parallel batch processing with low overhead.
  • Hybrid Quantization: For layers or channels with large dynamic ranges or outlier norms, it is practical to quantize only the top-z=Sxz = Sx6 channels with higher precision (e.g., 6 bits), while applying QJL to the remainder (Zandieh et al., 2024).
  • Pipeline Position: Within TurboQuant, QJL is used only for the residual of the initial MSE-optimal quantization, yielding unbiasedness in the final estimated inner product (Zandieh et al., 28 Apr 2025).

7. Empirical Results and Benchmarks

Experimental analysis confirms the theoretical guarantees:

  • Unbiasedness: Inner-product estimate histograms (TurboQuant) display zero bias across all bit widths. The variance closely matches the predicted z=Sxz = Sx7 scaling.
  • Quality Preservation: Benchmarks (NarrativeQA, Qasper, 2WikiMultiQA) demonstrate no loss—and occasionally improvement—in F1 compared to full-precision baseline at 3-bit quantization (Zandieh et al., 2024).
  • Speedup: Prompt encoding and quantization incurs only z=Sxz = Sx85% overhead compared to no-quantization baseline, while overall inference for long context is z=Sxz = Sx9 faster than exact computation due to lower memory traffic and simplified arithmetic.

8. Summary Table: Key Properties of QJL

Property Description Reference
Sketch type 1-bit sign of random Gaussian projection, with stored x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m0 norm (Zandieh et al., 2024)
Estimation property Unbiased inner-product, distortion x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m1 with x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m2 (Zandieh et al., 2024, Zandieh et al., 28 Apr 2025)
Memory overhead None (vanishing per-entry as x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m3 grows) (Zandieh et al., 2024)
Dual-stage use (TurboQuant) 1-bit QJL on residual after x~=sign(z){1,+1}m\tilde x = \mathrm{sign}(z) \in \{-1, +1\}^m4-bit MSE quantizer; unbiased, variance-bounded (Zandieh et al., 28 Apr 2025)

In summary, the 1-bit Quantized JL transform offers a mathematically principled, hardware-friendly strategy for compressing vectors while preserving critical linear measurements, eliminating memory overheads of traditional quantization, and enabling accurate and efficient inference at scale (Zandieh et al., 2024, Zandieh et al., 28 Apr 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to QJL: 1-Bit Quantized JL Transform.