Source-linked AI summary

Debiasing Pre-trained Contextualised Embeddings

Masahiro Kaneko, Danushka Bollegala

arXiv:2101.09523v1cs.CL

TL;DR

Contextualised embeddings encode unfair biases, but methods for debiasing them remain relatively underexplored, especially because bias depends on context. The paper fine-tunes pre-trained contextualised embeddings at token or sentence level and finds that debiasing can reduce gender bias while preserving useful semantic information, with results varying across models.

  • Problem

    Contextualised embeddings encode unfair biases that can propagate to downstream NLP applications, while methods for debiasing them remain relatively underexplored and must account for context-dependent bias.

  • Method

    The paper proposes an architecture-agnostic fine-tuning method that debiases pre-trained contextualised embeddings at token or sentence level across model layers.

  • Results

    The method debiases the contextualised models evaluated while preserving useful semantic information for downstream tasks.

  • Takeaways & Limitations

    Token-level debiasing across all tokens and layers performs best, but debiasing outcomes and the accuracy–bias trade-off vary across contextualised embedding models.

  • Takeaways & Limitations

    The WNLI comparison is limited because its test set contains only 146 instances, making the observed improvement insignificant.

Abstract

from arXiv · show

In comparison to the numerous debiasing methods proposed for the static non-contextualised word embeddings, the discriminative biases in contextualised embeddings have received relatively little attention. We propose a fine-tuning method that can be applied at token- or sentence-levels to debias pre-trained contextualised embeddings. Our proposed method can be applied to any pre-trained contextualised embedding model, without requiring to retrain those models. Using gender bias as an illustrative example, we then conduct a systematic study using several state-of-the-art (SoTA) contextualised representations on multiple benchmark datasets to evaluate the level of biases encoded in different contextualised embeddings before and after debiasing using the proposed method. We find that applying token-level debiasing for all tokens and across all layers of a contextualised embedding model produces the best performance. Interestingly, we observe that there is a trade-off between creating an accurate vs. unbiased contextualised embedding model, and different contextualised embedding models respond differently to this trade-off.

1 Introduction

Contextualised embeddings are powerful but can encode unfair biases, while their layered, context-dependent structure makes debiasing difficult. The paper proposes architecture-agnostic fine-tuning of pre-trained models and evaluates it using gender bias.

  • Contextualised embeddings dynamically represent words by context but can still encode unfair biases that propagate to downstream NLP applications.
  • Debiasing contextualised embeddings is underexplored compared with the extensive work on static embeddings, including projection-based and adversarial methods.
  • Their many interconnected layers and parameters make it unclear which components encode a word’s bias, preventing direct application of standard static-embedding projection methods.
  • Bias depends jointly on the target word and its context, so effective debiasing must consider co-occurring words across contexts.
  • The proposed method fine-tunes pre-trained contextualised embeddings without retraining them, is architecture-agnostic, and can operate at token or sentence level.
  • Experiments report debiasing across compared contextualised models while preserving semantic information useful for downstream tasks, using gender bias as the running example.

2 Related Work

Prior work developed bias benchmarks and debiasing methods for static and contextualised embeddings, but existing contextualised approaches differ in applicability, training cost, and effectiveness across models.

  • Prior debiasing research separates broadly into methods for static embeddings and methods for contextualised embeddings.
  • Static-embedding approaches include projection, gender-information preservation with autoencoders, and adversarial learning with target-task and protected-attribute classifiers.
  • Static-embedding benchmarks measure associations and gender information using tests such as WEAT, WAT, and WinoBias.
  • SEAT extends WEAT to sentence templates, while other work reports contextualised-embedding bias and evaluates pronoun prediction or downstream coreference effects.
  • The proposed method considers hidden states from different layers and can calculate its debiasing loss for target words or all words in a sentence.
  • Existing contextualised methods include orthogonal projection, gender-swapped data augmentation, averaging reversed-gender embeddings, and conceptor matrices, with limitations in retraining requirements or mixed model results.

3 Debiasing Contextualised Embeddings

The method fine-tunes pre-trained contextualised embeddings to remove discriminative gender-related information while preserving useful semantics, supporting token- or sentence-level debiasing across model layers.

  • Method overview: The method fine-tunes pre-trained contextualised embeddings to remove gender-related biases while preserving semantic information.It operates in hidden layers and does not depend on a model's architecture or pre-training method.
  • Data construction: Attribute and target words are identified from sentences, with semantic information preserved for attribute-word contexts and discriminative biases removed for target-word contexts.Sentences containing multiple attribute or target words are excluded to avoid ambiguities.
  • Debiasing objective: The debiasing loss minimizes inner products between target-token embeddings and averaged attribute embeddings at each layer.The attribute embedding is computed by averaging its contextualised embeddings across sentences containing that attribute.
  • Preservation objective: A regulariser preserves useful information by penalizing squared ℓ2 distance between original and debiased contextualised embeddings.The overall objective is a linearly weighted sum of the debiasing loss and the regularisation loss.
  • Debiasing settings: The method compares debiasing only the first layer, only the last layer, or all layers, and applies the loss either to target tokens or to all sentence tokens.These choices produce six experimentally evaluated settings, including token-level and sentence-level debiasing.

4 Experiments

The experiments evaluate gender debiasing across contextualised models using SEAT, MNLI, and GLEU, comparing token- and sentence-level methods and different layer choices. All-token debiasing across all layers generally removes bias most effectively, while preserving downstream information varies by model.

  • Experimental setup: The study evaluates contextualised models on SEAT, MNLI, and GLEU, using BERT, RoBERTa, ALBERT, DistilBERT, and ELECTRA.SEAT measures gender bias; MNLI evaluates inference behavior; GLEU evaluates retention of useful information.
  • Debiasing configuration: All-token debiasing across all layers performs best overall, because biases are learned at each layer and token-level updates target the debiased word directly.Sentence-level debiasing sums losses across all sentence tokens, whereas token-level debiasing computes the loss on the target word.
  • Target selection: Careful target-word selection is essential: randomly selecting target and attribute words debiases BERT somewhat but is ineffective on other models.This indicates the method is not merely regularisation over arbitrary words.
  • Information preservation: BERT, DistilBERT, and ELECTRA retain comparable GLEU performance after debiasing, whereas RoBERTa and ALBERT lose substantial performance.The authors suspect RoBERTa and ALBERT are more sensitive to fine-tuning and defer addressing this issue to future work.
  • Downstream evaluation: The proposed method outperforms noncontextualised debiasing on MNLI neutrality measures, while MNLI performance remains comparable to the original embeddings.The comparison supports debiasing all layers rather than only BERT’s first layer.
  • Layer analysis: Across layers, first-token and last-token debiasing leave more bias than all-token debiasing, showing that selected layers are insufficient for reliably removing bias throughout the embedding.This pattern also holds for DistilBERT despite its smaller number of layers.

5 Conclusion

The proposed method debiases pre-trained contextualised word embeddings at token or sentence level while preserving useful semantic information. Experiments show it effectively reduces discriminative gender-related biases and improves downstream debiasing effectiveness over previous studies.

  • The method operates at token or sentence level to debias pre-trained contextualised word embeddings.
  • It effectively debiases discriminative gender-related biases while preserving useful semantic information in the pre-trained embeddings.
  • The reported downstream task results were more effective in debiasing than those of previous studies.
Loading 2101.09523v1…