Title: DuQuant: Distributing Outliers via Dual Transformation Makes Stronger Quantized LLMs
Venue: NeurIPS 2024
Accepted: yes
Keywords: Model compression

Post-training Quantization

PTQ of Large Language Models
Abstract: Quantization of large language models (LLMs) faces significant challenges, particularly due to the presence of outlier activations that impede efficient low-bit representation. Traditional approaches predominantly address Normal Outliers, which are activations across all tokens with relatively large magnitudes. However, these methods struggle with smoothing Massive Outliers that display significantly larger values, which leads to significant performance degradation in low-bit quantization. In this paper, we introduce DuQuant, a novel approach that utilizes rotation and permutation transformations to more effectively mitigate both massive and normal outliers. First, DuQuant starts by constructing the rotation matrix, using specific outlier dimensions as prior knowledge, to redistribute outliers to adjacent channels by block-wise rotation. Second, We further employ a zigzag permutation to balance the distribution of outliers across blocks, thereby reducing block-wise variance. A subsequent rotation further smooths the activation landscape, enhancing model performance. DuQuant simplifies the quantization process and excels in managing outliers, outperforming the state-of-the-art baselines across various sizes and types of LLMs on multiple tasks, even with 4-bit weight-activation quantization. Our code is available at https://github.com/Hsu1023/DuQuant.

DuQuant: Distributing Outliers via Dual Transformation Makes Stronger Quantized LLMs

Abstract

Quantization of large language models (LLMs) faces significant challenges, particularly due to the presence of outlier activations that impede efficient low-bit representation. Traditional approaches predominantly address Normal Outliers , which are activations across all tokens with relatively large magnitudes. However, these methods struggle with smoothing Massive Outliers that display significantly larger values, which leads to significant performance degradation in low-bit quantization. In this paper, we introduce DuQuant, a novel approach that utilizes rotation and permutation transformations to more effectively mitigate both massive and normal outliers. First, DuQuant starts by constructing the rotation matrix, using specific outlier dimensions as prior knowledge, to redistribute outliers to adjacent channels by block-wise rotation. Second, We further employ a zigzag permutation to balance the distribution of outliers across blocks, thereby reducing block-wise variance. A subsequent rotation further smooths the activation landscape, enhancing model performance. DuQuant simplifies the quantization process and excels in managing outliers, outperforming the state-of-the-art baselines across various sizes and types of LLMs on multiple tasks, even with 4-bit weight-activation quantization. Our code is available at https://github.com/Hsu1023/DuQuant .

1 Introduction

Large language models (LLMs) [51, 7, 50] have demonstrated exceptional performance across a wide range of natural language processing tasks. However, their billions of parameters present considerable deployment challenges on resource-constrained edge devices, particularly in terms of memory usage and inference speed [22, 15, 56]. In response to these challenges, network quantization methods [20, 23] have been extensively explored to minimize memory usage by converting floatingpoint parameters into low-bit formats [18, 32, 8], and to expedite inference by quantizing both activations and weights for accelerating the matrix multiplication process [64, 34, 74].

Among LLM quantization methods, a primary issue is the presence of activation outliers, which enlarge the quantization step sizes and subsequently cause significant accuracy loss [59]. To mitigate this problem, current research has developed various methods to address Normal Outliers in activations, which are persistent in several channels across all tokens [13, 64]. However, besides Normal Outliers, there exists another type of activation outlier [48, 35], termed Massive Outliers .

(a) LLaMA2_7B_Layer1_Attn_K_Proj

(b) LLaMA2_7B_Layer1_FFN_Down_Proj

(c) Activation Change with SmoothQuant

(d) Weight Change with SmoothQuant

SmoothQuant Fails to Eliminate Massive Outliers

All tokens,

Relevantly large values

Limited tokens,

Extremely large values

New outliers

Hard to eliminate

Massive

1

11000

100

Max (after smooth)

Max (before smooth)

10

Max (after smooth)

Max (before smooth)

1400

Absolute Value

10

1200

1000

800

009

0

1000

Channel

2000

3000

4000

0

50

100

150

200

e

250

200

400

0

0

2000

4000

Channel

6000

8000

10000

0

50

100

150

200

250

1-10

1

1

1

1-100

1

Channel ID

-10

100

Channel ID

1

These outliers are characterized by their exceedingly high values and limited occurrence in a subset of tokens , as depicted in Figure 1(b). Unfortunately, existing LLM quantization methods struggle to effectively address these Massive Outliers. For instance, SmoothQuant [64], despite using a smooth factor to shift some of the activation outliers to the weight part, still cannot effectively handle Massive Outliers with extremely large values, as shown in Figure 1(c)(d). OmniQuant [47] and AffineQuant [39], on the other hand, exhibit training instability issues [34] due to the presence of Massive Outliers. Consequently, there is a pressing need for an LLM quantization approach that effectively addresses both Normal and Massive Outliers.

To tackle this challenge, we propose the Du al transformations Quant ization (DuQuant) method. Our motivation is to redistribute the activation outlier values across different channels , facilitating easier quantization. Specifically, we construct the orthogonal rotation matrix and the orthogonal permutation matrix. By multiplying these matrices with the activations, we can effectively perform column transformations on the activations, which in turn allows for the redistribution of outliers. For the rotation transformation aspect, we first identify specific dimensions of outliers as the prior knowledge and employ a greedy algorithm to construct the rotation matrix. To enhance the multiplication efficiency, we utilize diagonal block-wise rotation matrices, with each matrix responsible for a small portion of the activations. However, this approach may result in uneven outlier magnitudes across different blocks. Therefore, we propose the zigzag permutation for reordering the activation channels, which promotes a more uniform distribution across different blocks. Concretely, we distribute the channels with the highest activations across the blocks in a back-and-forth pattern. After establishing blocks with uniformly distributed outlier magnitudes, we employ another rotation transformation to further redistribute the outliers within each block. Note that we multiply the weight matrix with the transpose of the rotation and permutation matrices at the same time, preserving the linear layer equivalence and smoothing weights. Theoretical analysis confirms that the rotation and permutation transformations greatly mitigate quantization challenges induced by outliers.

As a result, DuQuant offers several clear advantages over QuaRot [2]: (1) DuQuant's optimal rotation matrix, derived through a greedy search guided by prior knowledge, surpasses QuaRot's Hadamard rotation in managing outliers; (2) our unique zigzag permutation significantly reduces activation variance across blocks, providing a distinct advantage for handling massive outliers; and (3) by jointly smoothing weights and activations, DuQuant avoids time-consuming GPTQ algorithm in QuaRot. Extensive evaluations demonstrate that our DuQuant approach significantly outperforms existing 4-bit weight-activation quantization baselines across various benchmarks. Notably, DuQuant achieves a 5% improvement in Commonsense QA tasks across all LLaMA model sizes and a 10% increase in zero-shot MMLU benchmarks for the Vicuna-v1.5-13B. Moreover, in practical applications with the LLaMA2-7B model, DuQuant not only accelerates pre-filling phase by up to 2.08 × but also reduces memory usage during decoding phase by 3.50 × , with minimal impact on performance: only a 0.61 increase in perplexity and a 2.71% drop in accuracy compared to the FP16 model. These results highlight the effectiveness of DuQuant in enhancing the efficiency and capacity of quantized LLMs.

2 Motivation

Normal Outliers and Massive Outliers. Previous works [13, 72, 32] have highlighted the challenge posed by activation outliers in LLMs for model compression. These outlier features consistently

manifest large values across specific feature dimensions and are present in all token sequences [64], which we refer to as Normal Outliers . Recently, a distinct type of outlier [48, 35], termed Massive Outliers , has been observed in LLMs. The primary distinctions between normal and massive outliers are: 1) Normal outliers persist across all token sequences, whereas massive outliers are confined to a limited number of tokens. 2) Massive outliers exhibit significantly larger magnitudes, often surpassing 100 and being approximately 1000 times greater than the median of other activations [48]. In our study, we delve deeper into the impact of these two distinct types of outliers on quantization.

Massive Outliers Exist at the Second Linear Layer of FFN Module. In contrast to previous studies [48, 35] that observe massive outliers at the output of Transformer blocks, we first discover that these extremely large activations exist at the input of the down-projection layer within the FFN module. As depicted in Figure 1, the input of the down-projection layer in the LLaMA2-7B model Layer 1 contains a single activation of significant magnitude (approximately 1400). This activation is isolated to one token and therefore classified as one of massive activations. This phenomenon is consistently observed across different layers and sizes of models, as illustrated in Appendix I.

Massive Outliers Enlarge Quantization Difficulty. Although previous studies [64, 47, 39, 1] have proposed various approaches to eliminate outlier features, they still face challenges in effectively managing massive outliers. SmoothQuant [64], for instance, attempts to shift the quantization difficulty from activations to weights by dividing the activation by a per-channel smoothing factor and multiplying it to the weight matrix. Nevertheless, we observe that this transfer at the input of the down-projection layer can cause the weights of the down-projection to display noticeable outliers, as demonstrated in Figure 1 . This issue arises because massive outliers cause the smoothing factor to become significantly large. Moreover, extremely large outliers can lead optimization-based methods to encounter problems with loss explosion. Both OmniQuant [47] and AffineQuant [39] have had to exclude their learnable parameters for the down projection layer due to unstable gradients. Given the poor accuracy observed with 4-bit quantization, QUIK [1] opts to use INT8 quantization for the down projection layer and Atom [74] applies INT8 quantization for 128 outlier channels. Consequently, massive outliers introduce new challenges to the quantization process that existing methods cannot fully address. This observation has motivated us to develop rotation and permutation transformations, which effectively handles both massive and normal outliers and achieves state-of-the-art performance.

3 Method

In this section, we delve into the distribution of outliers and introduce our proposed DuQuant method. The DuQuant method is built on two key components: 1) the block-diagonal rotation matrix, tasked with the local redistribution of feature outliers, and 2) the zigzag permutation, responsible for the global reordering of outliers across different blocks.

3.1 Preliminaries

As the common modules within each transformer block of LLMs, both Multi-head Self-Attention (MSA) and Feed-Forward Network (FFN) fundamentally consist of basic linear layers, which can be represented as, Y = X · W ∈ R T × C out . Here, X ∈ R T × C in is the activation input and W ∈ R C in × C out denotes the weight matrix. In this paper, we focus on integer uniform quantization [25] of both activation and weight, aiming to achieve better hardware support. Specifically, the b -bit quantization process maps the FP16 tensor X to low-bit integer X q :

The notation ⌊·⌉ means the nearest rounding operation, ∆ is the quantization step size and z represents the zero point. Following [64, 47, 34, 39], we employ per-token quantization for activation and per-channel quantization for weight, which entails assigning different step sizes to individual tokens of activations ( ∆ X ∈ R T × 1 ) and different output channels of weights ( ∆ W ∈ R 1 × C out ).

3.2 The proposed DuQuant Method

