NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Dbias: Detecting biases and ensuring Fairness in news articles

Shaina Raza, Deepak John Reji, Chen Ding

Abstract

The problem of fairness is garnering a lot of interest in the academic and broader literature due to the increasing use of data-centric systems and algorithms in machine learning. This paper introduces Dbias, an open-source Python package for ensuring fairness in news articles. Dbias can take any text to determine if it is biased. Then, it detects biased words in the text, masks them, and suggests a set of sentences with new words that are bias-free or at least less biased. We conduct extensive experiments to assess the performance of Dbias. To see how well our approach works, we compare it to the existing fairness models. We also test the individual components of Dbias to see how effective they were. The experimental results show that Dbias outperforms all the baselines in terms of accuracy and fairness. We make this package (Dbias) as publicly available for the developers and practitioners to mitigate biases in textual data (such as news articles), as well as to encourage extension of this work.

Introduction

AI systems are increasingly deployed in sensitive areas, but they frequently absorb human biases—ranging from gender and racial prejudices to political and age-related stereotypes—present in their training corpora. While existing fairness toolkits like IBM's AIF360 or FairML focus on tabular data or algorithmic tweaks, they often fail to address the root cause in unstructured text. Furthermore, most NLP bias research focuses merely on detection rather than remediation.

Dbias addresses this gap by providing an end-to-end pipeline that takes raw text, identifies bias, and automatically rewrites it to be fairer before it is fed into downstream machine learning models.

Examples of biases addressed by Dbias, including gender, age, and racial bias.

The Dbias Pipeline

The Dbias framework is built as a multi-stage machine learning pipeline leveraging state-of-the-art Transformer models. The package is designed for ease of use, installable via a simple pip install Dbias command, and provides a complete workflow from data ingestion to de-biased output.

The end-to-end Dbias architecture, illustrating the progression from raw news articles to bias-free news through detection, recognition, masking, and de-biasing phases.

The pipeline consists of three primary stages:

  1. Bias Detection: A binary classifier determines if a sentence is biased. The authors utilized a fine-tuned DistilBERT model, which offers a robust balance between high accuracy and fast inference speed.
  2. Bias Recognition: Moving beyond standard Named Entity Recognition (NER), Dbias repurposes NER to tag "bias-bearing words." This stage employs a RoBERTa-based Spacy Transformer pipeline to extract specific linguistic triggers of bias based on syntax and semantics.
  3. De-biasing (Masking and Infilling): This novel step uses targeted masking. Instead of random token masking used in standard training, Dbias masks only the words flagged in the recognition stage. It then uses a "mask shifting" technique to sequentially predict neutral, context-aware replacements to reconstruct a fairer sentence.

Datasets and Methodology

The primary training source is an extended version of the Media Bias Annotation Dataset (MBIC), containing 17,000 sentences sourced from diverse US news outlets like HuffPost, Fox News, Reuters, and MSNBC. This dataset covers a broad spectrum of prejudices, including religious, political, and educational biases.

A key insight from the research is that targeted masking significantly outperforms random masking for de-biasing tasks. By isolating specific biased words, the model can generate replacements that maintain the original context while stripping away the prejudice. This approach minimizes the typical "accuracy vs. fairness" trade-off found in many ML systems.

Experimental Results

The Dbias pipeline was evaluated against several baselines, demonstrating superior performance in both detection and fairness metrics:

  • Detection Performance: The DistilBERT module achieved 77.6% accuracy and a 75.9% F1-score, outperforming traditional models like Logistic Regression (61% F1) and adversarial debiasing baselines (64.1% accuracy).
  • Fairness Metrics: Fairness was quantified using the Disparate Impact (DI) ratio. While the industry standard for "fair" is 0.8 to 1.25, the Dbias pipeline achieved a near-perfect DI ratio of 1.012.
  • Recognition Accuracy: The RoBERTa-based NER module identified biased words with 72% accuracy, proving more effective than smaller, non-transformer alternatives.

Conclusion and Future Directions

While Dbias represents a significant step forward, the authors acknowledge the inherent subjectivity of "bias," which evolves over time and context. Future work involves expanding the training data to include other sensitive domains such as hiring applications, healthcare records, and legal sentencing documents. By cleaning data at the ingestion stage, Dbias enables developers to build fairer NLP systems from the ground up.

Summary updated

BibTeX
@inproceedings{raza2022dbias,
  author = {Shaina Raza and Deepak John Reji and Chen Ding},
  title = {{Dbias: Detecting biases and ensuring Fairness in news articles}},
  booktitle = {Research Square},
  year = {2022},
  doi = {10.21203/rs.3.rs-1356281/v1},
}
Figure