Large language models (LLMs) often inherit and amplify societal biases present in their training data. This paper, a collaboration between DeepMind, UCLA, and UCL, introduces a framework to quantify and mitigate "sentiment bias"—the tendency of models to generate text with varying emotional tones based on sensitive attributes like occupation or nationality.
The Problem: Sentiment Bias in LLMs
When prompted with phrases like "My friend is a baker..." versus "My friend is an accountant...", LLMs frequently alter the emotional "vibe" of the continuation. Because these models are trained on vast amounts of human-generated text, they internalize real-world prejudices.
If a model consistently generates positive continuations for one group and negative ones for another, it exhibits systematic sentiment bias. This is particularly problematic for downstream applications like dialogue agents or creative writing tools, where such biases reinforce harmful stereotypes. The core challenge lies in measuring this bias mathematically and correcting it without compromising the model's semantic understanding.
Methodology
The researchers propose a two-pronged approach involving counterfactual evaluation for measurement and a novel regularization technique for mitigation.
1. Counterfactual Evaluation
To quantify bias, the authors employ counterfactual evaluation. They take a prompt template (e.g., "The person from [Country] is..."), substitute different values for the sensitive attribute, and generate 1,000 continuations for each. These continuations are then processed by a sentiment classifier. Fairness is measured using Wasserstein-1 distance (Earth Mover's Distance) to compare the resulting sentiment distributions.
2. Sentiment Regularization
The mitigation strategy follows a three-step curriculum: standard training, training a sentiment projector on internal hidden states, and finally, fine-tuning with a specialized "fairness loss."
The authors compare two types of fairness loss:
- Embedding Regularization: Forces internal representations of different attributes to be as similar as possible. This can lead to a utility trade-off where the model loses the ability to distinguish between different concepts.
- Sentiment Regularization: A more targeted approach that only forces the sentiment-related components of the representation to be similar. This allows the model to reduce emotional bias while retaining the semantic distinctions between words.
Key Results and Insights
The study evaluated models on datasets like WMT-19 and WikiText-103, as well as the 1.5B parameter GPT-2. Key findings include:
- Effectiveness of Sentiment Regularization: Both regularization methods reduced bias, but Sentiment Regularization proved superior. It achieved significant fairness gains while maintaining much higher semantic similarity scores compared to Embedding Regularization.
- Bias in Web Data: Larger models trained on uncurated web data (like GPT-2) exhibited higher levels of bias than those trained on more curated sources like Wikipedia or news articles.
- Human Correlation: Human evaluations confirmed that models optimized for these fairness metrics were perceived as fairer and more relevant by readers.
Limitations and Future Directions
While promising, the method depends on the accuracy of the external sentiment classifier. Future work is needed to address intersectional biases (e.g., gender combined with race) and to scale these techniques to even larger models. Additionally, moving beyond fixed templates to more natural, complex prompts remains an open challenge in ensuring LLMs are truly fair in real-world deployment.
Summary updated