To address the Normal Outliers issue stated in Section 2, current quantization methods, such as SmoothQuant [64] and OmniQuant [64], usually adopt the smooth technique. Concretely, it involves the utilization of a per-channel smoothing diagonal matrix, denoted as Λ , to scale the input activation and weight matrix. The adjustment allows us to rewrite the original linear layer as Y = X · W = ( X ·

、

1

4

5

8

2

3

6

7

1.3

2.9

0.2

1.2

1.2

3.5

0.4

2.1

1.5

0.8

2.7

0.2

1.3

0.8

2.2

0.3

1.5

0.6

1.3

0.5

1.8

4.2

1.5

2.9

9.9

6.9

2.2

4.2

7.9

9.7

1.65

Activation Matrix

3.0

0.9

0.3

0.2

2.9

0.5

1.8

0.9

2.8

0.3

1.2

0.6

2.5

0.9

0.7

1.1

1.6

0.4

1.5

1.6

2.1

0.2

0.1

0.2

2.3

0.9

0.8

0.1

1.9

1.1

0.5

1.4

7

2

5

1

8

3

4

6

Sorted Index

3.0

0.9

1.5

1.6

2.9

1.2

1.8

1.4

Easy to Quantize

(c) Example of Rotation and Permutation Transformation

2.2

5.5

4.2

5.8

1.2

4.8

4.7

3.4

3.2

1.9

2.9

4.2

4.7

3.2

3.5

1.3

1.8

4.2

0.7

0.3

1.2

1.0

0.3

4.3

3.4

4.9

2.4

4.2

4.9

3.9

2.5

0.7

3.4

0.9

1.4

0.3

0.9

2.2

1.4

4.3

1.3

3.2

0.3

2.4

4.2

2.5

0.3

1.8

1.9

1.2

4.2

4.7

0.7

0.9

3.4

4.2

1.0

4.9

3.2

3.4

2.2

4.9

0.7

2.9

0.3

3.9

3.5

0.9

①

0.175

③

Rotation

Rotation

②

①

Rotation

③

Rotation

Permutation

②

(a) Normal outlier

(b) Massive outlier

Permutation

1.75

0.5

0.5

0.30

1.50

1.25

1.00

0.4

0.3

0.2

0.4

0.3

0.2

0.25

0.20

0.15

0.10

0.00

1000

2000

3000

4000

50

100ken

150

200

250

0.1

0.0

→

1000

Channel

2000

3000

4000

0.1

→

00

1000

2000

000E

000

150

200

250

0.05

0.00

→

1000

Channel

2000

3000

4000

6.2

9.6

40

33225050

6.9

5.4

8.8

5.5

9.9

5.6

9.7

5.8

7.9

8.9

150

1

1

->

1.75

1.50

1.25

1.00

5.5

0.75

0.50

0.25

5.8

0.00

2000

00

6000

5.5

5.8

Λ -1 )( Λ · W ) . The diagonal element Λ j within Λ is computed as Λ j = max ( | X j | ) α / max ( | W j | ) 1 -α , where α is a hyper-parameter representing the migration strength. However, despite the ability of this smoothing technique to shift the quantization challenge from activations to weights, it still faces difficulties in effectively managing Massive Outliers, as depicted in Figure 1. This challenge stems from the extremely large massive outliers inducing large scaling factors Λ j , which in turn introduce new outliers in the weight matrix and result in significant performance declines in 4-bit quantization.

According to these findings, we propose the DuQuant method, which includes the Rotation and Permutation transformations based on the smooth technique. By combining rotation transformation and channel permutation, our DuQuant method aims to redistribute these features within the activation space, thereby mitigating the effects of both Normal and Massive Outliers.

The Rotation Transformation. In contrast to the smooth technique, our aim is to apply a rotation matrix for row or column transformations, mitigating the impact of both Normal and Massive outliers. The ideal rotation matrix, denoted as R , should possess the following properties: 1) R is an orthogonal matrix satisfying RR ⊤ = I and | R | = ± 1 . This allows us to reformulate the linear layer within the transformer as Y = X · W = ( XR )( R ⊤ W ) ; 2) R should be capable of effectively target the positions of outliers and effectively mitigating them through matrix multiplication. However, due to the Massive Outliers are usually randomly distributed within the activation space, it is challenging to directly identify the optimal rotation matrix R capable of mitigating outliers through a single rotation transformation. To address this problem, we employ a greedy search with prior knowledge to compute a rotation matrix ˆ R , thereby approximating the ideal rotation matrix R . Specifically, the calculation of ˆ R involves the following steps,

Identify the feature dimension d (1) where the outlier are primarily concentrated, i.e., d (1) = arg max j (max i | X ij | ) . Here, X ij represents the element in the i -th row and j -th column of X .

Based on the searched dimensions d (1) , we construct the rotation matrix as follows,

Here, E d (1) is the switching matrix used to swap the first and the d (1) -th columns of the activation, and ˜ R represents an orthogonal initialized rotation matrix, in which the first row is specifically uniformly distributed. The motivation behind this is to mitigate outliers in the first column after the transformation by E d (1) . To further increase the randomness of the rotation operation,

we retain the first column, where outliers have been mitigated, and randomly rotate the other columns by multiplying them with a random orthogonal matrix Q ′ .

Let N denote the greedy search steps, then the approximated rotation matrix ˆ R = R 1 R 2 · · · R n , where n = arg min k ∈ [1: N ] ( max i,j | ( XR 1 · · · R k ) ij | ) . Each R i is constructed according to Eqn. (2) and the identified feature dimension d ( i ) . Appendix G provides detailed pseudo code.

Through this construction manner, we can ensure that the approximated optimal rotation matrix ˆ R can effectively mitigate outliers with large magnitudes, as opposed to merely using a randomly selected orthogonal rotation matrix. Nevertheless, directly constructing the entire rotation matrix is timeconsuming and results in substantial memory overhead. For fast matrix multiplication, following [63], we approximate the rotation matrix ˆ R ∈ R C in × C in in a block-wise manner,

where ˆ R b i ∈ R 2 n × 2 n denotes a square matrix of the i -th block, which is constructed following the three steps mentioned above. And the block numbers K is calculated by K = C in / 2 n .

The Permutation Transformation. Despite adopting the block-diagonal rotation matrix ˆ R for its time and storage efficiency, its focus on local information introduces a potential limitation in further reducing the outliers. This is because the rotation transformation, conducted within each small block, cannot integrate the information across different blocks to further minimize outliers. Consequently, one block may have relatively larger outliers while another block has smaller outliers, resulting in high variance among different blocks, as shown in Figure 2. This limitation explains that merely utilizing the block-diagonal rotation matrix is insufficient to effectively reduce the overall outliers.

To effectively mitigate the overall outliers, it is essential to balance the outliers' magnitudes among various blocks. Specifically, within each small block, we denote the largest outlier in dimension d j as O j . Meanwhile, M b i represents the mean value of all O j in the i -th block, where i = 1 , 2 , ..., K . Then the variance in activation magnitudes across various blocks can be expressed as,

To minimize this variance and further reduce the overall outliers, we introduce the zigzag permutation . Concretely, we generate a zigzag sequence that starts by assigning channels with the highest activations to the first block. The process continues by assigning channels with the next highest activations to the subsequent blocks in descending order until the end of block K . Upon reaching the final block, the order reverses, starting from the channel with the next highest activation and proceeding in ascending order. This back-and-forth patterning continues throughout all the blocks, ensuring that no single block consistently receives either the highest or lowest activation channels. It is worth noting that the constructed permutation is an orthogonal matrix, which we denote as P , satisfying the conditions PP ⊤ = I and | P | = ± 1 . By employing the zigzag permutation, we achieve a balanced distribution of outliers across different blocks. This allows us to use an additional rotation transformation to further smooth the outliers. Figure 2 provides an illustration of outlier mitigation.

The Overall DuQuant Method. To effectively mitigate both Normal and Massive Outliers, we first employ the smooth technique to shift the quantization challenge from activations to weights. Next, we introduce the block-diagonal rotation matrix ˆ R to locally redistribute feature outliers within the activation space. We then propose the zigzag permutation matrix for globally balancing the outliers across different blocks, followed by another application of the block-diagonal rotation transformation. To sum up, the linear layers within the transformer can be rewrite as,

where the notation P denotes the orthogonal permutation matrix learned via the zigzag manner, the ˆ R (1) and ˆ R (2) represent the first and second block-diagonal rotation matrix, respectively.

Remark 1. It is worth noting that the proposed DuQuant method can simultaneously smooth the weight matrix. While the commonly adopted smooth technique is effective, it can cause the weight matrix of the down-projection layer to exhibit pronounced outliers, leading to performance degradation. However, in the proposed DuQuant method, the rotation transformation we designed is applied to not only the activation input but also the weight matrix. As a result, the outliers induced by the smooth technique can be mitigated through our approximated rotation matrix ˆ R , yielding a

smoother, more quantization-friendly weight matrix. Moreover, this approach eliminates the reliance on complex weight quantization techniques, such as GPTQ [18] used in Atom [74] and QuaRot [2].

Remark 2. To further decrease the computation and memory costs, we initially construct the k -th block rotation matrix ˆ R b k , with the k -th block containing the largest outlier. We then assign ˆ R b i = ˆ R b k for all 1 ≤ i ≤ K . This strategy not only effectively mitigates the impact of outliers, but also reduces the number of block rotation matrices from K to 1, significantly reducing computation and memory requirements. Importantly, incorporating the invertible matrix G from Eqn. (5) significantly eases the quantization challenges for X and W . Consequently, the quantization process acts as Y = ( XG )( G -1 W ) = ˆ X · ˆ W ≈ ∆ ∆ ( ˆ X -z )( ˆ W -z ) .

3.3 Theoretical Analysis

To further demonstrate the effectiveness of the proposed DuQuant method, we conduct a theoretical analysis of the rotation and permutation transformations. Theorem 1 shows that within each block, the constructed rotation matrix effectively mitigates the maximum outlier, thereby reducing the outlier magnitude through a greedy search. Theorem 2 reveals that the employed zigzag permutation ensures a balanced upper bound shared among different blocks. This suggests that the zigzag permutation effectively reduces the variance shown in Eqn. (4) and thus assists the rotation matrix in further decreasing the outliers. Please refer to Appendix B for detailed proofs.

Theorem 1 (Rotation) . For the activation input X ∈ R T × C in , ˆ R ∈ R 2 n × 2 n is a diagonal block matrix constructed as per Eqn. (3). For a specific block b i , let O j ( · ) represent the maximum outlier of the j -th dimension d j within the input. Then, we can deduce that,

Theorem 2 (Zigzag Permutation) . For the activation input X ∈ R T × C in , it can be divided into K blocks, where K = C in / 2 n . Let O j denote the max outlier of the dimension d j in X , the reordered outliers from large to small is expressed as O (1) , O (2) , ..., O ( C in ) . Moreover, the M b i represents the mean value of all O j in the i -th block, i = 1 , 2 , ..., K . Let δ := max {| O ( i +1) -O ( i ) |} , i = 1 , 2 , ..., C in -1 . Then, following the zigzag permutation described in Section 3.2, the mean value M b i within each i -th block consistently satisfies,

4 Experiment

Models and Evaluations. We apply our DuQuant on pre-trained LLMs: LLaMA (7B-65B) [51], LLaMA2 (7B-70B) [52], LLaMA3 (8B, 70B), Mistral, Phi2 and instruction-tuned LLMs: Vicunav1.5 (7B-13B) [10]. We evaluate quantized pre-trained LLMs on language generation tasks and commonsense QA tasks. Specifically, we assess the perplexity on WikiText2 [40] and C4 [44] datasets, as well as the zero-shot accuracy on PIQA [6], ARC [12], BoolQ [11], HellaSwag [70], and WinoGrande [45] datasets. Moreover, we evaluate quantized Vicuna models on MMLU [21] and MT-Bench [76] benchmarks, as well as their long-form generative capabilities on LongBench [4].

