Evaluating the Generalization Ability of Quantized LLMs: Benchmark, Analysis, and Toolbox

## Abstract

Abstract Large language models (LLMs) have exhibited exciting progress in multiple scenarios, while the huge computational demands hinder their deployments in lots of real-world applications. As an effective means to reduce memory footprint and inference cost, quantization also faces challenges in performance degradation at low bit-widths. Understanding the impact of quantization on LLM capabilities, especially the generalization ability , is crucial. However, the community’s main focus remains on the algorithms and models of quantization, with insufficient attention given to whether the quantized models can retain the strong generalization abilities of LLMs. In this work, we fill this gap by providing a comprehensive benchmark suite for this research topic, including an evaluation system, detailed analyses, and a general toolbox. Specifically, based on the dominant pipeline in LLM quantization, we primarily explore the impact of calibration data distribution on the generalization of quantized LLMs and conduct the benchmark using more than 40 datasets within two main scenarios. Based on this benchmark, we conduct extensive experiments with two well-known LLMs (English and Chinese) and four quantization algorithms to investigate this topic in-depth, yielding several counter-intuitive and valuable findings, e.g. , models quantized using a calibration set with the same distribution as the test data are not necessarily optimal. Besides, to facilitate future research, we also release a modular-designed toolbox, which decouples the overall pipeline into several separate components, e.g. , base LLM module, dataset module, quantizer module, etc. and allows subsequent researchers to easily assemble their methods through a simple configuration.
Our benchmark suite is publicly available at https://github.com/TsingmaoAI/MI-optimize .

## 1 Introduction

In recent years, large language models (LLMs) have made groundbreaking advancements, demonstrating remarkable results and outstanding *generalization ability* across various tasks (; ; ; ). For example, given a few prompt examples or questions, LLMs can produce insightful answers within the unseen domain (; ).
However, while LLMs exhibit remarkable capabilities, their substantial size makes real-world implementation cost-prohibitive.
To address this challenge, model quantization has emerged as a prevailing technique for reducing the memory footprint of LLMs (; ; ; ; ; ; ).
Specifically, quantization reduces the model size by replacing high-precision floating-point numbers with lower-precision integers (*e.g.*, from FP16 to INT4) (; ; ).
Currently, to avoid the substantial retraining costs of LLMs, the quantization methods for large models primarily employ post-training quantization (PTQ) (; ; ; ), which leverages calibration data to optimize the error caused by the quantization.
Given the prevalent view that LLM capabilities stem from their extensive parameter count (), a critical question emerges:

*Can the quantized LLMs still retain their strong generalization ability?*

While some works have acknowledged this issue (; ; ; ; ), there is still a lack of systematic evaluation regarding the generalization performance of LLMs after quantization, particularly considering the impact of *calibration data* introduced during the quantization process.

Figure: Figure 1: We show the pipeline of model quantization and the data required at each stage (Top).
Refer to caption: x1.png

As shown in Fig. 1, the process of model quantization encompasses three distinct stages: pre-training, quantization, and inference, utilizing pre-training data, calibration data, and test data, respectively.
Existing quantization researches typically use a standard calibration set, which is usually a subset of the pre-training data (Scenario 1, S1), and evaluate on several fixed datasets (; ; ; ; ).
However, because using task-specific data for model calibration is a more reasonable choice in practical applications, the relationship between the distribution of *calibration data* and *test data* and its impact on the generalization ability of quantized models is a more worthy research topic that has not been deeply explored (Scenario 2, S2). In this work, to answer the abovementioned question and bridge the gap between academic research and practical implementation, we provide a platform to evaluate the generalization ability of quantized LLMs, covering *benchmarks*, *analyses*, and a modular-designed *toolbox*.

Benchmark evaluation. As shown in Fig. 1, we build the benchmark based on the two scenarios:

$\bullet$ In S1 (Section 2), beyond the existing research, we collect the most comprehensive evaluation of test datasets to date, covering 9 categories and 26 datasets. We use C4 () as the calibration dataset, and quantize LLaMA-7B () model by two methods (; ) across three weight bit-widths.

$\bullet$ In S2 (Section 3), our benchmark covers 19 datasets with two types of distribution shifts between calibration data and test data: *cross-dataset* and *cross-subject*. We consider both English and Chinese domains for the cross-dataset setting. Besides, our benchmark also includes a more challenging cross-subject setting, e.g. from humanities to social science. To our knowledge, no prior work has investigated the generalization of quantized models in a cross-subject setting. For all settings, our benchmark builds the Independent and Identically Distribution (I.I.D) and Out-of-Distribution (OOD) evaluations by adjusting the calibration data distributions. In our experiments, we quantize LLaMA-7B () and Baichuan2-7B-Base () for English and Chinese models with four methods (; ; ; )
across three weight bit-widths.

The generalization performance of quantized models is assessed using zero-shot and few-shot evaluation for all experiments, and we summarize the key features of our benchmark in Tab. 1.

Empirical findings. Based on the experiments, we observe several counter-intuitive phenomena, e.g.,

$\bullet$ *Tasks vary significantly in their sensitivity to quantization, and even the same tasks exhibit different sensitivities on different datasets*. For example, natural language inference tasks are the least sensitive across various tasks and MC-TACO () varies more than ARC-Easy () in the zero-shot setting.
We also observe that lower bit quantization even yields improved performance in some settings, such as GLUE-SST and GLUE-QNLI () in the zero-shot setting.

$\bullet$ *Consistency between calibration data and test distribution does not always yield optimal performance*, which is significantly correlated to the evaluation tasks and the magnitude of the distribution shift.
For example, in cross-dataset tasks (English), there is often an optimal calibration dataset for the same task, which is *not* I.I.D data and can vary depending on the base quantization algorithm.
For cross-subject tasks, except for the SpQR algorithm, which generally favors I.I.D data, the regularity of results in other settings is not obvious.

**Table 1: Summary of the proposed benchmark.**
| Scenario | Distribution<br>Shift | Task<br>Language | Weight<br>Precision | Model | Benchmark &<br>Dataset | Results |
| --- | --- | --- | --- | --- | --- | --- |
| S1 | - | English | {16, 4, 3, 2} | LLaMA2-7B () | WinoGrande (), WSC273 (), HellaSwag () | Fig. 2 |
| SWAG (), PIQA (), MathQA (), |  |  |  |  |  |  |
| Mutual, Mutual_Plus (), CrowS-Pairs (), |  |  |  |  |  |  |
| Toxigen (),PubMedQA (), OpenBookQA (), SciQ (), |  |  |  |  |  |  |
| ARC-Easy, ARC-Challenge (), MC-TACO (), RACE (), |  |  |  |  |  |  |
| QA4MRE (), GLUE (6 datasets) (), ANLI (), BLiMP () |  |  |  |  |  |  |
| S2 | Cross-dataset | English | {4, 3} | LLaMA2-7B () | BOSS (16 datasets) () | Tab. 2 |
| S2 | Cross-dataset | Chinese | {4, 3, 2} | Baichuan2-7B () | C-EVAL (), CMMLU () | Tab. 3 |
| S2 | Cross-subject | Chinese | {4, 3, 2} | Baichuan2-7B () | C-EVAL () | Tab. LABEL:tab:cds_subject |

Toolbox. To support this work and facilitate future research, we develop a modular-designed code library. Specifically, this toolbox decouples the overall pipeline shown in Fig.1 into several separate components, e.g., LLM module, dataset module, quantizer module, etc., and provides common choices for each component and easy-to-use interface for possible extensions (see Section 4 and Fig. 4 for more details of the toolbox).
This toolbox will be open-sourced along with the benchmark to facilitate future quantization applications and research.

## 2 S1: Generalization Assessment of Quantized LLMs with Standard Setting

Figure: Figure 2: S1: evaluation of quantized LLaMA2-7B on several standard datasets. Quantization methods include GPTQ and SpQR. Quantization bits include W4A16, W3A16, and W2A16, with W16A16 used as reference. The left figure shows 5-shot results, while the right figure shows 0-shot results. Different background colors represent different task types.
Refer to caption: x2.png

To assess the difference in generalization ability, it is necessary to ensure that all other settings remain consistent except for the quantization process. To maintain consistency in the data encountered by the model before and after quantization, we strive to use calibration data during quantization that is as similar as possible to the data used during the pre-training phase of the LLM, namely the dataset C4 () derived from pre-training data. The experimental setting is consistent with the evaluation settings used previously for quantized models (; ; ; ; ). We utilize the LM Evaluation Harness () with recommended parameters to conduct zero-shot and few-shot tests on the following tasks. We provide full configurations in the *supplemental material*, as well as code that we plan to release publicly.

The 26 datasets we evaluate can be divided into nine categories:
❶common sense reasoning,
❷mathematical reasoning,
❸multi-turn dialogue reasoning,
❹bias diagnosis and mitigation,
❺scientific knowledge question answering,
❻reading comprehension,
❼natural language inference,
❽sentiment analysis, and ❾syntax phenomena evaluation.
The common sense reasoning datasets include WinoGrande (), WSC273 (), GLUE-WNLI (), HellaSwag (), SWAG (), and PIQA (). The mathematical reasoning datasets include MathQA(). The multi-turn dialogue reasoning datasets include Mutual and Mutual_Plus (). The bias diagnosis and mitigation datasets include CrowS-Pairs () and Toxigen (). The scientific knowledge question answering datasets include PubMedQA (), OpenBookQA (), SciQ (), ARC-Easy, ARC-Challenge (), and MC-TACO (). The reading comprehension datasets include RACE () and QA4MRE (). The natural language inference datasets include GLUE-MNLI, GLUE-MNLI-Mismatched, GLUE-RTE, GLUE-QNLI (), and ANLI (). The sentiment analysis dataset includes GLUE-SST (). The syntax phenomena evaluation dataset includes BLiMP ().

We present the experimental results for both the 5-shot and 0-shot scenarios in Fig. 2. It can be observed that when quantizing model weights to 3-4 bits, the performance degradation of all methods is not very pronounced. In some cases, quantizing to 4 bits even leads to higher model performance compared to full precision. However, when weights are quantized to 2 bits, GPTQ exhibits a significant performance drop on most tasks. Compared to other methods, SPQR maintains relatively good performance at 2 bits, which may be attributed to SPQR’s ability to identify and isolate outlier weights. Additionally, we found that the relative difference in performance degradation after quantization across different datasets for the same task is not significant, whereas the relative difference in performance degradation after quantization between datasets for different tasks is considerable. This suggests that the sensitivity to quantization is similar for the same tasks but varies for different tasks. For instance, in natural language inference tasks, the performance drop of quantized models is minimal across all datasets, while in scientific knowledge question answering tasks and common sense reasoning tasks, the performance drop is more significant. In the case of the 5-shot scenario, the performance degradation caused by quantization is relatively smoother compared to 0-shot scenario, especially noticeable in scientific knowledge question answering tasks. For example, on the SciQ dataset, in the 5-shot scenario, the performance of GPTQ decreases from 0.96 at 4 bits to 0.69 at 2 bits, whereas in the 0-shot scenario, it drops from 0.91 at 4 bits to 0.51.

Overall, when most methods quantize weights to 3-4 bits precision, models can still achieve performance close to that of full precision models on most tasks. This indicates that under moderate quantization, models still retain strong generalization capabilities. Additionally, different tasks exhibit varying sensitivities to quantization, with natural language inference tasks showing lower sensitivity while scientific knowledge question answering tasks and common sense reasoning tasks emerge higher sensitivity. In the 5-shot scenario, the performance degradation due to quantization is relatively smoother compared to the 0-shot scenario.

## 3 S2: Generalization Assessment of Quantized LLMs with Domain Shifts

