DiscQuant: A Quantization Method for Neural Networks Inspired by Discrepancy Theory

Jerry Chee, Arturs Backurs, Rainie Heck, Li Zhang, Janardhan Kulkarni, Thomas Rothvoss, Sivakanth Gopi · DOI

TL;DR

This paper introduces DiscQuant, a novel post-training quantization (PTQ) method for neural networks that leverages discrepancy theory. DiscQuant significantly improves quantization accuracy over existing methods like GPTQ and RTN, especially at lower bitwidths, by optimizing weight rounding in a data-dependent manner.

What Problem Does This Paper Address?

Modern neural networks, particularly large language models (LLMs), are becoming increasingly massive, posing significant challenges for deployment due to their high memory and computational requirements. Post-training quantization (PTQ) is a crucial technique to compress these models by reducing the precision of their weights. However, existing PTQ methods often struggle to maintain accuracy, especially when quantizing to very low bitwidths (e.g., 3-4 bits). This paper focuses on the often-under-explored "rounding" step in PTQ, aiming to find a more effective way to map original weights to a quantized representation without sacrificing model performance.

Methods

DiscQuant tackles the rounding problem by drawing inspiration from discrepancy theory. The core idea is to find a set of quantized weights ($\hat{w}$) that minimize the change in the model's loss function ($\Delta f$) when evaluated on data samples. This is framed as finding a discrete solution (quantized weights) that closely approximates a continuous one (original weights) without significantly altering the objective.

The authors connect this to finding a point within a specific polytope, which is the intersection of a hypercube (representing the quantization grid) and an affine subspace defined by constraints derived from per-sample gradients of the loss function. They prove that if the gradient distribution is low-rank, a vertex of this polytope will have many "fully rounded" coordinates.

DiscQuant implements this by:

  1. Distillation Objective: Minimizing the KL divergence between the output distributions of the original and quantized models. This is shown to be equivalent to minimizing a second-order term related to gradients, which is a good proxy for minimizing the loss change.
  2. Discrepancy-Inspired Optimization: Using stochastic gradient descent to minimize a combined objective that includes the KL divergence and a linear term, guided by the theoretical insights from discrepancy theory.
  3. Projection: Projecting weights back onto the hypercube after each gradient update to stay within the feasible region.
  4. Heuristic Vertex Selection: Instead of a purely random approach, DiscQuant uses a carefully chosen linear term to guide the optimization towards a vertex of the polytope that is "closest" to the original weights, improving practical performance.
  5. RTN for Remaining Weights: Any weights that remain unrounded after the optimization are rounded using the standard Round-to-Nearest (RTN) method.

Datasets

The paper uses the following datasets for training and/or evaluation:

  • WikiText-2: Used for evaluating perplexity.
  • GSM8k: A math-based generative task dataset.
  • MMLU: A broad language understanding benchmark.
  • ARC_Challenge: A commonsense reasoning dataset.
  • PIQA: A physical interaction commonsense reasoning dataset.
  • HellaSwag: A commonsense inference dataset.
  • Winogrande: A commonsense reasoning dataset.
  • RedPajama-1T-Sample: Used for constructing the quantization dataset.

Key Insights and Ideas

  • Discrepancy Theory as a Framework for Quantization Rounding: The paper successfully frames the weight rounding problem in PTQ as a problem in discrepancy theory, providing a theoretical foundation for data-dependent rounding.
  • Per-Sample Gradients Matter: Contrary to some prior assumptions, the authors show that per-sample gradients can be significant and are crucial for effective quantization. The first-order approximation of the loss change using these gradients is a good indicator of quantization error.
  • Low-Rank Gradients Enable Generalization: The theoretical analysis reveals that if the distribution of gradients is approximately low-rank, then data-dependent rounding can generalize well to unseen data, leading to improved accuracy.
  • KL Divergence as a Proxy for Loss Minimization: Using KL divergence as a distillation objective effectively constrains the quantized model's behavior to mimic the original, which indirectly minimizes the loss change and aligns with the theoretical framework.
  • Practical Algorithm from Theory: DiscQuant demonstrates that theoretical insights from discrepancy theory can be translated into a practical and effective quantization algorithm that outperforms existing methods.

Key Results

  • Superior Accuracy: DiscQuant consistently outperforms baseline methods like RTN and GPTQ across various tasks and models (Phi-3-mini-4k-instruct and Meta-Llama-3.1-8B-Instruct), especially at lower bitwidths (e.g., 3.25 bits).
  • Significant Gains on Generative Tasks: On the GSM8k dataset, DiscQuant achieves notably higher accuracy. For instance, rounding Phi-3-mini-4k-instruct to 3.25 bits, DiscQuant reaches 64% accuracy, compared to GPTQ's 54% and RTN's 31%.
  • Full Recovery at Lower Bits: On tasks like ARC_Challenge, PIQA, and WinoGrande, DiscQuant achieves full recovery with at least 0.25 fewer bits per parameter than GPTQ and RTN.
  • Composability: DiscQuant is shown to be agnostic to the quantization grid and can be combined with other quantization improvements like incoherence processing, maintaining competitive performance.

Limitations and Future Work

  • Theoretical Assumptions: The theoretical guarantees rely on the assumption that the gradients are approximately low-rank and the data distribution is $\beta$-reasonable. While empirically validated, these assumptions might not hold for all models or datasets.
  • Computational Cost: While DiscQuant is presented as a practical algorithm, it involves a distillation process and optimization, which can be more computationally intensive than simpler methods like RTN. The paper mentions that it requires two copies of the model, similar to knowledge distillation.
  • Data Mix Sensitivity: The paper notes that the choice of data mix for quantization can significantly impact performance, and determining the optimal data mix remains an open question.
  • Vector Quantization: The current work focuses on scalar quantization. Generalizing the method to vector quantizers is suggested as an interesting future research direction.
  • Inference Timing: The authors did not perform inference timing experiments, focusing on accuracy. Future work could explore the actual speedups achieved.

Summary updated

BibTeX
@misc{chee2025discquant,
  author = {Jerry Chee and Arturs Backurs and Rainie Heck and Li Zhang and Janardhan Kulkarni and Thomas Rothvoss and Sivakanth Gopi},
  title = {{DiscQuant: A Quantization Method for Neural Networks Inspired by Discrepancy Theory}},
  year = {2025},
  eprint = {2501.06417},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.06417},
}
Figure