FairPair: A Robust Evaluation of Biases in Language Models through Paired Perturbations

Jane Dwivedi-Yu, Raaz Dwivedi, Timo Schick

Abstract

The accurate evaluation of differential treatment in language models to specific groups is critical to ensuring a positive and safe user experience. An ideal evaluation should have the properties of being robust, extendable to new groups or attributes, and being able to capture biases that appear in typical usage (rather than just extreme, rare cases). Relatedly, bias evaluation should surface not only egregious biases but also ones that are subtle and commonplace, such as a likelihood for talking about appearances with regard to women. We present FairPair, an evaluation framework for assessing differential treatment that occurs during ordinary usage. FairPair operates through counterfactual pairs, but crucially, the paired continuations are grounded in the same demographic group, which ensures equivalent comparison. Additionally, unlike prior work, our method factors in the inherent variability that comes from the generation process itself by measuring the sampling variability. We present an evaluation of several commonly used generative models and a qualitative analysis that indicates a preference for discussing family and hobbies with regard to women.

Introduction

Evaluating bias in Large Language Models (LLMs) is notoriously difficult. Existing benchmarks like CrowS-Pairs or StereoSet often rely on "extreme" or unnatural sentences (e.g., "I am a moustachioed guy") that don't reflect typical user prompts. Furthermore, these methods often fail to distinguish between a model's genuine bias and its mere familiarity with certain names or terms.

Another major hurdle is sampling variability. Because LLMs are stochastic, a single "biased" output might just be a fluke of the generation process. Current evaluations rarely account for this "noise," making it hard to tell if a model is consistently biased or just inconsistent.

The FairPair Framework

The authors introduce FairPair, which uses a "paired perturbation" approach to isolate bias. The process works as follows:

  1. Original Prompt ($x$): Start with a prompt like "John is a computer scientist."
  2. Original Generation ($g(x)$): The model generates a continuation about John.
  3. Perturbed Original ($p(g(x))$): This continuation is edited to change all references from "John/he" to "Jane/she."
  4. Perturbed Prompt ($p(x)$): A new prompt is created: "Jane is a computer scientist."
  5. Perturbation Generation ($g(p(x))$): The model generates a continuation for the Jane prompt.
The FairPair framework isolates bias by comparing a perturbed generation with a generation from a perturbed prompt, grounding both in the same demographic group.

The "FairPair" comparison happens between $p(g(x))$ and $g(p(x))$. Crucially, both are now about "Jane." This "grounding" ensures that any differences found are due to how the model thinks about Jane vs. John, rather than superficial differences in name frequency.

To handle randomness, the authors generate multiple continuations for each prompt and calculate the FairPair metric ($F$). This metric is a ratio: the measured bias divided by the sampling variability (the "noise" of the model's own inconsistency). An $F$ value significantly greater than 1 indicates that the difference in treatment is likely due to internal model bias rather than random chance.

Dataset: Common Sents

To move away from "stress-test" style benchmarks, the authors introduced Common Sents, a dataset of natural, commonplace sentences created from templates. Sentences follow the form: {Name} is a {descriptor}, working as a {occupation}. Occupations were sourced from the Winogender dataset, and descriptors (like age or eye color) came from the Holistic Bias dataset. This allows for evaluating how models behave during ordinary, everyday usage.

Key Insights

  • Grounding is Essential: By ensuring both sequences in a pair refer to the same entity, the evaluation focuses on how entities are discussed (e.g., technical skills vs. personality traits) rather than just if the model prefers one name over another.
  • Bias vs. Noise: Bias shouldn't be measured in a vacuum. If a model's "bias" between John and Jane is smaller than the difference between two random generations about John, the "bias" might just be statistical noise.
  • The "Scale" Paradox: Interestingly, larger and more "capable" models like LLaMa-13B and InstructGPT showed higher FairPair scores ($F > 1$) than smaller models. This suggests that as models become more coherent and less "noisy," their underlying social biases become more statistically significant and apparent.

Results and Analysis

The researchers evaluated six models, including GPT-2, GPT-J, LLaMa-13B, and InstructGPT, using Jaccard dissimilarity and sentiment analysis.

Density plot for InstructGPT showing the distribution of bias (B) relative to sampling variability (Vpg, Vgp).

Larger models (LLaMa, InstructGPT) showed smaller absolute bias but much higher $F$ metrics (up to 1.09 for sentiment in InstructGPT). This means their bias is very consistent and distinct from their sampling noise.

Qualitatively, the study found a clear gendered divide:

  • Male (John): Continuations focused on occupational capabilities (e.g., "responsible," "designs buildings," "debugging," "finance").
  • Female (Jane): Continuations were more diverse but leaned heavily toward family, upbringing, and personality (e.g., "traditional values," "husband," "hobbies," "loving," "kind").

Conclusion and Future Work

FairPair provides a more robust and realistic measure of differential treatment than previous benchmarks. However, it has limitations, including higher computational costs due to multiple sampling and reliance on the accuracy of the perturbation function. Future work includes extending the framework to non-binary identities and complex demographic intersections like race and age.

Summary updated

BibTeX
@inproceedings{dwivediyu2024fairpair,
  author = {Jane Dwivedi-Yu and Raaz Dwivedi and Timo Schick},
  title = {{FairPair: A Robust Evaluation of Biases in Language Models through Paired Perturbations}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2024},
}
Figure