Can Model Compression Improve NLP Fairness

Guangxuan Xu, Qingyuan HuarXiv 2022

Introduction

Large language models (LMs) like GPT-2 have revolutionized natural language processing, but they carry significant "ethical debt." Trained on vast, unfiltered swaths of the internet, these models frequently memorize and reproduce toxic content and social biases. While model compression is a standard technique to reduce "computational debt" for deployment on edge devices, its impact on ethical debt has remained under-explored. This research investigates whether shrinking a model through techniques like Knowledge Distillation (KD) and pruning can actually improve its fairness.

The Ethical Debt of Large Language Models

The massive size of modern LMs presents two primary challenges. First, their computational requirements make them difficult to deploy on resource-constrained devices. Second, their training data often contains harmful stereotypes and toxic language. A key question in the field is whether model compression exacerbates these biases—by forcing the model to rely on "lazy" stereotypes (the "Winner Takes It All" hypothesis)—or if it helps the model filter out noisy, toxic outliers (the "Memorization" hypothesis).

Methodology: Compressing GPT-2

The researchers evaluated two primary compression techniques applied to GPT-2:

  1. Knowledge Distillation (KD): A full-sized "teacher" model (GPT-2) trains a smaller "student" model. The student learns to replicate the teacher's output probability distributions. Six distilled versions were created, ranging from 4 to 10 decoder blocks.
  2. Attention Head Pruning: This involves identifying and masking the least significant attention heads, retaining approximately 85% of the original architecture.

Fairness was quantified using the Detoxify classifier for toxicity and specialized datasets like WinoBias for gender bias and Stereoset for broader social biases.

Key Insights: Compression as Regularization

The study's findings strongly support the Memorization Hypothesis. In generative NLP, compression appears to act as a form of regularization. By restricting the model's capacity, distillation pressures the student to retain the most general and useful linguistic features while "forgetting" the rare, toxic, and biased outliers found in the training corpus.

An important distinction was found between model size and the compression process. An ablation study using DialoGPT models trained from scratch at various sizes showed that simply being small is insufficient to reduce toxicity. The distillation process itself—learning from a teacher—is the critical driver of fairness improvements.

Experimental Results

The most striking result was the monotonic reduction in toxicity as models became smaller through distillation. As shown in the toxicity evaluation, both the raw toxic count and the cumulative toxicity score decreased significantly as the number of layers was reduced.

Toxicity count and score across different model sizes.

Similarly, gender bias measured via the WinoBias dataset consistently decreased with model size. However, results on Stereoset were less conclusive, suggesting that some forms of social bias are more deeply embedded or require more nuanced metrics.

There is, however, a performance trade-off. As models become "fairer" and smaller, their Perplexity (PPL)—a measure of predictive accuracy—increases. This indicates a tension between raw language modeling performance and social safety.

Perplexity (PPL) increases as models are compressed.

Conclusion and Future Work

This research demonstrates that model compression, specifically through knowledge distillation, offers a promising path toward more ethical AI. By acting as a regularizer, compression helps models shed toxic memorization. Future work will expand these investigations to larger architectures like GPT-3 and T5, and explore more advanced pruning techniques to further bridge the gap between efficiency and fairness.

Summary updated

BibTeX
@misc{xu2022can,
  author = {Guangxuan Xu and Qingyuan Hu},
  title = {{Can Model Compression Improve NLP Fairness}},
  year = {2022},
  eprint = {2201.08542},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.08542},
}
Figure