Implementation Details. In line with prior studies [34, 47, 39], we apply per-token activation quantization and per-channel weight quantization. Given that W8A8 quantization has been established as lossless in precision by SmoothQuant [64], our primary evaluation in this paper focuses on 4-bit and 6-bit quantization for weights and activations. As for details, we quantize all intermediate activations, excluding the SoftMax output. Moreover, we have developed two types of quantized models, denoted as DuQuant and DuQuant+LWC . For DuQuant, we employ round-to-nearest quantization, using a clipping ratio of 0.9 for activations and 0.8 for weights. To improve weight matrix quantization, DuQuant+LWC integrates the learnable weight clipping (LWC) technique from OmniQuant. Concretely, LWC adjusts weights by training parameters γ, β ∈ [0 , 1] to compute step size ∆ = γ max( X ) -β min( X ) 2 b -1 in Eqn. (1). Notably, the smoothing diagonal matrix and the learned weight clipping factor can be integrated into the quantized weights, introducing no additional computational or memory costs. More details and hyperparameters are left in Appendix C.

Baselines. We compare with state-of-the-art (SOTA) weight-activation PTQ methods, including SmoothQuant [64], Outlier Supression+ [59], OmniQuant [47], QLLM [34], AffineQuant [39], and Atom [74]. For Atom, we reproduce the results with no group-wise asymmetric quantization.

4.1 Main Results

Quantization of LLaMA1 and LLaMA2 Models. We conduct a comprehensive comparison of our DuQuant with several SOTA baselines on LLaMA1 and LLaMA2 models. Results for W4A4 quantization are presented in this Section, while results for W6A6 quantization are provided in

Appendix D. Table 1 indicates that our DuQuant quantized models notably outperform other baselines on both the WikiText2 and C4 datasets. Notably, LWC technique further enhances model capacity, with our DuQuant+LWC achieving comparable performance with FP16 models. Table 2 and Table D1 showcase the zero-shot accuracy of W4A4 quantization on Commonsense QA tasks, where DuQuant significantly improves the average accuracy. Our method surpasses QLLM by +9%, and Atom by +5% for all model sizes. These results demonstrate the superiority of our rotation and permutation transformation, which establishes new SOTA performance by effectively eliminating outlier features.

Quantization of Instruction-tuned Models. We quantize Vicuna-v1.5 [10] models to assess the generalizability of our DuQuant. Table 3 illustrates that our quantized models surpass the baselines across all task categories on MMLU benchmark. For Vicuna-13B, our DuQuant+LWC surpasses Atom by 10.01% under zero-shot settings and 6.95% under five-shot settings. Moreover, we compare our DuQuant with Atom and OmniQuant using MT-Bench and utilize GPT-4 to evaluate the answers from quantized models. As shown in Figure 3, DuQuant quantized models significantly outperform both Atom and OmniQuant in win rates. Specifically, for Vicuna-7B, DuQuant only lost 16 and 1 times to Atom and OmniQuant, respectively, while achieving 68 and 155 wins against them.

Evaluation of Long-context Generation. To further evaluate the long-text generative capabilities, we follow [37, 33, 55] and conduct a comprehensive comparison of DuQuant against state-of-the-art baselines on the LongBench [4], which includes a variety of generative tasks to provide a broader evaluation. We set the maximum sequence length to 3500 for Vicuna models, with results presented in Table 4. DuQuant achieves performance comparable to FP16 models, demonstrating the effectiveness of our dual transformations. More detailed results on different subtasks are listed in Table D3, D4.

Quantization of LLaMA3 Models. LLaMA3, known for its superior performance in various tasks, faces significant degradation in low-bit quantization [24]. To address this, we apply our DuQuant to quantize LLaMA3-8B. Table 5 displays the perplexity and zero-shot accuracy results. Notably, under W6A6 setting, our DuQuant achieves performance comparable to FP16 model. Furthermore, unlike other methods that show weaker results under W4A4 setting, our DuQuant maintains competitive performance, indicating its robustness with LLaMA3. We attribute this success to the advanced handling of outliers achieved through dual transformations, which is not restricted to specific models.

4.2 Ablation Study

Module-wise Impact. We ablate four distinct operations within DuQuant: 1) only the smoothing technology like SmoothQuant; 2) one rotation following the smoothing operation; 3) a sequence of rotation, permutation, and another rotation without smoothing; and k4) full DuQuant approach. Table 6 shows that the smoothing operation plays a basic role in our DuQuant by shifting activation outliers to weight. The initial rotation significantly enhances model performance, yielding competitive PPL results. Finally, permutation combined with a second rotation further enhances the quantized model.

Influence of Normal/Massive Outliers. In this section, we comprehensively explore the influence of massive and normal outliers on quantization. Notably, we observe that massive outliers primarily occur at the down-projection of the FFN module. To isolate their effect, we remove the rotation and permutation transformations, applying only the smoothing technique to all down-projection inputs. The resulting perplexity for LLaMA2-7B and LLaMA-13B showed significant degradation, presented in Table 7. Conversely, when we eliminate the rotation and permutation transformations for normal outliers, the performance decrease was noticeable but less severe compared to massive outliers. These findings indicate that: 1) massive outliers exert a more substantial impact on quantization, corroborating our claims in Section 2; 2) the smoothing technique alone struggles to fully mitigate the influence of outliers, particularly massive ones; and 3) our rotation and permutation methods prove highly effective against both types of outliers, leading to superior performance.

vs. OmniQuant

68

78

16

155

44

1

Ties

DuQuant Losses

0

20

40

60

80

100

120

140

160

vs. OmniQuant

70

65

24

117

39

4

Comparison with QuaRot [2] In light of the recent introduction of Hadamard rotations by QuaRot[2] to eliminate outlier features, we have undertaken a detailed analysis to highlight the key differences between our DuQuant and QuaRot. To ensure a balanced evaluation, we have reimplemented QuaRot in accordance with our quantization settings. The results demonstrate that 1) the rotation matrix constructed by DuQuant outperforms QuaRot's approach of simply selecting a randomly initialized Hadamard matrix. As depicted in Figure 10, our DuQuant more effectively smooths activations than QuaRot. This is attributed to the prior knowledge utilized by DuQuant to accurately target the outliers; 2) As demonstrated by the perplexity in Table 8, QuaRot employs GPTQ for their weight quantization method, whereas our DuQuant, with its sophisticated outlier management, attains competitive results using RTN quantization. The superiority proves the effectiveness of our zigzag permutation to enhance capacity. For a more comprehensive comparison, please refer to Appendix F.

Permutation Frequency. We conduct ablations on the rotation and permutation frequencies in DuQuant. As shown in Figure 5, 'Perm 1' (two rotations with one permutation) achieves stronger

performance compared with 'Perm 0' (no permutation), while incurring an additional 8.9% computational cost on LLaMA2-7B and 9.3% on LLaMA2-13B compared to the W4A4 setup. Considering the approximately 2 × speedup and the impressive performance, these additional costs are deemed acceptable. Further permutations, like 'Perm 2,' do not improve performance and reduce inference efficiency. Consequently, 'Perm 1' strikes the best balance between perplexity and inference speed, making it the optimal configuration for DuQuant.

Inference Speedup. To assess the inference speedup delivered by our DuQuant, we adopt the measurement strategy and W4A4 kernel from [2]. We evaluate the layer-wise speedup of LLaMA2 models on one NVIDIA 3090 GPU, with results detailed in Table 9 and 10. We set the pre-filling sequence length at 2048 and decode for 128 steps. In the pre-filling stage, DuQuant achieves a 2 . 08 × speedup over FP16 for LLaMA2-7B and a 2 . 34 × speedup for LLaMA2-13B, with slight variations across different batch sizes. In the decoding stage, batching the token generation phase yields high throughput without any downside [43]. Consequently, we enlarge the batch size to 64 and the results for LLaMA2-7B in Table 10 prove DuQuant achieves speedup comparable to QuaRot. More detailed analyses and end-to-end speedup are available in Appendix E.1.

Figure 5: Computational overhead analysis.

W4A4

Perm. 0

Perm. 1

Perm. 2

0.0

0.5

1.0

1.5

2.0

2.5

3.0

Speedup

2.138x

2.105x

1.946x

1.792x

2.366x

2.324x

2.146x

1.955x

2-7B Speedup (

)

2-13B Speedup (

)

4

5

6

7

8

9

10

11

Perplexity

2-7B PPL (

)

2-13B PPL (

)

Memory Consumption. We measure the peak memory usage of DuQuant with the W4A4 kernel on LLaMA2-7B using a single NVIDIA 3090 GPU. We process 2048 tokens for pre-filing and run 128 decoding steps, with the results listed in Table 11. In the pre-filling stage, DuQuant, SmoothQuant, and QuaRot achieve up to 3.2 × memory reduction, while QLLM performs worse. In the decoding stage, DuQuant maintains strong memory efficiency, with superior performance.

Runtime. Our DuQuant stands out for its efficiency, surpassing other baselines [47, 34, 39, 74]. The blockwise rotation ensures fast multiplication between the rotation and activation matrices. Zigzag permutation,

involving simple channel swaps, is much faster than complex algorithms like Simulated Annealing, as discussed in Appendix E.3. Moreover, the advanced management of outliers makes DuQuant not rely on GPTQ or gradient-based training. Hence, DuQuant enables a rapid quantization process shown in Table F24, e.g., we successfully quantize LLaMA2-13B in just 71s with superior performance.

5 Conclusion

In conclusion, this paper presents DuQuant, an innovative quantization strategy for large language models (LLMs) that effectively addresses the challenge of outlier activations. By integrating rotation and permutation transformations, DuQuant effectively mitigates the impacts of both massive and normal outliers. This strategic redistribution of outliers not only simplifies the quantization process but also leads to substantial improvements in model performance. Consequently, DuQuant establishes new state-of-the-art results in 4-bit weight-activation quantization scenarios. This advancement enhances the deployment of efficient LLMs in resource-constrained environments.

References

Saleh Ashkboos, Ilia Markov, Elias Frantar, Tingxuan Zhong, Xincheng Wang, Jie Ren, Torsten Hoefler, and Dan Alistarh. Towards end-to-end 4-bit inference on generative large language models. arXiv preprint arXiv:2310.09259 , 2023.

Saleh Ashkboos, Amirkeivan Mohtashami, Maximilian L Croci, Bo Li, Martin Jaggi, Dan Alistarh, Torsten Hoefler, and James Hensman. Quarot: Outlier-free 4-bit inference in rotated llms. arXiv preprint arXiv:2404.00456 , 2024.

Haoli Bai, Wei Zhang, Lu Hou, Lifeng Shang, Jing Jin, Xin Jiang, Qun Liu, Michael Lyu, and Irwin King. Binarybert: Pushing the limit of bert quantization. arXiv preprint arXiv:2012.15701 , 2020.

Yushi Bai, Xin Lv, Jiajie Zhang, Hongchang Lyu, Jiankai Tang, Zhidian Huang, Zhengxiao Du, Xiao Liu, Aohan Zeng, Lei Hou, et al. Longbench: A bilingual, multitask benchmark for long context understanding. arXiv preprint arXiv:2308.14508 , 2023.

Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432 , 2013.

Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI conference on artificial intelligence , volume 34, pages 7432-7439, 2020.

Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems , 33:1877-1901, 2020.