This section investigates novel generalization scenarios in quantization, where different generalization scenarios serve as instantiations of the framework. The distribution shift we consider primarily pertains to the shift from calibration data to test data. Types of distribution shift include *cross-dataset* distribution shift and *cross-subject* distribution shift, aimed at studying the impact of distribution shift from calibration data to test data on quantized model performance. Cross-dataset distribution shift refers to using different datasets as calibration set, while cross-subject distribution shift refers to using different subjects from the same dataset as calibration set. Experiments will encompass two main categories: *English* *cross-dataset* distribution shift experiments on the out-of-distribution generalization benchmark BOSS, and *Chinese* *cross-subject* distribution shift experiments as well as *cross-dataset* distribution shift experiments on Chinese domain-specific tasks.

**Table 2: Cross-dataset distribution shift evaluation on BOSS. "Calib." represents the calibration dataset, and "Gene." represents generalization scenario. To save space, abbreviations are used for datasets. Each row presents experimental results using different datasets as calibration sets on the same test dataset. Results with colored backgrounds indicate I.I.D results, while those without color represent OOD results. The higher the metric, the better the performance. Bold results indicate the best performance on the same test dataset. Note: Some datasets could not be used as calibration sets due to insufficient memory resources.**
| Method | EQA | SA | NLI | TD |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPTQ | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. |  |  |  |  |  |  |  |  |  |  |  |
| SQ | AQA | NQA | SQA | AZ | DS | SE | SST | MN | AN | WN | CN | CC | AC | IH | TG |  |  |  |  |  |  |  |  |  |  |  |  |
| SQ | 0-shot | 4/16 | 53.84 | 52.73 | 54.69 | 57.31 | AZ | 0-shot | 4/16 | 70.81 | 17.87 | 63.18 | 72.08 | MN | 0-shot | 4/16 | 0.36 | 0.23 | 0.22 | - | CC | 0-shot | 4/16 | 23.90 | 26.96 | 52.52 | 53.32 |
| 3/16 | 45.31 | 48.86 | 49.49 | 50.79 | 3/16 | 38.06 | 0.38 | 0.26 | 0.04 | 3/16 | 0.00 | 0.00 | 0.00 | - | 3/16 | 0.60 | 2.45 | 9.70 | 10.60 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 67.04 | 65.97 | 67.06 | 68.16 | 3-shot | 4/16 | 83.69 | 56.66 | 80.79 | 82.55 | 3-shot | 4/16 | 49.69 | 32.81 | 34.93 | - | 2-shot | 4/16 | 91.80 | 87.46 | 91.71 | 91.84 |  |  |  |  |
| 3/16 | 60.76 | 58.84 | 63.34 | 63.01 | 3/16 | 74.54 | 24.86 | 59.06 | 59.79 | 3/16 | 34.12 | 31.79 | 31.82 | - | 3/16 | 89.11 | 35.94 | 91.96 | 90.35 |  |  |  |  |  |  |  |  |
| AQA | 0-shot | 4/16 | 28.00 | 27.12 | 28.40 | 30.40 | DS | 0-shot | 4/16 | 46.10 | 21.37 | 31.82 | 46.79 | AN | 0-shot | 4/16 | 1.07 | 0.52 | 0.93 | - | AC | 0-shot | 4/16 | 19.12 | 5.93 | 7.84 | 17.02 |
| 3/16 | 21.81 | 25.28 | 23.35 | 24.99 | 3/16 | 17.59 | 1.72 | 0.01 | 0.00 | 3/16 | 4.17 | 0.00 | 0.00 | - | 3/16 | 0.76 | 1.72 | 0.19 | 0.57 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 35.50 | 36.11 | 31.97 | 35.77 | 3-shot | 4/16 | 54.40 | 38.78 | 52.54 | 55.50 | 3-shot | 4/16 | 34.34 | 33.76 | 33.24 | - | 2-shot | 4/16 | 15.87 | 17.59 | 15.87 | 16.25 |  |  |  |  |
| 3/16 | 31.39 | 29.54 | 31.60 | 32.24 | 3/16 | 54.68 | 36.05 | 33.86 | 43.46 | 3/16 | 30.97 | 33.69 | 33.28 | - | 3/16 | 60.23 | 90.35 | 15.87 | 56.02 |  |  |  |  |  |  |  |  |
| NQA | 0-shot | 4/16 | 37.94 | 38.76 | 38.63 | 38.23 | SE | 0-shot | 4/16 | 18.32 | 8.21 | 15.60 | 26.43 | WN | 0-shot | 4/16 | 0.09 | 0.04 | 0.11 | - | IH | 0-shot | 4/16 | 37.37 | 22.55 | 33.90 | 40.82 |
| 3/16 | 31.36 | 33.79 | 33.37 | 34.45 | 3/16 | 4.83 | 0.09 | 0.20 | 0.01 | 3/16 | 0.49 | 0.00 | 0.00 | - | 3/16 | 11.27 | 7.32 | 4.53 | 13.18 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 48.55 | 49.30 | 49.73 | 49.09 | 3-shot | 4/16 | 42.96 | 28.55 | 42.99 | 44.75 | 3-shot | 4/16 | 41.51 | 43.34 | 47.53 | - | 2-shot | 4/16 | 62.36 | 63.46 | 62.00 | 62.29 |  |  |  |  |
| W3A16 | 44.38 | 43.35 | 46.95 | 45.61 | 3/16 | 42.36 | 22.67 | 35.54 | 29.40 | 3/16 | 38.83 | 48.09 | 48.15 | - | 3/16 | 63.52 | 90.35 | 61.83 | 61.77 |  |  |  |  |  |  |  |  |
| SQA | 0-shot | 4/16 | 42.58 | 45.72 | 46.21 | 44.20 | SST | 0-shot | 4/16 | 49.15 | 20.73 | 27.12 | 44.98 | CN | 0-shot | 4/16 | 0.06 | 0.00 | 0.00 | - | TG | 0-shot | 4/16 | 48.44 | 36.72 | 44.84 | 57.97 |
| 3/16 | 30.19 | 26.99 | 28.49 | 33.73 | 3/16 | 7.82 | 1.04 | 0.00 | 0.00 | 3/16 | 0.06 | 1.12 | 1.45 | - | 3/16 | 12.81 | 9.53 | 2.19 | 14.06 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 56.04 | 61.89 | 60.92 | 62.17 | 3-shot | 4/16 | 60.50 | 33.25 | 45.24 | 51.11 | 3-shot | 4/16 | 35.23 | 36.35 | 32.44 | - | 2-shot | 4/16 | 72.03 | 75.47 | 67.81 | 68.40 |  |  |  |  |
| 3/16 | 43.46 | 42.83 | 45.17 | 48.82 | 3/16 | 54.37 | 33.25 | 35.46 | 50.20 | 3/16 | 29.54 | 29.03 | 33.39 | - | 3/16 | 70.47 | 90.35 | 57.50 | 62.19 |  |  |  |  |  |  |  |  |
| SpQR | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. |  |  |  |  |  |  |  |  |  |  |  |
| SQ | AQA | NQA | SQA | AZ | DS | SE | SST | MN | AN | WN | CN | CC | AC | IH | TG |  |  |  |  |  |  |  |  |  |  |  |  |
| SQ | 0-shot | 4/16 | 57.03 | 49.87 | 53.00 | 54.36 | AZ | 0-shot | 4/16 | 63.34 | 62.46 | 72.52 | 83.14 | MN | 0-shot | 4/16 | 0.57 | 0.02 | 0.13 | - | CC | 0-shot | 4/16 | 61.73 | 59.48 | 58.92 | 37.48 |
| 3/16 | 52.37 | 45.90 | 54.55 | 58.36 | 3/16 | 72.38 | 55.79 | 37.28 | 27.84 | 3/16 | 0.00 | 0.01 | 0.00 | - | 3/16 | 36.90 | 2.54 | 15.42 | 22.38 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 66.45 | 66.80 | 67.41 | 67.21 | 3-shot | 4/16 | 79.65 | 69.31 | 85.44 | 82.91 | 3-shot | 4/16 | 36.19 | 40.45 | 41.62 | - | 2-shot | 4/16 | 90.65 | 89.27 | 91.74 | 84.69 |  |  |  |  |
| 3/16 | 65.12 | 65.55 | 68.65 | 66.95 | 3/16 | 83.68 | 86.30 | 72.18 | 83.50 | 3/16 | 32.39 | 40.31 | 38.47 | - | 3/16 | 87.70 | 91.76 | 86.99 | 83.56 |  |  |  |  |  |  |  |  |
| AQA | 0-shot | 4/16 | 30.59 | 25.11 | 27.60 | 29.50 | DS | 0-shot | 4/16 | 35.47 | 43.53 | 40.85 | 50.40 | AN | 0-shot | 4/16 | 0.86 | 0.07 | 0.28 | - | AC | 0-shot | 4/16 | 10.13 | 4.97 | 12.05 | 13.58 |
| 3/16 | 26.35 | 21.43 | 27.55 | 30.36 | 3/16 | 41.87 | 31.17 | 15.42 | 29.10 | 3/16 | 0.00 | 0.07 | 0.00 | - | 3/16 | 2.49 | 0.76 | 7.84 | 2.87 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 37.64 | 36.63 | 36.94 | 35.42 | 3-shot | 4/16 | 50.82 | 46.67 | 57.74 | 56.34 | 3-shot | 4/16 | 33.17 | 33.31 | 33.79 | - | 2-shot | 4/16 | 16.44 | 21.03 | 15.87 | 20.46 |  |  |  |  |
| 3/16 | 34.61 | 34.75 | 37.49 | 33.10 | 3/16 | 59.10 | 54.80 | 52.56 | 56.02 | 3/16 | 33.66 | 31.93 | 33.14 | - | 3/16 | 15.87 | 15.87 | 19.31 | 15.87 |  |  |  |  |  |  |  |  |
| NQA | 0-shot | 4/16 | 40.30 | 38.01 | 39.40 | 38.22 | SE | 0-shot | 4/16 | 14.62 | 23.36 | 19.85 | 33.24 | WN | 0-shot | 4/16 | 0.28 | 0.00 | 0.00 | - | IH | 0-shot | 4/16 | 42.21 | 41.79 | 40.12 | 31.76 |
| 3/16 | 35.79 | 33.27 | 40.80 | 38.77 | 3/16 | 16.05 | 10.22 | 4.75 | 7.30 | 3/16 | 0.00 | 0.06 | 0.00 | - | 3/16 | 31.32 | 6.78 | 17.68 | 16.96 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 49.61 | 49.12 | 49.70 | 48.47 | 3-shot | 4/16 | 44.48 | 44.15 | 44.25 | 44.39 | 3-shot | 4/16 | 43.28 | 43.77 | 41.79 | - | 2-shot | 4/16 | 64.24 | 65.85 | 62.14 | 66.07 |  |  |  |  |
| 3/16 | 48.25 | 46.61 | 48.99 | 47.79 | 3/16 | 53.16 | 43.63 | 41.76 | 44.77 | 3/16 | 39.09 | 47.32 | 40.77 | - | 3/16 | 62.95 | 63.14 | 63.17 | 64.37 |  |  |  |  |  |  |  |  |
| SQA | 0-shot | 4/16 | 46.45 | 42.62 | 44.30 | 45.10 | SST | 0-shot | 4/16 | 46.02 | 29.47 | 44.72 | 55.67 | CN | 0-shot | 4/16 | 0.00 | 0.22 | 0.45 | - | TG | 0-shot | 4/16 | 54.37 | 52.66 | 51.09 | 39.53 |
| 3/16 | 36.90 | 44.57 | 42.88 | 39.31 | 3/16 | 23.08 | 14.87 | 3.65 | 6.52 | 3/16 | 0.06 | 0.00 | 0.89 | - | 3/16 | 41.88 | 9.69 | 19.38 | 37.34 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 61.63 | 57.77 | 61.79 | 60.55 | 3-shot | 4/16 | 55.41 | 42.37 | 58.54 | 59.32 | 3-shot | 4/16 | 36.13 | 34.84 | 34.23 | - | 2-shot | 4/16 | 69.84 | 76.56 | 61.41 | 77.60 |  |  |  |  |
| 3/16 | 48.86 | 59.19 | 56.34 | 55.06 | 3/16 | 63.49 | 60.37 | 53.98 | 61.80 | 3/16 | 35.29 | 35.90 | 33.17 | - | 3/16 | 73.13 | 66.88 | 68.44 | 77.03 |  |  |  |  |  |  |  |  |
| AWQ | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. |  |  |  |  |  |  |  |  |  |  |  |
| SQ | AQA | NQA | SQA | AZ | DS | SE | SST | MN | AN | WN | CN | CC | AC | IH | TG |  |  |  |  |  |  |  |  |  |  |  |  |
| SQ | 0-shot | 4/16 | 56.73 | 55.09 | 52.09 | 50.21 | AZ | 0-shot | 4/16 | - | 5.42 | 35.23 | 33.65 | MN | 0-shot | 4/16 | 0.48 | 0.14 | 0.06 | - | CC | 0-shot | 4/16 | 50.17 | 66.60 | 42.19 | 42.11 |
| 3/16 | 48.32 | 37.95 | 44.45 | 40.30 | 3/16 | - | 39.41 | 70.10 | 35.95 | 3/16 | 0.00 | 0.01 | 0.01 | - | 3/16 | 41.96 | 39.03 | 46.95 | 14.72 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 66.57 | 66.91 | 67.02 | 66.21 | 3-shot | 4/16 | - | 83.64 | 83.73 | 78.06 | 3-shot | 4/16 | 42.20 | 38.37 | 36.05 | - | 2-shot | 4/16 | 91.84 | 91.63 | 90.80 | 89.31 |  |  |  |  |
| 3/16 | 59.81 | 61.81 | 61.27 | 61.38 | 3/16 | - | 88.73 | 90.16 | 88.92 | 3/16 | 35.44 | 34.22 | 35.34 | - | 3/16 | 36.43 | 73.04 | 90.93 | 27.24 |  |  |  |  |  |  |  |  |
| AQA | 0-shot | 4/16 | 29.73 | 29.20 | 28.34 | 27.57 | DS | 0-shot | 4/16 | - | 2.36 | 20.10 | 22.19 | AN | 0-shot | 4/16 | 0.59 | 0.07 | 0.07 | - | AC | 0-shot | 4/16 | 9.56 | 11.85 | 11.28 | 5.55 |
| 3/16 | 23.02 | 17.58 | 20.37 | 18.62 | 3/16 | - | 8.76 | 27.09 | 11.87 | 3/16 | 0.00 | 0.00 | 0.00 | - | 3/16 | 5.74 | 4.59 | 4.21 | 1.15 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 35.76 | 37.01 | 37.55 | 36.78 | 3-shot | 4/16 | - | 53.91 | 55.92 | 50.95 | 3-shot | 4/16 | 33.66 | 33.66 | 33.66 | - | 2-shot | 4/16 | 15.87 | 15.87 | 16.06 | 16.63 |  |  |  |  |
| 3/16 | 31.64 | 33.04 | 32.88 | 33.46 | 3/16 | - | 50.95 | 56.24 | 59.05 | 3/16 | 33.69 | 32.55 | 33.69 | - | 3/16 | 24.86 | 18.93 | 16.06 | 56.02 |  |  |  |  |  |  |  |  |
| NQA | 0-shot | 4/16 | 39.20 | 38.58 | 39.47 | 38.10 | SE | 0-shot | 4/16 | - | 4.19 | 18.90 | 14.96 | WN | 0-shot | 4/16 | 0.30 | 0.17 | 0.02 | - | IH | 0-shot | 4/16 | 37.59 | 44.64 | 34.09 | 27.16 |
| 3/16 | 35.75 | 31.27 | 32.91 | 33.69 | 3/16 | - | 5.52 | 14.95 | 5.49 | 3/16 | 0.00 | 0.00 | 0.00 | - | 3/16 | 20.22 | 17.97 | 25.72 | 4.73 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 43.25 | 43.18 | 43.39 | 42.56 | 3-shot | 4/16 | - | 45.03 | 45.44 | 43.77 | 3-shot | 4/16 | 40.02 | 39.40 | 38.23 | - | 2-shot | 4/16 | 62.36 | 62.46 | 65.03 | 64.67 |  |  |  |  |
| 3/16 | 41.02 | 40.50 | 41.27 | 41.26 | 3/16 | - | 38.53 | 55.02 | 44.50 | 3/16 | 37.11 | 44.38 | 37.17 | - | 3/16 | 61.85 | 63.03 | 61.88 | 61.79 |  |  |  |  |  |  |  |  |
| SQA | 0-shot | 4/16 | 43.83 | 43.07 | 44.32 | 44.20 | SST | 0-shot | 4/16 | - | 2.09 | 11.47 | 19.17 | CN | 0-shot | 4/16 | 3.35 | 1.56 | 3.41 | - | TG | 0-shot | 4/16 | 49.38 | 52.5 | 40.31 | 36.56 |
| 3/16 | 35.10 | 29.62 | 29.55 | 32.07 | 3/16 | - | 3.39 | 30.77 | 8.21 | 3/16 | 3.07 | 0.06 | 1.79 | - | 3/16 | 26.72 | 20.00 | 37.03 | 8.44 |  |  |  |  |  |  |  |  |
| 1-shot | 4/16 | 48.12 | 48.39 | 49.37 | 47.24 | 3-shot | 4/16 | - | 58.28 | 58.80 | 51.76 | 3-shot | 4/16 | 33.84 | 34.51 | 33.28 | - | 2-shot | 4/16 | 65.31 | 65.47 | 71.25 | 75.16 |  |  |  |  |
| 3/16 | 40.48 | 39.14 | 39.84 | 43.61 | 3/16 | - | 57.11 | 64.93 | 65.84 | 3/16 | 28.14 | 33.61 | 29.87 | - | 3/16 | 68.75 | 74.22 | 63.91 | 67.66 |  |  |  |  |  |  |  |  |
| SQ | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. |  |  |  |  |  |  |  |  |  |  |  |
| SQ | AQA | NQA | SQA | AZ | DS | SE | SST | MN | AN | WN | CN | CC | AC | IH | TG |  |  |  |  |  |  |  |  |  |  |  |  |
| SQ | 0-shot | 4/8 | 35.34 | 39.17 | 40.12 | 40.64 | AZ | 0-shot | 4/8 | 0.00 | 0.87 | 0.00 | 0.01 | MN | 0-shot | 4/8 | 0.01 | 0.00 | 0.00 | - | CC | 0-shot | 4/8 | 0.03 | 0.00 | 0.00 | 0.00 |
| 3/8 | 0.01 | 0.01 | 0.00 | 0.01 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.01 | 0.00 |  |  |  |  |  |  |  |  |
| 1-shot | 4/8 | 28.01 | 56.13 | 55.12 | 56.59 | 3-shot | 4/8 | 54.76 | 88.36 | 85.90 | 84.85 | 3-shot | 4/8 | 31.70 | 32.86 | 34.54 | - | 2-shot | 4/8 | 90.39 | 65.29 | 65.08 | 87.63 |  |  |  |  |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.01 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 |  |  |  |  |  |  |  |  |
| AQA | 0-shot | 4/8 | 14.22 | 18.10 | 18.18 | 18.17 | DS | 0-shot | 4/8 | 0.00 | 0.02 | 0.00 | 0.00 | AN | 0-shot | 4/8 | 0.03 | 0.00 | 0.00 | - | AC | 0-shot | 4/8 | 0.19 | 0.19 | 0.19 | 0.00 |
| 3/8 | 0.01 | 0.00 | 0.00 | 0.01 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 |  |  |  |  |  |  |  |  |
| 1-shot | 4/8 | 28.01 | 28.91 | 27.96 | 29.13 | 3-shot | 4/8 | 47.01 | 50.42 | 50.00 | 34.88 | 3-shot | 4/8 | 32.97 | 33.93 | 33.14 | - | 2-shot | 4/8 | 18.16 | 23.71 | 53.15 | 23.33 |  |  |  |  |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 |  |  |  |  |  |  |  |  |
| NQA | 0-shot | 4/8 | 24.26 | 27.83 | 23.95 | 24.07 | SE | 0-shot | 4/8 | 0.00 | 0.00 | 0.00 | 0.01 | WN | 0-shot | 4/8 | 0.00 | 0.00 | 0.00 | - | IH | 0-shot | 4/8 | 0.09 | 0.01 | 0.00 | 0.04 |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.01 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.02 | 0.00 |  |  |  |  |  |  |  |  |
| 1-shot | 4/8 | 30.69 | 32.16 | 29.83 | 33.18 | 3-shot | 4/8 | 47.03 | 34.43 | 43.43 | 34.27 | 3-shot | 4/8 | 47.32 | 46.70 | 47.15 | - | 2-shot | 4/8 | 61.87 | 60.73 | 59.28 | 57.42 |  |  |  |  |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 |  |  |  |  |  |  |  |  |
| SQA | 0-shot | 4/8 | 19.92 | 20.30 | 19.07 | 18.07 | SST | 0-shot | 4/8 | 0.00 | 0.00 | 0.00 | 0.00 | CN | 0-shot | 4/8 | 0.00 | 0.00 | 0.00 | - | TG | 0-shot | 4/8 | 0.63 | 0.00 | 0.16 | 0.00 |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.01 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.31 | 0.00 |  |  |  |  |  |  |  |  |
| 1-shot | 4/8 | 25.64 | 17.73 | 21.70 | 21.10 | 3-shot | 4/8 | 26.47 | 53.06 | 55.02 | 36.90 | 3-shot | 4/8 | 26.02 | 27.19 | 14.91 | - | 2-shot | 4/8 | 58.28 | 65.31 | 59.06 | 59.38 |  |  |  |  |
| 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 | 3/8 | 0.00 | 0.00 | 0.00 | - | 3/8 | 0.00 | 0.00 | 0.00 | 0.00 |  |  |  |  |  |  |  |  |

