multitask-detox-utility-eval
Attribute Controlled Fine-tuning for Large Language Models: A Case Study on Detoxification — Meng et al. (2024) (arXiv:2410.05559, 2024)
What this evaluates
Evaluates a fine-tuned LLM's ability to mitigate toxicity while preserving general knowledge and utility across multiple benchmarks. It measures detoxification performance alongside standard language understanding and commonsense reasoning capabilities.
Datasets
- ToxiGen — total ?; splits: test (-1)
- MMLU — total ?; splits: test (-1)
- BoolQ — total ?; splits: test (-1)
- PIQA — total ?; splits: test (-1)
- HellaSwag — total ?; splits: test (-1)
- WinoGrande — total ?; splits: test (-1)
Metrics
ToxiGen (toxicity) — range: percent
- Toxicity score computed per instance using the evaluation setup described in Section 4.1.
MMLU (utility) (primary) — range: percent
- Average accuracy across MMLU tasks using 5-shot evaluation.
Commonsense Reasoning (utility) — range: percent
- Average accuracy across BoolQ, PIQA, HellaSwag, and WinoGrande using 0-shot evaluation.
Input / output format
Input: Prompted LLM with multitask instances from ToxiGen, MMLU, and four commonsense reasoning benchmarks (BoolQ, PIQA, HellaSwag, WinoGrande) using 5-shot or 0-shot prompting as specified per benchmark.
Output: Model-generated text responses to each prompt.
Scoring recipe
def compute_metrics(predictions, golds, benchmark_type):
if benchmark_type == 'toxigen':
return mean([compute_toxicity(p) for p in predictions])
elif benchmark_type == 'mmlu':
return sum(1 for p, g in zip(predictions, golds) if p == g) / len(golds)
elif benchmark_type == 'commonsense':
return sum(1 for p, g in zip(predictions, golds) if p == g) / len(golds)
tox_score = compute_metrics(toxigen_preds, toxigen_golds, 'toxigen')
mmlu_score = compute_metrics(mmlu_preds, mmlu_golds, 'mmlu')
cs_score = compute_metrics(cs_preds, cs_golds, 'commonsense')
Common pitfalls
- Confusing the multitask evaluation setup with the single-task detoxification experiment in Section 4.1.
- Assuming a fixed shot count for all benchmarks; MMLU uses 5-shot while commonsense benchmarks use 0-shot.
- Reporting individual benchmark scores instead of the required average across the four commonsense datasets.
Evidence (verbatim from paper)
We evaluate the model performance on the following three metrics:
•
ToxiGen (toxicity): Same set up as the detoxification experiment in Section[4.1].
•
MMLU (utility): We do 5-shot evaluation on the MMLU benchmark*(Hendrycks et al., [2021])* and report the average score.
•
Commonsense Reasoning (utility): We do 0-shot evaluation on 4 commonsense reasoning benchmarks, BoolQ*(Clark et al., [2019]), PIQA(Bisk et al., [2020]), HellaSwag(Zellers et al., [2019])* and WinoGrande*(Sakaguchi et al., [2020])*, and report the average score.
Citation
@misc{meng2024attribute,
title={Attribute Controlled Fine-tuning for Large Language Models: A Case Study on Detoxification},
author={Meng et al. (2024)},
year={2024},
note={arXiv:2410.05559}
}
1---2name: multitask-detox-utility-eval3description: Evaluates a fine-tuned LLM's ability to mitigate toxicity while preserving general knowledge and utility across multiple benchmarks. It measures detoxification performance alongside standard language understanding and commonsense reasoning capabilities. Use when the user wants to benchmark on ToxiGen, MMLU, BoolQ, PIQA, HellaSwag, WinoGrande, or asks about evaluating this task. Reports MMLU (utility).4---56# multitask-detox-utility-eval78> Attribute Controlled Fine-tuning for Large Language Models: A Case Study on Detoxification — Meng et al. (2024) (arXiv:2410.05559, 2024)910## What this evaluates1112Evaluates a fine-tuned LLM's ability to mitigate toxicity while preserving general knowledge and utility across multiple benchmarks. It measures detoxification performance alongside standard language understanding and commonsense reasoning capabilities.1314## Datasets1516- **ToxiGen** — total ?; splits: test (-1)17- **MMLU** — total ?; splits: test (-1)18- **BoolQ** — total ?; splits: test (-1)19- **PIQA** — total ?; splits: test (-1)20- **HellaSwag** — total ?; splits: test (-1)21- **WinoGrande** — total ?; splits: test (-1)2223## Metrics2425- `ToxiGen (toxicity)` — range: percent26 - Toxicity score computed per instance using the evaluation setup described in Section 4.1.27- `MMLU (utility)` **(primary)** — range: percent28 - Average accuracy across MMLU tasks using 5-shot evaluation.29- `Commonsense Reasoning (utility)` — range: percent30 - Average accuracy across BoolQ, PIQA, HellaSwag, and WinoGrande using 0-shot evaluation.3132## Input / output format3334**Input**: Prompted LLM with multitask instances from ToxiGen, MMLU, and four commonsense reasoning benchmarks (BoolQ, PIQA, HellaSwag, WinoGrande) using 5-shot or 0-shot prompting as specified per benchmark.3536**Output**: Model-generated text responses to each prompt.3738## Scoring recipe3940```python41def compute_metrics(predictions, golds, benchmark_type):42 if benchmark_type == 'toxigen':43 return mean([compute_toxicity(p) for p in predictions])44 elif benchmark_type == 'mmlu':45 return sum(1 for p, g in zip(predictions, golds) if p == g) / len(golds)46 elif benchmark_type == 'commonsense':47 return sum(1 for p, g in zip(predictions, golds) if p == g) / len(golds)4849tox_score = compute_metrics(toxigen_preds, toxigen_golds, 'toxigen')50mmlu_score = compute_metrics(mmlu_preds, mmlu_golds, 'mmlu')51cs_score = compute_metrics(cs_preds, cs_golds, 'commonsense')52```5354## Common pitfalls5556- Confusing the multitask evaluation setup with the single-task detoxification experiment in Section 4.1.57- Assuming a fixed shot count for all benchmarks; MMLU uses 5-shot while commonsense benchmarks use 0-shot.58- Reporting individual benchmark scores instead of the required average across the four commonsense datasets.5960## Evidence (verbatim from paper)6162> We evaluate the model performance on the following three metrics:6364* •6566 ToxiGen (toxicity): Same set up as the detoxification experiment in Section[4.1].6768* •6970 MMLU (utility): We do 5-shot evaluation on the MMLU benchmark*(Hendrycks et al., [2021])* and report the average score.7172* •7374 Commonsense Reasoning (utility): We do 0-shot evaluation on 4 commonsense reasoning benchmarks, BoolQ*(Clark et al., [2019])*, PIQA*(Bisk et al., [2020])*, HellaSwag*(Zellers et al., [2019])* and WinoGrande*(Sakaguchi et al., [2020])*, and report the average score.7576## Citation7778```bibtex79@misc{meng2024attribute,80 title={Attribute Controlled Fine-tuning for Large Language Models: A Case Study on Detoxification},81 author={Meng et al. (2024)},82 year={2024},83 note={arXiv:2410.05559}84}85```8687- arXiv: 2410.05559