Jerry Chee, Yaohui Cai, Volodymyr Kuleshov, and Christopher M De Sa. Quip: 2-bit quantization of large language models with guarantees. Advances in Neural Information Processing Systems , 36, 2024.

Mengzhao Chen, Wenqi Shao, Peng Xu, Jiahao Wang, Peng Gao, Kaipeng Zhang, Yu Qiao, and Ping Luo. Efficientqat: Efficient quantization-aware training for large language models. arXiv preprint arXiv:2407.11062 , 2024.

Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E Gonzalez, et al. Vicuna: An open-source chatbot impressing gpt-4 with 90%* chatgpt quality. See https://vicuna. lmsys. org (accessed 14 April 2023) , 2023.

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 Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies , pages 2924-2936, 2019.

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. arXiv preprint arXiv:1803.05457 , 2018.

Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. Llm.int8(): 8-bit matrix multiplication for transformers at scale. In Conference on Neural Information Processing Systems , 2022.

Tim Dettmers, Ruslan A. 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. In The Twelfth International Conference on Learning Representations , 2024.

Peijie Dong, Lujun Li, Zhenheng Tang, Xiang Liu, Xinglin Pan, Qiang Wang, and Xiaowen Chu. Pruner-zero: Evolving symbolic pruning metric from scratch for large language models. In Proceedings of the 41st International Conference on Machine Learning . PMLR, 2024. URL https://arxiv.org/abs/2406.02924 . [arXiv: 2406.02924].

Dayou Du, Yijia Zhang, Shijie Cao, Jiaqi Guo, Ting Cao, Xiaowen Chu, and Ningyi Xu. Bitdistiller: Unleashing the potential of sub-4-bit llms via self-distillation. arXiv preprint arXiv:2402.10631 , 2024.

Haojie Duanmu, Zhihang Yuan, Xiuhong Li, Jiangfei Duan, Xingcheng Zhang, and Dahua Lin. Skvq: Sliding-window key and value cache quantization for large language models. arXiv preprint arXiv:2405.06219 , 2024.

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.

Yuxin Guo, Siyang Sun, Shuailei Ma, Kecheng Zheng, Xiaoyi Bao, Shijie Ma, Wei Zou, and Yun Zheng. Crossmae: Cross-modality masked autoencoders for region-aware audio-visual pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 26721-26731, 2024.

Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149 , 2015.

Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. In International Conference on Learning Representations , 2020.

Jung Hwan Heo, Jeonghoon Kim, Beomseok Kwon, Byeongwook Kim, Se Jung Kwon, and Dongsoo Lee. Rethinking channel dimensions to isolate outliers for low-bit weight quantization of large language models. arXiv preprint arXiv:2309.15531 , 2023.

Lu Hou, Quanming Yao, and James T Kwok. Loss-aware binarization of deep networks. arXiv preprint arXiv:1611.01600 , 2016.

Wei Huang, Xudong Ma, Haotong Qin, Xingyu Zheng, Chengtao Lv, Hong Chen, Jie Luo, Xiaojuan Qi, Xianglong Liu, and Michele Magno. How good are low-bit quantized llama3 models? an empirical study. arXiv preprint arXiv:2404.14047 , 2024.

Benoit Jacob, Skirmantas Kligys, Bo Chen, Menglong Zhu, Matthew Tang, Andrew Howard, Hartwig Adam, and Dmitry Kalenichenko. Quantization and training of neural networks for efficient integer-arithmetic-only inference. In Proceedings of the IEEE conference on computer vision and pattern recognition , pages 2704-2713, 2018.

Mojan Javaheripi, Sébastien Bubeck, Marah Abdin, Jyoti Aneja, Sebastien Bubeck, Caio César Teodoro Mendes, Weizhu Chen, Allie Del Giorno, Ronen Eldan, Sivakanth Gopi, et al. Phi-2: The surprising power of small language models. Microsoft Research Blog , 2023.

Albert Q Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, et al. Mistral 7b. arXiv preprint arXiv:2310.06825 , 2023.

Sehoon Kim, Coleman Hooper, Amir Gholami, Zhen Dong, Xiuyu Li, Sheng Shen, Michael W Mahoney, and Kurt Keutzer. Squeezellm: Dense-and-sparse quantization. arXiv preprint arXiv:2306.07629 , 2023.

Liang Li, Qingyuan Li, Bo Zhang, and Xiangxiang Chu. Norm tweaking: High-performance low-bit quantization of large language models. In Proceedings of the AAAI Conference on Artificial Intelligence , volume 38, pages 18536-18544, 2024.

Shiyao Li, Xuefei Ning, Luning Wang, Tengxuan Liu, Xiangsheng Shi, Shengen Yan, Guohao Dai, Huazhong Yang, and Yu Wang. Evaluating quantized large language models. arXiv preprint arXiv:2402.18158 , 2024.

Haokun Lin, Haoli Bai, Zhili Liu, Lu Hou, Muyi Sun, Linqi Song, Ying Wei, and Zhenan Sun. Mope-clip: Structured pruning for efficient vision-language models with module-wise pruning error metric. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 27370-27380, 2024.

Ji Lin, 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.

Akide Liu, Jing Liu, Zizheng Pan, Yefei He, Gholamreza Haffari, and Bohan Zhuang. Minicache: Kv cache compression in depth dimension for large language models. arXiv preprint arXiv:2405.14366 , 2024.

Jing Liu, Ruihao Gong, Xiuying Wei, Zhiwei Dong, Jianfei Cai, and Bohan Zhuang. QLLM: Accurate and efficient low-bitwidth quantization for large language models. In The Twelfth International Conference on Learning Representations , 2024. URL https://openreview. net/forum?id=FIplmUWdm3 .

Ruikang Liu, Haoli Bai, Haokun Lin, Yuening Li, Han Gao, Zhengzhuo Xu, Lu Hou, Jun Yao, and Chun Yuan. IntactKV: Improving large language model quantization by keeping pivot tokens intact. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar, editors, Findings of the Association for Computational Linguistics ACL 2024 , pages 7716-7741, Bangkok, Thailand and virtual meeting, August 2024. Association for Computational Linguistics. doi: 10.18653/ v1/2024.findings-acl.460. URL https://aclanthology.org/2024.findings-acl.460 .

Zechun Liu, Barlas Oguz, Changsheng Zhao, Ernie Chang, Pierre Stock, Yashar Mehdad, Yangyang Shi, Raghuraman Krishnamoorthi, and Vikas Chandra. Llm-qat: Data-free quantization aware training for large language models. arXiv preprint arXiv:2305.17888 , 2023.

Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, and Xia Hu. Kivi: A tuning-free asymmetric 2bit quantization for kv cache. arXiv preprint arXiv:2402.02750 , 2024.

Shijie Ma, Fei Zhu, Zhun Zhong, Wenzhuo Liu, Xu-Yao Zhang, and Cheng-Lin Liu. Happy: A debiased learning framework for continual generalized category discovery. arXiv preprint arXiv:2410.06535 , 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.

Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In International Conference on Learning Representations , 2016.

Markus Nagel, Rana Ali Amjad, Mart Van Baalen, 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.

Davide Paglieri, Saurabh Dash, Tim Rocktäschel, and Jack Parker-Holder. Outliers and calibration sets have diminishing effect on quantization of modern llms. arXiv preprint arXiv:2405.20835 , 2024.

Pratyush Patel, Esha Choukse, Chaojie Zhang, Aashaka Shah, Íñigo Goiri, Saeed Maleki, and Ricardo Bianchini. Splitwise: Efficient generative llm inference using phase splitting. In 2024 ACM/IEEE 51st Annual International Symposium on Computer Architecture (ISCA) , pages 118-132. IEEE, 2024.

Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research , 21(1):5485-5551, 2020.

Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Communications of the ACM , 64(9):99-106, 2021.

Yuzhang Shang, Zhihang Yuan, and Zhen Dong. PB-LLM: Partially binarized large language models. In The Twelfth International Conference on Learning Representations , 2024.

Wenqi Shao, Mengzhao Chen, Zhaoyang Zhang, Peng Xu, Lirui Zhao, Zhiqian Li, Kaipeng Zhang, Peng Gao, Yu Qiao, and Ping Luo. Omniquant: Omnidirectionally calibrated quantization for large language models. In The Twelfth International Conference on Learning Representations , 2023.

Mingjie Sun, Xinlei Chen, J Zico Kolter, and Zhuang Liu. Massive activations in large language models. arXiv preprint arXiv:2402.17762 , 2024.

Chaofan Tao, Lu Hou, Wei Zhang, Lifeng Shang, Xin Jiang, Qun Liu, Ping Luo, and Ngai Wong. Compression of generative pre-trained language models via quantization. arXiv preprint arXiv:2203.10705 , 2022.

Chaofan Tao, Qian Liu, Longxu Dou, Niklas Muennighoff, Zhongwei Wan, Ping Luo, Min Lin, and Ngai Wong. Scaling laws with vocabulary: Larger models deserve larger vocabularies. arXiv preprint arXiv:2407.13623 , 2024.

Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971 , 2023.

Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288 , 2023.

Albert Tseng, Jerry Chee, Qingyao Sun, Volodymyr Kuleshov, and Christopher De Sa. Quip#: Even better llm quantization with hadamard incoherence and lattice codebooks. arXiv preprint arXiv:2402.04396 , 2024.

Zhongwei Wan, Xin Wang, Che Liu, Samiul Alam, Yu Zheng, Zhongnan Qu, Shen Yan, Yi Zhu, Quanlu Zhang, Mosharaf Chowdhury, et al. Efficient large language models: A survey. arXiv preprint arXiv:2312.03863 , 1, 2023.

Zhongwei Wan, Xinjian Wu, Yu Zhang, Yi Xin, Chaofan Tao, Zhihong Zhu, Xin Wang, Siqi Luo, Jing Xiong, and Mi Zhang. D2o: Dynamic discriminative operations for efficient generative inference of large language models. arXiv preprint arXiv:2406.13035 , 2024.

Zhongwei Wan, Ziang Wu, Che Liu, Jinfa Huang, Zhihong Zhu, Peng Jin, Longyue Wang, and Li Yuan. Look-m: Look-once optimization in kv cache for efficient multimodal long-context inference. arXiv preprint arXiv:2406.18139 , 2024.

Haoxuan Wang, Yuzhang Shang, Zhihang Yuan, Junyi Wu, and Yan Yan. Quest: Low-bit diffusion model quantization via efficient selective finetuning. arXiv preprint arXiv:2402.03666 , 2024.

Xin Wang, Yu Zheng, Zhongwei Wan, and Mi Zhang. Svd-llm: Truncation-aware singular value decomposition for large language model compression. arXiv preprint arXiv:2403.07378 , 2024.

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 effective shifting and scaling. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing , pages 1648-1665, 2023.

Junyi Wu, Haoxuan Wang, Yuzhang Shang, Mubarak Shah, and Yan Yan. Ptq4dit: Post-training quantization for diffusion transformers. arXiv preprint arXiv:2405.16005 , 2024.