We evaluate *cross-dataset* distribution shift experiments on the OOD benchmark BOSS () in NLP. Previous work in NLP concerning OOD mostly considers distribution shifts from various sources, e.g. from movies to Twitter (). GLUE-X () and BOSS () represent pioneering efforts in benchmarking OOD generalization in NLP. BOSS, building upon GLUE-X, improves by employing SimCSE scores for detection analysis and identifying dataset pairs exhibiting the lowest semantic similarity. These pairs are then utilized for training and testing, constructing a benchmark consisting of five downstream tasks. Each downstream task comprises an in-domain (ID) dataset and three OOD datasets.

To evaluate the generalization ability of quantized models in cross-dataset distribution shift experiments, we randomly sample 300 samples from the test set of each OOD dataset within the BOSS benchmark as its corresponding training set, serving as the calibration set for the quantization process. For each downstream task, we utilize the training set from different datasets as the calibration set for the quantization process and test on the corresponding I.I.D and OOD test sets. In our experiments, we employ LLaMA2-7B () as the target for quantization and selected four PTQ methods: GPTQ (), AWQ (), SpQR (), and SmoothQuant (). Given that there is not much difference in performance between excessively high bits and full precision, and too low a bit has already lost basic performance in these tasks, we quantize the model weights to 3-4 bits with SmoothQuant quantizing the activations to 8 bits. We test two forms: 0-shot and few-shot.

