Skip to content
AI.info

Research

Trainable Vector Quantization for Large Language Models

Overview Research area: Model compression and efficient inference for Large Language Models, specifically post-training vector quantization (VQ) of weights. Technical level: Advanced — the paper assum

arXiv
2610.41822
Published
2026-10-30
Authors
Anastasiia Prutianova, Alina Bogdanova, Mikhail Shutov, Dmitrii Poimanov, Anatoly Gorkov, Ilia Zharikov

AI summary

Overview

Research area: Model compression and efficient inference for Large Language Models, specifically post-training vector quantization (VQ) of weights. Technical level: Advanced — the paper assumes familiarity with quantization, straight-through estimation, and Transformer block-wise distillation. Scope: The paper introduces TVQ, a gradient-based method for optimizing the discrete index matrices of vector-quantized LLMs against arbitrary loss functions, and evaluates it across Llama 2, Llama 3, and Mistral models at ~2 bits per weight.

What This Paper Is About

Vector quantization compresses LLM weights by replacing small groups of weights with entries from a shared codebook, storing only integer indices. At extreme compression (around 2 bits per weight), model quality degrades, but the indices that carry most of the parameters are discrete, so existing fixes are training-free and optimize each layer in isolation against a reconstruction loss. TVQ's goal is to make those indices trainable, so that a quantized model can be optimized end-to-end against a real task objective rather than a per-layer proxy.

Key Contributions

  1. Trainable Vector Quantization (TVQ): A reformulation in which the integer index matrix is reparameterized as a function of a continuous latent weight matrix and the codebook, with gradients passed through the discrete assignment using the Straight-Through Estimator. This turns index assignment into a differentiable problem solvable with standard gradient descent against any differentiable loss.
  2. A block-wise knowledge distillation pipeline: Stage-1 applies TVQ block by block to match the original model's block outputs (an L1 reconstruction objective); Stage-2 fine-tunes a small subset of continuous parameters (layer norms, codebooks, LM head) using KL divergence between quantized and full-precision model outputs.
  3. Practical training accelerators: Scheduled index updates (recomputing indices every S_upd steps instead of every step) and Approximate Nearest-Neighbor search via Voronoi cells implemented with FAISS, plus a straightforward PyTorch implementation.
  4. Compatibility with existing VQ schemes: TVQ is demonstrated on the unconstrained scheme used by AQLM/VPTQ ("TVQ+BasicVQ"), the fixed E8P codebook of QuIP# ("TVQ+QuIP#"), and the HYB codebooks with bitshift-trellis-packed indices of QTIP ("TVQ+QTIP"), leaving model architecture unchanged.