Yichen Wu, Long-Kai Huang, and Ying Wei. Adversarial task up-sampling for meta-learning. Advances in Neural Information Processing Systems , 35:31102-31115, 2022.

Yichen Wu, Long-Kai Huang, Renzhen Wang, Deyu Meng, and Ying Wei. Meta continual learning revisited: Implicitly enhancing online hessian approximation via variance reduction. In The Twelfth International Conference on Learning Representations , 2024.

Haocheng Xi, Changhao Li, Jianfei Chen, and Jun Zhu. Training transformers with 4-bit integers. Advances in Neural Information Processing Systems , 36:49146-49168, 2023.

Guangxuan Xiao, Ji Lin, 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.

Haobo Xu, Yuchen Yan, Dingsu Wang, Zhe Xu, Zhichen Zeng, Tarek F Abdelzaher, Jiawei Han, and Hanghang Tong. Slog: An inductive spectral graph neural network beyond polynomial filter. In Forty-first International Conference on Machine Learning , 2024.

Jaewoo Yang, Hayun Kim, and Younghoon Kim. Mitigating quantization errors due to activation spikes in glu-based llms. arXiv preprint arXiv:2405.14428 , 2024.

Lianwei Yang, Zhikai Li, Junrui Xiao, Haisong Gong, and Qingyi Gu. Mgrq: Post-training quantization for vision transformer with mixed granularity reconstruction. arXiv preprint arXiv:2406.09229 , 2024.

Zhewei Yao, Reza Yazdani Aminabadi, Minjia Zhang, Xiaoxia Wu, Conglong Li, and Yuxiong He. Zeroquant: Efficient and affordable post-training quantization for large-scale transformers. In Conference on Neural Information Processing Systems , 2022.

Zhihang Yuan, Lin Niu, Jiawei Liu, Wenyu Liu, Xinggang Wang, Yuzhang Shang, Guangyu Sun, Qiang Wu, Jiaxiang Wu, and Bingzhe Wu. Rptq: Reorder-based post-training quantization for large language models. arXiv preprint arXiv:2304.01089 , 2023.

Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics , pages 4791-4800, 2019.

Wei Zhang, Lu Hou, Yichun Yin, Lifeng Shang, Xiao Chen, Xin Jiang, and Qun Liu. Ternarybert: Distillation-aware ultra-low bit bert. arXiv preprint arXiv:2009.12812 , 2020.

Yingtao Zhang, Haoli Bai, Haokun Lin, Jialin Zhao, Lu Hou, and Carlo Vittorio Cannistraci. Plug-and-play: An efficient post-training pruning method for large language models. In The Twelfth International Conference on Learning Representations , 2024. URL https:// openreview.net/forum?id=Tr0lPx9woF .

Tianchen Zhao, Xuefei Ning, Tongcheng Fang, Enshu Liu, Guyue Huang, Zinan Lin, Shengen Yan, Guohao Dai, and Yu Wang. Mixdq: Memory-efficient few-step text-to-image diffusion models with metric-decoupled mixed precision quantization. arXiv preprint arXiv:2405.17873 , 2024.

Yilong Zhao, Chien-Yu Lin, Kan Zhu, Zihao Ye, Lequn Chen, Size Zheng, Luis Ceze, Arvind Krishnamurthy, Tianqi Chen, and Baris Kasikci. Atom: Low-bit quantization for efficient and accurate llm serving. arXiv preprint arXiv:2310.19102 , 2023.

Zhenghao Zhao, Yuzhang Shang, Junyi Wu, and Yan Yan. Dataset quantization with active learning based adaptive sampling. arXiv preprint arXiv:2407.07268 , 2024.

Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric Xing, et al. Judging llm-as-a-judge with mt-bench and chatbot arena. arXiv preprint arXiv:2306.05685 , 2023.

Yinan Zhou, Yuxin Chen, Haokun Lin, Shuyu Yang, Li Zhu, Zhongang Qi, Chen Ma, and Ying Shan. Doge: Towards versatile visual document grounding and referring. arXiv preprint arXiv:2411.17125 , 2024.

Appendix Overview

Section A: Related work.

Section B: Theory proofs.

Section C: Additional implementation details.

Section D: More empirical results.

Section E: More detailed ablation studies.

Section F: Detailed comparison with QuaRot.

Section G: Algorithm for rotation matrix.

Section H: Limitations and broader impacts.

Section I: More visualization examples.

A Related Work

A.1 Network Quantization

Neural networks achieve great success in recent years [65, 77, 38, 61, 31, 19, 62], quantization [1, 63, 67, 74, 57, 75] is a widely utilized technique aimed at reducing model size and memory usage. Research in this area generally falls into two main categories: quantization-aware training (QAT) [71, 3, 49] and post-training quantization (PTQ) [41, 60, 73]. QAT involves training quantized model weights using additional data, often with the assistance of a straight-through estimator (STE) [5]. However, the computational cost associated with QAT poses challenges, particularly for large language models (LLMs) with millions of parameters, which necessitate significant amounts of data for retraining [36, 16, 9]. In contrast, PTQ has gained popularity for LLMs [54, 22, 69, 58, 37] due to its efficient approach, involving the training of quantized models using a small amount of data, known as calibration data [18]. However, PTQ often leads to significant performance degradation, especially when employing low-bit settings [18, 53, 46, 30]. Consequently, our work focuses on enhancing the performance of low-bit PTQ quantized models.

A.2 Post Training Quantization of LLM

Post-training quantization for LLMs can be categorized into weight-only quantization [32, 14, 28, 29] and weight-activation quantization [68, 64, 74]. We focus on 4-bit weight-activation quantization due to the actual speedup it provides with low-bit quantization kernels [1]. Quantizing LLMs faces challenges due to activation outlier features persisting across different tokens and layers [13, 64]. Some approaches [13, 74] retain a small portion of crucial outlier channels at high precision (e.g., INT8), which poses challenges to hardware compatibility and leads to additional memory footprint. Other methods [64, 59, 47] attempt to shift quantization difficulty from activation to weight channels. However, the learnable equivalent transformation in OmniQuant [47] and the affine transform matrix in AffineQuant [39] exhibit instability as discussed in Section 2. The channel disassembly and assembly in QLLM [34], coupled with LoRA-tuning, incur significant time costs. Notably, these methods demonstrate poor performance under W4A4 quantization. We attribute this degradation to the ineffective handling of outlier features, especially massive outliers. Hence, we propose DuQuant to effectively eliminate outlier features through rotation matrices and channel permutation, achieving state-of-the-art performance. In contrast with QuaRot [2] also utilizing Hadamard matrices to enhance weight-activation quantization, our approach uniquely incorporates knowledge about the actual outlier channels. Furthermore, unlike QuaRot, which relies on GPTQ [18] for weight quantization, our permutation transformation has been proven helpful and efficient, facilitating a faster quantization process. The more detailed analysis and comparison with QuaRot are left in Appendix F. In addition, unlike RPTQ [69] and SKVQ [17], which use channel reordering to cluster similar activations, our method employs Permutation transformations with a fundamentally different goal: to evenly distribute outliers across blocks. This balanced distribution is crucial for enabling effective secondary rotations, ultimately leading to smoother activations that facilitate easier quantization.

B Proofs

Theorem 1 (Rotation) . For the activation input X ∈ R T × C in , ˆ R ∈ R 2 n × 2 n is a diagonal block matrix constructed as per Eqn. (3). For a specific block b i , let O j ( · ) represent the maximum outlier of the j -th dimension d j within the input. Then, we can deduce that,

Proof. In the case of a specific block b i , the potential maximum value O j ( X b i ˆ R b i ) , where X b i ∈ R T × 2 n , can be achieved by ensuring that the different j -th column outliers O j ( X b i ) are located in the same t -th row of the activation input X b i . This can be formally defined as follows,

Without loss of generality, let's assume that δ i ≥ 0 and define m := arg max i δ 2 i . Then we can derive that δ m ≥ 1 √ 2 n . Consequently, we can obtain the following inequality,

The inequality (1) holds because the switch matrix E d (1) has swap the largest outliers O 1 ( X b i ) in the first column, i.e., O 1 ( X b i E d (1) ) > max 2 ≤ m ≤ M O m ( X b i E d (1) ) .

Theorem 2 (Zigzag Permutation) . For the activation input X ∈ R T × C in , it can be divided into K blocks, where K = C in / 2 n . Let O j denote the max outlier of the dimension d j in X , the reordered outliers from large to small is expressed as O (1) , O (2) , ..., O ( C in ) . Moreover, the M b i represents the mean value of all O j in the i -th block, i = 1 , 2 , ..., K . Let δ := max {| O ( i +1) -O ( i ) |} , i = 1 , 2 , ..., C in -1 . Then, following the zigzag permutation described in Section 3.2, the mean value M b i within each i -th block consistently satisfies,

Proof. According to the zigzag permutation described in Section 3.2, and considering the reordered outliers O (1) , O (2) , ..., O ( C in ) , we can redistribute the channels they occupy (i.e., O ( i ) c )across different blocks. Specifically, for the i -th block, it contains the following channels,

Similarly, we can deduce that all M b i ( i = 1 , 2 , ..., K ) share the same upper bound after applying our zigzag permutation.

C Additional Implementation Details

In this work, all experiments are done on NVIDIA RTX 3090 GPUs for small-scale models and NVIDIA A100 GPUs for large-scale models. We set sequence length to 2048 for all evaluation tasks.

For calibration data, following [47, 39, 34], we randomly select 128 sampled sequences from the WikiText2 dataset, with the sequence length of 2048. For rotation and permutation transformations, the rotation block size 2 n is set to 128, and maximum greedy search steps N equals 256. We adopt once permutation times for efficiency. We conduct detailed ablation studies in Appendix E.2, E.3, E.4.

Regarding quantization details, for multiplications between activations in MSA, such as Query and Key, attention outputs and Value, we apply a Hadamard rotation matrix for rapid and straightforward processing. A Hadamard matrix is an orthogonal and symmetric matrix filled with elements ± 1 / √ 2 n . For smooth parameter α , we set it to 0.6 for DuQuant and 0.5 DuQuant+LWC. We clip the maximum activation values in all projection blocks, and the clipping ratio is set to 0.9. For DuQuant we also clip the maximum values in weight matrices, with a clipping ratio of 0.8. For LWC, we keep the same default epoch numbers of 20, batch size as 1, learning rate as 5e-3, and zero weight decay, as [47].

D More Empirical Results

Zero-shot QA Results for 4-bit LLaMA2 Models. Table D1 showcases the zero-shot commonsense QA results for INT4 quantized LLaMA2 models. Our DuQuant method excels across various model sizes and datasets, demonstrating state-of-the-art performance in commonsense reasoning tasks. For example, DuQuant outperforms Atom by 5.43% for the LLaMA2-7B model and by 5.18% for the LLaMA2-13B model. In contrast to Atom [74], which relies on GPTQ for weight quantization and maintains 128 channels at INT8, thereby increasing memory usage, our method offers a rapid and more efficient weight-activation quantization solution through Rotation and Permutation.

MMLUResults for 4-bit Vicuna-v1.5-7B. Vicuna-v1.5 models [10], fine-tuned from LLaMA2 models using high-quality user-shared conversations, are considered state-of-the-art chatbots. Table D2 displays the INT4 quantization results for Vicuna-v1.5-7B on the MMLU benchmarks. In comparison to SmoothQuant, OmniQuant, and Atom, our DuQuant method exhibits the smallest

