---
title: "QuantEase: Optimization-based Quantization for Language Models"
description: "QuantEase compresses pretrained language networks by repeatedly choosing low-bit weights that preserve layer outputs, with an option to…"
canonical: "https://research.elamur.ai/free/en/papers/behdin-2023-quantease-optimization-based-quantization-language/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/behdin-2023-quantease-optimization-based-quantization-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / QuantEase: Optimization-based Quantization for Language Models

# QuantEase: Optimization-based Quantization for Language Models

Paper · 2023 · Kayhan Behdin, Ayan Acharya, Aman Gupta et al.

**Authors:** [Kayhan Behdin](https://md.research.elamur.ai/free/en/authors/kayhan-behdin/), [Ayan Acharya](https://md.research.elamur.ai/free/en/authors/ayan-acharya/), [Aman Gupta](https://md.research.elamur.ai/free/en/authors/aman-gupta/), [Qingquan Song](https://md.research.elamur.ai/free/en/authors/qingquan-song/), [Siyu Zhu](https://md.research.elamur.ai/free/en/authors/siyu-zhu/), [Sathiya Keerthi](https://md.research.elamur.ai/free/en/authors/sathiya-keerthi/) and [Rahul Mazumder](https://md.research.elamur.ai/free/en/authors/rahul-mazumder/) · **Year:** 2023 · **Venue:** arXiv:2309.01885 · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/2309.01885)
- [arXiv 2309.01885](https://arxiv.org/abs/2309.01885)

## Summary

A language network can be too large to fit on the hardware available to run it, even after training is finished. Storing the weights with fewer bits makes the network smaller, but replacing each weight with its nearest available value can change what the network predicts. QuantEase addresses that tradeoff through post-training quantization. It keeps the trained network as a reference, compresses one layer at a time, and judges each replacement by how well the compressed layer reproduces the original layer’s output on a small collection of text inputs.

The main idea is to revisit decisions. For a given weight, QuantEase holds the other weights fixed, calculates the value that would best reconstruct the layer output if any real number were allowed, then chooses the available quantization level closest to that value. The best replacement therefore depends on the errors already made elsewhere in the layer. Repeating the process can improve a fully quantized layer, including one produced by another method. The updates reduce to matrix and vector operations and avoid the inverse and Cholesky factorization used in the comparison with GPTQ.

On OPT, BLOOM and Falcon, the authors report that QuantEase gave the lowest perplexity in the reported uniform 3-bit comparisons. At 4 bits, it generally matched or improved on the alternatives. On the LAMBADA word-prediction benchmark, its relative accuracy improvement over GPTQ reached 15% at 3 bits. A separate analysis on BLOOM-1b1 found that the layer reconstruction error fell by as much as 30% relative to GPTQ, with a reported median improvement of 12%. The authors also report a Falcon-180b iteration taking 2.9 hours on one NVIDIA A100 after reworking the implementation. That experiment used a single iteration.

An optional variant gives a small number of weights full-precision corrections and lets the optimizer change which weights receive them. On WikiText2, that variant improved on SpQR in the reported near-3-bit and sub-3-bit experiments. The sub-3-bit setting used a 2-bit grid and a 2% outlier budget, for approximately 2.6 bits per weight under the paper’s accounting. These experiments measure prediction quality after compression and the resources needed to perform it. The runtime of serving the resulting weights, especially when full-precision corrections are scattered through a layer, remains an open question.

## Deep dive: QuantEase: Optimization-based Quantization for Language Models

QuantEase compresses pretrained language networks by repeatedly choosing low-bit weights that preserve layer outputs, with an option to retain outliers. · about 37 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why weight precision matters after training

Training produces matrices whose entries determine how information moves through a network. At inference time, those entries have to be stored and made available for calculations. As the number of parameters grows, the weight storage alone can become prohibitive. The authors illustrate this with GPT3, which they describe as having approximately 175 billion parameters and a memory footprint of more than 300GB. A machine may be able to run the calculations needed for a task in principle and still lack the memory to hold the weights in their original form. [Language Models are Few-Shot Learners](https://md.research.elamur.ai/free/en/papers/brown-2020-language-models-few-shot-learners/)

The authors connect the deployment problem to the growth in both training data and parameter counts. Their starting point is a network whose training has already consumed substantial time and compute. Going through training again to make the weights easier to compress can be impractical. Post-training quantization, or PTQ, starts with the completed weights and replaces them with values that can be represented more compactly. The original network can still supply reference outputs while those replacements are being decided. [Scaling Laws for Neural Language Models](https://md.research.elamur.ai/free/en/papers/kaplan-2020-scaling-laws-neural-language-models/) and Training Compute-Optimal Large Language Models

Quantization and sparsification are two approaches to compression discussed in the paper. Quantization restricts the values a stored weight can take. Sparsification removes selected contributions by setting weights to zero. The distinction matters for QuantEase’s outlier variant. There the main weight matrix is quantized, and a second matrix stores corrections at a small number of positions. Sparsity describes the distribution of those corrections. The main matrix still supplies a low-bit value at each position.

In the uniform schemes the authors study, a channel has a finite grid of evenly spaced values. An individual weight can be represented by the code for a grid point. As the bit budget shrinks, so does the number of available grid points. If the grid is spread over a broad range, a weight in the middle of that range may land far from any of them. A narrower range gives finer choices for many ordinary weights, at the cost of making extreme weights harder to represent. The choice of range and the choice of a grid point within that range are distinct problems.

The simplest rule is to round each weight to the nearest grid point. This is a natural choice if the only quantity being measured is the change in each stored number. A layer, though, multiplies a matrix of weights by its inputs. Several weight changes may amplify or offset one another when the input features occur together. A large change on a rarely active feature can have little effect on the observed output. A small change on a often active feature can matter more. QuantEase treats the response of the layer on observed inputs as the quantity worth preserving.

#### Why work one layer at a time

The layer-wise framework gives the optimization problem a manageable boundary. The input to a layer and the weights of that layer determine its linear output. Once the input has been recorded, a compression algorithm can ask how well different replacements reproduce that output. It can solve a sequence of such problems across a network rather than searching for a joint combination of all the quantized weights at once.

This approach depends on a practical choice about what to preserve. Every layer has a local reconstruction target, while the job of the complete network is to put probability on the right text or supply the right prediction. Local reconstruction has the advantage that the compression algorithm can compute it directly for each layer. Its usefulness for predicting behavior at the end of the network is an empirical question. That is why the paper considers both reconstruction error and language benchmarks.

The paper places QuantEase in a line of layer-wise methods that includes GPTQ and AWQ. GPTQ inherits an error-compensation idea from Optimal Brain Surgeon. It takes a column of weights, rounds it, and adjusts other weights to compensate for the change. The previously quantized columns stay fixed, while the columns still awaiting quantization can move in continuous space. This arrangement gives GPTQ a way to account for relationships among input features without simultaneously solving for all the discrete weights. Once every column has been quantized, the pool of unquantized columns available for compensation is exhausted.

AWQ addresses the relationship between weights and input features through scaling. It rescales weights and applies the reciprocal scaling to the layer inputs, so the factors would cancel in the absence of rounding. Quantization intervenes between those operations. Consequently, changing the scales can change which errors the layer incurs. AWQ searches for useful scales using the magnitudes of weights and activations. This approach can protect weights associated with influential inputs while operating through a search over a restricted set of scaling choices.

QuantEase begins with the same general goal of preserving layer outputs, then makes the quantized entries themselves the variables in a repeated search. Its comparison with GPTQ concerns which states the search can visit. GPTQ fixes earlier rounded columns and compensates using the remaining ones. QuantEase can return to an already quantized column and replace its entries with other legal values while holding the rest of the layer steady. This also makes a quantized result from GPTQ a possible starting point for QuantEase.

#### Why outliers complicate a uniform grid

The authors describe two ways a weight can cause difficulty at low precision. An unusually large magnitude can stretch the grid across a wider range, making the spacing coarser for many other weights. A weight can also be difficult because changing it has a large effect on reconstruction. In that case its importance depends on the calibration inputs and on how the surrounding weights can compensate. Magnitude offers information about grid range. Sensitivity offers information about output error.

SpQR extends GPTQ with a way to identify weights whose quantization would be especially costly. It estimates the layer error incurred when a particular weight is forced to its rounded value and uses a threshold to select exceptions. During quantization it retains those exceptions at full precision. The paper also discusses SqueezeLLM as related work on preserving consequential weights and on non-uniform quantization. These alternatives address a shared difficulty of very low precision, where the dense grid can be too coarse to carry every contribution well. [SqueezeLLM](https://md.research.elamur.ai/free/en/papers/kim-2023-squeezellm-dense-sparse-quantization/)

There is also an implementation problem beyond choosing the weights. A compact representation has to be read and used at inference time. Group-specific grids and separately stored outliers can affect how a kernel accesses weights and performs calculations. The authors put hardware-level optimization and inference-time activation quantization outside the main scope of their study. Their question is how well a weight optimizer can preserve a trained network’s behavior under a given set of precision constraints. SmoothQuant and [ZeroQuant](https://md.research.elamur.ai/free/en/papers/yao-2022-zeroquant-efficient-affordable-post-training/)

### The method, step by step

#### Turn a layer into a reconstruction problem

QuantEase starts with a trained layer and examples of the inputs that reach it. In the experiments, the authors randomly sample 128 sequences of length 2048 from C4 to supply these examples. Text is passed through the network, and the quantities used to fit a given layer are the input features arriving at that layer. The compression procedure also has the original weights. Together, the input matrix and original weights define the layer outputs it tries to reproduce. The authors use the word calibration for this procedure because the text is used to fit the compressed representation of an existing network.

The output being reconstructed is the pre-activation output, meaning the result of the linear multiplication before any subsequent nonlinear activation. For each calibration input, every output channel has an original value and a value produced by the candidate quantized weights. QuantEase squares the difference and adds the squared differences across samples and channels. Differences in opposite directions across samples therefore contribute to the total individually. Within a single sample and channel, contributions from different weights can offset one another before the difference is squared.

The per-channel grids are taken as given in the basic optimization problem. The optimizer searches for the best assignments it can find on those grids. It can pick different values for different entries within a channel, while every entry in that channel has the same set of available values. In the experiments those values are evenly spaced. The coordinate update itself depends only on the ability to find a nearest allowed value, which is why the authors say the approach can extend beyond uniform spacing.

How QuantEase compresses a layer The steps in order.

The reconstruction problem can be written as follows.

```
minimize over Ŵ: f(Ŵ) = ‖WX − ŴX‖²_F, with Ŵᵢⱼ ∈ 𝒬ᵢ for i ∈ [q], j ∈ [p]
```

Here W is the original layer’s weight matrix, and Ŵ is its candidate replacement. The matrices have q rows for output channels and p columns for input features. X has p rows and n columns, with n counting the calibration input vectors. WX and ŴX are the original and replacement pre-activation outputs. The squared Frobenius norm, written ‖·‖²_F, sums the squares of all entries in the matrix to which it is applied. The indices i and j identify an output channel and an input feature, respectively. The bracketed ranges cover all channels and features, and 𝒬ᵢ is the finite set of permitted values for channel i. An entry Ŵᵢⱼ belongs to that set when it can be represented on the grid.

This objective weights errors by the inputs on which they appear. A replacement can move the stored weights farther from their original values and still reconstruct the calibration outputs more closely. For instance, if two features tend to move together on the calibration inputs, a change in one coefficient can be offset partly by a change in the other. The objective incorporates those interactions through multiplication by X. It leaves open whether the same compensation will work on inputs with different feature relationships.

#### Find the best choice for one weight

Coordinate descent means optimizing one variable at a time while holding the rest fixed. QuantEase visits the columns cyclically. At a given column it updates all output rows in parallel, because reconstruction for one output row does not depend on the weights in another row. The term coordinate refers to a single entry of the weight matrix. The term column update describes how the implementation groups mutually independent coordinate decisions.

Start with a single output row. The contribution of the feature under consideration is its calibration input vector multiplied by the weight being updated. The remaining features contribute a fixed vector as long as all their weights stay fixed. As the candidate weight varies, the squared error for this row traces a quadratic curve. If the input feature has positive squared magnitude in calibration, that curve has a single lowest point in continuous space. Among the allowable discrete values, a nearest value to that lowest point gives the smallest error.

The nearest-level rule has a concise expression.

```
qᵢ(x) ∈ argmin over y ∈ 𝒬ᵢ of (x − y)²
```

The function qᵢ denotes the quantizer for output channel i. The real number x is the input to that quantizer, y ranges over the grid 𝒬ᵢ, and `(x − y)²` is their squared distance. The expression argmin means the set of inputs that achieve the smallest value of that squared distance. Membership allows either grid point when two are tied. The same quantizer can be applied to an original weight or to a newly computed continuous optimum. Those inputs generally differ once the optimization is underway.

To calculate the optimum efficiently, QuantEase summarizes the calibration inputs with their Gram matrix.

```
Σ = XXᵀ
```

Σ is the matrix of inner products between feature rows of X. The superscript ᵀ denotes transpose. The entry Σⱼₖ combines feature j and feature k by summing their products across the calibration inputs. The diagonal entry Σⱼⱼ gives the sum of squares for feature j. This matrix describes the relationships needed by the squared reconstruction objective. It is formed once for a layer’s given inputs and remains fixed as the optimizer changes its estimate of the weights.

The continuous optimum for one entry, followed by the quantized update, is given by the paper’s central formula.

```
β̃ = ((WΣ)ᵢⱼ − ∑ₖ≠ⱼ Σⱼₖ Ŵᵢₖ) / Σⱼⱼ
```

The real number β̃ is the best unconstrained value for the entry in row i and column j when all the other entries are fixed. The entry `(WΣ)ᵢⱼ` comes from the original weights and the feature inner products. In the sum, k ranges over every input column except j, and Ŵᵢₖ is the current replacement weight for that column in row i. The term Σⱼₖ describes how its input feature is related to the one being updated. The denominator Σⱼⱼ is the calibration sum of squares for feature j. The formula assumes it is positive.

```
Ŵᵢⱼ⁺ = qᵢ(β̃)
```

The superscript ⁺ marks the new value of the weight at position i, j. The quantizer qᵢ chooses the permitted level nearest to β̃. This solves the one-coordinate problem because the part of the objective that varies with the candidate is a positive multiple of its squared distance from β̃, plus a term independent of the candidate. The result is optimal for that coordinate under the current settings of its neighbors. As those neighboring weights change, the best discrete choice for the same coordinate can change too.

There is a special case when an input feature has zero squared magnitude throughout calibration. Its entire row in X is then zero, so changing any weight in that column has no effect on the calibration output. The authors can put those weights on their grids arbitrarily and remove the column from the optimization. This also avoids dividing by the zero diagonal entry that would otherwise appear in the continuous update. The reasoning is about the observed calibration inputs. It does not establish that the feature vanishes for all future inputs.

#### Visit the weights repeatedly

The basic initialization sets the candidate weights equal to the original weights. This gives exact reconstruction at the start, but generally violates the quantization constraints. During the first sweep, QuantEase assigns grid values to columns in turn. Once the sweep reaches the end, the whole matrix is a feasible compressed solution. A subsequent sweep starts from an completely different situation. The weight already present at each position is one of its legal choices, so the optimizer can always retain it if all the other choices would increase the error.

This is the basis of the descent guarantee for feasible discrete sweeps. Each update minimizes the objective over a set that includes the old coordinate. It may leave the objective unchanged, and it can reduce the objective when a better level exists. There is no requirement to retain the decisions from the first sweep. Revisiting a coordinate can help because the conditions under which its old value was selected have changed.

A finished quantized matrix from another method can also initialize QuantEase, provided it lies on the required grids. Its starting reconstruction error then comes from an already feasible solution. Every subsequent discrete update can compare a proposed change with that starting solution or with the improved state left by earlier updates. The authors describe this as a way to use QuantEase after GPTQ. It follows from the form of the optimization, independently of the experiments comparing their standalone versions.

The implementation also uses an empirical heuristic that periodically performs a sweep using the continuous optima directly. In the authors’ description, this happens in every other third iteration. The sweep can take the weights off their grids, and a following discrete sweep restores feasibility. This gives the search a chance to move through intermediate states unavailable to a purely discrete run. The authors report that the heuristic helped reduce reconstruction error. Its intermediate states fall outside the feasible-state descent argument, and the guarantee for ordinary discrete updates does not compare the two feasible solutions on either side of such an excursion.

#### Make a sweep practical

The update uses relationships among all the input features, so a direct implementation could spend considerable time recomputing their contributions. QuantEase reuses products. The original product WΣ stays fixed, while the product ŴΣ changes with the candidate weights. To get the sum in the continuous optimum, the algorithm can read the current product and remove the contribution of the very coordinate it is about to replace.

```
∑ₖ≠ⱼ Σⱼₖ Ŵᵢₖ = (ŴΣ)ᵢⱼ − Σⱼⱼ Ŵᵢⱼ
```

Here k runs over input features other than j. The coefficients Σⱼₖ come from the symmetric Gram matrix, so they can also be read down its j-th column. The product entry `(ŴΣ)ᵢⱼ` contains the contributions of every feature in row i, and the last term removes the one from column j. This form lets all output rows read from the same column of the product while making their own independent weight decisions.

A change to one column affects the full product ŴΣ, but it does so in a structured way. Every changed row contributes in proportion to the same row of Σ. The basic implementation can therefore update the product through an outer product.

```
Ŵ⁺Σ = ŴΣ + (Ŵ⁺[:, j] − Ŵ[:, j]) Σ[j, :]
```

Ŵ⁺ is the candidate matrix after column j has been replaced, and Ŵ is the matrix before replacement. The slice `[:, j]` selects every row of that column. The slice `[j, :]` selects row j across all columns of Σ. The product of the column difference and that row is an outer product. It has rank at most one and captures the whole change induced by replacing the column. The updated product reuses the work already present in ŴΣ.

In the basic implementation, keeping the products current in this way trades repeated full matrix multiplication for simpler operations at each inner step. The accelerated version goes further. The authors found that repeatedly materializing outer products in PyTorch was expensive in time and memory. They combine the old and new column contributions through their difference and defer work on product columns until the values in those columns are actually needed. A step about to update column j needs the result of previous updates to the columns already visited in that sweep. It can obtain that result from the current column and the accumulated differences.

The paper also absorbs the division by the diagonal of the Gram matrix into an initial normalization. Each Gram column is divided by its own diagonal entry. This gives unit diagonal values before the diagonal is set to zero. The zeroed diagonal excludes the current weight from the calculation automatically. Though the original Gram matrix is symmetric, dividing each column by its own factor can make the normalized matrix asymmetric. The normalization changes the arithmetic used to evaluate the same conditional optimum.

Using the accelerated update’s notation, the calculation becomes the following expression.

```
β̃ᵢ = Pᵢⱼ − P̂ᵢⱼ + ΔŴ[i, 1:j] Σⁿᵒʳᵐ[1:j, j]
```

The scalar β̃ᵢ is the continuous candidate for row i at the current column j. Pᵢⱼ is the normalized original-target term from WΣ. P̂ᵢⱼ is the normalized contribution of the replacement weights at the start of the sweep, using the Gram matrix with its diagonal removed. ΔŴ uses the old-minus-current convention for weight changes, so its product with the normalized Gram column corrects the subtracted starting contribution. The range `1:j` is the prefix through column j. The self term vanishes because the relevant diagonal entry of Σⁿᵒʳᵐ is zero. The product in the last term is a dot product between that prefix of the row’s differences and the corresponding entries of the normalized Gram column.

Keeping Σ and the needed products avoids tying the optimizer’s persistent storage directly to the number of calibration vectors. The paper describes its layer-level storage requirement as follows.

```
p² + O(pq)
```

The term p² accounts for the square Gram matrix over the p input features. The term O(pq) describes storage on the order of the size of a layer weight matrix with p input features and q output channels. It covers weight-shaped matrices used by the updates. The expression applies to the optimizer’s stored matrices. Running a full network, forming the input statistics and storing the final compressed representation involve their own memory requirements.

For the basic column-update scheme, the authors give the sweep cost in the following form.

```
O(p²q)
```

Here p is the number of columns and q the number of output rows. An update of the cached product after a column change touches a number of entries proportional to pq, and a sweep visits p columns. The notation O describes the growth rate as the dimensions increase. The paper gives its overall accounting using the calibration size and iteration count as well.

```
O(pqn + Kp²q)
```

The symbol n denotes the number of calibration vectors, and K denotes the number of iterations. The term containing K describes the repeated sweep work. The authors group the initial matrix calculations into their setup accounting. Forming a dense XXᵀ by direct multiplication has a cost that also depends on p twice, so the quoted overall expression should be read as the paper’s accounting for its setting. The concrete runtime measurements come from the accelerated implementation.

#### What convergence means here

A feasible matrix is a coordinate-wise minimum if trying another permitted value at any one position fails to improve the objective. The paper’s formal condition uses the fact that each entry solves its own discrete problem with the other entries fixed.

```
W*ᵢⱼ ∈ argmin over u ∈ 𝒬ᵢ of f(W* with entry (i, j) replaced by u)
```

W* is a feasible matrix under consideration, and W*ᵢⱼ is its entry in row i and column j. The variable u runs through channel i’s grid 𝒬ᵢ. The function f is the layer reconstruction objective. The condition is required for every position. It permits ties between choices that give the same objective. It also permits a situation in which changing several weights together would help even though changing any one of them alone would fail.

For the convergence result, the authors consider a modified discrete update that keeps the current value whenever the proposed one fails to decrease the objective strictly. This rule prevents motion among equal-error states. Once a feasible solution is present, the finite grids give a finite set of matrices. Each successful change strictly reduces the error, so the optimizer cannot cycle back to a previous matrix or make strict changes indefinitely. With cyclic visits, a state that persists through a sweep satisfies the coordinate-wise condition. This proof concerns the strict-update variant on the discrete grid. It supplies neither a global optimum guarantee nor a quality guarantee for the network’s eventual predictions.

#### Add a limited number of full-precision corrections

The outlier-aware variant gives each layer a quantized matrix and a sparse correction matrix. The quantized part still uses the per-channel grids. The correction part is free to take full-precision values, within a budget on how many of its entries can be non-zero. At positions with zero correction, the quantized matrix supplies the entire weight. At a selected position, the sum includes a full-precision correction whose value can be optimized.

```
minimize over Ŵ, Ĥ: g(Ŵ, Ĥ) = ‖WX − (Ŵ + Ĥ)X‖²_F, with Ŵᵢⱼ ∈ 𝒬ᵢ and ‖Ĥ‖₀ ≤ s
```

The original weights W and calibration inputs X define the same target as in the basic problem. Ŵ is the quantized component, and Ĥ is the matrix of full-precision corrections. The function g measures how well their sum reconstructs the original layer output. The indices i and j again select a channel and feature. The notation ‖Ĥ‖₀ counts the non-zero entries of the correction matrix, and s is the layer’s budget for such entries. A zero correction leaves the weight on its grid. At selected positions the effective weight belongs to the sum, which the objective can move away from the original weight if that helps reconstruct the layer.

The authors begin by finding the s largest-magnitude entries of W. They omit those entries when constructing the grids, so a few extreme weights need not determine the range used for the dense part. They also use the same magnitude criterion to initialize the correction matrix.

```
Ĥ = Pₛ(W),  Ŵ = W − Ĥ
```

Pₛ is the operator that keeps up to s entries of its matrix argument with the largest absolute values and sets the rest to zero. W is the original matrix. The initial correction Ĥ holds the selected entries, and the initial dense component Ŵ contains the remainder. Their sum still reproduces W, while the dense component generally needs a quantization sweep to land on its grids. This choice uses magnitude to construct a sensible initial representation. Subsequent updates can allocate the correction budget to a different set of entries.

The optimizer alternates between the two matrices. When Ĥ is fixed, its contribution to the output is known. Subtracting that contribution from the original target leaves the same kind of reconstruction problem that basic QuantEase solves. In effect, the original target weight matrix in the calculation becomes W minus Ĥ. The update then searches for quantized entries able to supply what the current corrections leave to the dense matrix.

When Ŵ is fixed, the objective is a least-squares problem in the entries of Ĥ with a constraint on their number. The authors use iterative hard thresholding. A gradient step proposes changes across the entire matrix. The thresholding step keeps the entries of the proposal with the largest magnitudes and discards the others. Taking the largest entries is the closest feasible approximation to the gradient proposal in squared Frobenius distance, because each discarded entry contributes its own square to that distance.

```
Ĥ⁺ = Pₛ(Ĥ − η ∇_Ĥ g(Ŵ, Ĥ))
```

Ĥ⁺ is the new correction matrix. The gradient ∇_Ĥ g measures the change in reconstruction error with respect to the correction entries while the dense weights Ŵ are held fixed. The positive step size η determines how far the proposal moves in the direction of reduced error. Applying Pₛ keeps it within the non-zero budget s. An entry absent from the current correction matrix can enter after the gradient step, and a previously selected entry can leave if other proposals have larger magnitudes.

```
L = 1/η = 2 λₘₐₓ(XXᵀ)
```

L is the gradient’s Lipschitz bound, which limits how rapidly the gradient can change with the correction matrix. The step size η is its reciprocal. The notation λₘₐₓ denotes the largest eigenvalue of the Gram matrix XXᵀ, which describes the largest amount of curvature relevant to this least-squares step. The authors discuss obtaining it by an iterative power method built on matrix and vector multiplication.

The bound gives a quadratic approximation that upper-bounds the change in the true objective. Hard thresholding minimizes that approximation within the support budget. The old correction matrix is itself an eligible choice if it already satisfies the budget. Choosing a closest eligible matrix to the gradient proposal therefore gives an approximation value at least as good as the old one. This is the reason the paper can prove descent for the correction update at the specified step size.

```
g(Ŵ, Ĥ⁺) ≤ g(Ŵ, Ĥ)
```

The inequality compares the outlier-aware error g before and after a correction update. The dense component Ŵ is the same on both sides, and the current correction matrix Ĥ must already satisfy the sparsity budget. The result allows equality. Combined with feasible dense updates, this keeps the objective from rising during the corresponding alternating steps. The guarantee refers to those updates, while the initialization becomes jointly feasible only once the dense weights have been brought onto their grids.

The outlier variant also keeps the correction matrix and its product with Σ in memory. These have the same dimensions as the weight matrix, so the authors retain the same asymptotic storage expression for optimizer matrices. The additional computation includes multiplying the correction matrix by the Gram matrix and identifying the largest entries for thresholding. They state the overall cost as follows.

```
O(pqn + Kp²q + Kpq log(pq))
```

The dimensions p, q and n refer to input features, output channels and calibration vectors. K is the iteration count. The terms cover the paper’s setup and matrix-work accounting, with the logarithmic term reflecting the authors’ reported average complexity for selecting large entries. This is a computation estimate for compression. The work involved in reading and applying the sparse corrections when serving the compressed network is a separate question.

The authors also outline a structured version of the selection step. It would retain entire columns, chosen using their Euclidean norms. This could make the full-precision part easier for some kernels to handle, with a different constraint on which entries can receive corrections. If one influential entry belongs to a selected column, every row in that column consumes part of the budget. Unstructured selection can allocate those entries individually. The paper leaves the serving tradeoff between these choices open.

### Experiments and results

#### What was fitted and what was evaluated

The comparisons use pretrained members of the OPT, BLOOM and Falcon families. The authors sample 128 sequences of length 2048 from C4 for calibration. These sequences supply the input features and original layer outputs used by the compression algorithms. WikiText2 and PTB are separate evaluation corpora. The distinction matters because a procedure that repeatedly improves the reconstruction of the C4 activations can still reach a point where further fitting yields little improvement on another corpus. [OPT](https://md.research.elamur.ai/free/en/papers/zhang-2022-opt-open-pre-trained-transformer/) and [The Penn Treebank](https://md.research.elamur.ai/free/en/papers/marcus-1994-penn-treebank-annotating-predicate-argument/)

The language prediction results use perplexity, where a lower value means the network assigns more probability to the text it is evaluated on. The paper reports results on WikiText2 in the main experiments and gives parallel PTB comparisons in its appendix. A separate task measures zero-shot accuracy on LAMBADA, which requires predicting a word using the passage preceding it. Zero-shot here means the benchmark is used to evaluate the compressed network without task-specific training on it. Perplexity and word-prediction accuracy give different views of the effects of compression. [LAMBADA](https://md.research.elamur.ai/free/en/papers/paperno-2016-lambada-dataset-word-prediction-requiring/)

The uniform baselines are RTN, GPTQ and AWQ. RTN rounds to the nearest grid level. GPTQ also rounds but compensates for the resulting error through the columns that remain unquantized. AWQ seeks a scaling that reduces the effect of quantizing weights associated with influential activations. The comparison includes AWQ for OPT. The authors excluded it for BLOOM and Falcon because of architecture-related issues with the implementation they considered. The absence of an AWQ value for those families is consequently a condition of the experiment.

SpQR is the comparison for settings that keep selected weights at full precision. The authors excluded SqueezeLLM because its main emphasis is non-uniform quantization and because they were unaware of public quantization code for it at the time. The comparisons also omit grouping. With grouping, separate subsets of weights may have their own quantization ranges. Omitting it makes the experiments more directly about the alternative optimizers and outlier rules under the paper’s selected conditions.

The primary hardware was one NVIDIA A100 with 80GB of memory. The paper also describes a memory comparison on one NVIDIA V100 for OPT-66b. QuantEase could carry out quantization there, while GPTQ ran out of memory in connection with its Cholesky calculation and AWQ ran out of memory in its batched calculations. This is a concrete test of the implementations and hardware used by the authors. The paper attributes QuantEase’s result in part to its ability to carry out weight updates without explicitly inverting or factoring the calibration Gram matrix. [GPU & parallel computing](https://md.research.elamur.ai/free/en/topics/gpu-parallel-computing/)

The paper describes its implementation as PyTorch-based and says it will be released on GitHub. All the reported QuantEase experiments use the accelerated version. This matters when interpreting both runtime and feasibility. The method’s basic arithmetic explains what the optimizer computes, while the accelerated implementation determines much of the practical cost of computing it on the hardware used.

#### Uniform quantization on text and word prediction

In the 3-bit text prediction results, the authors report lower perplexity for QuantEase in the cases they compare across OPT, BLOOM and Falcon. At 4 bits, the reported pattern is largely an improvement or a result close to the other methods. These claims cover the evaluated settings with reported comparisons. The corpus names and the fact that calibration comes from C4 are important to the interpretation. Perplexity on WikiText2 or PTB tests the behavior of the full compressed network away from the inputs directly used to select the layer weights.

The contrast between bit widths is informative even without placing the results on a single scale. At 4 bits, several methods can produce similar perplexity, leaving less visible benefit from revisiting weight choices. At 3 bits, fewer values compete for each weight, so early decisions can leave larger reconstruction errors for other weights to absorb. QuantEase’s repeated updates have room to improve those decisions. The experimental pattern is consistent with that explanation. The bit-width comparison does not isolate any specific mechanism inside the algorithm.

On LAMBADA, the tested families are OPT and BLOOM. At 3 bits, the paper reports an advantage for QuantEase over GPTQ and over AWQ where AWQ was run. The relative accuracy improvement over GPTQ reaches 15% in the reported comparison. That percentage describes a relative gain in zero-shot LAMBADA accuracy. It is neither an absolute accuracy score nor a gain measured in percentage points. At 4 bits, the results across methods are closer, and the authors describe QuantEase as the strongest overall in those comparisons.

The Falcon runs include qualifications that matter for both speed and accuracy. The authors report numerical trouble in the Cholesky factorization for GPTQ with the default configuration on most seeds they explored for Falcon-40b and Falcon-180b. The difficulty affects which comparisons the authors could obtain. They also stopped QuantEase after a single iteration on Falcon-180b to avoid what they describe as overfitting. The Falcon runtime appendix reports 30 iterations for Falcon 7b/40b and 1 iter for Falcon-180b. Consequently, the largest Falcon case gives evidence about a deliberately short run, while the smaller ones give evidence about repeated optimization.

The appendix includes generated passages from OPT-13b at 4 bits, alongside the original FP16 output and GPTQ output. In one prompt about an algorithm behaving unexpectedly, GPTQ starts closer to the full-precision continuation, while the authors find the QuantEase continuation more internally consistent as it develops. In a story about a feline ruler, both compressed versions take the story in a different direction from the original, and the authors note that QuantEase keeps some of the roles in the premise in view. Another prompt gives a QuantEase continuation closer to the original storyline, with repetition near the end. In the talking-dog example, the authors find that the compressed continuations diverge from the full-precision output. These examples show several kinds of change in individual generations. Perplexity and benchmark accuracy supply the aggregate comparisons.

#### Outlier-aware quantization

For the near-3-bit comparison on WikiText2, the authors use a 3-bit dense grid and correction budgets of 0.5% and 1% of the weights. They estimate approximately 0.15 bits of overhead for the 0.5% setting, giving 3.15 bits on average. For the 1% setting, they estimate an overhead of 0.3 bits, giving 3.3 bits on average. These are approximate storage figures under the paper’s accounting. They name the cost of carrying corrections alongside the dense values, a separate property from the perplexity calculated after quantization.

The SpQR threshold was chosen to give at least 1% outliers on average. The authors report that the QuantEase setting with a 0.5% budget reduces WikiText2 perplexity compared with SpQR throughout the reported comparison, and that the 1% QuantEase setting improves further. The family-level results cover OPT, BLOOM and Falcon. For the larger Falcon cases, the paper again records numerical problems with Cholesky factorization, this time for SpQR. The favorable result for the smaller QuantEase budget concerns the reported threshold settings and implementations. Exact equality in realized storage is a different comparison.

The experiments then take the dense grid down to 2 bits. With a 2% outlier budget, the paper estimates approximately 2.6 bits per weight on average. The results discussed for OPT and BLOOM favor outlier-aware QuantEase over SpQR in WikiText2 perplexity. The paper’s introduction describes perplexity improvements reaching a factor of 2.5 against SpQR in the near- or sub-3-bit comparisons. This is the paper’s headline comparison across those settings. It does not specify a common improvement to expect across individual sizes or families.

The authors also report a substantial degradation when they tried 2-bit quantization with neither grouping nor outlier detection. The low average bit count therefore depends on the representation carrying a small number of exceptions in addition to its dense values. The outlier comparison supports the feasibility of that combined representation at the tested settings. It does not imply that a uniformly quantized layer with the same dense grid would give similar predictions.

#### Compression time

The most concrete timing comparison is between the basic and accelerated implementations of the same optimizer on Falcon-180b. With a single NVIDIA A100, the authors report reducing the iteration time from 99 hours to 2.9 hours. They attribute the difference to the partial updates and related arithmetic changes, and report that the acceleration preserved accuracy. The comparison shows the practical effect of changing how the same weight update is computed.

Falcon-180b quantization iteration time on one NVIDIA A100 Partial updates greatly reduce the time required for the QuantEase iteration.

**The numbers**

| System or setting | hours |
| --- | --- |
| Basic QuantEase | 99 |
| Accelerated QuantEase (this paper) | 2.9 |

The appendix reports runtimes for the 3-bit configurations more broadly, ranging from tens of minutes for networks below a billion parameters to around a day for a 13b case. Iteration count is part of the explanation for how to read these timings. The Falcon-180b figure comes from a run stopped after the first sweep. A smaller network run for many sweeps can take longer than that particular run. The paper describes a single accelerated sweep as comparable in speed to its well-optimized GPTQ comparison. The complete time to obtain a compressed network also depends on how many sweeps are used.

### What the ablations show

#### How much repeated optimization helps

The clearest iteration-count comparison uses OPT-350m with 3-bit and 4-bit weights. The authors vary the count from 10 to 30 and evaluate perplexity on WikiText2. More iterations generally improve perplexity, with only a small improvement in the 4-bit case. This provides evidence that revisiting weight decisions can improve the full network’s predictions under some settings. The weaker effect at the higher bit width indicates that the value of additional sweeps depends on the precision regime.

The authors choose 25 iterations as a balance between runtime and accuracy for the rest of the experiments, with exceptions including the Falcon settings specified in the runtime appendix. The iteration study provides a basis for this operating point. It covers a single size in the OPT family, so it cannot establish that the same count offers the best tradeoff for all the layers or families studied. The Falcon-180b exception makes the relevance of that distinction especially clear.

The comparison also helps separate the objective’s behavior from its usefulness. For feasible discrete steps, the optimizer can directly ensure that the calibration objective does not rise. WikiText2 perplexity is an evaluation of the resulting network on different data. The reported trend indicates that improvement in reconstruction can be accompanied by an improvement on separate text, with diminishing benefit in the 4-bit case. The relationship need not persist for arbitrarily many iterations.

#### What differs across layers

The authors compare QuantEase and GPTQ on the calibration reconstruction error of individual BLOOM-1b1 layers. They divide the squared output discrepancy by the squared magnitude of the original layer output. This normalization gives an error relative to the scale of that layer’s original output on C4 calibration inputs.

```
error(Ŵ) = ‖WX − ŴX‖²_F / ‖WX‖²_F
```

The function error takes the quantized weight matrix Ŵ as its argument. W is the original weight matrix and X supplies the calibration input vectors. The numerator is the reconstruction objective, and the denominator is the summed square of the original outputs. The ratio describes the size of the error relative to the energy of the reference output, under the same calibration inputs. It is a local measure of compression error, separate from a benchmark score for the complete network.

The comparison also expresses the reduction relative to GPTQ’s error.

```
(error(ŴᴳᴾᵀQ) − error(Ŵᑫᵘᵃⁿᵗᴱᵃˢᵉ)) / error(ŴᴳᴾᵀQ)
```

The superscripts identify the two quantized weight matrices produced by GPTQ and QuantEase. Each error is calculated for the same target layer using its calibration inputs. The numerator is the reduction in relative calibration error, and the denominator sets GPTQ’s error as the reference for that reduction. A positive result favors QuantEase. This percentage addresses fit to the layer objective and should be distinguished from the percentage gain in LAMBADA accuracy.

The QuantEase error across layers runs from almost zero to 5% for 4-bit compression and from zero to 15% for 3-bit compression. The authors report lower error than GPTQ for most layers, with a maximum relative improvement of 30% and a median improvement of 12% in the figure caption. Those summaries concern BLOOM-1b1 reconstruction on calibration inputs. The range makes clear that the same bit budget can be a mild constraint in some layers and a stronger one in others.

The layers in the figure are ordered by their QuantEase error. That ordering shows how widely errors vary across the network. It is not the sequence in which the layers occur in the architecture. The analysis supports the narrower claim that QuantEase can better optimize a stated calibration objective for most layers in this case. The separate whole-network results are needed to judge whether this improvement matters for prediction.

#### What the outlier and implementation comparisons isolate

Comparing the two QuantEase budgets at a 3-bit dense precision examines the effect of allowing more full-precision corrections. The larger budget improves the reported WikiText2 perplexity, at the expense of a larger estimated average storage cost. Comparing against SpQR asks a related question about how effectively a method uses its corrections, with threshold and budget choices specific to each method. QuantEase chooses both the values and locations of its corrections during the search. SpQR selects exceptions using a sensitivity rule and keeps their positions fixed. The comparison includes those differences together with the difference between the dense weight optimizers.

The 2-bit experiments supply a stronger stress test of the representation. The paper’s observation of poor results when neither grouping nor outlier correction is available explains why the full-precision component matters in the tested regime. Several elements change together when it is added. Constructing the grid after omitting extreme values can improve the fit of common weights. Updating the sparse component can compensate for errors that remain. The paper reports the performance of the combined procedure. It does not break out the independent gains from narrowing the initial range, changing the support during optimization or refitting the correction values.

The basic-versus-accelerated comparison is more direct. The implementations use the same coordinate update and differ in the work used to calculate it. The reported improvement on Falcon-180b therefore addresses runtime without requiring a change in the quantization objective. The paper does not give a separate timing for every implementation change. The observed speed reflects the combination of partial updates, cached differences and normalization.

The occasional continuous sweep is another component for which the evidence is narrower. The authors report that it helped optimization in their observations. The iteration-count experiment varies how long QuantEase runs, instead of holding the sweep count fixed and comparing runs with and without continuous updates. Its perplexity curve therefore describes the procedure as run. The discrete descent result and the empirical observation about the continuous sweep answer different questions about that procedure.

### Limitations

#### Limits the authors identify

The study deliberately omits grouping. The authors say grouping can be incorporated because QuantEase uses standard quantizers, and they leave its performance in that setting to future work. The experiments show what the method achieves with the chosen per-channel grids and, for its outlier version, a separate sparse correction. They do not quantify the gain, runtime cost or storage effect of adding group-specific grids.

The authors also suggest pairing AWQ’s scaling with QuantEase. Their reasoning is that AWQ scaling can be combined with GPTQ, and QuantEase often compares favorably with GPTQ under the reported uniform settings. The combination is a proposal in the discussion. The experiments offer neither its perplexity nor its LAMBADA accuracy. They also do not show how the scaling would affect the best grid assignments after repeated coordinate updates.

Serving with outliers raises a hardware question the paper leaves open. Scattered full-precision entries can make a GPU kernel more complicated, with a possible increase in latency. Retaining full columns is one way to impose structure, but that limits where the correction budget can be spent. The authors leave the choice of representation and kernel to a serving study. Their average-bit estimates and perplexity results do not provide a direct measurement of latency, throughput or memory use for a deployed inference workload.

The paper also restricts its scope to network weights. It discusses related work on inference-time activation quantization and hardware-level optimization as separate lines of inquiry. QuantEase uses activations from calibration to choose weight values. The presence of those activations in the objective does not mean the procedure also compresses the activations used later at inference.

Some comparison gaps arise from the implementations used. AWQ was omitted for BLOOM and Falcon, and the Cholesky calculations for GPTQ or SpQR posed problems in larger Falcon settings. Those observations are relevant to the practical conditions of the study. They leave open which quality and runtime results different configurations or implementations could obtain for those same cases.

#### Limits that follow from the design

The proof gives a local guarantee for the modified discrete optimizer. It reaches a state from which changing one weight alone cannot improve calibration reconstruction. Two or more changes made together may still help. Initial choices can matter because the proof does not identify which coordinate-wise minimum the method will reach. Runs that include off-grid sweeps also move outside the conditions of the finite-state argument during those sweeps. For the sparse correction step, the descent proof supplies a bound for that block update with the dense weights fixed. It does not establish that the alternating procedure finds the globally best correction support and dense grid assignment.

Calibration uses a particular sample of C4, and evaluation centers on a small set of text benchmarks. The experimental scope is broad enough to compare several language families in the tested precision regimes. It does not establish that the same calibration sample, grid choices or number of sweeps will be effective for an arbitrary task or distribution. The fact that the largest Falcon run was cut short to avoid overfitting also shows that more opportunity to reduce calibration error was treated as a possible liability in practice.

The reconstruction objective is local to each layer and specific to its recorded inputs. It does not explicitly optimize the final probabilities of the complete network. Errors in earlier layers can change the inputs to later ones, and an improvement for a particular calibration objective need not have a predictable effect on a given word or passage. The held-out perplexity and zero-shot results make an empirical case for the method on the selected benchmarks. The generation examples show that qualitative behavior can still vary from prompt to prompt after quantization.

The outlier experiments combine several choices in a single procedure, including the initial removal of extreme weights from grid construction, the optimization of the dense weights and the reassignment of sparse corrections. The study shows that those choices can work together. It leaves unresolved how much of the gain comes from each, and whether a different selection policy would obtain the same perplexity at the same realized storage cost. The average-bit estimates provide a way to describe the tested settings. A comparison of actual stored formats would also depend on their grid metadata, correction values and the way correction positions are represented.

The speed measurements are for producing the compressed weights. They establish that the procedure can be run under particular hardware and iteration choices. They do not measure the speed of generating text with those weights. The distinction becomes especially important for the sub-3-bit setting. A smaller dense representation can coexist with extra work to recover and apply the corrections. Whether that tradeoff is worthwhile for serving depends on measurements the paper leaves outside its scope.

### What came after

[A Survey on Efficient Inference](https://md.research.elamur.ai/free/en/papers/zhou-2024-survey-efficient-inference-large-language/) cites QuantEase in a survey whose subject is efficient language inference. Its connection is at the level of surveying approaches to the deployment problem that motivates post-training weight compression. QuantEase provides an example of an optimization method for selecting a low-bit representation after training. The citation establishes that the survey takes account of this work. It does not establish that the survey implemented the cyclic update, reran the perplexity experiments or extended the method.

[LLM Inference Unveiled](https://md.research.elamur.ai/free/en/papers/yuan-2024-llm-inference-unveiled-survey-roofline/) also cites QuantEase and frames its own subject around inference and roofline analysis. That perspective makes a distinction already present in QuantEase especially relevant. The error from choosing compressed weights and the cost of executing calculations with those weights are different quantities. QuantEase measures the former through reconstruction and prediction quality and reports the resources needed for the compression step. The later citation connects the paper to a wider treatment of inference, without establishing a roofline measurement for a QuantEase deployment.

Both later works are surveys dated 2024. Their citations document how the optimization entered the broader discussion of efficient inference. They leave the technical questions raised by the original paper intact, particularly how its low-bit assignments interact with grouping and how much a deployment gains from the sparse full-precision corrections once the serving kernel is included.

## Cite

Cite as Kayhan Behdin, Ayan Acharya, Aman Gupta, Qingquan Song, Siyu Zhu, Sathiya Keerthi and Rahul Mazumder. 2023. QuantEase: Optimization-based Quantization for Language Models. arXiv:2309.01885.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2309.01885](https://doi.org/10.48550/arxiv.2309.01885) · [arXiv 2309.01885](https://arxiv.org/abs/2309.01885)

```bibtex
@misc{behdin2023quantease,
  title = {{QuantEase: Optimization-based Quantization for Language Models}},
  author = {Kayhan Behdin, Ayan Acharya, Aman Gupta, Qingquan Song, Siyu Zhu, Sathiya Keerthi and Rahul Mazumder},
  year = {2023},
  doi = {10.48550/arxiv.2309.01885},
  eprint = {2309.01885},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2309.01885}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