We present the results in Tab. 2. We evaluate four downstream tasks in BOSS: EQA, SA, NLI, and TD. Each downstream task consists of four datasets, with each dataset tested using four datasets as calibration set. The following conclusions can be observed:

For datasets with poor performance or even close to zero, few-shot learning significantly improves the performance.
For the EQA task with both 4-bit and 3-bit quantization and the SA task with 4-bit quantization, where satisfactory performance can be achieved, there is a relatively slight improvement with few-shot learning compared to 0-shot. However, for the SA task with 3-bit quantization, the NLI task with both 4-bit and 3-bit quantization and the TD task with 4-bit and 3-bit quantization with poor performance, few-shot learning shows a qualitative leap compared to 0-shot. Especially on some datasets where the 0-shot performance is nearly zero, few-shot learning achieves accuracy ranging from 80% to 90%. This indicates that LLM can benefit from the examples provided to solve complex tasks, yielding significant improvements (). However, for quantized models with severe performance degradation, such as those quantized to 3 bits using SmoothQuant, few-shot learning cannot improve the quantized model’s performance.

For the same test dataset, it’s not necessarily the case that using I.I.D dataset as calibration set yield superior performance; rather, there exist one or more datasets that demonstrate enhanced performance when used as calibration set.
Across the same test dataset, the variance in performance when using different datasets as calibration set can be substantial, differing by as much as 70%. Counterintuitively, the overlap between background-colored and bolded data is not high, indicating that using I.I.D datasets as calibration sets does not necessarily result in higher performance. Instead, for each task, there are one or more datasets for which performance improves when used as the calibration set, and this characteristic is method-dependent. For EQA task, when quantized using the GPTQ and SpQR, the performance using NQA and SQA as calibration set generally exceeds that of SQ and AQA. For SA task, when quantized using the GPTQ method, performance significantly improves when using AZ and SST as calibration set compared to SE and DS. For NLI task, all methods maintain decent performance when using the MN dataset as the calibration set. For TD task, when quantified using the GPTQ method, performance consistently outperforms other datasets when TG is used as the calibration set.

**Table 3: Cross-dataset distribution shift in Chinese domain specific task. To save space, abbreviations are used for datasets. Each row presents the 0-shot and 5-shot experimental results using different datasets as calibration sets on the same test dataset. Results with colored backgrounds indicate I.I.D results, while those without color represent OOD results. The higher the metric, the better the performance. Bold results indicate the best performance on the same test dataset.**
| Method |  |  | 0-shot | 5-shot |  |  | 0-shot | 5-shot |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPTQ | Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |
| CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM |  |  |  |  |
| CE-HM | 4/16 | 39.4 | 37.9 | 53.2 | 52.1 | CM-HM | 4/16 | 50.0 | 50.7 | 59.1 | 59.1 |
| 3/16 | 30.0 | 28.0 | 38.1 | 41.9 | 3/16 | 32.3 | 30.6 | 52.4 | 54.4 |  |  |
| 2/16 | 25.1 | 24.4 | 23.9 | 23.4 | 2/16 | 25.3 | 23.7 | 25.9 | 24.4 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS |  |  |  |  |
| CE-SS | 4/16 | 36.9 | 35.4 | 58.8 | 57.5 | CM-SS | 4/16 | 53.9 | 54.0 | 63.1 | 63.8 |
| 3/16 | 34.6 | 30.3 | 51.9 | 47.5 | 3/16 | 32.8 | 34.3 | 55.4 | 54.6 |  |  |
| 2/16 | 25.1 | 23.9 | 25.9 | 24.7 | 2/16 | 25.7 | 26.2 | 25.6 | 25.3 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST |  |  |  |  |
| CE-ST | 4/16 | 30.4 | 26.0 | 41.8 | 39.2 | CM-ST | 4/16 | 39.3 | 35.2 | 43.1 | 43.8 |
| 3/16 | 28.1 | 25.7 | 33.9 | 35.5 | 3/16 | 29.9 | 25.7 | 38.6 | 37.7 |  |  |
| 2/16 | 24.6 | 25.4 | 24.5 | 25.0 | 2/16 | 26.2 | 25.7 | 24.5 | 25.2 |  |  |
| SpQR | Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |
| CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM |  |  |  |  |
| CE-HM | 4/16 | 38.5 | 36.3 | 53.8 | 52.5 | CM-HM | 4/16 | 52.9 | 49.3 | 59.0 | 59.5 |
| 3/16 | 36.0 | 34.6 | 47.9 | 46.6 | 3/16 | 49.5 | 38.1 | 57.1 | 56.9 |  |  |
| 2/16 | 30.1 | 30.9 | 37.4 | 34.5 | 2/16 | 39.3 | 26.0 | 47.5 | 46.3 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS |  |  |  |  |
| CE-SS | 4/16 | 38.2 | 38.9 | 60.0 | 57.7 | CM-SS | 4/16 | 54.8 | 54.3 | 63.8 | 64.7 |
| 3/16 | 39.8 | 34.7 | 56.1 | 53.3 | 3/16 | 52.8 | 51.1 | 59.4 | 60.2 |  |  |
| 2/16 | 30.1 | 32.1 | 39.5 | 37.3 | 2/16 | 38.8 | 39.7 | 44.2 | 47.1 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST |  |  |  |  |
| CE-ST | 4/16 | 32.2 | 30.3 | 41.5 | 41.1 | CM-ST | 4/16 | 40.4 | 39.5 | 43.7 | 43.3 |
| 3/16 | 31.1 | 28.4 | 37.5 | 37.8 | 3/16 | 37.4 | 37.8 | 40.8 | 41.4 |  |  |
| 2/16 | 27.8 | 27.7 | 32.2 | 30.6 | 2/16 | 31.8 | 31.9 | 35.9 | 35.6 |  |  |
| AWQ | Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |
| CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM |  |  |  |  |
| CE-HM | 4/16 | 36.5 | 35.6 | 47.7 | 49.0 | CM-HM | 4/16 | 47.8 | 53.2 | 58.5 | 58.2 |
| 3/16 | 26.7 | 29.7 | 41.1 | 40.8 | 3/16 | 42.6 | 50.5 | 48.0 | 49.5 |  |  |
| 2/16 | 24.2 | 24.3 | 24.0 | 23.3 | 2/16 | 25.9 | 42.4 | 25.8 | 23.4 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS |  |  |  |  |
| CE-SS | 4/16 | 32.2 | 34.9 | 57.5 | 56.7 | CM-SS | 4/16 | 51.3 | 52.4 | 62.2 | 61.4 |
| 3/16 | 32.6 | 31.5 | 42.7 | 40.5 | 3/16 | 40.1 | 42.1 | 50.5 | 50.8 |  |  |
| 2/16 | 24.8 | 25.0 | 24.9 | 25.7 | 2/16 | 24.8 | 24.9 | 24.8 | 24.7 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST |  |  |  |  |
| CE-ST | 4/16 | 26.6 | 29.4 | 39.1 | 38.6 | CM-ST | 4/16 | 36.7 | 35.3 | 41.0 | 41.6 |
| 3/16 | 26.2 | 27.1 | 31.9 | 34.0 | 3/16 | 31.7 | 31.7 | 36.3 | 35.5 |  |  |
| 2/16 | 25.1 | 24.9 | 25.7 | 25.2 | 2/16 | 24.6 | 24.6 | 24.1 | 24.5 |  |  |
| SQ | Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |
| CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM | CE-HM | CM-HM |  |  |  |  |
| CE-HM | 4/8 | 27.2 | 27.2 | 24.7 | 24.5 | CM-HM | 4/8 | 31.6 | 29.8 | 29.4 | 27.1 |
| 3/8 | 25.5 | 25.5 | 24.9 | 23.9 | 3/8 | 24.7 | 24.8 | 25.3 | 23.9 |  |  |
| 2/8 | 27.1 | 24.2 | 25.5 | 24.2 | 2/8 | 24.1 | 25.5 | 24.8 | 25.3 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS | CE-SS | CM-SS |  |  |  |  |
| CE-SS | 4/8 | 27.4 | 26.7 | 24.4 | 24.5 | CM-SS | 4/8 | 33.1 | 28.2 | 28.7 | 25.8 |
| 3/8 | 26.1 | 25.0 | 26.2 | 24.4 | 3/8 | 25.0 | 25.1 | 24.7 | 24.6 |  |  |
| 2/8 | 26.6 | 25.1 | 25.3 | 23.3 | 2/8 | 24.3 | 25.3 | 25.2 | 25.3 |  |  |
| Test | W/A | Calib. | Test | W/A | Calib. |  |  |  |  |  |  |
| CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST | CE-ST | CM-ST |  |  |  |  |
| CE-ST | 4/8 | 32.2 | 26.2 | 25.5 | 23.9 | CM-ST | 4/8 | 28.2 | 27.7 | 26.9 | 43.3 |
| 3/8 | 31.1 | 27.4 | 24.8 | 25.6 | 3/8 | 25.4 | 24.2 | 24.4 | 41.4 |  |  |
| 2/8 | 27.8 | 26.8 | 24.9 | 26.8 | 2/8 | 24.8 | 24.9 | 24.6 | 35.6 |  |  |