performance decline and maintains competitive capacities in both zero-shot and five-shot settings. These results demonstrate the effectiveness of DuQuant in generalizing to instruction-tuned models.

Long-context Evaluation Results. LongBench [4] is proposed to access the long-context generation ability of LLMs, which covers several key long-text application scenarios. We evaluate the 4-bit quantized Vicuna models on five different tasks. Specifically, Qasper, MultiFieldQA, and NarrativeQA (F1 score) are Single-Document QA tasks; DuReader (Rouge-L score) and 2WikiMultihopQA (F1 score) are Multi-Document QA tasks; QMSum, GovReport (F1 score) and MultiNews (Rouge-L score) are Summarization tasks; TREC (Accuracy CLS), TriviaQA (F1 score), and SAMSum (Rouge-L score) are Few-shot Learning tasks; and RepoBench-P (similarity score) is Code Completion task. Table D3 and Table D4 show that our DuQuant outperforms other baselines by a clear margin, maintaining the ability for long context generation tasks compared with FP16 models.

Comparison with FP16 models on MT-Bench.

We conducted additional comparisons using the MT-Bench between our INT4 quantized models and the FP16 models. As shown in Table D5, for both 7B and 13B models, our DuQuant performs comparably to FP16, which further underscores

the effectiveness of dual transformations in maintaining high accuracy even with reduced precision.

Results for 4-bit Mistral-7B and Phi2-2.8B. We have extended the application of DuQuant to include Mistral [27] and Phi2 [26] under 4-bit WA quantization. From Table D6, we can observe that

DuQuant largely surpasses other baselines, particularly with Mistral-7B. Regarding the Phi2-2.8B model, it often experiences instability in matrix multiplication between queries and values, leading to overflow issues and posing great challenges to quantization. However, while DuQuant may not perform as well as FP models, it still significantly outperforms other baselines. In addition, we have visualized the massive outliers in the down projection layer of the Mistral-7B model and the feature space after our dual transformations. These visualizations are shown in Figure I9. It can be observed that our DuQuant perfectly eliminates these outliers. These results underscore the effectiveness of our dual transformation approach in addressing massive outliers across various types of LLMs.

Results for 4-bit LLaMA3-70B. As LLaMA3 models have proven to be sensitive to quantization, we apply our DuQuant to the LLaMA3-70B and present the results in Table D7. Due to time constraints, we do not add learnable weight clipping. The results demonstrate that our DuQuantquantized models outperform SmoothQuant by 12.9% on Commonsense QA tasks and significantly reduce perplexity across the WikiText2, C4, and PTB datasets. These improvements underscore the robustness of our DuQuant method when applied to the LLaMA3-70B model.

W6A6 Quantization Results. To thoroughly evaluate the effectiveness of our DuQuant models, we conduct comprehensive assessments under the W6A6 quantization setting. The perplexity results for language generation tasks are displayed in Table D8, while the zero-shot accuracy for Commonsense QAtasks is detailed in Tables D9 and D10. Our findings reveal that DuQuant not only surpasses other baselines but also achieves nearly lossless performance with FP16 models in these tasks. Interestingly, in several instances, DuQuant slightly outperforms DuQuant+LWC . This suggests that the Rotation and Permutation transformations alone are sufficient to create highly competitive quantized models under W6A6 settings, without the need for additional enhancements such as the learnable weight clipping (LWC) technique. These outcomes highlight the exceptional versatility and robustness of DuQuant across various quantization scenarios, confirming its potential as a leading solution in post-training quantization for large language models.

E More Ablation Studies

E.1 Time Speedup and Memory Saving

The current generation of LLMs usually splits into pre-filling and decoding phases and deploys on two separate machines [43]. Here, we present more speedup and memory-saving results for these two phases achieved with the LLaMA2-7B model on a single NVIDIA RTX 3090 GPU. We set the input sequence length to 2048 and the decoding steps to 256. End-to-end results for time speedup and memory savings during the pre-filling stage are shown in Table E11 and E12. We can observe that DuQuant achieves a maximum speedup of 2 . 01 × during the pre-filling phase, with speedup increasing as the batch size grows. From Table E12, DuQuant demonstrates significant memory savings, effectively reducing memory usage by up to 3 . 20 × through quantization. For the decoding phase, we enlarge the batch size to 64 and measure speedup along with memory usage for one LLaMA2-7B layer, constrained by the 24 GB memory of the GPU. As shown in Table E13, DuQuant maintains speedup and memory usage comparable to QuaRot. These results underscore the efficiency of DuQuant in optimizing resource utilization, highlighting its potential to enhance performance and reduce costs in deploying large language models, particularly in resource-constrained environments.

E.2 Effects of Rotation Matrix

Ablation of Rotation Block Size. To further explore the impact of rotation block size, we apply varying block sizes in the rotation matrices to both LLaMA2-7B and LLaMA2-13B models and evaluate the perplexity of the quantized models. The results, presented in Table E14, indicate that increasing block sizes generally improves model performance. This improvement occurs because larger block sizes allow outliers to be distributed across more channels, evening out values throughout the activation/weight matrix thereby enhancing quantization accuracy and performance. Additionally, quantization runtime decreases with larger block sizes, likely due to more efficient transformations during the reshaping of original activation/weight matrices. Consequently, we adopt 128 as our rotation block size for all experiments for efficiency and effectiveness.

Ablation of Rotation Times. Identifying the optimal rotation matrix R is a complex challenge, so we employ a greedy search algorithm to approximate the matrix as ˆ R . We conduct an ablation study on the number of greedy steps N and summarize the results in Table E15. Initially, as N increases, the model performance improves, reflecting our ability to determine ˆ R more effectively. However, when N reaches 1024, the model begins to overfit. Consequently, we have chosen N = 256 for all our experiments, as it offers the optimal balance between model performance and time usage.

E.3 Effects of Permutation Algorithm.

As discussed in Section 3.2, rotation transformations within each block are limited and unable to redistribute outliers across different blocks. To address this, we introduce a permutation transformation aimed at balancing outliers more comprehensively. Our primary goal is to minimize the variance among different blocks, as outlined in Eqn. (4). We explore several optimization algorithms, with the results detailed in Table E16. Note that the variance values are measured on activation values of the query project in the first layer of each model, and the time in the table represents the runtime of calibration. The Zigzag permutation notably reduces the variance to 3.0e-4, achieving this with minimal time expenditure and yielding competitive perplexity results. While Simulated Annealing slightly outperforms Zigzag in terms of perplexity for the LLaMA2-7B model, it was significantly more time-consuming, and the marginal gains did not justify the additional complexity. Therefore, we select Zigzag permutation as our preferred method, leading to smoother outlier distribution and more effective quantized models.

E.4 Effects of Calibration Datasets

Ablation of Different Calibration Datasets. We apply our DuQuant to quantize the LLaMA2-7B model using different calibration datasets, with results presented in Table E17. It can be observed that the selection of calibration datasets has a relatively minor impact on quantization performance. This is because our method uses the calibration data solely to identify outlier channels, rather than for gradient-based parameter learning as seen in methods like OmniQuant [47] and AffineQuant [39]. This ablation study underscores the robustness of our DuQuant method.

Calibration-free Quantization. To further explore the robustness of DuQuant under varying calibration conditions, we generate random calibration data within the vocabulary range of the model, setting the sample count to 256. The results, shown in Table E18, indicate that even in calibrationfree settings, our method continues to perform well, achieving results that are competitively close to those obtained with actual calibration data. This demonstrates that DuQuant could provide a viable solution in real-world scenarios where obtaining specific calibration data is challenging or impossible. In addition, our findings suggest that outliers are inherent to certain model layers, reflecting characteristics of the model weights or modules, especially in recent LLMs. This aligns with concurrent research: [66] identified consistent massive outliers at the FFN down projection layer in GLU-based LLMs, such as LLaMA, Mistral, Mixtral, SOLAR, and Gemma, while [42] reported that, although OPT models are sensitive to different calibration sets, newer models demonstrate robustness to outliers and maintain stable activations. These insights reinforce the idea that outliers are more linked to the internal structure of model weights and modules than to calibration data. DuQuant's ability to deliver high performance without relying on traditional calibration data creates opportunities for deploying quantized models in environments with stringent privacy requirements or limited data availability. This highlights a promising direction for future research, focusing on improving model adaptability and deployment flexibility.

Ablation of Different Numbers of Calibration Samples. We utilize our DuQuant to quantize the LLaMA2-7B model using varying numbers of calibration samples from the WikiText2 dataset, with results detailed in Table E19. Interestingly, the quantization performance shows a low correlation with the number of samples, demonstrating the robustness of DuQuant ˙ This stability arises because we utilize the mean activation values from these samples to construct our rotation matrices. Since we average the activations, the influence of any single, potentially non-representative sample is minimized, ensuring consistent performance. Notably, as we use mean values, the time cost of our quantization process remains constant regardless of the number of samples, enhancing the efficiency.

F Detailed Comparison with QuaRot

In this section, we present a detailed comparison between our DuQuant and QuaRot [2]. QuaRot employs Hadamard matrices to mitigate outliers in activations and utilizes the GPTQ algorithm for weight quantization to achieve competitive performance. However, our DuQuant method demonstrates several distinct advantages:

Effective Use of Prior Knowledge: DuQuant leverages prior knowledge to accurately target and eliminate outliers through multiple rotations, achieving a smoother activation distribution compared to the Hadamard transformation, as demonstrated in Figure 10.

Efficient Channel Permutation: Our channel permutation not only further smooths outlier features but also benefits from rapid implementation, enhancing overall performance.

Simultaneous Weight Matrix Smoothing: Unlike QuaRot, DuQuant directly and efficiently smooths the weight matrix, avoiding the time-consuming GPTQ algorithm and accelerating the quantization process, as demonstrated high quantization efficiency in Table F24.

Experimental results underscore the superiority of DuQuant over QuaRot. We first summarize the experimental setting differences between the original paper of QuaRot with ours in Table F20 * . For a fair comparison, we reproduce the QuaRot under 4-bit per-channel weight and per-token activation asymmetric quantization. Table F21 displays the perplexity (PPL) and zero-shot accuracy for models LLaMA1-7B, LLaMA2-7B, and LLaMA3-8B. Our DuQuant method consistently outperforms QuaRot-RTN across all benchmarks, showcasing our advanced weight matrix management. Furthermore, compared to QuaRot-GPTQ, DuQuant and DuQuant+LWC achieve better average accuracy across six QA tasks and demonstrate superior performance on the WikiText and C4 datasets, particularly for LLaMA3-8B. Moreover, we further provide the results of DuQuant under the setting utilized in the original paper of QuaRot in Table F22. DuQuant still surpasses QuaRot by a large margin.

Additionally, we assess the effectiveness of the rotation matrices utilized in DuQuant which incorporate prior knowledge against the Hadamard matrices used in QuaRot. We omit the permutation step in DuQuant and directly contrast it with QuaRot-RTN. Results in Table F23 show that our DuQuant without permutation outperforms QuaRot by a clear margin, which confirms that our rotation transformation is more effective than Hadamard by leveraging prior knowledge. It is worth noting that because a Hadamard matrix is orthogonal and symmetric, it multiplies by itself to yield the identity matrix. In other words, the Hadamard matrix is not suitable for greedy searches aimed at finding smaller outliers. These findings differentiate DuQuant from QuaRot and highlight the effectiveness of our approach in managing outliers for post-training quantization of large language models.

