Semantic Properties of cosine based bias scores for word embeddings

Sarah Schröder, Alexander Schulz, Fabian Hinder, Barbara Hammer · DOI

Abstract

Plenty of works have brought social biases in language models to attention and proposed methods to detect such biases. As a result, the literature contains a great deal of different bias tests and scores, each introduced with the premise to uncover yet more biases that other scores fail to detect. What severely lacks in the literature, however, are comparative studies that analyse such bias scores and help researchers to understand the benefits or limitations of the existing methods. In this work, we aim to close this gap for cosine based bias scores. By building on a geometric definition of bias, we propose requirements for bias scores to be considered meaningful for quantifying biases. Furthermore, we formally analyze cosine based scores from the literature with regard to these requirements. We underline these findings with experiments to show that the bias scores' limitations have an impact in the application case.

Introduction

As Large Language Models (LLMs) become ubiquitous in modern technology, the research community has focused heavily on measuring the social biases—such as gender or racial stereotypes—embedded within their word representations. This has led to a proliferation of metrics, yet few have undergone rigorous mathematical scrutiny. This paper provides a necessary "sanity check" for these metrics, formalizing the requirements for any bias score to be considered mathematically sound for quantifying and comparing bias across different models.

Formalizing Bias Measurement

To evaluate existing metrics, the authors propose two essential geometric requirements:

  1. Trustworthiness: A bias score is considered trustworthy only if it reports a "zero" value when target words are truly equidistant from all protected groups. A metric that fails this requirement might "miss" existing bias or report bias where none exists due to its mathematical structure.
  2. Magnitude-Comparability: For a score to be useful in comparing different models, its maximum and minimum possible values must be independent of the specific words used to define a group (e.g., comparing "man/woman" vs. "king/queen"). Without this, a higher score in Model A compared to Model B might be an artifact of the word choice rather than a reflection of actual bias levels.

Analysis of Industry Standards

The researchers applied these requirements to two of the most prominent metrics in the field: the Word Embedding Association Test (WEAT) effect size and Direct Bias (a PCA-based method).

The WEAT Variance Trap

The analysis reveals that the WEAT effect size is highly sensitive to the internal variance of associations. Mathematically, it is possible for a model to receive a lower bias score even when groups are more distinctly separated, simply because the internal spread of the words changed. This makes WEAT an unreliable tool for ranking models by their relative fairness.

The PCA Flaw in Direct Bias

Direct Bias relies on Principal Component Analysis (PCA) to identify a "bias direction" in the vector space. The authors prove that this method is vulnerable to outliers; just one or two atypical word pairs can hijack the identified direction. This can cause the metric to overlook blatant bias in other directions or report massive bias based on a few unrepresentative data points.

The Scaling Problem

A significant hurdle in bias research is that different models represent the "distance" between concepts on vastly different scales. For instance, the average distance between male and female attributes in XLNet is nearly 26 times larger than in DistilRoBERTa. Because current raw bias scores are not normalized against these scaling differences, comparing a raw score from one model to another is fundamentally flawed—akin to comparing temperatures in different units without a conversion formula.

Experimental Results

The authors validated their theoretical proofs using a suite of models, including BERT, GPT-2, RoBERTa, and XLNet. Their findings are summarized in a "Failure Matrix," which categorizes the shortcomings of current metrics:

  • WEAT Sample Score: Trustworthy but not comparable.
  • WEAT Effect Size: Comparable in theory but not trustworthy (can report zero bias in biased models).
  • Direct Bias: Comparable in theory but not trustworthy.

In practical tests with distilBERT, the researchers demonstrated that target words with higher stereotypical clustering actually produced a lower effect size than less clustered sets, confirming that these metrics can be counter-intuitive in real-world applications.

Conclusion

While this work does not propose a single "perfect" metric, it establishes a rigorous framework for validating future fairness evaluations. The findings suggest that the current "Wild West" of bias metrics is built on shaky mathematical ground. Future research must focus on developing magnitude-comparable versions of these tests that account for the varying scales of different embedding spaces to ensure that our measurements of AI fairness are both accurate and actionable.

Summary updated

BibTeX
@inproceedings{schroder2024semantic,
  author = {Sarah Schröder and Alexander Schulz and Fabian Hinder and Barbara Hammer},
  title = {{Semantic Properties of cosine based bias scores for word embeddings}},
  booktitle = {ICPRAM},
  year = {2024},
  url = {https://openreview.net/forum?id=8V3akRdal1},
}

Loading related content...

Figure