**Table 4: Cross-subject distribution shift in Chinese domain-specific task. To save space, abbreviations are used for datasets. Each row presents the experimental results using different datasets as calibration sets on the same test dataset. Results with colored backgrounds indicate I.I.D results, while those without color represent OOD results. The higher the metric, the better the performance. Bold results indicate the best performance on the same test set.**
| Meth. | Test | Gene. | W/A | Gene. | Test | Gene. | W/A | Gene. | Test | Gene. | W/A | Gene. |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| HM | SS | ST | HM | SS | ST | HM | SS | ST |  |  |  |  |  |  |  |  |  |  |
| GPTQ | HM | 0-shot | 4/16 | 39.4 | 36.4 | 37.6 | SS | 0-shot | 4/16 | 38.8 | 36.9 | 38.9 | ST | 0-shot | 4/16 | 30.4 | 28.4 | 30.4 |
| 3/16 | 30.0 | 30.5 | 29.2 | 3/16 | 29.6 | 34.6 | 30.4 | 3/16 | 25.9 | 28.3 | 28.1 |  |  |  |  |  |  |  |
| 2/16 | 25.1 | 24.1 | 26.2 | 2/16 | 27.3 | 25.1 | 25.2 | 2/16 | 24.9 | 24.8 | 24.6 |  |  |  |  |  |  |  |
| 5-shot | 4/16 | 53.2 | 52.9 | 52.2 | 5-shot | 4/16 | 58.9 | 58.8 | 60.1 | 5-shot | 4/16 | 40.9 | 40.4 | 41.8 |  |  |  |  |
| 3/16 | 38.1 | 43.5 | 39.9 | 3/16 | 42.5 | 51.9 | 48.2 | 3/16 | 29.7 | 34.1 | 33.9 |  |  |  |  |  |  |  |
| 2/16 | 23.9 | 26.2 | 23.7 | 2/16 | 24.3 | 25.9 | 24.6 | 2/16 | 27.3 | 25.1 | 24.5 |  |  |  |  |  |  |  |
| SpQR | HM | 0-shot | 4/16 | 38.5 | 38.0 | 40.9 | SS | 0-shot | 4/16 | 39.3 | 38.2 | 41.3 | ST | 0-shot | 4/16 | 30.3 | 29.9 | 32.2 |
| 3/16 | 36.0 | 39.0 | 38.9 | 3/16 | 34.8 | 39.8 | 39.0 | 3/16 | 30.5 | 29.1 | 31.1 |  |  |  |  |  |  |  |
| 2/16 | 30.1 | 29.9 | 29.2 | 2/16 | 28.7 | 30.1 | 30.6 | 2/16 | 26.1 | 26.6 | 27.8 |  |  |  |  |  |  |  |
| 5-shot | 4/16 | 53.8 | 51.0 | 52.6 | 5-shot | 4/16 | 59.3 | 60.0 | 59.6 | 5-shot | 4/16 | 41.4 | 41.0 | 41.5 |  |  |  |  |
| 3/16 | 47.9 | 45.8 | 46.5 | 3/16 | 52.8 | 56.1 | 53.0 | 3/16 | 36.5 | 37.6 | 37.5 |  |  |  |  |  |  |  |
| 2/16 | 37.4 | 35.0 | 37.7 | 2/16 | 40.6 | 39.5 | 45.0 | 2/16 | 28.3 | 28.0 | 32.2 |  |  |  |  |  |  |  |
| AWQ | HM | 0-shot | 4/16 | 36.5 | 34.2 | 33.4 | SS | 0-shot | 4/16 | 35.2 | 32.2 | 31.4 | ST | 0-shot | 4/16 | 28.5 | 28.5 | 26.6 |
| 3/16 | 26.7 | 32.1 | 27.5 | 3/16 | 28.3 | 32.6 | 28.2 | 3/16 | 27.7 | 28.9 | 26.2 |  |  |  |  |  |  |  |
| 2/16 | 24.2 | 24.2 | 24.6 | 2/16 | 24.9 | 24.8 | 25.2 | 2/16 | 24.9 | 24.8 | 25.1 |  |  |  |  |  |  |  |
| 5-shot | 4/16 | 47.7 | 49.7 | 51.2 | 5-shot | 4/16 | 53.4 | 57.5 | 56.6 | 5-shot | 4/16 | 37.7 | 38.5 | 39.1 |  |  |  |  |
| 3/16 | 41.1 | 38.4 | 37.4 | 3/16 | 44.0 | 42.7 | 38.7 | 3/16 | 31.9 | 31.0 | 31.9 |  |  |  |  |  |  |  |
| 2/16 | 24.0 | 24.6 | 23.8 | 2/16 | 23.9 | 24.9 | 25.1 | 2/16 | 25.2 | 25.3 | 25.7 |  |  |  |  |  |  |  |
| SQ | HM | 0-shot | 4/8 | 27.2 | 28.9 | 27.4 | SS | 0-shot | 4/8 | 28.3 | 27.4 | 28.2 | ST | 0-shot | 4/8 | 26.8 | 28.0 | 25.4 |
| 3/8 | 25.5 | 23.9 | 26.4 | 3/8 | 26.4 | 26.1 | 25.5 | 3/8 | 26.6 | 25.2 | 26.7 |  |  |  |  |  |  |  |
| 2/8 | 27.1 | 25.2 | 24.8 | 2/8 | 26.2 | 26.6 | 26.4 | 2/8 | 26.4 | 26.4 | 25.7 |  |  |  |  |  |  |  |
| 5-shot | 4/8 | 24.7 | 24.2 | 24.9 | 5-shot | 4/8 | 26.0 | 24.4 | 24.3 | 5-shot | 4/8 | 24.8 | 24.3 | 25.5 |  |  |  |  |
| 3/8 | 24.9 | 26.4 | 26.2 | 3/8 | 24.7 | 26.2 | 25.9 | 3/8 | 26.8 | 25.3 | 24.8 |  |  |  |  |  |  |  |
| 2/8 | 25.5 | 26.4 | 24.2 | 2/8 | 26.5 | 25.3 | 24.9 | 2/8 | 26.6 | 26.8 | 24.9 |  |  |  |  |  |  |  |

Chinese Domain-specific Tasks. We evaluate *cross-dataset* distribution shift experiments and *cross-subject* distribution shift experiments on the Chinese domain-specific datasets C-EVAL () and CMMLU (). C-EVAL serves as a comprehensive benchmark for evaluating Chinese LLM. It consists of 13,948 multiple-choice questions covering 52 different subjects categorized into Humanities, Social Sciences, STEM, and Other. CMMLU is another Chinese evaluation dataset designed specifically to assess the advanced knowledge and reasoning abilities of LLM in the context of the Chinese language and culture. It encompasses 67 different subjects categorized into Humanities, Social Sciences, STEM, and Chinese specific and others.

Both C-EVAL and CMMLU, two Chinese-specific domain datasets, include Humanities, Social Sciences, and STEM three subject categories. We design cross-dataset distribution shift experiments based on the same subject categories. For each subject test, we respectively utilize the corresponding subjects from C-EVAL and CMMLU as calibration set to assess the impact of different datasets as calibration set on the test results. Additionally, we conducted cross-subject distribution shift experiments on the C-EVAL dataset. For each subject test, we use Humanities, Social Sciences, and STEM as calibration set to evaluate the influence of different subject subsets as calibration set on the test results. Since both C-EVAL and CMMLU lack training datasets, we used the validation dataset of C-EVAL as the training dataset and randomly sampled 300 samples from the test dataset of CMMLU as the training dataset. We utilize the Chinese LLM Baichuan2-7B-Base () as the quantization target and selecte four PTQ methods: GPTQ (), AWQ (), SpQR (), and SmoothQuant (). We quantize the weights to 2-4 bits, with SmoothQuant quantizing the activations to 8 bits, and test both 0-shot and 5-shot forms.

The results of cross-dataset distribution shift experiments on C-EVAL and CMMLU are presented in Tab. 3. We observe that performance generally improves when using I.I.D datasets as calibration set, while performance tends to degrade when using OOD datasets as calibration set. This contrasts with our findings in OOD Benchmark BOSS, suggesting that there is not a golden dataset that consistently improves test accuracy when used as a calibration set. The inconsistency in conclusions may stem from the fact that the distribution shift experiment in this setting is slightly more challenging compared to the distribution shift experiment tested on the BOSS dataset.
The distribution differences among datasets in the BOSS benchmark are relatively small, so higher-quality datasets may result in higher accuracy for the quantized model. Additionally, the subjects included in the same subject category in C-EVAL and CMMLU are not entirely consistent, and the distribution differences within the same subject between the two datasets may be larger. In cases of greater distribution disparity, using I.I.D datasets as calibration set may lead to better performance.

The results of cross-subject distribution shift experiments on C-EVAL are presented in Tab. LABEL:tab:cds_subject. The results tend to be more random, and no conclusion can be drawn that using any particular dataset as calibration set or an I.I.D dataset as calibration set results in higher test accuracy. Cross-subject distribution shift is significantly more challenging compared to previous cross-dataset distribution shifts. This is because, in previous settings, different datasets are from the same task type or domain, whereas the cross-subject distribution shift experiments on C-EVAL directly span from one domain to another. This may cause the quantized model to fail in obtaining accurate quantization parameters from the calibration set, ultimately leading to poor performance or unpredictable results.

## 4 MI-optimize: A LLM Quantization Toolbox

Overview. MI-optimize is a versatile tool designed for the quantization and evaluation of LLMs.

Figure: Figure 3: Overview of the Quantization and Evaluation Framework.
Refer to caption: x3.png

The library’s seamless integration of various quantization methods and evaluation techniques empowers users to customize their approaches according to specific requirements and constraints, providing a high level of flexibility. Although LLMs excel in various NLP tasks, their computational and memory demands may limit their deployment in real-time applications and on resource-constrained devices. MI-optimize addresses this challenge by employing quantization techniques to compress these models, ensuring they maintain performance while remaining adaptable to a wide range of scenarios.
Fig. 3 illustrates the framework of MI-optimize, which comprises five main modules: the Configuration, Quantization, Evaluation, Inference, and Execution modules.

Experimental Setup and Results.
To validate the framework’s capability of combining mixed quantization methods, we conduct experiments using the LLaMA-2-7B model (). We test the model using SmoothQuant and a combination of SmoothQuant for activations and GPTQ for weight quantization on WikiText-2 (Wiki2) (), Penn Treebank (PTB) (), and C4 () datasets, and measure the perplexity (PPL) of the quantized models. Quantization is implemented using PyTorch. All quantization experiments are exclusively conducted on the LLaMA-2-7B model, utilizing a single NVIDIA V100 GPU. For calibration, we utilize a dataset consisting of 128 random segments, each containing 512 tokens, extract from the C4 dataset. These segments represent generic text data, sourced from randomly crawled websites, ensuring that the quantization process does not rely on task-specific information. Our quantization setup employ SmoothQuant with default activation quantization of 8 bits. We utilize groupwise quantization with a group size of 128.

**Table 5: Perplexity (PPL) of the LLaMA-2-7B model using SmoothQuant and a combination of SmoothQuant for activations and GPTQ for weight quantization on the WikiText-2 (Wiki2), Penn Treebank (PTB), and C4 datasets.**
| Method | W/A | Wiki2 | C4 | PTB |
| --- | --- | --- | --- | --- |
| Baseline | 16/16 | 5.47 | 37.92 | 7.22 |
| Smoothquant | 8/8 | 19.70 | 3026.75 | 11.27 |
| Smoothquant+GPTQ | 8/8 | 21.18 | 3110.05 | 11.27 |
| Smoothquant | 4/8 | 34.87 | 5133.82 | 20.82 |
| Smoothquant+GPTQ | 4/8 | 22.95 | 1359.59 | 13.39 |
| Smoothquant | 3/8 | 24041.06 | 42625.86 | 29585.39 |
| Smoothquant+GPTQ | 3/8 | 290.77 | - | 231.02 |

The results presented in Tab. 5 indicate several key findings. Comparing SmoothQuant with SmoothQuant + GPTQ configurations, it is evident that the latter consistently outperforms the former across all bit-width settings. This suggests that the combined use of SmoothQuant and GPTQ leads to a notable improvement in model performance. Particularly, at bit-widths of 4 and 3, the SmoothQuant + GPTQ method demonstrates a significant reduction in perplexity compared to SmoothQuant alone, indicating the pronounced effectiveness of GPTQ in reducing perplexity.

## 5 Related Work

Quantization of LLMs.
Quantization techniques for LLMs mainly include Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT). PTQ does not require retraining the model and is typically suitable for situations with limited computational resources (; ; ; ; ; ; ). QAT simulates the effects of quantization throughout the entire training process, enabling the model to adapt to low-precision representations during training, which typically leads to higher performance (; ). It’s worth noting that in this paper, we consider applying quantization directly on the pretrained LLMs instead of performing quantization-aware finetuning for the quantized LLMs (such as variants of QLoRA (; ; )) because the latter typically needs the former for initialization.

Evaluation of quantized LLMs.
Numerous studies have undertaken evaluations of the performance of quantized LLMs (; ; ; ; ; ; ; ; ; ; ). The majority of assessments employ fixed calibration set, primarily focusing on language modeling tasks (; ; ) and standard NLP tasks (; ; ; ; ; ; ). Certain investigations have deviated from the practice of using fixed calibration set, extending them to encompass a broader spectrum of crawled web text and pre-training data, while also conducting multiple random samplings for calibration set selection (). Additionally, certain studies have conducted assessments encompassing a broader array of downstream task types and datasets, approaching the evaluation from various angles (; ; ).

## 6 Conclusion

