Understanding the Effect of Model Compression on Social Bias in Large Language Models (2023)

Abstract: Large Language Models (LLMs) trained with self-supervision on vast corpora of web text fit to the social biases of that text. Without intervention, these social biases persist in the model’s predictions in downstream tasks, leading to representational harm. Many strategies have been proposed to mitigate the effects of inappropriate social biases learned during pretraining. Simultaneously, methods for model compression have become increasingly popular to reduce the computational burden of LLMs. Despite the popularity and need for both approaches, little work has been done to explore the interplay between these two. We perform a carefully controlled study of the impact of model compression via quantization and knowledge distillation on measures of social bias in LLMs. Longer pretraining and larger models led to higher social bias, and quantization showed a regularizer effect with its best trade-off around 20% of the original pretraining time.

## introduction large language models (llms) are trained on large corpora using self-supervision, which allows models to consider vast amounts of unlabelled data, and learn language patterns through masking tasks @xcite . however, self-supervision allows llms to pick up social biases contained in the training data. which is amplified by larger models, more data, and longer training @xcite @xcite . social biases in llms are an ongoing problem that is propagated from pretraining to finetuning @xcite . biased pretrained models are hard to fix, as retraining is prohibitively expensive both financially and environmentally @xcite . at the same time, the compression of llms has been intensely studied. pruning, quantization, and distillation are among the most common strategies to compress llms. pruning reduces the parameters of a trained model by removing redundant connections while preserving equivalent performance to their original counterparts @xcite . quantization reduces the precision of model weights and activations to improve efficiency while preserving performance @xcite . finally, knowledge distillation @xcite trains a smaller more efficient model based on a larger pre-trained model. while much research has been done on measuring and mitigating social bias in llms, and making llms smaller and more efficient, by using one or a combination of many compression methods @xcite , little research has been done regarding the interplay between social biases and llm compression. existing work has shown that pruning disproportionately impacts classification accuracy on low-frequency categories in computer vision models @xcite , but that pruning transformer models can have a beneficial effect with respect to bias when modeling multilingual text @xcite . further, @xcite have shown that compressing pretrained models improves model fairness by working as a regularizer against toxicity. unlike previous work, our work focuses on the impacts of widely used quantization and distillation on the social biases exhibited by a variety of both encoder-and decoder-only llms. we focus on the effects of social bias over bert @xcite , roberta @xcite and pythia llms @xcite . we evaluate these models against bias bench @xcite , a compilation of three social bias datasets. in our experimental results we demonstrate a cor-relation between longer pretraining, larger models, and increased social bias, and show that quantization and distillation can reduce bias, demonstrating the potential for compression as a pragmatic approach for reducing social bias in llms. ## methodology we were interested in understanding how dynamic post-training quantization (ptq) and distillation influence social bias contained in llms of different sizes, and along their pretraining. in dynamic ptq, full-precision floating point model weights are statically mapped to lower precisions after training, with activations dynamically mapped from high to low precision during inference. to this end, in section 2.1 we present the datasets of the bias bench benchmark @xcite that enable us to evaluate three different language modeling tasks across the three social bias categories. in section 2.2 we lay out the models we studied. we expand on the bias bench original evaluation by looking at the large versions of the bert and roberta models, and the pythia family of autoregressive models. the chosen models cover different language modeling tasks and span across a wide range of parameter sizes, thus providing a comprehensive view of the variations of social bias. ## limitations while this work provides three different datasets, which have different views on social bias and allow for an indicative view of llms, they share some limitations that should be considered. the datasets ss and crows define an unbiased model as one that makes an equal amount of stereotypical and anti-stereotypical choices. while we agree that this makes a good definition of an impartial model it is a limited definition of an unbiased model. this has also been noted by @xcite , showing that crows is slightly more robust than ss by taking "extra steps to control for varying base rates between groups." @xcite . we should consider that these datasets depict mostly western biases, and the dataset construction since it is based on assessors it is dependent on the assessor's views. @xcite has also noted the existence of unbalanced stereotype pairs in ss and crows, and the fact that some samples in the dataset are not consensual stereotypes. all datasets only explore three groups of biases: gender, race, and religion, which are not by any means exhaustive representations of social bias. the experiments in this paper should be considered indicative of social bias and need to be further studied. additionally, the gender category is defined as binary, which we acknowledge that does not reflect the timely social needs of llms, but can be extended to include non-binary examples by improving on existing datasets. we benefited from access to a cluster with two amd epyc 7 662 64-core processors, where the quantized experiments ran for approximately 4 days. a cpu implementation was used given the quantization backends available in pytorch. experiments that did not require quantization ran using an nvidia a100 40gb gpu and took approximately 5 hours to run.