glue-lm-eval
Zero-Shot Sharpness-Aware Quantization for Pre-trained Language Models — Zhu et al. (2023) (arXiv:2310.13315, 2023)
What this evaluates
Evaluates the quantization performance of pre-trained language models (both discriminative BERT-style and generative GPT-style) across standard NLP classification, regression, and language modeling tasks under data-free zero-shot quantization settings.
Datasets
- GLUE — total ?; splits: dev (-1)
- WikiText2 — total ?; splits: test (-1)
- Penn Treebank (PTB) — total ?; splits: test (-1)
- WikiText103 — total ?; splits: test (-1)
Metrics
Accuracy (Acc.) — range: [0, 1]
- Fraction of correctly predicted class labels.
Pearson correlation (Pear.) — range: [-1, 1]
- Pearson correlation coefficient between predicted and ground-truth continuous scores.
Matthew correlation (Mcc.) — range: [-1, 1]
- Matthews correlation coefficient for binary classification tasks.
Perplexity (PPL) — range: [0, inf)
- Exponential of the average negative log-likelihood of the ground-truth tokens.
GLUE Avg. (primary) — range: [0, 1]
- Average of task-specific metrics (Acc., Pear., Mcc.) across all GLUE sub-tasks.
Input / output format
Input: Tokenized text sequences for classification/regression tasks; raw text for language modeling tasks.
Output: Class labels or probability distributions for classification; continuous scores for regression; next-token log-probabilities for language modeling.
Scoring recipe
def compute_metrics(predictions, golds, task_type):
if task_type == 'classification':
return np.mean(predictions == golds)
elif task_type == 'regression':
return pearsonr(golds, predictions)[0]
elif task_type == 'binary':
return matthews_corrcoef(golds, predictions)
elif task_type == 'lm':
return np.exp(-np.mean(np.log(predictions + 1e-9)))
Common pitfalls
- Task-specific metrics must be applied correctly (e.g., Mcc. for CoLA, Pear. for STS-B, not Accuracy).
- All reported results are averaged over 5 random seeds to mitigate stochasticity.
- The 'WxAy' notation denotes weight and activation bit-widths respectively, not just weight quantization.
- The method is data-free/zero-shot for quantization; only the teacher model is fine-tuned on task data.
Evidence (verbatim from paper)
For evaluation, we report the performance with Accuracy ("Acc.") metric for most tasks, except the Pearson correlation ("Pear:") for STS-B, the Matthew correlation ("Mcc.") for CoLA, the perplexity (PPL) score for language modeling tasks. We report the averaged results over 5 random seeds to avoid stochasticity.
Citation
@misc{zhu2023zeroshotsharpnessawarequantization,
title={Zero-Shot Sharpness-Aware Quantization for Pre-trained Language Models},
author={Zhu et al. (2023)},
year={2023},
note={arXiv:2310.13315}
}
1---2name: glue-lm-eval3description: Evaluates the quantization performance of pre-trained language models (both discriminative BERT-style and generative GPT-style) across standard NLP classification, regression, and language modeling tasks under data-free zero-shot quantization settings. Use when the user wants to benchmark on GLUE, WikiText2, Penn Treebank (PTB), WikiText103, or asks about evaluating this task. Reports GLUE Avg..4metadata:5 source: https://skillmd.com/skills/qhjqhj00/glue-lm-eval6 skill_kind: dataset_eval7 source_arxiv: 2310.133158 bibtex_key: zhu2023zeroshotsharpnessawarequantization9 confidence: high10---1112# glue-lm-eval1314> Zero-Shot Sharpness-Aware Quantization for Pre-trained Language Models — Zhu et al. (2023) (arXiv:2310.13315, 2023)1516## What this evaluates1718Evaluates the quantization performance of pre-trained language models (both discriminative BERT-style and generative GPT-style) across standard NLP classification, regression, and language modeling tasks under data-free zero-shot quantization settings.1920## Datasets2122- **GLUE** — total ?; splits: dev (-1)23- **WikiText2** — total ?; splits: test (-1)24- **Penn Treebank (PTB)** — total ?; splits: test (-1)25- **WikiText103** — total ?; splits: test (-1)2627## Metrics2829- `Accuracy (Acc.)` — range: [0, 1]30 - Fraction of correctly predicted class labels.31- `Pearson correlation (Pear.)` — range: [-1, 1]32 - Pearson correlation coefficient between predicted and ground-truth continuous scores.33- `Matthew correlation (Mcc.)` — range: [-1, 1]34 - Matthews correlation coefficient for binary classification tasks.35- `Perplexity (PPL)` — range: [0, inf)36 - Exponential of the average negative log-likelihood of the ground-truth tokens.37- `GLUE Avg.` **(primary)** — range: [0, 1]38 - Average of task-specific metrics (Acc., Pear., Mcc.) across all GLUE sub-tasks.3940## Input / output format4142**Input**: Tokenized text sequences for classification/regression tasks; raw text for language modeling tasks.4344**Output**: Class labels or probability distributions for classification; continuous scores for regression; next-token log-probabilities for language modeling.4546## Scoring recipe4748```python49def compute_metrics(predictions, golds, task_type):50 if task_type == 'classification':51 return np.mean(predictions == golds)52 elif task_type == 'regression':53 return pearsonr(golds, predictions)[0]54 elif task_type == 'binary':55 return matthews_corrcoef(golds, predictions)56 elif task_type == 'lm':57 return np.exp(-np.mean(np.log(predictions + 1e-9)))58```5960## Common pitfalls6162- Task-specific metrics must be applied correctly (e.g., Mcc. for CoLA, Pear. for STS-B, not Accuracy).63- All reported results are averaged over 5 random seeds to mitigate stochasticity.64- The 'WxAy' notation denotes weight and activation bit-widths respectively, not just weight quantization.65- The method is data-free/zero-shot for quantization; only the teacher model is fine-tuned on task data.6667## Evidence (verbatim from paper)6869> For evaluation, we report the performance with Accuracy ("Acc.") metric for most tasks, except the Pearson correlation ("Pear:") for STS-B, the Matthew correlation ("Mcc.") for CoLA, the perplexity (PPL) score for language modeling tasks. We report the averaged results over 5 random seeds to avoid stochasticity.7071## Citation7273```bibtex74@misc{zhu2023zeroshotsharpnessawarequantization,75 title={Zero-Shot Sharpness-Aware Quantization for Pre-trained Language Models},76 author={Zhu et al. (2023)},77 year={2023},78 note={arXiv:2310.13315}79}80```8182- arXiv: 2310.13315