We investigated the generalization ability of quantized LLMs, proposing two evaluation scenarios and testing them on our own implemented platform.
Drawing from our evaluation results, we found some underutilized datasets that exhibit quantization performance that deviates from conventional expectations.
These findings warrant further investigation to elucidate the underlying mechanisms and optimize quantization strategies for such datasets.
Our work unveils the significant role of distribution discrepancies between calibration and test data for quantization. We uncover the existence of cross-dataset optimal calibration data for specific tasks, prompting the development of novel methods for optimizing calibration data collection, which is overlooked in the current field of model quantization. Lastly, we provided a modular and scalable toolbox to this topic to facilitate future research.

## Appendix A More Details of MI-optimize

Fig. 3 illustrates the framework of MI-optimize, which comprises five main modules: the Configuration, Quant, Evaluation, Inference, and Execution modules. Combining these modules forms a cohesive pipeline that provides researchers with a reliable experimental environment, with each module responsible for a specific step in the pipeline. The subsequent sections will provide a detailed description of the implementation of each module.

- •
Configuration Module: Manages all parameters involved in the framework, including default settings, quantization configurations, and evaluation configurations.
- •
Model Module: Contains various pre-trained models such as LLaMA [], Baichuan [], ChatGLM [], and custom user models.
- •
Dataset Module: Handles different datasets, including Chinese domain-specific datasets (e.g., C-EVAL [] and CMMLU []), the BOSS benchmark [], general datasets (e.g., Amazon reviews, Dynasent), and LM-EVAL datasets (e.g., Winogrande, WSC273).
- •
Quant Module: Responsible for loading pre-trained models, applying various quantization methods (e.g., GPTQ [], AWQ [], SPQR []), and performing the actual model quantization.
- •
Inference & Eval Module: Exports the quantized model, runs inference using engines such as VLLM [] and TensorRT, and evaluates benchmark performance.
- •
Execution Module: Oversees the primary tasks of model quantization, benchmarking, and the combined process of quantization and evaluation.

Key Features Supported by MI-optimize.

- •
Quantization of LLMs to reduce computational and memory requirements: MI-optimize focuses on reducing the computational and memory footprint of large language models through advanced quantization techniques, making them more suitable for deployment in resource-limited environments.
- •
Support for various quantization algorithms: The framework supports a wide range of quantization algorithms, including RTN, GPTQ [], AWQ [], SpQR [], ZeroQuant [], SmoothQuant [], QuIP [], and FP8. This flexibility allows users to choose the most appropriate method for their specific use case, optimizing performance and resource usage.
- •
Evaluation on OOD tasks using benchmarks: MI-optimize includes tools for evaluating quantized models on out-of-distribution (OOD) tasks using established benchmarks such as BOSS. This ensures that the models maintain their performance even when encountering data that differs from their training set.
- •
Support for multiple datasets: The framework supports multiple datasets for both calibration and testing purposes. Users can also incorporate custom datasets to better align the model’s performance with their specific requirements.
- •
Command-line interface for easy integration and automation: MI-optimize provides a command-line interface that facilitates easy integration into existing workflows and automation of the quantization and evaluation processes, streamlining the deployment pipeline.
- •
Support for combination of quantization methods: The framework allows for the combination of different quantization methods within the same model. Different layers can apply different quantization algorithms, and even multiple quantization algorithms can be applied to the same layer. This granular control helps optimize model performance and efficiency.
- •
Ease of adding new quantization algorithms: Researchers can easily add new quantization algorithms to the MI-optimize repository. This modularity ensures that the framework remains up-to-date with the latest advancements in quantization techniques.
- •
Customer tools for model quantization and evaluation: Customers can install the tools provided by MI-optimize to quantize and evaluate their own models. This empowers users to tailor the framework to their specific needs, ensuring optimal model performance in their applications.

## Appendix B Limitation and Future works

Despite comprehensive evaluation on over 50 datasets, our study acknowledges the need for a more thorough assessment of models and quantization algorithms. Future work could involve a more extensive evaluation framework. Additionally, the developed toolbox does not yet support all quantization algorithms and large models. Further development is warranted to expand its capabilities.

## Appendix C Datasets

In this section, we present all the datasets utilized in the experiments, encompassing their evaluated tasks and abilities, assessment metrics, and dataset sizes. Tab. 6 and 7 provide a comprehensive summary of all the datasets.

### C.1 Datasets in S1

Common sense reasoning. WinoGrande [] is a large-scale coreference resolution task dataset derived from extensive internet text, aimed at addressing ambiguous and complex coreference relationships. WSC273 [] comprises 273 coreference resolution problems derived from the classic Winograd Schema Challenge, primarily assessing the common-sense reasoning capabilities of natural language understanding systems. GLUE-WNLI [] is designed to test coreference resolution capability, which involves determining which noun a pronoun in a sentence refers to. It is sourced from the Winograd Schema Challenge. HellaSwag [] is generated from web videos and Wikipedia articles and is used to infer the most suitable continuation for text segments in multiple-choice tasks. SWAG [] is generated based on video descriptions, aiming to predict plausible subsequent scenarios for video events. PIQA [] is a dataset for reasoning about physical common sense, derived from physics problems and solutions, designed to evaluate algorithms’ reasoning abilities in physical environments.

Mathematical reasoning. MathQA [] is collected from the MathQA website, consisting of 37,200 mathematical questions, with the task being to automatically answer mathematical questions.

Multi-turn dialogue reasoning. MuTual [] and Mutual_plus [] is a retrieval-based dataset for multi-turn dialogue reasoning, which is modified from Chinese high school English listening comprehension test data.

Bias diagnosis and mitigation. CrowS-Pairs [] is derived from a wide range of internet text and is designed to evaluate social biases in language models. Toxigen [] is for implicit hate speech detection.

Scientific knowledge question answering. PubMedQA [] is a biomedical question answering dataset sourced from PubMed articles, aimed at evaluating systems’ understanding and answering capabilities of biomedical texts. OpenBookQA [] is a new kind of question-answering dataset modeled after open book exams for assessing human understanding of a subject. It originates from open science education resources. SciQ [] is a high-quality, science-themed multiple-choice dataset constructed manually. ARC-Easy [] originates from science exams administered in American elementary through high schools, assessing fundamental scientific knowledge. ARC-Challenge [] presents challenging scientific questions aimed at testing higher-level scientific comprehension and reasoning abilities. MC-TACO [] consists of temporal common-sense questions sourced from a wide range of internet texts, designed for temporal common-sense reasoning tasks.

Reading comprehension. RACE [] is a large-scale reading comprehension dataset sourced from English exams for Chinese middle school and high school students, aimed at testing reading comprehension abilities. QA4MRE [] is created for the CLEF 2011/2012/2013 shared tasks, aimed at testing cross-domain reading comprehension abilities.

Natural language inference. GLUE-MNLI [] is a natural language inference dataset comprising pairs of sentences sourced from various text genres such as novels, telephone conversations, and news articles. GLUE-MNLI-Mismatched [] is utilized to evaluate the generalization capability of models on unseen text genres, with sentence pairs sourced from the same origins as GLUE-MNLI. GLUE-RTE [] is sourced from news reports and Wikipedia. GLUE-QNLI [] originates from the Stanford University’s SQuAD dataset. ANLI [] is a large-scale adversarial natural language inference dataset divided into three difficulty levels. It is constructed by employing adversarial search techniques to generate challenging questions based on human annotations.

Sentiment analysis. GLUE-SST [] is sourced from movie reviews, and its task involves sentiment classification, which entails determining the emotional inclination of a sentence.

Syntax phenomena evaluation. BLiMP [] is a challenge set for evaluating what language models know about major grammatical phenomena in English. BLiMP consists of 67 sub-datasets, each containing 1000 minimal pairs isolating specific contrasts in syntax, morphology, or semantics. The data is automatically generated according to expert-crafted grammars.

### C.2 Datasets in S2

Extractive question answering in BOSS. SQuAD [] is a collection of question-answer pairs derived from Wikipedia articles. AdversarialQA [] formulates adversarial questions within the SQuAD context, utilizing a collaborative process involving both human annotators and models. NewsQA [] crafts questions based on CNN news articles, each demanding reasoning for answers, rather than relying solely on lexical overlap and textual entailment. SearchQA [] employs a reverse construction approach, utilizing the Google search engine to fetch pertinent contexts for each question-answer pair from the J!Archive website.

Sentiment analysis in BOSS. Amazon [] is a dataset comprising reviews across 29 distinct product categories from the Amazon website. DynaSent [] constructs a dataset by identifying challenging sentences from existing collections and generating adversarial counterparts through human-and-model collaborative annotation. SemEval [] offers a three-class sentiment analysis dataset centered on Twitter content. SST [] features sentence-level movie reviews sourced from the Rotten Tomatoes website.

Natural language inference in BOSS. MNLI [] offers sentence pairs across ten diverse categories of written and verbal communication, showcasing various styles, topics, and formalities. ANLI [] is an adversarial dataset created using a human-and-model-in-the-loop method, featuring premises primarily sourced from Wikipedia and hypotheses crafted by human adversaries. ContractNLI [] treats individual contracts as premises and applies a consistent set of hypotheses across the dataset. WANLI [] is generated by GPT-3, containing examples that include challenging patterns initially identified in MNLI.

Toxic detection in BOSS. Civil Comments [] features public comments from the Civil Comments platform, encompassing a diverse user base and various subtypes of toxic text. AdvCivil introduces a new toxic dataset, derived from Civil Comments through textual adversarial attacks within an automated model-in-the-loop adversarial pipeline. Implicit Hate [] includes toxic tweets that are both explicit and implicit, with the latter capable of evading keyword-based toxic detection systems. ToxiGen [] is generated by GPT-3 and contains subtly and implicitly toxic texts targeting 13 minority groups.

Chinese domain-specific. C-Eval [] is a comprehensive Chinese evaluation suite for foundation models. It consists of 13948 multi-choice questions spanning 52 diverse disciplines and four difficulty levels, primarily encompassing humanities, social sciences, STEM, and other 4 categories. CMMLU [] is a comprehensive Chinese evaluation benchmark designed specifically to assess language models’ knowledge and reasoning abilities within Chinese contexts. CMMLU covers 67 topics ranging from fundamental subjects to advanced professional levels. It encompasses topics such as STEM requiring calculation and reasoning, humanities and social sciences necessitating knowledge, and everyday knowledge such as Chinese driving rules.

**Table 6: Summary of the datasets in S1.**
| Scenario | Task&Ability | Dataset | Gene. | Metric | Size |
| --- | --- | --- | --- | --- | --- |
| S1 | Common sense reasoning | WinoGrande [] | 0/5 | Acc | 1267 |
| S1 | Common sense reasoning | WSC273 [] | 0/5 | Acc | 273 |
| S1 | Common sense reasoning | GLUE-WNLI [] | 0/5 | Acc | 71 |
| S1 | Common sense reasoning | HellaSwag [] | 0/5 | Acc | 10042 |
| S1 | Common sense reasoning | SWAG [] | 0/5 | Acc | 20006 |
| S1 | Common sense reasoning | PIQA [] | 0/5 | Acc | 1838 |
| S1 | Mathematical reasoning | MathQA [] | 0/5 | Acc | 2985 |
| S1 | Multi-turn dialogue reasoning | Mutual [] | 0/5 | R2 | 886 |
| S1 | Multi-turn dialogue reasoning | Mutual_Plus [] | 0/5 | R2 | 886 |
| S1 | Bias diagnosis and mitigation | CrowS-Pairs [] | 0 | Pct_stereotype | 6708 |
| S1 | Bias diagnosis and mitigation | Toxigen [] | 0/5 | Acc | 940 |
| S1 | Scientific knowledge question answering | PubMedQA [] | 0/5 | Acc | 1000 |
| S1 | Scientific knowledge question answering | OpenBookQA [] | 0/5 | Acc | 500 |
| S1 | Scientific knowledge question answering | SciQ [] | 0/5 | Acc | 1000 |
| S1 | Scientific knowledge question answering | ARC-Easy [] | 0/5 | Acc | 2376 |
| S1 | Scientific knowledge question answering | ARC-Challenge [] | 0/5 | Acc | 1172 |
| S1 | Scientific knowledge question answering | MC-TACO [] | 0/5 | F1 | 9442 |
| S1 | Reading comprehension | RACE [] | 0/5 | Acc | 1045 |
| S1 | Reading comprehension | QA4MRE [] | 0/5 | Acc | 564 |
| S1 | Natural language inference | GLUE-MNLI [] | 0/5 | Acc | 9815 |
| S1 | Natural language inference | GLUE-MNLI-Mismatched [] | 0/5 | Acc | 9832 |
| S1 | Natural language inference | GLUE-RTE [] | 0/5 | Acc | 277 |
| S1 | Natural language inference | GLUE-QNLI [] | 0/5 | Acc | 5463 |
| S1 | Natural language inference | ANLI [] | 0/5 | Acc | 3200 |
| S1 | Sentiment analysis | GLUE-SST [] | 0/5 | Acc | 872 |
| S1 | Syntax phenomena evaluation | BLiMP [] | 5 | Acc | 67000 |

