Abstract
While word-level embeddings have long been scrutinized for social biases, modern NLP has shifted toward contextualized sentence representations (like BERT and ELMo) which are harder to debias. This paper introduces SENT-DEBIAS, a post-hoc method that identifies and removes bias subspaces from sentence encoders using diverse, naturally occurring sentence templates. Our results demonstrate that SENT-DEBIAS effectively reduces gender and religious bias with minimal impact on downstream task performance across various benchmarks.
Introduction
As NLP models move from static word vectors (like GloVe) to complex, contextualized sentence encoders (like BERT), the "bias problem" has followed. These models inherit societal prejudices regarding gender, race, and religion from their training data. However, debiasing sentences is significantly harder than debiasing words due to high computational costs for retraining and the complexity of how bias manifests in full sentence structures. Existing research has measured these biases but struggled to remove them without requiring expensive retraining or losing the model's predictive power.
The SENT-DEBIAS Framework
The authors propose SENT-DEBIAS, a four-step post-hoc algorithm designed to "strip away" the bias components of a sentence representation:
- Defining Bias Attributes: The process begins with pairs or tuples of words that define a bias (e.g., man/woman for gender).
- Contextualization: Instead of just looking at the words, the method finds naturally occurring "templates" from large text corpora (like Wikipedia or Reddit). Swapping the bias words within these templates creates sets of sentences that are identical except for the bias attribute.
- Subspace Estimation: These sentences are passed through a pretrained encoder (BERT or ELMo), and Principal Component Analysis (PCA) is used to identify the "bias subspace"—the specific directions in the high-dimensional vector space corresponding to the bias.
- Debiasing (Neutralization): To debias a new sentence, its vector is projected onto this bias subspace and that projection is subtracted. This effectively "zeroes out" the bias-related information while preserving the sentence's semantic meaning.
Experimental Results and Analysis
The researchers used a variety of datasets for template generation, including WikiText-2, Reddit, and the Stanford Sentiment Treebank. Evaluation was conducted using the Sentence Encoder Association Test (SEAT) for bias measurement and tasks like SST-2 and CoLA for downstream utility.
The Importance of Domain Diversity
A key insight from the study is that using a large and diverse set of sentence templates is crucial. Simple, manual templates fail to capture the full scope of the bias subspace. As shown in the experimental data, increasing the number of domains from which templates are drawn leads to a significant reduction in the average absolute effect size of the bias.
Performance and Visualization
SENT-DEBIAS consistently reduced bias across multiple versions of BERT and ELMo. For example, SENT-DEBIAS BERT achieved a lower average absolute effect size (+0.256) compared to the original BERT (+0.354). Crucially, the "cost" of fairness was low; downstream performance drops were typically restricted to between 1% and 3%.
Visualizing the embedding space using t-SNE plots confirms these findings. After debiasing, neutral concepts (like "science" or "art") move to a position equidistant between gendered terms, whereas they were previously "tilted" toward one gender in the pretrained space.
Conclusion and Future Work
SENT-DEBIAS provides a surgical, post-hoc way to handle bias in contextualized representations. While effective, the method currently removes bias from all sentences, including those where gender may be relevant (e.g., "She gave birth to me"). Future work is needed to distinguish between neutral and inherently gendered sentences and to expand beyond binary gender to more complex intersections of identity.
Summary updated