Abstract
Detecting institutional and social bias in written records is critical for preventing real-world harms in sectors like healthcare and law. This study explores the geometric properties of text embeddings generated by various transformer models to identify racial, religious, gender, and orientation-based biases. By applying K-Nearest Neighbors (KNN) classifiers to embeddings from BERT and RoBERTa variants, the research demonstrates that compact, monolingual models like Mini BERT can achieve near-perfect classification accuracy. The results suggest that biased language forms distinct, dense clusters in high-dimensional vector space, though multilingual models struggle to maintain the same level of granularity.
Introduction
Bias in documentation—ranging from medical charts to legal proceedings—often leads to systemic inequities, such as misdiagnoses or disproportionate sentencing. While machine learning has made significant strides in identifying overt hate speech, detecting subtle institutional and implicit bias remains a complex challenge.
A primary obstacle in this field is the lack of understanding regarding how the high-dimensional "shape" or geometry of Large Language Model (LLM) embeddings influences the detection of these biases. This paper investigates the topological properties of text embeddings to determine if specific geometric structures can be leveraged for robust, automated bias identification. The ultimate goal is to provide a framework for flagging biased language, enabling targeted anti-bias training and the dismantling of institutional barriers.
Methodology
The researchers developed a multi-stage pipeline to analyze the topological characteristics of biased text, focusing on how different architectures represent social categories in vector space.
1. Text Embedding
Four distinct pre-trained transformer models were utilized to convert text samples into numerical vectors:
- Full BERT (
all-mpnet-base-v2) - Mini BERT (
all-MiniLM-L6-v2) - Full RoBERTa (
all-roberta-large-v1) - Raw RoBERTa (
xlm-roberta-base), a multilingual model.
2. Visualization and Classification
To inspect the clustering behavior of these embeddings, the team employed t-distributed Stochastic Neighbor Embedding (t-SNE) to project high-dimensional vectors into 2D space. For classification, they utilized K-Nearest Neighbors (KNN), a classifier that relies on local geometry. By testing various values of $k$ (3, 10, and 25), the researchers could determine how localized the "neighborhoods" of biased language truly are.
3. Statistical Validation
To ensure the robustness of the findings, classifiers were executed 50 times each. The results were analyzed using Bonferroni-corrected t-tests to confirm statistical significance and eliminate the possibility of performance gains due to random chance.
Data Overview
The study utilized the RedditBias dataset, a curated repository of text samples from Reddit categorized into four primary bias types: Religious, Racial, Gender, and Orientation. To address initial imbalances in the dataset—specifically a surplus of religious bias examples—the authors performed random sampling to create a balanced dataset consisting of 504 examples per category.
Results and Discussion
The experimental results provided several key insights into the relationship between model architecture and bias detection.
The Efficiency of Compact Models
Contrary to the trend of "bigger is better" in LLM development, Mini BERT emerged as a top performer. With $k=3$, it achieved a near-perfect classification score of 1.00 (0.99, 1.00). This suggests that for specialized tasks like bias detection, highly dense and compact embeddings may capture semantic nuances more effectively than the sparser representations found in larger models.
The Multilingual Penalty
The Raw RoBERTa (multilingual) model was the clear laggard, with accuracy dropping to approximately 0.87–0.88. This performance gap indicates that models trained on a vast array of languages without specific curation may lose the fine-grained linguistic distinctions necessary to identify subtle social biases in English. The "jack-of-all-trades" nature of multilingual models appears to dilute the geometric clarity of bias clusters.
Geometric Distinctness of Bias
The high performance of KNN at low $k$ values (3 and 10) indicates that biased language forms very tight, distinct clusters in vector space. As $k$ increased to 25, performance generally declined, suggesting that the geometric regions associated with specific biases are relatively small. Including too many neighbors introduces "noise" from adjacent but unrelated semantic categories.
Conclusion and Future Directions
This research confirms that the geometry of text embeddings is a powerful tool for bias detection. The study highlights that compact, monolingual models are currently the most reliable choice for identifying social biases in text.
However, limitations remain. The models were evaluated on Reddit data, where bias is often more overt than the jargon-heavy, subtle biases found in clinical or legal documentation (e.g., the use of "non-compliant" in medical notes). Future work should focus on:
- Domain Adaptation: Testing this methodology on specialized datasets from the medical and legal fields.
- Multilingual Refinement: Developing better-curated multilingual models that do not sacrifice local semantic precision.
- Long-form Analysis: Investigating how these geometric properties hold up in longer, more complex documents compared to the relatively short samples found in the RedditBias dataset.
Summary updated