Main Findings

  • Consistent gains over layer-wise optimization: Comparing pairs that differ only in optimization method, TVQ beats the beam-search assignment of AQLM by 1.5% on average across models, reducing the average compression-related accuracy drop from 3.7% to 2.2%. It improves the QuIP# scheme by 0.9% on average across all models except Llama3-70B.
  • All TVQ+QTIP variants beat their QTIP baselines on every tested model, making TVQ+QTIP the leading configuration in the evaluation.
  • Llama3-70B failure case detected: The original QuIP# algorithm reaches only 43.5% QA accuracy, while TVQ+QuIP# reaches 73.7% — a gap invisible in perplexity, which the authors cite as evidence that perplexity has limited predictive value for downstream quantization damage.
  • Near-lossless 2-bit Llama2-70B: The abstract reports near-lossless 2-bit quantization with only a 1% accuracy drop; Section 4.2 states the improvement over the previous best (QuIP# at 1.3% degradation) leaves 0.7% degradation relative to the original model.
  • Llama3-70B state of the art: TVQ improves on the best prior result by 1.9% QA accuracy, narrowing the gap to the full-precision baseline from 4.5% to 2.6%. TVQ+QTIP reaches 72.8/75.0 QA average versus 75.4/77.6 for FP16.
  • Llama2-7B: TVQ outperforms all other methods by 1–2%.
  • No single baseline dominates: Prior best methods differ by architecture (VPTQ on Llama3-70B, PV-tuning on Mistral-7B-v0.1, QTIP on Llama3-8B), whereas TVQ achieves the best low-bit PTQ result for every architecture considered.
  • Moderate compute: For 2-bit Llama2-70B measured in single NVIDIA 80GB Ampere100 GPU-hours, TVQ+QuIP# costs 54 (Stage-1) + 50 (Stage-2) = 104 total versus 90 for QuIP# and 300 for AQLM; TVQ+BasicVQ costs 262, comparable to AQLM's 300; TVQ+QTIP costs 440. PV-tuning needs roughly 1,500 GPU-hours for Stage-2 alone and an 8-GPU Ampere100 node, while the TVQ pipeline runs on 2–4 Ampere100 GPUs.
  • Scheduled updates are nearly free: For TVQ+QTIP, S_upd of 8, 16, and 32 give comparable quality (Llama2-7B WikiText-2 6.15, 6.17, 6.22; QA 59.0, 58.9, 58.8) at roughly 32h, 21h, and 15h, while S_upd = 64 collapses quality (WikiText-2 > 100, QA < 10). S_upd = 16 was selected as the default.
  • BasicVQ acceleration trade-off: For Llama2-70B, raising S_upd from 1 to 2 and 4 cuts Stage-1 time from 51h to 33h and 19h with WikiText-2 moving from 4.11 to 4.10 and 4.15 and QA average from 68.2 to 68.1 and 67.8.
  • Approximate search is safe: Table 6 reports settings from 99.9% down to 60% search accuracy with 5.0x to 6.7x speedups over exact search, and model quality is unaffected even when search accuracy drops to 95%, with only minimal decline at 80%.
  • Parameters live in the indices: In 2-bit quantization of 7–8B models, about 1.86 bits per weight encode index matrices versus about 0.16 bits per weight for codebooks; for 70B models the index fraction is even larger.

Methodology in Plain English

A weight matrix is chopped into small vectors, and each vector is replaced by the closest entry in a shared codebook; only the codebook and a grid of integer indices are stored. Because a lookup of "closest codebook entry" has zero gradient almost everywhere, ordinary backpropagation cannot move the indices. TVQ keeps a full-size, continuous "latent" copy of the weights alongside the compressed version. At each step it re-derives the indices by finding each latent vector's nearest codebook entry, dequantizes, computes the loss, and then pretends the dequantization step was the identity function when passing gradients backwards. The latent weights — and optionally the codebooks — are then updated by gradient descent, and the indices are refreshed from the updated latents.

Training proceeds block by block: each quantized Transformer block is trained to reproduce the output activations of the corresponding original block, which keeps cost near that of layer-wise methods while letting each block see the errors already introduced by earlier quantized blocks. A short second stage then fine-tunes only continuous parameters (layer normalization weights, codebooks, LM head) by minimizing KL divergence between the quantized and original model's outputs. Only the codebook and indices are kept for inference, so the deployed model has the same structure as any prior VQ checkpoint.

Why This Matters

Research impact: The paper shows that the discrete assignment problem in VQ LLMs — previously handled with beam search, Hessian-based adaptive rounding, or layer-wise EM — is tractable with plain gradient descent, and that swapping only the optimizer (keeping the VQ scheme fixed) yields measurable gains. It also opens the door to optimizing quantization against task losses beyond reconstruction.

Real-world applications:

  • Serving 70B-class models on memory-constrained accelerators, where the paper notes Llama3-70B needs 140GB in FP16, exceeding modern GPU capacity.
  • On-device or edge deployment of 7–8B models at roughly 2 bits per weight.
  • Lowering the cost of quantization pipelines in production, since TVQ fits in 100–400 GPU-hours on 2–4 Ampere100 GPUs rather than the 1,500+ GPU-hours and 8-GPU nodes needed by PV-tuning.
  • Recovering quality in existing compressed checkpoints without changing file formats, since TVQ output remains compatible with prior inference software.

Industry relevance: The work comes from Huawei Technologies, targets open-weight model families (Llama 2, Llama 3, Mistral), and emphasizes a simple PyTorch implementation and unchanged deployment format — the properties most relevant to teams shipping compressed models.

Future Directions

  • Extending the latent-weight formulation to optimize directly against task-level or generation-level losses rather than block-output reconstruction and KL divergence, which the framework already permits in principle.
  • Combining TVQ with hardware-specific kernels and packing formats; the authors explicitly note they do not contribute CUDA or other hardware utilities, leaving throughput and latency gains to existing tooling.
  • Applying TVQ to co-optimize codebook structure and index assignment jointly, especially for schemes with fixed codebooks (QuIP#'s E8P) or constrained index spaces (QTIP's bitshift trellis), where the current pipeline is more constrained.
  • Investigating whether TVQ generalizes to model-wise rather than block-wise optimization, and how far the scheduled-update approximation can be pushed before the quality cliff observed at S_upd = 64 appears in other settings.

Target Audience

Researchers and engineers working on LLM quantization, compression, and efficient inference who already understand scalar and vector quantization basics; also practitioners deploying 2-bit VQ checkpoints who want higher downstream accuracy without adopting a new model format. Readers interested in straight-through estimators and knowledge distillation for compression will find the block-wise pipeline directly reusable.

Authors’ abstract

Vector Quantization (VQ) is a rapidly evolving technique for compressing Large Language Model (LLM) weights, reducing memory usage, and speeding up inference. However, extreme compression deteriorates model performance, which is challenging to recover due to the discrete nature of VQ parameters. Existing methods employ training-free approaches that are limited to layer-wise reconstruction loss minimization. To address this limitation, we propose TVQ, a novel method that leverages straight-through estimation to enable gradient descent-based optimization of vector-quantized LLMs. By reformulating VQ LLM optimization with trainable latent weights, TVQ enables arbitrary objective minimization. We constitute our approach by applying TVQ in a block-wise knowledge distillation paradigm, which balances quality and training efficiency, and propose several practical solutions to accelerate training. In experiments on modern LLMs, we demonstrate that TVQ is compatible with modern VQ schemes. As a result, TVQ achieves state-of-the-art quality in low-bit post-training quantization settings with a modest training budget and straightforward PyTorch implementation. For instance, TVQ achieves near-lossless 2-bit quantization for LLaMA2-70B with only 1% accuracy drop on popular Question-Answering benchmarks.

Read the original paper