G Algorithm for Rotation Matrix

H Limitations and Broader Impacts

Limitations. The primary limitation of our method is the lack of a specialized strategy for calibration data selection. We adhere to established practices [47, 39, 34, 74, 2, 1] by randomly selecting 128 samples from the WikiText2 dataset to compute the mean embeddings that inform our rotation matrix and zigzag permutation order. We also explore the possibility of calibration-free quantization and show some promising results. However, further investigating more tailored choices for calibration data can potentially enhance the performance of our quantized models. We leave this for future study.

Broader Impacts. Our work identifies the presence of massive outliers in down-projection layer of FFN modules, which significantly complicates low-bit weight-activation quantization. To address this challenge, we implement a combination of rotation and permutation matrices to effectively smooth both massive and uniform outliers, proving both fast and effective. Consequently, we establish a new state-of-the-art for INT4 weight-activation post-training quantization methods. Our approach aims to accelerate large language models and reduce memory usage during deployment, offering substantial benefits to the field of LLM research. These advancements could lead to more efficient and accessible LLM applications, facilitating broader usage and enabling more sustainable AI implementations.

I More Visualizations

We provide additional visualizations of normal and massive outliers in various models (LLaMA1, LLaMA2, Vicuna-v1.5, Mistral) from Figure I1 to Figure I9. In each figure except Mistral, the left side illustrates changes in normal outliers before and after applying our rotation and permutation transformations, while the right side shows the changes in massive outliers before and after transformations. It is evident that massive outliers consistently occur in the down-projection layer of the FFN module across all models, supporting our findings discussed in Section 2. Conversely, normal outliers appear in different modules within the transformation block. For instance, Figure I3 shows normal outliers at the up-projection layer of the FFN module in LLaMA1-13B. Significantly, both massive and normal outliers are reduced markedly after our rotation and permutation transformations, leading to easier quantization of activations. This underscores the effectiveness of our DuQuant in managing outlier features across diverse LLM models.

(a) LLaMA1_7B_Layer15_Attn_O_Proj

(b) After Rotation and Permutation

(c) LLaMA1_7B_Layer2_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

0.200

0.175

1

175

150

1.4

1.2

一

Channel

3000,

3500000

0

50

100

150

vef

200

250

0.100

0.150

0.125

0.075]

0.050

0.025

0.000

0

Channel

4000

0

50

00T

150

T0

200

250

1

1

1

1

1

1

1

125

100

75

50

25

0

0

2000

4000

Channel

0009

8000

10000

Q

50

100

150

200

250

1.0

0.8

0.6

0.4

0.2

0.0

2000

4000

Channel

0009

8000

10000

50

100

150

200

250

1

(a) LLaMA1_13B_Layer1_Attn_K_Proj

(b) After Rotation and Permutation

(c) LLaMA1_13B_Layer6_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

1

1

1

10

8

6

4

Z

U

0

1000

2000

3000

4000

5000

0

50

100

150

200

250

0.25

0.20

0.15

0.10

0.05

0.00

0

1000

2000

Channel

3000

4000

5000

50

100

150

0

200

250

1

1

1

1

1

1

I

1

1

1

1

1

500

400

300

200

100

0

0

2000

4000

Channel

6000

8000

10000

12000

14000

50

100

Token

150

200

250

2.25

2.00

1.75

1.50

1.25

1.00

0.75

0.50

0.25

0.00°

0

2000

4000

Channel

0009

8000

10000

12000

14000

0

50

100

150

200

250

1

1

(a) LLaMA1_13B_Layer3_FFN_Up_Proj

(b) After Rotation and Permutation

(c) LLaMA1_13B_Layer2_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

1

1

2.0

1.5

0.175

0.150

0.125

1

1

1

1

300

350

250

1.0

0.8

1.0

0.5

0.0

0

1000

2000

Channel

3000

4000

5000

0

50

150

200

250

0.100

0.075

0.050

0.025

0.000

0

1000

2000

Channel

3000

4000

5000

0

50

100

150

200

250

1

1

1

1

1

1

200

150

100

50

0

0

4000

Channel

6000

0008

10000

12000

14000

0

50

100

150

200

250

0.6

0.4

0.2

0.0

2000

4000

Channel

6000

8000

10000

12000

14000

0

50

100

150

200

250

(a) LLaMA1_65B_Layer11_Attn_K_Proj

(b) After Rotation and Permutation

(c) LLaMA1_65B_Layer2_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

800

12

0.30

1.2

10

0.25

600

1.0

8

6

0.20

0.15

500

400

0.8

0.6

4

2

0

0002000000000000

Channel

8000

0

50

100

150

en

200

250

0.10

0.05

0.00°

00g

Channel

8000

0

50

100

150

200

250

1

300

200

100

0

0

5000

Channel

10000

15000

20000

0

50

100

150

200

250

0.4

0.2

0.0

0

5000

Channel

10000

15000

20000

0

50

00T

150

er

200

250

(a) LLaMA2_13B_Layer1_Attn_K_Proj

(b) After Rotation and Permutation

(c) LLaMA2_13B_Layer3_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

5

0.25

0.20

1

200

175

1.0

4

3

N

1000

2000

Channel

3000

4000

5000

0

50

100

150

en

200

25

0.15

0.10

0.05

0.00°

0

1000

Channel

2000

3000

4000

5000

0

50

100

150

200

e

250

1

1

1

1

1

1

150

125

100

1550250

0

Channel

12000

14000

0

50

100

150

200

250

0.8

0.6

0.4

0.2

0.0

0

2000

4000

Channel

6000

8000

10000

50

100

150

200

250

(a) LLaMA2_70B_Layer1_Attn_K_Proj

(b) After Rotation and Permutation

(c) LLaMA2_70B_Layer2_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

12

0.175

250

1.2

10

8

6

4

2

0

Channel

0

50

100

150

200

250

0.150

0.125

0.100

0.075

0.025

0.050

0.000

Channel

8000

0

50

100

150

200

250

1

1

1

200

150

100

50

0

5000

10000

Channel

15000

20000

25000

30000

50

100

150

200

250

1.0

0.8

0.6

0.2

0.4

0.0

0

5000

Channel

10000

15000

20000

0

50

100

150

200

250

oken

(a) Vicuna_v1.5_7B_Layer1_Attn_K_Proj

(b) After Rotation and Permutation

(c) Vicuna_v1.5_7B_Layer1_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

8

0.30

0.25

250

|300

2.00

1.75

1.50

6

0.20

|200

1.25

0.15

150

1.00

4

2

0

Channel

0

50

00T

150

ef

200

250

0.05

0.10

0.00°

0

50

Channel

0

50

100

150

200

250

1

1

1

100

50

0

0

2000

4000

Channel

6000

8000

10000

0

50

100

150

en

200

250

0.75

0.50

0.25

0.00

0

2000

4000

Channel

6000

8000

10000

0

50

100

150

O

200

250

(a) Vicuna_v1.5_13B_Layer8_Attn_K_Proj

(b) After Rotation and Permutation

(c) Vicuna_v1.5_13B_Layer3_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Normal Outliers

8

6

4

0.40

0.35

0.30

0.25

0.20

0.15

1

140

120

100

80

60

0.8

0.6

0.4

2

0

0

1000

2000

Channel

3000

4000

5000

0

50

100

150

200

250

0.10

0.05

0.00°

0

1000

2000

Channel

3000

4000

5000

0

50

100

150

O

en

200

250

1

1

1

1

40

20

0

40006000

Channel

8000

10000

12000

14000

0

50

100

150

200

250

0.2

0.0

0

Channel

10000

12000

14000

0

50

100

150

kef

200

250

(a) Mistral_7B_Layer1_FFN_Down_Proj

(b) After Rotation and Permutation

(c) Mistral_7B_Layer30_FFN_Down_Proj

(d) After Rotation and Permutation

Massive Outliers

Massive Outliers

1200

1000

0.4

400

350

0.4

600

800

400

200

0

020004000 6

Channel

060000000

14000

0

50

100

150

200

250

0.3

0.2

0.1

0.0

0

2000

4000

Channel

12000

14000

0

50

100

150

200

250

1

1

1

1

1

300

250

200

150

100

50

0

Channel

140000

50

100

150

200

25C

0.3

0.2

0.1

0.0

Channel

12001.40000

0

50

100

150

200

250

1

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

Justification: We state the contributions in the abstract and introduction sections.

Guidelines:

The answer NA means that the abstract and introduction do not include the claims made in the paper.

The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.

The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.

It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes]

Justification: We discuss the main limitations in Appendix H.

Guidelines:

The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.

The authors are encouraged to create a separate "Limitations" section in their paper.

The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.

The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.

The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.

The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.

If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.

While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [Yes]

Justification: Please refer to Appendix B for related assumptions and proofs.

Guidelines:

The answer NA means that the paper does not include theoretical results.

All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.

All assumptions should be clearly stated or referenced in the statement of any theorems.

The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.

Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.

Theorems and Lemmas that the proof relies upon should be properly referenced.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: Implementation details are provided in Appendix C. We have released our code at https://github.com/Hsu1023/DuQuant .

Guidelines:

The answer NA means that the paper does not include experiments.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [Yes]

Justification: We have released our code at https://github.com/Hsu1023/DuQuant .

Guidelines:

The answer NA means that paper does not include experiments requiring code.

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

Justification: Please refer to Section 4 and Appendix C for experimental settings.

Guidelines:

The answer NA means that the paper does not include experiments.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

The full details can be provided either with the code, in appendix, or as supplemental material.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [No]

Justification: Our study used a fixed seed for all quantization operations, following standards in post-training quantization, and thus did not report statistical significance.

Guidelines:

The answer NA means that the paper does not include experiments.

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

The assumptions made should be given (e.g., Normally distributed errors).

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: All experiments are done on NVIDIA RTX 3090 GPUs and A100 GPUs.

The answer NA means that the paper does not include experiments.

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes]

Justification: We confirm the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics.

Guidelines:

The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.

If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.

The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [Yes]

Justification: We discuss the broader impacts of our work in Appendix H.

The answer NA means that there is no societal impact of the work performed.

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.

Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.

The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to

generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.

The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.

If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA]

Justification: This work poses no such risks.

Guidelines:

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

Justification: We cite all datasets and models utilized in our experiments.

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should cite the original paper that produced the code package or dataset.

The authors should state which version of the asset is used and, if possible, include a URL.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA]

Justification: This work does not release new assets.

The answer NA means that the paper does not release new assets.

Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.

The paper should discuss whether and how consent was obtained from people whose asset is used.

At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA]

Justification: This work does not involve crowdsourcing nor research with human subjects.

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.

According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: [NA]

Justification: This work does not involve crowdsourcing nor research with human subjects.

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.

