What is in a name? Mitigating Name Bias in Text Embeddings via Anonymization

Sahil Manchanda, Pannaga ShivaswamyarXiv 2025 · DOI

Abstract

Text embedding models are fundamental to modern semantic search and information retrieval. However, these models often suffer from a significant "name bias," where identity-specific information like character names is prioritized over the actual semantic meaning or plot of the text. This paper demonstrates that such bias is pervasive across both open-source and proprietary models. We propose a simple, training-free mitigation strategy: anonymizing text during inference by removing proper nouns. Our results show that this approach dramatically improves a model's ability to capture true thematic similarity, leading to substantial gains in performance on semantic tasks without requiring costly retraining.

The Problem: Identity Over Semantics

When utilizing state-of-the-art embedding models, such as OpenAI's text-embedding-3-small or HuggingFace's all-MiniLM-L6-v2, the expectation is that they capture the underlying theme or intent of a sentence. However, research reveals that these models are easily distracted by "identity-specific information."

Consider the following three stories:

  1. Story 1: Alejandro gently examined the injured bird. He gave it food.
  2. Story 2: Jelani tenderly inspected the wounded bird and gave it a meal to eat.
  3. Story 3: Alejandro tracked the injured bird. He used it as his food.

Thematically, Story 1 and Story 2 are nearly identical (rescuing a bird), while Story 3 is the opposite (hunting a bird). Ideally, a model should find Story 1 and 2 highly similar. Instead, many models rate Story 1 and 3 as more similar simply because they share the name "Alejandro."

Table 1: Example stories illustrating thematic vs. identity-based similarity.

This "name bias" has serious implications for applications like plagiarism detection and semantic search, where a model might incorrectly surface documents based on shared names rather than relevant content.

Methodology

The authors employed a two-pronged approach to address this issue:

1. Benchmarking via Perturbation

To quantify bias, the researchers developed a "Perturb Text" algorithm. They took a base text and generated 20 variants by systematically replacing person and country names with random alternatives while keeping the narrative structure intact. In an unbiased model, the cosine similarity between these variants should ideally be 1.0.

2. Anonymization at Inference

Rather than retraining massive models, the authors proposed anonymizing text before generating embeddings. They utilized Large Language Models (LLMs) like Gemini and Claude to identify and remove proper nouns (names, locations, organizations). They found that simply removing names (replacing them with an empty string) was more effective than replacing them with placeholders like CHAR_A, which could introduce new, subtle biases.

Key Results

The study confirmed that name bias is a universal issue, affecting both small open-source models and large proprietary ones.

Table 2: Cosine similarity scores showing models favoring name matches (Story 1 & 3) over semantic matches (Story 1 & 2).

As shown in the table above, many models (e.g., multi-qa-distilbert-cos-v1) show significantly higher similarity for the name-matched pair (Story 1, Story 3) than the semantically-matched pair (Story 1, Story 2). In some cases, the similarity for the name-matched pair is nearly double that of the thematic pair.

Other key findings include:

  • Semantic Similarity Task (STS): On a custom "trap" dataset designed to trigger name bias, original models performed worse than random guessing. After anonymization, AUC-ROC scores improved to 0.95–1.0.
  • Human Alignment: Using the SummEval benchmark, anonymization improved the correlation between model embeddings and human ratings by approximately 30% for models like all-distilroberta-v1.

Insights and Limitations

The core insight is that embedding models "over-index" on names because they are trained on massive internet datasets where names are often tied to specific contexts. Anonymization serves as a powerful "thematic" fix that preserves the grammatical skeleton of a narrative.

However, some limitations remain:

  • Task Specificity: Anonymization is unsuitable for searches where identity is the primary criteria (e.g., searching for a specific historical figure).
  • Language Scope: The study focused on English; further research is needed to see how these biases manifest in other languages.

Ultimately, this work highlights a fundamental challenge in NLP: building models that inherently prioritize narrative structure and semantic meaning over proper nouns.

Summary updated

Abstract

Text-embedding models often exhibit biases arising from the data on which they are trained. In this paper, we examine a hitherto unexplored bias in text-embeddings: bias arising from the presence of $\textit{names}$ such as persons, locations, organizations etc. in the text. Our study shows how the presence of $\textit{name-bias}$ in text-embedding models can potentially lead to erroneous conclusions in assessment of thematic similarity.Text-embeddings can mistakenly indicate similarity between texts based on names in the text, even when their actual semantic content has no similarity or indicate dissimilarity simply because of the names in the text even when the texts match semantically. We first demonstrate the presence of name bias in different text-embedding models and then propose $\textit{text-anonymization}$ during inference which involves removing references to names, while preserving the core theme of the text. The efficacy of the anonymization approach is demonstrated on two downstream NLP tasks, achieving significant performance gains. Our simple and training-optimization-free approach offers a practical and easily implementable solution to mitigate name bias.
BibTeX
@misc{manchanda2025what,
  author = {Sahil Manchanda and Pannaga Shivaswamy},
  title = {{What is in a name? Mitigating Name Bias in Text Embeddings via Anonymization}},
  year = {2025},
  eprint = {2502.02903},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.02903},
}
Figure