**Table 7: Summary of the datasets in S2.**
| Scenario | Task&Ability | Dataset | Gene. | Metric | Size |
| --- | --- | --- | --- | --- | --- |
| S2 | Extractive question answering | SQuAD [] | 0/1 | F1 | 10570 |
| S2 | Extractive question answering | AdversarialQA [] | 0/1 | F1 | 2694 |
| S2 | Extractive question answering | NewsQA [] | 0/1 | F1 | 3912 |
| S2 | Extractive question answering | SearchQA [] | 0/1 | F1 | 16680 |
| S2 | Sentiment analysis | Amazon [] | 0/3 | Acc | 38905 |
| S2 | Sentiment analysis | DynaSent [] | 0/3 | Acc | 4020 |
| S2 | Sentiment analysis | SemEval [] | 0/3 | Acc | 20322 |
| S2 | Sentiment analysis | SST [] | 0/3 | Acc | 767 |
| S2 | Natural language inferenc | MNLI [] | 0/3 | Acc | 9815 |
| S2 | Natural language inferenc | ANLI [] | 0/3 | Acc | 2900 |
| S2 | Natural language inferenc | ContractNLI [] | 0/3 | Acc | 1791 |
| S2 | Natural language inferenc | WANLI [] | 0/3 | Acc | 4700 |
| S2 | Toxic detection | Civil Comments [] | 0/2 | Acc | 97320 |
| S2 | Toxic detection | AdvCivil | 0/2 | Acc | 523 |
| S2 | Toxic detection | Implicit Hate [] | 0/2 | Acc | 21180 |
| S2 | Toxic detection | ToxiGen [] | 0/2 | Acc | 641 |
| S2 | Chinese domainspecific | CEVAL [] | 0/5 | Acc | 13948 |
| S2 | Chinese domainspecific | CMMLU [] | 0/5 | Acc | 11917 |

## Appendix D Experiment Details