For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper introduces a method called DuQuant, a new quantization method specialized for LLMs. The paper notes that \"massive outliers\" cause previous quantization approaches to be less effective or powerful, and then proposes a new quantization method which ameliorates the effect of such massive outliers. Theoretical analysis shows that the method has good properties, such as successfully spreading out the outlier mass directly before quantization, which facilitates better outcomes. Experiments show state-of-the-art performance across standard language modelling benchmarks on Llama and Llama-2 class models, preserving most of the base model's performance.\n\nSTRENGTHS:\n- The exposition/writing is very clear. \n- All major steps of the method are motivated, and the theoretical calculations straightforwardly apply to the method's real-world implementation. The design choices are either made straightforwardly or chosen via experiments/ablations.\n- Experimental results show that the overall model performance is better than other (previously state-of-the-art) quantization methods. The time and memory costs are also reduced, owing to the simple construction of the matrices in the construction (block diagonal, orthogonal, or permutation matrices).\n\nWEAKNESSES:\nSeveral potentially desirable properties of the model may not be completely covered by the analysis. For example:\n- The memory consumption reduction seems good, but the presentation of this result is postponed to the appendix E. Could you find a way to put this in the main body (maybe moving back the presentation of one of the several pure performance metrics such as PPL, or one of the ablation studies), and compare to other state-of-the-art models? In my opinion, since people usually only do quantization for better memory consumption or speeding up inference, measuring the performance on both of these axes is crucial.\n- The speedup is only measured for pre-filling. Is it possible to compute end-to-end speedup for open-ended generation? It would be great to see the impact of the method on some more realistic workloads (again, across the axes of performance, memory consumption, and speedup), to supplement the thorough analysis of each component in the paper.\nTo address both these issues, along with an empirical study, an analysis of the asymptotic runtime/memory complexity of the quantization procedure would be great if possible.\n\nAlso a slight nitpick: at the bottom of page 2, massive activations are not the same phenomenon as attention sinks, though they can be related.\n\nQUESTIONS:\n- Previous work on Massive Activations have shown their ubiquity in many types of LLMs, not just Llama, and even on certain types of vision models. Is it possible that this work can be done on other types of LLMs/transformers? Does the backbone model you pick significantly change the effectiveness of the method (e.g., Phi vs Llama vs Mistral)?\n\nLIMITATIONS:\nThe authors are generally precise about the method's strengths and weaknesses, and include a limitations section.", "TITLE": "Official Review", "RECOMMENDATION": 8, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-06-15"}

comments: SUMMARY:
This work proposed a transformation (composition of orthogonal and permutation transformation) that makes LLMs more quantization-friendly (accounting for the presence of outlier features). The approach is validated on several modern LLMs from Llama-1,2,3 families.

STRENGTHS:
The introduced method makes sense and targets the specific case of Massive outliers, that is not accounted in previous weight+activation approaches. The obtained results are pretty strong and achieve state-of-the-art at W4A4 quantization. 

This approach is pretty fast and takes a couple of minutes even on large LLMs.

This work conducts a study on location and impact of specific types of outliers.

Speedups are quite significant.

WEAKNESSES:
The idea of applying rotation transformation for simplifying weight/activation quantization is not novel and (to my knowledge) was first introduced in QuaRot. The introduced method proposes a specific form of orthogonal/permutation matrices. QuaRot results for Llama-2-7b quantization reported in QuaRot paper are significantly better than the one presented in Table 7 and only marginally inferior to DuQuant numbers. I would suggest comparing with the numbers from original paper for fairness.

QUESTIONS:
* Do the learned rotation possess incoherence property [1]? 

* Can one boost GPTQ performance further (as it is strictly stronger method compared to RTN) with DuQuant rotation matrices? 

* What is the context length for Llama-3-8B evaluation? Typically, one uses the training context length for comparison (8k for Llama-3 model family). 

[1] Chee, Jerry, et al. "Quip: 2-bit quantization of large language models with guarantees." Advances in Neural Information Processing Systems 36 (2024).

LIMITATIONS:
See Weaknesses.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 3
DATE: 2024-07-03

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper presents a new post-quantization method (DuQuant) that targets low-precision (4-bit / 6-bit) weight and activation quantization. The authors show how the presence of massive outliers affects quantization when using existing methods (smoothing is not sufficient with SmoothQuant / OmniQuant training is not stable for layers exhibiting massive outliers). They propose their method for better handling both normal and massive outliers - by utilizing orthogonal rotation and permutation matrices, with a simple zigzag permutation scheme for a better / more even distribution of outliers. They provide theoretical proofs for both their rotation and zigzag-permutation operations grounding their proposed algorithm. They showcase the strength of the propsed methods as it can be enabled with simple quantization, and not rely on expensive quantization methods like GPTQ to achieve new state of art quantized models across a range of different models.\n\nSTRENGTHS:\n1. The paper presents a theoretically grounded approach to low-precision (4-bit / 6-bit) quantization of LLMs.\n2. The paper showcases how massive outliers are challenging for existing methods to adapt to (for e.g., SmoothQuant just fails and OmniQuant sees unstable gradients in training layers with massive outliers). The authors also particularly show that the down-projection layers in FFNs particularly face massive outliers - which inhibit effectively their quantization.\n3. The authors propose a new RAP (rotation and permutation) based method for enabling more even distribution of outliers from the activations to weights.\n    - They first start with the smoothing operation proposed in SmoothQuant, through ablations they show this helps get better post-quant model quality.\n    - They follow this up with a rotation operation, with the constraints that it should be able to as evenly distribute the outliers through the matrix multiplications. They show that a single rotation process cannot handle this effectively and design an iterative but greedy process that solves this using block-diagonal rotation matrices.\n    - Followed by this, they propose a new zigzag permutation operation to evenly distribute large outliers across different blocks. Finally, they apply another rotation to ensure that the outliers are maximally reduced and spread across the weights.\n4. They follow the proposal of the method through theoretical analysis, showing how their methods will results in either optimal results / have bounds in each phase of the smoothening to ensure maximal quality.\n5. They propose two variants of the algorithm - one standard with specific activation / weight clipping coeffs and another with LWC enabled from the OmniQuant algorithm. They follow these with 4-bit and 6-bit results for the LLaMA-1,2,3 and Vicuna-1.5 models, showcasing that their method outperforms other existing methods in these settings.\n6. They provide a comparison with the recently proposed QuaRot method and how their proposed algorithm performs better than the algorithm, while being competitive for implementation performance.\n\nWEAKNESSES:\n1. Most of the evals (except MT-Bench) are logit-based evals (and not generative). This has a side effect of hiding some of the inherent limitations of low-precision quantization algorithms (i.e., error accumulation across generated tokens).\n2. One limitation of the proposed benchmarks (for implementation performance) is that they measure the prefill performance, but do not show any generation performance. This typically dominates over prefill performance.\n3. One thing is the reporting of results is not consistent across the models - for eg. some tables use Atom for reporting model quality at 4-bits, but some models do not report this performance. While the benefits of the method are clear given the higher accuracies on downstream tasks, it is difficult to judge how the differences translate on models of higher quality (e.g. Llama-2 vs Llama=3 70B).\n\nQUESTIONS:\n1. Many times the perplexity numbers and downstream performance are not 1:1 correlated. This most likely has to do with the standard error of the downstream tasks? If so, it will be good to clarify this for the reader.\n2. Figure 5 is not clear in explaining the different settings - what do Perm 0, 1, and 2 correspond to? Also in the paragraph above the figure, in lines 312-313, it is not clear which Figure is being referred to.\n3. For Table 6, it will be better to explain how to read the table. It took multiple passes to understand the full setup of the ablations and the associated results in the table.\n4. It is surprising that the method is largely calibration free - indicating that the outliers are more a property of the model weights, and activations are suffering as a by-product of this? can the authors clarify their intuition around this.\n\nLIMITATIONS:\nThe authors address the limitations and broader impacts of their work. One thing they do mention in the checklist is reporting of statistical signficance - which I do not see anywhere in the paper. Can authors point to where these results are? Or equivalently change the checklist to reflect this.", "TITLE": "Official Review", "RECOMMENDATION": 8, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-11"}

comments: SUMMARY:
The paper explores new approaches in LLM quantization. The work tries to address the performance degradation due to massive outliers in the weights. The work show competitive performance across different settings, up to 4-bit weight activation quantization. The work also provides solid experiments and visualization on the effectiveness of the proposed methods.

STRENGTHS:
1. I think the paper is well-written. The experiments, plots, and tables are well clearly tied to the story on large/abnormal outlier in the activation. 
2. The work is easy to follow, especially in the methodology. 
3. The results in the tables show that work offer very competitive performance comparing to previous methods.

WEAKNESSES:
1. I am a bit puzzled by the results in Table.1 vs Table.2. It is shown that lower perplexity does not necessarily reflect in higher benchmark accuracy. This conflict exists within DuQuant (DuQuant vs DuQuant_LWC) and other methods like AffineQuant,OmniQuant vs QLLM. The authors might want to consider adding some justification to this conflict to further improve the soundness of the tables.

QUESTIONS:
From the benchmarks, it is shown that the proposed method almost matches the fp16 results (unquantized). It would be interesting to see the mt-bench of the quantized vs fp16 model to see if such an observation still holds.

LIMITATIONS:
NA
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 3
DATE: 2024-07-14

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper proposes a new LLM quantization method named DuQuant (for Dual transformations Quantization). This method is able to quantize the weights and activations of an LLM to 4 or 6 bits without losing significant precision.\n\nThe paper identifies the issue of Massive outliers in the activations of a LLM. These are outliers within the outliers, having magnitudes in the order of 100-1000. Traditional quantization methods, such as SmoothQuant, cannot deal with these outliers, because they attempt to address the errors locally. DuQuant, on the other hand, uses a sequence of rotation, permutation, and another rotation to spread these outliers out across many weights, resulting in a more accurate capture.\n\nThe results are supported with theoretical results as well as experiments. DuQuant outperforms the baselines on perplexity, QA and MT-bench.\n\nSTRENGTHS:\nThe paper is well-written and easy to understand (apart from a few minor typos). I especially like figure 2 that give a strong intuition to how the method works and also why it eliminates Massive outliers. The algorithm, the justification and the results are easy to follow.\n\nThe experimental results are very convincing. They demonstrate an improvement in prediction quality in W4A4 across the board. The paper shows extensive experiments looking at various Llama models as well as Vicuna. Compared to the baselines (SmoothQuant, AffineQuant, OmniQuant, Atom, QLLM), DuQuant always performs the closest to the uncompressed model. This result is shown across various tasks: perplexity, QA and MT bench.\n\nThe paper also includes ablations and runtime costs of the required transforms: the transforms incur an additional 8.9-9.3% computational cost at inference time compared to standard W4A4.\n\nWEAKNESSES:\nA shortcoming of the paper is the lack of close comparison to QuaRot. QuaRot is a very similar technique and it deserves to be in the related works section as well as be a baseline in the experiments. While there is a detailed comparison in the appendix, the work should also be mentioned in the main body.\n\nThe paper could be improved at places, but I don't consider any of these shortcomings a major issue:\n* The paper has numerous typos (eg.: Line 11: Typo, Line 188: typo, Line 313: Figure reference missing). Please proofread.\n* The paper is extremely dense, its sometimes difficult to distinguish the figure captions from the main body. Please use proper paddings for tables and figures where possible.\n* The description of how the rotation matrix is constructed could be more detailed (Lines 141 - 147). Given that this is a core algorithmic contribution of the paper, it should be clear to the reader how it works. Perhaps a figure or pseudocode would be helpful here.\n\nQUESTIONS:\nNo outstanding questions.\n\nLIMITATIONS:\nNo limitations.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 4, "DATE": "2024-07-15"}