Controlling Gender Bias in Retrieval via a Backpack Architecture

Amirabbas Afzali, Amirreza Velae, Iman Ahmadi, Mohammad Aliannejadi

Abstract

The presence of social biases in large language models (LLMs) has become a significant concern in AI research. These biases, often embedded in training data, can perpetuate harmful stereotypes and distort decision-making processes. When LLMs are integrated into ranking systems, they can propagate these biases, leading to unfair outcomes in critical applications such as search engines and recommendation systems. Backpack Language Models, unlike traditional transformer-based models that treat text sequences as monolithic structures, generate outputs as weighted combinations of non-contextual, learned word aspects, also known as senses. Leveraging this architecture, we propose a framework for debiasing ranking tasks. Our experimental results show that this framework effectively mitigates gender bias in text retrieval and ranking with minimal degradation in performance.

Introduction

Large Language Models (LLMs) have become the foundational technology for modern search and recommendation systems. However, because these models are trained on massive, uncurated web crawls, they frequently inherit and amplify societal biases. A common example is the implicit association of specific professions with gender (e.g., "nurse" with women and "doctor" with men). When such models are deployed to rank job candidates or search results, these associations can lead to systemic unfairness.

The primary challenge in addressing this is the "monolithic" nature of standard Transformer architectures. Bias is typically baked into the model weights in a way that is nearly impossible to isolate without expensive retraining or blunt post-processing techniques. This research explores a more surgical approach: building a ranking system where bias can be adjusted at the moment of prediction using the Backpack architecture.

Methods: The Backpack Advantage

To achieve controllable debiasing, we move away from standard Transformers in favor of the Backpack Language Model. Unlike traditional models that produce a single opaque vector for a word, a Backpack model represents each word as a collection of $k$ "senses" or non-contextual aspects.

The Backpack architecture for ranking decomposes words into senses, allowing for weighted relevance scoring.

Our framework operates in three primary stages:

  1. Sense-Attribute Alignment: We identify "bias channels" by measuring the cosine similarity of every sense to a set of gendered word pairs (e.g., he/she). Senses that consistently align with one gender pole are flagged as gender-sensitive.
  2. Inference-Time Reweighting: We introduce a control factor, $\lambda$. By setting $\lambda < 1$, the model specifically down-weights the influence of gender-sensitive senses during the scoring phase.
  3. Surgical Control: Because the architecture separates these senses, we can suppress only the most biased components while leaving the model's general knowledge intact, requiring no retraining.

Experimental Setup

We evaluated our framework using the following datasets:

  • MS MARCO Passage Ranking: Used for training and general effectiveness evaluation (~530,000 queries).
  • Bias Evaluation Set: A subset of 1,765 "non-gendered" queries from the MS MARCO dev set, used to determine if the model injects gendered assumptions into neutral searches.
  • Auxiliary Set: Cross-lingual gendered word pairs used to calibrate the gender-sensitive senses.

Results and Trade-offs

Our results demonstrate that interpretability can serve as a powerful tool for control. Even at full weight ($\lambda = 1.0$), the Backpack-based ranker outperformed a size-matched GPT-2 model by +5.7% in MRR@10 and +4.7% in NDCG@10.

Trade-off between ranking performance (NDCG@10) and gender fairness across different values of the controlling factor λ.

As shown in the trade-off analysis, adjusting the Gender Controlling Factor ($\lambda$) allows for precise tuning between performance and fairness. At a "strong mitigation" setting ($\lambda = 0.5$), the model achieved its lowest bias scores across all tested cut-offs. Remarkably, this significant reduction in bias resulted in only a modest 2–3% decrease in ranking effectiveness, still significantly outperforming classical baselines like BM25 or KNRM.

Conclusion and Future Work

This work demonstrates that the Backpack architecture allows for "surgical" debiasing at inference time, providing a flexible "control knob" for system administrators. While currently focused on gender bias in a 170M parameter model, future research will investigate whether these senses remain cleanly separable in multi-billion parameter models and extend the framework to other social attributes such as race, age, and religion across diverse domains.

Summary updated

Abstract

The presence of social biases in large language models (LLMs) has become a significant concern in AI research. These biases, often embedded in training data, can perpetuate harmful stereotypes and distort decision-making processes. When LLMs are integrated into ranking systems, they can propagate these biases, leading to unfair outcomes in critical applications such as search engines and recommendation systems. Backpack Language Models, unlike traditional transformer-based models that treat text sequences as monolithic structures, generate outputs as weighted combinations of non-contextual, learned word aspects, also known as senses. Leveraging this architecture, we propose a framework for debiasing ranking tasks. Our experimental results show that this framework effectively mitigates gender bias in text retrieval and ranking with minimal degradation in performance.
BibTeX
@inproceedings{afzali2026controlling,
  author = {Amirabbas Afzali and Amirreza Velae and Iman Ahmadi and Mohammad Aliannejadi},
  title = {{Controlling Gender Bias in Retrieval via a Backpack Architecture}},
  booktitle = {ECIR},
  year = {2026},
  doi = {10.1007/978-3-032-21300-6\_47},
}
Figure