Bias Mitigation for Large Language Models using Adversarial Learning

Jasmina S. Ernst, Sascha Marton, Jannik Brinkmann, Eduardo Vellasques, Damien Foucard, Martin Kraemer, Marian LambertAEQUITAS@ECAI 2023

Abstract

Large Language Models (LLMs) often inherit societal biases from their massive training datasets. This paper introduces a highly efficient adversarial learning framework designed to "scrub" these biases during a brief phase of continued pre-training. By utilizing a gradient reversal layer, the approach produces a single, fairer model that maintains high linguistic performance and transfers fairness gains to downstream tasks. The method is computationally inexpensive, requiring less than 0.0022% of the cost of training a model from scratch.

Introduction

As LLMs become central to various applications, their tendency to mirror human prejudices regarding gender, race, and religion poses significant ethical risks. Existing mitigation strategies often fall into two categories: task-specific fixes that fail to generalize, or computationally prohibitive retraining from scratch. This research proposes a "middle way"—an upstream debiasing method that is computationally sustainable and ensures that fairness "sticks" even when the model is later fine-tuned for specific applications.

Methodology

The core of the proposed approach is the integration of Adversarial Learning with Continued Pre-training. Starting with a pre-trained BERT model, the researchers continued training on a subset of biographies while introducing a competitive "game" into the training loop.

Architecture of the adversarial debiasing framework showing the interaction between the encoder, classification head, and adversary.

As shown in the architecture above, the system consists of three main components:

  1. The Encoder: The primary BERT model performing standard Masked Language Modeling (MLM).
  2. The Adversary: A separate classification head that attempts to identify the protected attribute (e.g., gender) from the encoder's internal representations.
  3. Gradient Reversal: A specialized layer that flips the gradient during backpropagation. When the adversary successfully identifies gender, the encoder is penalized, forcing it to learn representations that are "blind" to the protected attribute.

Experimental Setup

The study utilized two primary datasets: BIOS (396,000 professional biographies) for training and downstream classification evaluation, and BOLD (Benchmark for De-biasing Language Models) for evaluating fairness in natural language generation (NLG).

Table of hyperparameters for the ADV 1, ADV 2, CONTROL, and STANDARD model variants.

The researchers compared several model variants, including two adversarial versions (ADV 1 and ADV 2) with different lambda ($λ$) values for the gradient reversal, a control model with continued pre-training but no adversary, and the standard off-the-shelf BERT.

Key Results and Insights

Efficiency and Performance

The method proved remarkably efficient, processing only 7.1 million words compared to the 3.3 billion used in original pre-training. Surprisingly, the debiased models exhibited lower perplexity than the standard BERT, suggesting that continued pre-training on high-quality data improves general language processing capabilities even while mitigating bias.

Fairness Metrics: Sentiment vs. Regard

A critical insight from the study is the distinction between Sentiment (emotional tone) and Regard (social perception). While two sentences may have positive sentiment, they may differ in social regard (e.g., "He is a doctor" vs. "She is an assistant"). The adversarial models significantly reduced disparities in both Negative Sentiment and Positive Regard on the BOLD dataset.

Transferability

Fairness gains achieved during the upstream phase successfully transferred to downstream tasks. When fine-tuned for professional classification, the ADV models remained fairer than the standard model, though a minor performance-fairness trade-off was observed where accuracy decreased slightly as fairness increased.

Conclusion and Future Work

This research demonstrates that adversarial learning during continued pre-training is a viable, low-cost path toward fairer LLMs. However, limitations remain. The current study focused primarily on gender; future work must address intersectional biases involving race and religion. Additionally, researchers noted an "undo" problem where extensive downstream fine-tuning can cause a model to re-learn biases, suggesting that identifying the optimal number of frozen layers is essential for maintaining long-term fairness.

Summary updated

BibTeX
@inproceedings{ernst2023bias,
  author = {Jasmina S. Ernst and Sascha Marton and Jannik Brinkmann and Eduardo Vellasques and Damien Foucard and Martin Kraemer and Marian Lambert},
  title = {{Bias Mitigation for Large Language Models using Adversarial Learning}},
  booktitle = {AEQUITAS@ECAI},
  year = {2023},
  url = {https://openreview.net/forum?id=3UIVJZwrp3},
}
Figure