Abstract
Algorithmic fairness research is currently hindered by fragmented methodologies, inconsistent evaluation metrics, and varying model selection criteria. We introduce fairlib, an open-source PyTorch framework that unifies 14 debiasing methods and a comprehensive suite of evaluation metrics. By providing a standardized ecosystem for data processing, model training, and analysis, fairlib enables reproducible comparisons and rigorous assessment of the trade-offs between model performance and social fairness. Our benchmarks on standard NLP datasets demonstrate that systematic hyperparameter tuning within fairlib can significantly improve results over originally reported figures, highlighting the necessity of a unified evaluation framework.
Introduction: The Fragmentation of Fairness Research
In the rush to make AI more equitable, the research community has produced a dizzying array of "debiasing" techniques. However, comparing these methods is currently a significant challenge. Different papers use different datasets, inconsistent evaluation metrics (like various "GAP" scores), and—most importantly—varying model selection criteria.
Because there is almost always a trade-off between a model's performance (accuracy) and its fairness, a researcher can make a method look superior simply by choosing a different point on that trade-off curve. Without a unified framework, it is difficult to discern if a new algorithm represents a genuine breakthrough or is merely the result of superior hyperparameter tuning. fairlib addresses this by providing a modular ecosystem for consistent, reproducible comparisons.
The fairlib Framework
The authors developed fairlib as a modular ecosystem consisting of four main components:
- Data Module: Handles diverse inputs (text, images, audio) and automates pre-processing debiasing like resampling.
- Model Module: Supports standard backbones (like BERT) and integrates 14 built-in debiasing methods categorized into pre-processing (adjusting training data), at-training-time (adversarial components), and post-processing (adjusting trained model predictions).
- Evaluation Module: Provides a standardized suite of metrics based on confusion matrices, such as Equal Opportunity and Predictive Equality.
- Analysis Module: Includes tools for Pareto frontier analysis and the DTO (Distance To the Optimal) metric.
Quantifying Success with DTO
By using Distance To the Optimal (DTO), researchers can finally compare models using a single, objective scalar that accounts for both competing goals simultaneously. DTO measures how close a model is to the "Utopia point"—the theoretical (and usually impossible) state of having 100% accuracy and 100% fairness.
Visualizing the Trade-off
Instead of looking at a single number, fairlib encourages looking at the entire curve of possible models. The Pareto Trade-off plot filters out "sub-optimal" models, showing only those that provide the best possible fairness for a given level of performance. This allows for a more nuanced understanding of how different algorithms behave across the performance-fairness spectrum.
Experimental Insights
The framework was benchmarked using two standard NLP fairness datasets: MOJI (sentiment analysis of tweets with race as a protected attribute) and BIOS (professional biography classification with gender as a protected attribute).
Key findings include:
- The Hyperparameter Trap: Systematic hyperparameter tuning within
fairliboften led to better results than those originally reported in source papers. This highlights how much "performance" in fairness research can be attributed to the rigor of the experimental setup rather than the algorithm itself. - Methodological Nuance: Re-implementing 9 major debiasing methods showed that no single method dominates. For instance, BTEO (pre-processing) performed exceptionally well on BIOS, while INLP (post-processing) showed significant gains through better tuning. Methods like FAIRSCL demonstrated dataset-dependent efficacy, performing well on MOJI but struggling on BIOS.
Limitations and Future Work
A current limitation of fairlib is its reliance on the availability of protected attributes (like race or gender) during training, which may not always be feasible or legal. Future development will focus on privacy-preserving fairness, incorporating models that can debias without explicit access to protected labels, and expanding the framework's robust support for computer vision and audio processing modalities.
fairlib is released under the Apache License 2.0 and is available on GitHub.
Summary updated