In this section, we will present all the details of our experiment, including hardware resources, experimental setup, hyperparameter selection, and data selection. Besides, Our benchmark suite is publicly available at [https://github.com/TsingmaoAI/MI-optimize](https://github.com/TsingmaoAI/MI-optimize).

### D.1 Hardware Resources

In our experiments, we utilize one computer with 8 AMD Aldebaran GPUs and two computers with 2 NVIDIA Tesla V100 GPUs each. Specifically, each AMD Aldebaran GPU has 64GB of memory, totaling 512GB. Each NVIDIA Tesla V100 GPU has 32GB of memory, totaling 128GB.

### D.2 Experiment Details in S1

Experimental Setup.
We quantize LLaMA2-7B [] using the GPTQ [], SpQR [] methods. We quantize the weights to 2-4 bits and test 16 bits as reference. The quantization is implemented using our custom toolbox, maintaining consistency with the original method in all experimental details.

Hyperparameter Selection.
For the GPTQ [] method, we set the group-size parameter to 128 and apply block-sequential as well as layer-sequential quantization. For the SpQR [] method, we set the group-size parameter to 128 and apply block-sequential quantization. Throughout the quantization process, we use 128 calibration examples. In the few-shot setting, the number of selected examples corresponds to LM Evaluation Harness [], remaining at 5-shot.

Data Selection.
We follow GPTQ [] and randomly sample 128 samples from C4-en-val [] as the calibration set with a random seed of 42. For the selection of test data, we use the test splits of ANLI [], ARC [], CrowSPairs [], GLUE-MNLI-Mismatched [], MathQA [], MCTACO [], OpenBookQA [], RACE [], SciQ [], Toxigen [], and WSC273 [] as the test set. We use the validation splits of GLUE-SST, GLUE-MNLI, GLUE-QNLI, GLUE-WNLI, GLUE-RTE [], HellaSwag [], Mutual [], PIQA [], SWAG [], WinoGrande [] as the test set. Additionally, we use the train splits of BLiMP [], PubMedQA [], and QA4MRE [] as the test set. For the selection of examples in the few-shot setting, we use the default setting.

### D.3 Experiment Details in S2

#### D.3.1 BOSS

Experimental Setup. We quantize LLaMA2-7B using the GPTQ [], SpQR [], awq [], and Smoothquant [] methods. We quantize the weights to 3-4 bits, and for smoothquant, we further quantize the activations to 8 bits. The quantization is implemented using our custom toolbox, maintaining consistency with the original method in all experimental details.

Hyperparameter Selection. For the GPTQ [] method, we set the group-size parameter to 128 and apply block-sequential as well as layer-sequential quantization. For the SpQR [] method, we set the group-size parameter to 128 and apply block-sequential quantization. For the AWQ [] method, we set the group-size parameter to 128. Throughout the quantization process, we use 128 calibration examples. In the few-shot setting, the number of selected examples corresponds to those in BOSS. Specifically, EQA is 1-shot, SA and NLI are 3-shot, and TD is 2-shot. The prompt template is presented in Tab. 8.

Data Selection. For the calibration set, we use 128 calibration examples. For SQuAD [] dataset in EQA, Amazon [] dataset in SA, MNLI [] dataset in NLI, and Civil Comments [] dataset in TD, as the original datasets include train and test splits, we directly select the first 128 instances from the train split as the calibration set. For the remaining datasets, given that the original datasets exclusively contain a test split, we randomly sample 300 instances from the test split to form a train split, subsequently removing the sampled data from the test split. We use the first 128 instances from the sampled train split as the calibration set. The random seed is set to 42. The code for processing the original BOSS benchmark will be placed in our GitHub repository. Concerning the selection of examples in the few-shot setting, we maintain consistency with BOSS. For datasets lacking examples, we appropriately select suitable samples from the portion of the train split not chosen as part of the calibration set. For the test data, we use the test split of each dataset as the testing dataset.

#### D.3.2 Chinese domain-specific

Experimental Setup.
We quantize Baichuan2-7B-Base [] using the GPTQ [], SpQR [], AWQ [], and Smoothquant [] methods. We quantize the weights to 3-4 bits, and for smoothquant, we further quantize the activations to 8 bits. The quantization is implemented using our custom toolbox, maintaining consistency with the original method in all experimental details. Since the test split of C-EVAL was not publicly available, we upload the test answers to the official platform to obtain the results.

Hyperparameter Selection.
For the GPTQ [] method, we set the group-size parameter to 128 and apply block-sequential as well as layer-sequential quantization. For the SpQR [] method, we set the group-size parameter to 128 and apply block-sequential quantization. For the AWQ [] method, we set the group-size parameter to 128. Throughout the quantization process, we use 128 calibration examples. In the few-shot setting, the number of selected examples corresponds to those in C-EVAL [] and CMMLU [], remaining at 5-shot.

Data Selection.
For the calibration set, we use 128 calibration examples. For C-EVAL [], we utilize its validation split as the calibration set. For CMMLU [], we randomly select 300 instances from its test split for the train split, subsequently removing the sampled data from the test split. We use the first 128 instances from the sampled train split as the calibration set. The random seed is set to 42. As for the selection of examples in the few-shot setting, we remain consistent with the official standards of C-EVAL and CMMLU. The prompt template is presented in Tab. 8.

**Table 8: Prompts for BOSS and Chinese domain-specific tasks. We maintain consistency with the official template provided by BOSS [] and C-EVAL [].**
| Task | Prompt |
| --- | --- |
| EQA | ### Instruction ###<br>Solve the extractive question answering task. Refering to the passage below and extract answer for the question. The answer should be the shortest phrase as it can be.<br>### Format ###<br>Passage: {{Passage}} // Question: {{Question}} // Answer: {{Answer}}.<br>### Input ###<br>Passage: {{input_1}} // Question: {{input_2}} // Answer: |
| SA | ### Instruction ###<br>Solve the sentiment analysis task. Options for sentiment: negative, positive, neutral.<br>### Format ###<br>Text: {{Text}} // Prediction: {{Prediction}}<br>### Input ###<br>Text: {{input}} // Prediction: |
| NLI | ### Instruction ###<br>Solve the NLI task. Options for entailment relationship: entailment, neutral, contradiction.<br>### Format ###<br>Premise: {{Premise}} // Hypothesis: {{Hypothesis}} // Prediction: {{Prediction}}<br>### Input ###<br>Premise: {{input_1}} // Hypothesis: {{input_2}} // Prediction: |
| TD | ### Instruction ###<br>Solve the toxic detection task. Options for toxicity: benign, toxic.<br>### Format ###<br>Text: {{Text}} // Prediction: {{Prediction}}<br>### Input ###<br>Text: {{input}} // Prediction: |
| CDS | {CJK}UTF8gbsn以下是中国考试的单项选择题，请选出其中的正确答案。 |

## Appendix E The Robustness of Data Selection with respect to Random Seed

In the experiments conducted in the main text, we employ a random seed for the selection of train split and calibration set. In this section, we will alter the random seed to observe the sensitivity of the experiments to the random seed.

Figure: Figure 4: S1: evaluation of quantized LLaMA2-7B on several standard datasets. Quantization methods include GPTQ. Quantization bits include W4A16, W3A16, and W2A16, with W16A16 used as reference. The left figure shows 5-shot results, while the right figure shows 0-shot results. Different background colors represent different task types. The random seed is 42.
Refer to caption: x4.png

Figure: Figure 5: S1: evaluation of quantized LLaMA2-7B retested on several standard datasets. Quantization methods include GPTQ. Quantization bits include W4A16, W3A16, and W2A16, with W16A16 used as reference. The left figure shows 5-shot results, while the right figure shows 0-shot results. Different background colors represent different task types. The random seed is 567.
Refer to caption: x5.png

In S1, we randomly sampled 128 samples from c4-en-val as the calibration set and set the random seed to 42. We then modify the random seed to 567 and retest the GPTQ [] method. The results are presented in Fig. 4 and 5. We observe that the vast majority of datasets exhibited strong robustness to the selection of the calibration set, with performance trends remaining nearly identical across different random seeds.

In Cross-dataset distribution shift evaluation on BOSS in S2, we randomly sample some examples from the test split as the train split and use them as the calibration set, setting the random seed to 42. We modify the random seed to 567 and retest the SA and NLI experiments using GPTQ [] method. We present the average results with random seeds 42 and 567 in Tab. 9. The results indicate a certain robustness of the distribution shift experiment on BOSS towards the selection of the calibration set. For SA task, performance remains consistently better when using Amazon [] as the calibration set across different random seeds, and using SemEval [] as the calibration set performs better in most cases. However, the performance has consistently been poor when using DynaSent [] as the calibration set. For NLI task, performance remains consistently better when using MNLI [] as the calibration set across different random seeds.

**Table 9: Cross-dataset distribution shift evaluation retested on Boss. The result represents the average values obtained with random seeds 42 and 567. "Calib." represents the calibration dataset, and "Gene." represents generalization scenario. To save space, abbreviations are used for datasets. Each row presents experimental results using different datasets as calibration sets on the same test dataset. The higher the metric, the better the performance. The two best performances are denoted in descending order with red and orange respectively. Note: Some datasets could not be used as calibration sets due to insufficient memory resources.**
| Method | SA | NLI |  |  |  |  |  |  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| GPTQ | Test | Gene. | W/A | Calib. | Test | Gene. | W/A | Calib. |  |  |  |  |  |
| AZ | DS | SE | SST | MN | AN | WN | CN |  |  |  |  |  |  |
| AZ | 0-shot | 4/16 | 65.84 | 46.90 | 66.49 | 53.61 | MN | 0-shot | 4/16 | 0.25 | 0.31 | 0.25 | - |
| 3/16 | 19.14 | 0.50 | 21.41 | 0.03 | 3/16 | 0.03 | 0.00 | 0.00 | - |  |  |  |  |
| 3-shot | 4/16 | 78.47 | 70.35 | 81.43 | 80.32 | 3-shot | 4/16 | 43.28 | 34.18 | 41.46 | - |  |  |
| 3/16 | 80.73 | 41.28 | 70.79 | 70.23 | 3/16 | 32.95 | 33.02 | 32.01 | - |  |  |  |  |
| DS | 0-shot | 4/16 | 41.85 | 30.55 | 40.89 | 25.15 | AN | 0-shot | 4/16 | 0.74 | 0.57 | 0.74 | - |
| 3/16 | 8.80 | 1.17 | 10.57 | 0.00 | 3/16 | 2.26 | 0.00 | 0.00 |  |  |  |  |  |
| 3-shot | 4/16 | 53.88 | 45.50 | 54.15 | 52.38 | 3-shot | 4/16 | 34.1 | 33.52 | 33.76 | - |  |  |
| 3/16 | 53.86 | 40.25 | 44.26 | 48.91 | 3/16 | 32.25 | 33.33 | 34.19 | - |  |  |  |  |
| SE | 0-shot | 4/16 | 19.97 | 14.07 | 22.08 | 14.27 | WN | 0-shot | 4/16 | 0.09 | 0.08 | 0.10 | - |
| 3/16 | 2.48 | 0.10 | 8.25 | 0.02 | 3/16 | 0.27 | 0.00 | 0.00 | - |  |  |  |  |
| 3-shot | 4/16 | 41.09 | 36.48 | 43.41 | 44.05 | 3-shot | 4/16 | 42.16 | 42.15 | 39.925 | - |  |  |
| 3/16 | 42.69 | 27.98 | 38.57 | 36.48 | 3/16 | 43.16 | 43.36 | 46.97 | - |  |  |  |  |
| SST | 0-shot | 4/16 | 44.13 | 33.505 | 37.16 | 25.56 | CN | 0-shot | 4/16 | 0.03 | 0.50 | 0.00 | - |
| 3/16 | 3.93 | 0.52 | 5.09 | 0.00 | 3/16 | 0.03 | 0.56 | 0.73 | - |  |  |  |  |
| 3-shot | 4/16 | 54.83 | 44.01 | 52.61 | 48.11 | 3-shot | 4/16 | 35.93 | 36.67 | 32.27 | - |  |  |
| 3/16 | 57.17 | 44.33 | 46.68 | 52.29 | 3/16 | 28.28 | 20.41 | 26.13 | - |  |  |  |  |

## Peer Reviews

confidence: 2
contribution: 2
initial_rating: 5
presentation: 3
questions: Did the authors experiment with different samples from the C4 dataset? 
Did authors measure variance even when using the same dataset, like C4, but with different examples? 
Understanding these aspects would provide deeper insights into the robustness and reliability of the quantization process.

In line 1249, the authors mentioned: We present the average results with random seeds 42 and 567. Why particular choose 42 and 567 as random seed? What if we use other random seeds, like 0 or 1?
soundness: 2
strengths: The authors conducted comprehensive experiments, providing meaningful results that highlight the impact of calibration data on post-training quantization accuracy.
summary: The authors proposed a benchmark for evaluating the post-training quantized large language models (LLMs) generalization ability. They considered two scenarios and utilized 40 datasets. Additionally, they released a modular-designed toolbox.
weaknesses: compared to post-training quantization, the influence of data on quantization finetuning methods, such as Q-LoRA, is more significant. This is because the calibration data for post-training quantization is limited, making the model more susceptible to overfitting and data influence in Q-LoRA. 

Regarding the accuracy numbers presented in the table, it's important to know whether they represent a single trial or are averaged across multiple trials. Quantized networks can exhibit variance, and relying on a single trial may not provide reliable guidance. It is crucial to comprehend the inherent variability of a specific PTQ method prior to drawing conclusions regarding the impact of data on quantization accuracy.

---

confidence: 5
contribution: 2
initial_rating: 3
presentation: 3
questions: 1. For W1, apart from revising their statement, the authors also need to provide a detailed description of the differences between their research and the mentioned paper. Since the objectives and main content of this work and the mentioned one are extremely similar, failing to provide clear distinctions is a significant issue.

2. For W2, in the past research, it has been proven that larger LLMs are less sensitive to quantization. Therefore, due to the time constraint of the rebuttal, there is no need to extend the experimental models to various sizes. It suffices to provide experimental data on the largest model (e.g., llama2-70B) to demonstrate that the current conclusions remain valid.

3. For W3, one of the main contributions of a benchmark is to provide guidance for future work. Therefore, the authors should offer some appropriate suggestions based on the experimental results. For example, they should recommend which dataset is best suited as a calibration set for future quantization methods to achieve optimal results. In more detail, although different calibration sets may yield varying results, a comprehensively optimal dataset should be selected for calibration.

4. The athors should further describe the definition of IID and OOD which appears abruptly. Does IID means the different or the same dataset under the same subject?


[1] Miles Williams and Nikolaos Aletras. 2024. On the Impact of Calibration Data in Post-training Quantization and Pruning. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 10100–10118, Bangkok, Thailand. Association for Computational Linguistics.
soundness: 3
strengths: 1. This paper thoroughly considers a vast array of datasets and scenarios, which make clear and effective distinctions, to support its experimental conclusions.

2. The quantization methods adopted are all currently mainstream, demonstrating the universality of the experimental discoverages.
summary: This paper delves into the impact of the calibration set on the generative capacity of quantized LLMs through extensive experiments. In addition, a novel modular-designed toolbox is proposed to decouple the model quantization pipeline into seperate components to help investigate the different modules.
weaknesses: 1. A serious issue is that the authors claim that this article is the first to study the impact of the calibration set on the generative capacity of quantized large models. However, to my knowledge, similar work has already been done previously [1]. Therefore, the authors' statement is quite inappropriate.

2. The number of LLMs using for quantizing in the experiment is too small, and their size is relatively small (7B). This limits the generality of the experimental results to a certain extent.

3. This article appears to be a superficial description and summary of experimental phenomena, lacking in-depth discussion.

---

confidence: 4
contribution: 2
initial_rating: 5
presentation: 3
questions: 1. The paper highlights task-specific sensitivities to quantization. Could the authors provide more detailed analysis or theoretical insights into why some tasks are more robust than others?
2. Given that the evaluation could potentially be performed by extending existing toolboxes, what is the necessity of developing a new quantization and evaluation framework?
soundness: 3
strengths: - **Extensive Empirical Evaluation**: The study conducts comprehensive experiments across multiple datasets and quantization methods, providing valuable insights into LLM generalization under different calibration scenarios.
- **Practical Contribution**: The proposed modular toolbox is a significant resource for the evaluation and application of quantized LLMs, potentially benefiting the broader research community.
summary: This paper explores the generalization performance of quantized LLMs and introduces a comprehensive benchmark suite alongside a modular toolbox. The study examines how calibration data distribution affects generalization, revealing two key insights:
1. Tasks exhibit varying sensitivity to quantization, with some tasks showing improved performance under low-bit quantization.
2. Consistency between calibration and test data distributions does not consistently yield optimal performance.
weaknesses: 1. **Lack of Guidance on Calibration Data Selection**: Although the paper presents intriguing findings, it does not offer concrete criteria or methods for selecting calibration data to enhance the generalization of quantized LLMs. This limits its practical impact and novelty.
2. **Visualization Issues**: 
    - Radar charts (Figures 2, 5, and 6) lack marked magnitudes for the scores on the radius, and text overlays reduce clarity.
    - The task types, while indicated by background colors, are not explicitly labeled. An additional legend would make the visualizations more intuitive.

---

confidence: 3
contribution: 2
initial_rating: 6
presentation: 3
questions: 1. Will MI continue to be developed to support new LLM quantization algorithms? 
2. L462-L464, the authors utilize a dataset consisting of 128 random segments and each containing 512 tokens. This is actually a bit odd, as 128*2048 token length calibration sets are more common. Therefore, does the size of the calibration set affect the generalization performance of the quantization model? For example, different sequence numbers (e.g. 1,16, 128, 512, 1024) and lengths (e.g. 128, 512, 1024, 2048). 
3. Similarly, the author mainly discusses the 7B-13B size model in this paper. Will the conclusion change for the 70B+ model? Intuitively, the 70B model would be more redundant and easier to quantify.
soundness: 2
strengths: 1. Very large experimental workload. The authors implemented a Python package integrating various LLM quantization models, based on which a large number of experimental results were measured. 
2. From the perspectives of IID and OOD, detailed experimental data provide useful insight into the generalization performance of quantifying LLM.
summary: This paper addresses the gap in understanding how data impacts the generalization abilities of quantized large language models (LLMs). By benchmarking with over 40 datasets and experimenting with popular LLMs, the study reveals the non-optimal performance of models quantized with calibration data matching the test data distribution. Additionally, the authors provide a modular toolbox to support future exploration into LLM quantization.
weaknesses: 1. This paper does not propose new algorithms but rather tests quantization algorithms proposed by other researchers before. Can the authors provide some more insights, such as: does the generalization performance of different quantization algorithms differ?
2. Eq1 simply uses the number of samples where the performance of the I.I.D calibration set exceeds that of the OOD to evaluate, which is actually a little crude. LLM evaluation is a dirty task, and the accuracy of only higher a little does not mean that the model is better. This will weaken the validity of the paper's conclusions. It is recommended to have some statistical technical hypotheses and tests (like the Box-and-Whisker Plot or standard deviation).

Meta-review: This paper evaluates the generalization ability of quantized LLMs through a benchmark suite, offering an evaluation system, detailed analyses, and a modular toolbox. The study examines the impact of calibration data distribution on quantized LLMs using over 40 datasets and popular LLMs like LLaMA and Baichuan.

Concerns were raised about the lack of in-depth analysis and the superficial treatment of experimental findings. The paper does not provide clear guidance on selecting calibration data to enhance generalization, limiting its practical impact. Visualization issues, such as unclear radar charts, were also noted.

The reviewers had mixed opinions, with some recognizing the potential of the work, while others were skeptical due to the lack of depth and practical implications. The paper shows promise but needs refinement, particularly in analysis depth and practical data selection guidance.

This paper received an averaged score of 4.75, which, while above the threshold, is not competitive among this year's submissions. Given the balance of strengths and weaknesses, the final recommendation is to reject this submission in its current form.

Decision: Reject