Pranav Ajit Nair
Google DeepMind
pranavajitnair@google.com&Arun Sai Suggala
Google DeepMind
arunss@google.com
Abstract
Large language models (LLMs)††Work done when the authors were at Google Research. have recently demonstrated remarkable performance across diverse language tasks. But their deployment is often constrained by their substantial computational and storage requirements. Quantization has emerged as a key technique for addressing this challenge, enabling the compression of large models with minimal impact on performance. The recent GPTQ algorithm, a post-training quantization (PTQ) method, has proven highly effective for compressing LLMs, sparking a wave of research that leverages GPTQ as a core component. Recognizing the pivotal role of GPTQ in the PTQ landscape, we introduce CDQuant, a simple and scalable alternative to GPTQ with improved performance. CDQuant uses coordinate descent to minimize the layer-wise reconstruction loss to achieve high-quality quantized weights. Our algorithm is easy to implement and scales efficiently to models with hundreds of billions of parameters. Through extensive evaluation on the PaLM2 model family, we demonstrate that CDQuant consistently outperforms GPTQ across diverse model sizes and quantization levels. In particular, for INT2 quantization of PaLM2-Otter, CDQuantachieves a reduction in perplexity compared to GPTQ.
1 Introduction
Large language models (LLMs) have shown remarkable ability to handle various language tasks(Touvron etal., 2023; OpenAI, 2023; Google, 2023), but their widespread adoption is hampered by their substantial computational and memory demands. To tackle this challenge, researchers have explored techniques like quantization, pruning, and distillation, with quantization being a particularly promising avenue for reducing model size and inference time without significantly sacrificing performance(Miao etal., 2023).Quantization techniques broadly fall into two categories: post-training quantization (PTQ) and quantization-aware training (QAT). QAT, while potentially yielding better results, poses a significant challenge for LLMs due to the immense resources required to train these large models. As a result, a growing body of research has focused on PTQ, which is generally less computationally intensive and can be applied to large, pre-trained models.
A seminal work in PTQ for LLMs is GPTQ(Frantar etal., 2022), which introduced a one-shot weight quantization approach that minimizes the following layer-wise output reconstruction loss: ,where represents the layer inputs and are the original and quantized weight matrices, respectively. This method has sparked a wave of research in PTQ. Subsequent works have built upon GPTQ, addressing its limitations and improving it’s performance.For instance, SpQR(Dettmers etal., 2023) and OWQ(Lee etal., 2023) improve GPTQ by explicitly addressing outlier weights, maintaining them in full precision, while quantizing the remaining weights using GPTQ. This hybrid approach improves quantization accuracy, particularly at lower bit-widths. Another line of research focuses on transforming the weight space before applying GPTQ. For instance, QuIP(Chee etal., 2024), FrameQuant(Adepu etal., 2024) transform the weights into a more quantization-friendly space and apply GPTQ in the transformed space. AWQ(Lin etal., 2023), SmoothQuant(Xiao etal., 2023) reduce the effect of activation outliers by performing feature scaling before quantizing the weights using standard techniques.
Given the central role GPTQ plays in the landscape of PTQ methods for LLMs, improving its quality directly translates to better quantization across numerous techniques that build upon it.Consequently, in this work, we revisit the core optimization problem addressed by GPTQ and introduce a novel coordinate descent based algorithm, CDQuant, to minimize the objective. CDQuantis an iterative optimization technique that greedily selects coordinates to descend along in each iteration. This approach contrasts with GPTQ, which cycles through the coordinates only once, in a predetermined order, often leading to suboptimal solutions for the layer-wise objective (see Section2 for more details). CDQuantis simple to implement and scales effectively to models with billions of parameters.We further extend CDQuant to group/sub-channel quantization, a technique gaining popularity of late(Dettmers etal., 2021; Dettmers and Zettlemoyer, 2023). Extensive experiments on PaLM 2(Anil etal., 2023) demonstrate that CDQuantconsistently outperforms GPTQ across various model sizes and quantization precision levels. For example, for INT2 quantization of PaLM2-Otter, CDQuantachieves a reduction in perplexity compared to GPTQ.
2 Related Work
The literature on quantization is huge. In this section, we only review the works that are related to quantization of large pre-trained models, and those that are related to our work.
Weight-only Quantization.
Optimal Brain Quantization (OBQ)(Frantar and Alistarh, 2022), a post-training quantization (PTQ) technique, draws inspiration from the Optimal Brain Surgeon (OBS) framework proposed byLeCun etal. (1989). Frantar and Alistarh (2022) introduced exact yet efficient algorithms for implementing the OBS greedy strategy. However, OBQ remains computationally expensive and struggles to scale effectively to large language models (LLMs). Frantar etal. (2022) subsequently introduced GPTQ, which employs heuristics to accelerate the OBQ algorithm. Specifically, GPTQ updates coordinates once in a cyclic manner rather than the greedy approach used in OBQ. This modification significantly speeds up the algorithm but comes at the cost of reduced performance. In our work, we address this performance drop by proposing greedy coordinate descent algorithms that are both straightforward and easy to implement.
Recent works have sought to improve upon GPTQ. One popular strategy here is to identify and isolate problematic weights before applying GPTQ. For example, SpQR(Dettmers etal., 2023) isolates outlier weights and keeps them at full precision, quantizing only the remaining values using GPTQ. Similarly, OWQ(Lee etal., 2023) identifies weights that are highly sensitive to small perturbations and excludes them from the GPTQ quantization process.Another promising direction involves transforming the weights into a different basis before quantization. Both QuIP(Chee etal., 2024), and FrameQuant(Adepu etal., 2024) take this route and perform quantization in the transformed space using GPTQ. In all these approaches, we could potentially substitute GPTQ with CDQuantand expect to see further improvements in performance. Other promising methods such as AWQ(Lin etal., 2023), AffineQuant(Ma etal., 2024), suppress the effect of outliers in input activations by adjusting their scale and transferring it to weights. They then perform the standard MinMax quantization on the rescaled weights. One could replace MinMax with GPTQ, CDQuantto improve the performance of these techniques (see Table3 for a comparison of CDQuantwith AWQ).
While working on our paper, we came across QuantEase(Behdin etal., 2023), a parallel research effort sharing similar goals as ours for improving GPTQ. While both methods leverage the concept of coordinate descent, QuantEase adopts a cyclic approach for weight updates, whereas our work employs a greedy strategy. Although our experiments (AppendixF) indicate comparable performance between the two methods, our work extends beyond QuantEase by introducing specialized algorithms for group/sub-channel quantization, not just full-channel quantization. Additionally, we develop novel block coordinate descent algorithms that further improve the performance. That being said, both these works (QuantEase and ours) collectively highlight the potential of coordinate descent algorithms in outperforming GPTQ.
Weight+Activation Quantization.
SmoothQuant(Xiao etal., 2023), OS+(Wei etal., 2023, 2022) have a similar flavour as AWQ, but quantize both weights and activations after scaling them appropriately. OmniQuant(Shao etal., 2023) performs quantization of the entire transformer block in a single shot. This encompasses both activation and weight quantization. Furthermore, it subsumes SmoothQuant, OS+ by using both feature scaling and outlier suppression. QLLM(Liu etal., 2023) tackles the issue of outliers in the activations by splitting the outlier features into multiple sub-channels and then recombining them, effectively reducing their influence. QLLM also incorporates a fine-tuning step at the end, introducing low-rank weights into each layer of the LLM. LLM.int8()(Dettmers etal., 2022) quantizes both acativations and weights to -bits and also identifies outliers and stores them in full precision.
Efficient End-to-End Quantization.
To recover the drop in performance from quantizationChai etal. (2023); Dettmers etal. (2024); Hu etal. (2021) perform low-rank parameter-efficient fine-tuning.
3 CDQuant
Notation.
Throughout the paper, we denote vectors by bold faced letters (), and matrices by capital letters (). is the Euclidean norm and is the Frobenius norm of a matrix. represents a diagonal matrix with as its diagonal entries. denote the input, output dimensions of a layer. is the weight matrix of the layer, and is the matrix containing datapoints that are sent as input to the layer. is the Hessian matrix for our objective in Equation(1). denotes the number of bits of precision used in quantization. In quantization, we aim to represent as , where represent the scale and bias parameters and is the quantized matrix.
Many existing PTQ techniques, including GPTQ, aim to solve the following layer-wise optimization objective: .Observe that this problem breaks down into independent problems across the output dimension. So, in the sequel, we focus on the following problem of quantizing a -dimensional vector
(1) |
For a fixed , this problem is called Integer Linear Regression problem. It turns out, finding optimal solutions to this problem is NP-hard(Chrétien and Corset, 2009; Park and Boyd, 2018). So, several works have designed heuristics to solve this problem(Nagel etal., 2020; Li etal., 2021; Frantar and Alistarh, 2022; Frantar etal., 2022; Hubara etal., 2021). Within the context of LLMs, GPTQ is perhaps the most popular among these techniques, as it scales efficiently to models with billions of parameters(Frantar etal., 2022). In this work, we aim to improve upon GPTQ by designing better heuristics, while maintaining its scalability aspect. To this end, we rely on performing coordinate descent on objective(1), which we describe below.
3.1 Greedy Coordinate Descent
1:Input: - coordinate descent steps, - input data matrix, - vector to be quantized, - scale, - bias, - initial estimate
2:Compute Hessian as:
3:Compute gradient as:
4:fordo
5:Find the coordinate that leads to the largest reduction in loss
6:Update gradient as
where is the column of
7:Update as
where is the standard basis vector with in position and everywhere else
8:endfor
In this section, we assume we have suitable values for scale () and bias () parameters already at hand, and focus on optimizing . For a more in-depth discussion of how we determine these values, please refer to the final part of the section. As the name suggests, in greedy coordinate descent, at each round, we find the coordinate that leads to the biggest reduction in the objective and descend along that coordinate. Letting be the objective in Equation(1), we try to find a coordinate and value , such that updating the coordinate to gives the biggest reduction in loss
where is the standard basis vector with in position and everywhere else. Luckily for us, this can be implemented extremely efficiently as we have analytical expressions for the objective. In particular, one can easily show that
where are the Hessian and gradient of evaluated at .Algorithm1 describes this procedure. Observe that line 5 is the most expensive step of the algorithm. It requires finding the minimum value among possibilities, a task that is well-suited for parallelization on GPUs.
Extension to Block Coordinate Descent.
A natural extension to Algorithm1 is block coordinate descent (BCD), where multiple coordinates are updated simultaneously in each iteration. While a greedy approach to BCD could, in principle, optimize the objective much better, the computational cost becomes prohibitive. Specifically, updating coordinates at a time necessitates evaluating possible combinations of coordinates and their corresponding values. To overcome this, we propose a randomized BCD strategy (Algorithm 2), where we randomly partition the coordinates into blocks, and only search over these blocks and their corresponding values. This significantly reduces the search space to a more manageable possibilities, making the algorithm practical for larger models. In our experiments, we primarily set and work with .
Initializing .
To initialize in Algorithms1,2, we introduce a technique called Optimal Weight Clipping (OWC), which draws inspiration from the Learnable Weight Clipping (LWC) mechanism used in OmniQuant(Shao etal., 2023). In OWC, we quantize weight as follows
(2) |
Here, represents the clipping strength. We determine the optimal by minimizing the following layer-wise loss:
Note that while not explicitly stated, both in the above objective are implicitly dependent on .This optimization can be efficiently solved using a simple grid search. In contrast, LWC(Shao etal., 2023) optimizes a different objective function, focusing on end-to-end quantization of entire transformer block using gradient-based techniques. It is worth noting that setting in OWCrecovers the widely used MinMax quantization scheme, which is used in many existing quantization methods, including GPTQ(Frantar etal., 2022), SmoothQuant‘(Xiao etal., 2023). In our experiments, we observed that OWCprovides a much better initialization compared to MinMax quantization, for both GPTQ and CDQuant.
1:Input: - coordinate descent steps, - block size, - input data matrix, - vector to be quantized, - scale, - bias, - initial estimate
2:Compute Hessian as:
3:Compute gradient as:
4:fordo
5:Randomly partition the set into blocks, each of size
6:Find the block that leads to the largest reduction in loss
where are the sub-vector, sub-matrix of corresponding to block .
7:Update gradient as
8:Update as
9:endfor
3.2 Extension to Sub-channel Quantization
In this section, we consider sub-channel (or group) quantization, which is a morefine-grained quantization that divides the weight vector into multiple groups and assigns a quantization scale to each group(Dettmers etal., 2021; Dettmers and Zettlemoyer, 2023). Letting be the group size, we divide weight into groups each of size , and quantize as . To learn the optimal parameters for this sub-channel quantization, we solve the following optimization problem:
(3) |
Here, represents the columns of corresponding to the indices within group . To solve this optimization problem, we employ a coordinate descent approach, similar to Algorithms1 and 2 described earlier. That is, given initial values for the scaling and bias parameters, we iteratively optimize the quantized representation using coordinate descent. Due to space constraints, we present the resulting algorithms in AppendixC (see Algorithms4,5).
Initialization.
Next, we tackle the initialization of parameters for our coordinate descent procedure. Our approach draws inspiration from the OWCalgorithm described above, adapting its core idea to this problem. In essence, we reframe the initialization problem as one of selecting optimal clipping strengths for groups . This leads us to the following problem
(4) |
where
We use greedy coordinate descent to optimize Equation(4). In each iteration, we update the that leads to biggest drop in loss. This procedure, which we call OWC-CD, is described in Algorithm3.
1:Input: - coordinate descent steps, - group size, - input data matrix, - weight vector, - grid of possible values for clipping strength
2:fordo
3:fordo
4:Compute quantization residual for group with clipping strength as:
. where are as defined in Equation(2).
5:endfor
6:endfor
7:Initialize clipping strengths for each group
8:Compute Hessian as:
9: where is the sub-matrix of corresponding to the columns of group .
10:fordo
11:Find the group that leads to the largest reduction in loss
where is the block diagonal element of corresponding to group .
12:Update
13:Update
14:endfor
4 Experiments
Quantization.
In our experiments, we focus on weight-only quantization. We present results for two scenarios: (1) quantizing the FFN layers and (2) quantizing both the FFN and attention weights. In the former setting, all attention layers are quantized to INT8 using MinMax quantization, and low-bit quantization schemes are only applied to the feed-forward layers. It’s worth pointing out that this setting is very relevant in practice because FFN layers account for majority of the latency, and quantizing attention weights yields negligible latency reduction at the expense of model quality(Samaga etal., 2024). We perform both per-channel and sub-channel quantization (with a group size of ). We mainly focus on INT2, INT3 and INT4 quantization.
Models.
We use PaLM2 models(Anil etal., 2023) in all our experiments. In particular, we use PaLM2-Gecko, PaLM2-Otter, PaLM2-Bison models. These models vary in size, with PaLM2-Gecko being the smallest, followed by PaLM2-Otter, and finally PaLM2-Bison.
Baselines.
Since our primary goal is to demonstrate that CDQuantgets improved performance over GPTQ, we have chosen it as the primary baseline in most of our experiments. To further demonstrate the our technique can be used as a plug-and-play replacement for GPTQ, we also include comparisons with AWQ(Lin etal., 2023). For all our experiments, we initialize GPTQ with OWC, and run GPTQ for steps. To ensure stability and generalization, GPTQ regularizes its Hessian matrix by adding a scaled identity matrix (). Tuning this for every (model, layer) pair is infeasible. So, we determine a single optimal value using the PaLM2-Gecko model, and apply it universally.
CDQuant.
We evaluate both the coordinate descent variants described in Section3.1: CD (Algorithm1), BCD (Algorithm2). For per-channel quantization, we initialize CD with Optimal Weight Clipping (OWC), and for sub-channel quantization, we additionally include initialization with OWC-CD. BCD is always initialized with CD in our experiments. Unless otherwise stated, both CD and BCD are run for iterations, OWC-CDis run for iterations, where is the group size. Similar to GPTQ, we regularize the Hessian matrix used in CD, BCD by adding . We determine a reasonable value for using the PaLM2-Gecko model, and use it in all our experiments.
Evaluation.
Following recent works(Frantar etal., 2022; Ma etal., 2024), we evaluate all algorithms using two key metrics: perplexity and downstream task performance. To ensure a robust evaluation, we calculate perplexity using a million token subset derived from the PaLM2 training mixture. We chose to do this since the evaluation sets for PTB(Marcus etal., 1994) and WikiText2(Merity etal., 2017) datasets, that are commonly used in the field, are orders of magnitude smaller (83K and 246K tokens in their respective test sets, and 512K tokens subsampled from the C4 validation set (Frantar etal., 2022)), and thus can have high variance, and may not accurately reflect the model’s true performance. We use TriviaQA(Joshi etal., 2017), SQuAD(Rajpurkar etal., 2018), NaturalQuestions(Kwiatkowski etal., 2019) and WebQuestions(Berant etal., 2013) to evaluate generation capabilities of the quantized models, and to evaluate their reasoning capabilities, we test on ARC-c,ARC-e(Clark etal., 2018), HellaSwag(Zellers etal., 2019), BoolQ(Clark etal., 2019), PIQA(Bisk etal., 2020) and WinoGrande(Sakaguchi etal., 2020). For downstream evaluations, we consider both zero-shot, and one-shot settings. Finally, to determine which optimization technique is most effective at solving the layer-wise objective in Equation(1), we evaluate the final solution’s objective value using the same million tokens that we used to compute perplexity.
Training.
All techniques are calibrated using data points, where each data point has tokens. For OWC, we use a grid size of to find the most optimal . We used 8 Nvidia H GPUs for quantizing the models.
Config Method PaLM2-Gecko PaLM2-Otter PaLM2-Bison w16a16 - 7.948 5.984 5.298 w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Gecko PaLM2-Otter PaLM2-Bison Gen. Rank Avg. Gen. Rank Avg. Gen. Rank Avg. w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Results.
Table1 presents the perplexity numbers for different quantization techniques applied to FFN layers. It can be seen that both our CD and BCD methods have a clear advantage over GPTQ, leading to lower perplexity scores for all models and quantization levels. The difference is more pronounced for lower bit quantization. This is further highlighted in Table5, which focuses specifically on INT2 quantization. Here, we see almost improvement in perplexity over GPTQ. We also present (1-shot) downstream evals in Tables2,5 (for 0-shot results, and a detailed breakdown of results for each dataset, please refer to AppendixD). In Table5 we see - relative improvement in downstream evals over GPTQ. Furthermore, Table2 demonstrates that our methods consistently match or exceed GPTQ’s performance across all the settings, with the most substantial improvements observed in low-bit quantization, and smaller models. Finally, we also observe that coordinate descent techniques are better at optimizing the layer-wise objective in Equation(1), than GPTQ. For instance, the average objective value (relative to all ’s solution) for the GPTQ solution for the feed-forward layer is , whereas for CD it is , and for BCD(k=) it is .
Next, observe that Table5 also investigates the effect of multiple epochs of CD and BCD, where each epoch corresponds to iterations. For BCD with , additional epochs enhance performance. However, for BCD with , multiple epochs appear to lead to overfitting, indicating a need for stronger regularization.
FFN+Attention Quantization. In addition to FFN quantization, we also perform FFN + attention weight quantization. However, the inputs to the attention layer are often aligned in a handful of directions. Consequently, performing quantization using such a data leads to a huge drop in performance, as the algorithms would primarily focus on a few directions and ignore the rest. To mitigate this, we clip the largest eigenvalues of the Hessian to ensure a more balanced Hessian. This technique, reminiscent of the weight clipping in OmniQuant(Shao etal., 2023),improves the performance of both GPTQ and CDQuant111One could also rely on existing techniques such as AWQ and SmoothQuant to reduce the effect of outliers. But in our experiments we noticed that both AWQ and SmoothQuant performed poorly compared to the simple eigenvalue clipping technique.. For instance, for PaLM2-Gecko, the perplexity for w3a16-GPTQ improves from to with clipping, and for w4a16-GPTQ, it improves from to . Table4 presents the results from this experiment, where we run all the algorithms on the clipped Hessian. We once again notice that in almost all the settings, our coordinate descent algorithms outperform GPTQ.
Method PaLM2-Otter w3a16 w3a16g128 with AWQ w/o AWQ with AWQ w/o AWQ OWC GPTQ CD BCD(k=2)
AWQ. A major strength of our algorithm is its versatility. It seamlessly replaces GPTQ in any quantization technique that relies on it. To illustrate this, we focus on the AWQ algorithm. We demonstrate that our algorithm, when layered on top of AWQ, surpasses the performance of GPTQ layered on top of AWQ. Table3 presents the result from this experiment. It can be seen that BCD always outperforms GPTQ, for both per-channel and group quantization222The performance of AWQ on PaLM2-Bison is much worse than not performing AWQ. Hence, in Table3, we only present results for PaLM2-Otter..
Runtime.
The runtimes of various techniques for quantizing PaLM2-Otter and PaLM2-Bison are presented in Table6. To be precise, the table presents time taken to quantize all the FFN, attention layers in the model, for per-channel quantization. For group quantization runtimes, please refer to AppendixE. It can be seen that CD and GPTQ have comparable runtimes. While BCD takes longer than CD, the majority of its time is spent quantizing the FFN layer, where the quantization dimension is equivalent to the model’s hidden dimension. So, in practice, to speed up the entire process, one could rely on CD for quantizing FFN2 and use BCD for quantizing the rest of the weight matrices.
Config Method PaLM2-Gecko PaLM2-Otter PaLM2-Bison w16a16 - 7.948 5.984 5.298 w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Method Epochs PaLM2-Otter PaLM2-Bison w2a16g128 Perplexity Generation Rank Avg. Perplexity Generation Rank Avg. GPTQ - CD BCD(k=2) BCD(k=4)
Config Method PaLM2-Otter PaLM2-Bison FFN runtime (in minutes) Attn. runtime (in minutes) FFN runtime (in minutes) Attn. runtime (in minutes) w3a16 GPTQ m m m m CD m m m m BCD(k=2) m m m m w4a16 GPTQ m m m m CD m m m m BCD(k=2) m m m m
5 Conclusion and Future Work
In this work, we developed a coordinate descent framework (CDQuant) for quantization of LLMs. CDQuantis a simple and effective alternative to GPTQ, that consistently outperformed it on PaLM2 models. The simplicity of our algorithm makes it a seamless substitute for GPTQ in various algorithmic contexts where GPTQ currently functions as a sub-routine. Our future work aims to further improve the performance of CDQuant. In particular, we aim to speed up our BCD algorithm, and make it as fast as CD. Furthermore, we will focus on developing layer-wise loss functions that are more closely aligned with end-to-end loss, thereby reducing the performance gap between full-precision and quantized models. Finally, we will also explore integrating CDQuantwith QuIP and FrameQuant to evaluate potential performance gains for extreme low-bit quantization.
Acknowledgements
We are grateful to Kyuyeun Kim, Wonpyo Park, and Jaehong Kim for assisting in setting up the calibration pipelines, and Prateek Jain for helpful discussions, support, and feedback.
References
- Touvron etal. [2023]Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample.Llama: Open and efficient foundation language models.arXiv preprint arXiv:2302.13971, 2023.
- OpenAI [2023]OpenAI.Gpt-4 technical report.Technical report, 2023.URL https://cdn.openai.com/papers/gpt-4.pdf.
- Google [2023]GeminiTeam Google.Gemini: A family of highly capable multimodal models.arXiv preprint arXiv:2312.11805, 2023.
- Miao etal. [2023]Xupeng Miao, Gabriele Oliaro, Zhihao Zhang, Xinhao Cheng, Hongyi Jin, Tianqi Chen, and Zhihao Jia.Towards efficient generative large language model serving: A survey from algorithms to systems.arXiv preprint arXiv:2312.15234, 2023.
- Frantar etal. [2022]Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh.Gptq: Accurate post-training quantization for generative pre-trained transformers.arXiv preprint arXiv:2210.17323, 2022.
- Dettmers etal. [2023]Tim Dettmers, Ruslan Svirschevski, Vage Egiazarian, Denis Kuznedelev, Elias Frantar, Saleh Ashkboos, Alexander Borzunov, Torsten Hoefler, and Dan Alistarh.Spqr: A sparse-quantized representation for near-lossless llm weight compression.arXiv preprint arXiv:2306.03078, 2023.
- Lee etal. [2023]Changhun Lee, Jungyu Jin, Taesu Kim, Hyungjun Kim, and Eunhyeok Park.Owq: Lessons learned from activation outliers for weight quantization in large language models.arXiv preprint arXiv:2306.02272, 2023.
- Chee etal. [2024]Jerry Chee, Yaohui Cai, Volodymyr Kuleshov, and ChristopherM DeSa.Quip: 2-bit quantization of large language models with guarantees.Advances in Neural Information Processing Systems, 36, 2024.
- Adepu etal. [2024]Harshavardhan Adepu, Zhanpeng Zeng, LiZhang, and Vikas Singh.Framequant: Flexible low-bit quantization for transformers.arXiv preprint arXiv:2403.06082, 2024.
- Lin etal. [2023]JiLin, Jiaming Tang, Haotian Tang, Shang Yang, Xingyu Dang, and Song Han.Awq: Activation-aware weight quantization for llm compression and acceleration.arXiv preprint arXiv:2306.00978, 2023.
- Xiao etal. [2023]Guangxuan Xiao, JiLin, Mickael Seznec, Hao Wu, Julien Demouth, and Song Han.Smoothquant: Accurate and efficient post-training quantization for large language models.In International Conference on Machine Learning, pages 38087–38099. PMLR, 2023.
- Dettmers etal. [2021]Tim Dettmers, Mike Lewis, Sam Shleifer, and Luke Zettlemoyer.8-bit optimizers via block-wise quantization.arXiv preprint arXiv:2110.02861, 2021.
- Dettmers and Zettlemoyer [2023]Tim Dettmers and Luke Zettlemoyer.The case for 4-bit precision: k-bit inference scaling laws.In International Conference on Machine Learning, pages 7750–7774. PMLR, 2023.
- Anil etal. [2023]Rohan Anil, AndrewM Dai, Orhan Firat, Melvin Johnson, Dmitry Lepikhin, Alexandre Passos, Siamak Shakeri, Emanuel Taropa, Paige Bailey, Zhifeng Chen, etal.Palm 2 technical report.arXiv preprint arXiv:2305.10403, 2023.
- Frantar and Alistarh [2022]Elias Frantar and Dan Alistarh.Optimal brain compression: A framework for accurate post-training quantization and pruning.Advances in Neural Information Processing Systems, 35:4475–4488, 2022.
- LeCun etal. [1989]Yann LeCun, John Denker, and Sara Solla.Optimal brain damage.Advances in neural information processing systems, 2, 1989.
- Ma etal. [2024]Yuexiao Ma, Huixia Li, Xiawu Zheng, Feng Ling, Xuefeng Xiao, Rui Wang, Shilei Wen, Fei Chao, and Rongrong Ji.Affinequant: Affine transformation quantization for large language models.arXiv preprint arXiv:2403.12544, 2024.
- Behdin etal. [2023]Kayhan Behdin, Ayan Acharya, Aman Gupta, Qingquan Song, Siyu Zhu, Sathiya Keerthi, and Rahul Mazumder.Quantease: Optimization-based quantization for language models.arXiv preprint arXiv:2309.01885, 2023.
- Wei etal. [2023]Xiuying Wei, Yunchen Zhang, Yuhang Li, Xiangguo Zhang, Ruihao Gong, Jinyang Guo, and Xianglong Liu.Outlier suppression+: Accurate quantization of large language models by equivalent and optimal shifting and scaling.arXiv preprint arXiv:2304.09145, 2023.
- Wei etal. [2022]Xiuying Wei, Yunchen Zhang, Xiangguo Zhang, Ruihao Gong, Shanghang Zhang, QiZhang, Fengwei Yu, and Xianglong Liu.Outlier suppression: Pushing the limit of low-bit transformer language models.Advances in Neural Information Processing Systems, 35:17402–17414, 2022.
- Shao etal. [2023]Wenqi Shao, Mengzhao Chen, Zhaoyang Zhang, Peng Xu, Lirui Zhao, Zhiqian Li, Kaipeng Zhang, Peng Gao, YuQiao, and Ping Luo.Omniquant: Omnidirectionally calibrated quantization for large language models.arXiv preprint arXiv:2308.13137, 2023.
- Liu etal. [2023]Jing Liu, Ruihao Gong, Xiuying Wei, Zhiwei Dong, Jianfei Cai, and Bohan Zhuang.Qllm: Accurate and efficient low-bitwidth quantization for large language models.arXiv preprint arXiv:2310.08041, 2023.
- Dettmers etal. [2022]Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer.Gpt3. int8 (): 8-bit matrix multiplication for transformers at scale.Advances in Neural Information Processing Systems, 35:30318–30332, 2022.
- Chai etal. [2023]Yuji Chai, John Gkountouras, GlennG Ko, David Brooks, and Gu-Yeon Wei.Int2. 1: Towards fine-tunable quantized large language models with error correction through low-rank adaptation.arXiv preprint arXiv:2306.08162, 2023.
- Dettmers etal. [2024]Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer.Qlora: Efficient finetuning of quantized llms.Advances in Neural Information Processing Systems, 36, 2024.
- Hu etal. [2021]EdwardJ Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, LuWang, and Weizhu Chen.Lora: Low-rank adaptation of large language models.arXiv preprint arXiv:2106.09685, 2021.
- Chrétien and Corset [2009]Stéphane Chrétien and Franck Corset.Using the eigenvalue relaxation for binary least-squares estimation problems.Signal processing, 89(11):2079–2091, 2009.
- Park and Boyd [2018]Jaehyun Park and Stephen Boyd.A semidefinite programming method for integer convex quadratic minimization.Optimization Letters, 12:499–518, 2018.
- Nagel etal. [2020]Markus Nagel, RanaAli Amjad, Mart VanBaalen, Christos Louizos, and Tijmen Blankevoort.Up or down? adaptive rounding for post-training quantization.In International Conference on Machine Learning, pages 7197–7206. PMLR, 2020.
- Li etal. [2021]Yuhang Li, Ruihao Gong, XuTan, Yang Yang, Peng Hu, QiZhang, Fengwei Yu, Wei Wang, and Shi Gu.Brecq: Pushing the limit of post-training quantization by block reconstruction.arXiv preprint arXiv:2102.05426, 2021.
- Hubara etal. [2021]Itay Hubara, Yury Nahshan, Yair Hanani, Ron Banner, and Daniel Soudry.Accurate post training quantization with small calibration sets.In International Conference on Machine Learning, pages 4466–4475. PMLR, 2021.
- Samaga etal. [2024]Yashas Samaga, Varun Yerram, Chong You, Srinadh Bhojanapalli, Sanjiv Kumar, Prateek Jain, and Praneeth Netrapalli.Hire: High recall approximate top-k estimation for efficient llm inference.ArXiv, abs/2402.09360, 2024.URL https://api.semanticscholar.org/CorpusID:267657774.
- Marcus etal. [1994]MitchellP. Marcus, Grace Kim, MaryAnn Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark Ferguson, Karen Katz, and Britta Schasberger.The penn treebank: Annotating predicate argument structure.In Human Language Technology, Proceedings of a Workshop held at Plainsboro, New Jerey, USA, March 8-11, 1994. Morgan Kaufmann, 1994.URL https://aclanthology.org/H94-1020/.
- Merity etal. [2017]Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher.Pointer sentinel mixture models.In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017.URL https://openreview.net/forum?id=Byj72udxe.
- Joshi etal. [2017]Mandar Joshi, Eunsol Choi, DanielS. Weld, and Luke Zettlemoyer.Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension.In Regina Barzilay and Min-Yen Kan, editors, Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 1: Long Papers, pages 1601–1611. Association for Computational Linguistics, 2017.doi: 10.18653/V1/P17-1147.URL https://doi.org/10.18653/v1/P17-1147.
- Rajpurkar etal. [2018]Pranav Rajpurkar, Robin Jia, and Percy Liang.Know what you don’t know: Unanswerable questions for squad.In Iryna Gurevych and Yusuke Miyao, editors, Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 2: Short Papers, pages 784–789. Association for Computational Linguistics, 2018.doi: 10.18653/V1/P18-2124.URL https://aclanthology.org/P18-2124/.
- Kwiatkowski etal. [2019]Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, AnkurP. Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, AndrewM. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov.Natural questions: a benchmark for question answering research.Trans. Assoc. Comput. Linguistics, 7:452–466, 2019.doi: 10.1162/TACL\_A\_00276.URL https://doi.org/10.1162/tacl_a_00276.
- Berant etal. [2013]Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang.Semantic parsing on freebase from question-answer pairs.In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, EMNLP 2013, 18-21 October 2013, Grand Hyatt Seattle, Seattle, Washington, USA, A meeting of SIGDAT, a Special Interest Group of the ACL, pages 1533–1544. ACL, 2013.URL https://aclanthology.org/D13-1160/.
- Clark etal. [2018]Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord.Think you have solved question answering? try arc, the AI2 reasoning challenge.CoRR, abs/1803.05457, 2018.URL http://arxiv.org/abs/1803.05457.
- Zellers etal. [2019]Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi.Hellaswag: Can a machine really finish your sentence?In Anna Korhonen, DavidR. Traum, and Lluís Màrquez, editors, Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pages 4791–4800. Association for Computational Linguistics, 2019.doi: 10.18653/V1/P19-1472.URL https://doi.org/10.18653/v1/p19-1472.
- Clark etal. [2019]Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova.Boolq: Exploring the surprising difficulty of natural yes/no questions.In Jill Burstein, Christy Doran, and Thamar Solorio, editors, Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 2924–2936. Association for Computational Linguistics, 2019.doi: 10.18653/V1/N19-1300.URL https://doi.org/10.18653/v1/n19-1300.
- Bisk etal. [2020]Yonatan Bisk, Rowan Zellers, RonanLe Bras, Jianfeng Gao, and Yejin Choi.PIQA: reasoning about physical commonsense in natural language.In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 7432–7439. AAAI Press, 2020.doi: 10.1609/AAAI.V34I05.6239.URL https://doi.org/10.1609/aaai.v34i05.6239.
- Sakaguchi etal. [2020]Keisuke Sakaguchi, RonanLe Bras, Chandra Bhagavatula, and Yejin Choi.Winogrande: An adversarial winograd schema challenge at scale.In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 8732–8740. AAAI Press, 2020.doi: 10.1609/AAAI.V34I05.6399.URL https://doi.org/10.1609/aaai.v34i05.6399.
Appendix A Broader Impact
We introduce a Coordinate Descent based approach, CDQuant, for compressing Large Language Models. Our method uses only a small amount of data for calibration. We do not foresee any ethical implications arising from the technical aspects of our approach. However, compressing LLMs may give rise to bias effects, a study of which seems essential given the extensive use of LLMs. Our work may be of assistance to such studies. Also, since quantization allows for easier deployment of LLMs, it could have potential societal implications which seem difficult to predict.
Appendix B Limitations
- •
While both CD and BCD outperformed GPTQ in our experiments, BCD achieves slightly better performance than CD.However, BCD is not as fast as CD and can be expensive for large models. In future, we aim to develop techniques to speed up BCD.
- •
Our algorithms still don’t bridge the gap between QAT and PTQ, especially on smaller models. To bridge this gap, we believe one should move away from the surrogate loss that is being considered by most of the existing work. Instead, we should design surrogate losses that are more closely aligned with end-to-end loss.
- •
Due to computational reasons, we couldn’t run experiments where we replace GPTQ component with CDQuantin algorithms such as QuIP, FrameQuant.
Appendix C CDQuantfor sub-channel quantization
To simplify the explanation in this section, we introduce a slightly modified notation. Given a weight vector , we represent it’s sub-channel quantization as, where is the elementwise multiplication, and are the scale, and bias parameters that satisfy the following constraints: , for any two indices that fall in the same group. With this notation, for any given , the optimization problem in Equation(3) can be rewritten as
(5) |
Letting , the above problem can be further rewritten as
(6) |
Observe that this problem is the same as the per-channel quantization problem described in Equation(1), but with modified parameters . So extending CDQuantto sub-channel quantization simply involves running Algorithms1,2 with these modified parameters. Algorithms4,5 present the resulting algorithms.
1:Input: - coordinate descent steps, - input data matrix, - vector to be quantized, - scale, - bias, - initial estimate
2:
3:Compute Hessian as:
4:Compute gradient as:
5:fordo
6:Find the coordinate that leads to the largest reduction in loss
7:Update gradient as
where is the column of
8:Update as
where is the standard basis vector with in position and everywhere else
9:endfor
1:Input: - coordinate descent steps, - block size, - input data matrix, - vector to be quantized, - scale, - bias, - initial estimate
2:
3:Compute Hessian as:
4:Compute gradient as:
5:fordo
6:Randomly partition the set into blocks, each of size
7:Find the block that leads to the largest reduction in loss
where are the sub-vector, sub-matrix of corresponding to block .
8:Update gradient as
9:Update as
10:endfor
Appendix D Detailed Downstream Evaluation Results
Config Method PaLM2-Bison NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Otter NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Gecko NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Method Epochs PaLM2-Otter w2a16g128 NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande GPTQ - CD BCD(k=2) BCD(k=4)
Method Epochs PaLM2-Bison w2a16g128 NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande GPTQ - CD BCD(k=2) BCD(k=4)
Config Method PaLM2-Gecko PaLM2-Otter PaLM2-Bison Gen. Rank Avg. Gen. Rank Avg. Gen. Rank Avg. w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Bison NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Otter NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Config Method PaLM2-Gecko NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande w16a16 - w3a16 OWC GPTQ CD BCD(k=2) w3a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2) w4a16 OWC GPTQ CD BCD(k=2) w4a16g128 OWC GPTQ CD BCD(k=2) OWC-CD OWC-CD+ CD OWC-CD+ BCD(k=2)
Method Epochs PaLM2-Otter PaLM2-Bison w2a16g128 Generation Rank Avg. Generation Rank Avg. GPTQ - CD 1 BCD(k=2) BCD(k=4)
Method Epochs PaLM2-Otter w2a16g128 NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande GPTQ - CD BCD(k=2) BCD(k=4)
Method Epochs PaLM2-Bison w2a16g128 NatualQ. SQuAD TriviaQA WebQ ARC-c ARC-e BoolQ HellaSwag PIQA WinoGrande GPTQ - CD BCD(k=2) BCD(k=4)
Appendix E Quantization Runtime
Config Method PaLM2-Otter PaLM2-Bison FFN runtime (in minutes) Attn. runtime (in minutes) FFN runtime (in minutes) Attn. runtime (in minutes) w3a16 GPTQ m m m m CD m m m m BCD(k=2) m m m m w3a16g128 GPTQ m m m m CD m m m m BCD(k=2) m m m m w4a16 GPTQ m m m m CD m m m m BCD(k=2) m m m m w4a16g128 GPTQ m m m m CD m m m m BCD(k=2) m m m m
Appendix F Comparison to QuantEase
We also compare our per-channel quantization results with those of QuantEase, a parallel study to ours. It’s important to note that QuantEase does not have a publicly available implementation. So, we implemented the cyclic coordinate descent strategy used by QuantEase, and used the same initialization and regularization strength as our algorithms (although the QuantEase paper doesn’t provide these details). We then ran QuantEase for the recommended number of iterations specified in the paper ( epochs or iterations). The findings are presented in Table20. On PaLM2-Gecko, PaLM2-Otter, and PaLM2-Bison, both these approaches have similar performance. These results collectively highlight the potential of coordinate descent algorithms in outperforming GPTQ.
Config Method PaLM2-Gecko PaLM2-Otter PaLM2-Bison w3a16 GPTQ QuantEase (epochs=20) CD BCD(k=2) w4a16 GPTQ QuantEase (epochs=20) CD BCD(k=2)