TL;DR
humancompatible.detect is a new open-source Python toolkit designed to uncover hidden intersectional bias in AI models. By leveraging Maximum Subgroup Discrepancy (MSD) and subsampled $\ell_\infty$ distances, it bypasses the high sample complexity and computability bottlenecks of traditional metrics while providing provably optimal results.
What Problem Does This Paper Address?
Emerging regulations, such as the EU AI Act, mandate that developers audit high-risk AI systems for bias on both input data and model outputs. However, doing this effectively is a massive technical challenge. Traditional distributional distance metrics—like Wasserstein-1 or Maximum Mean Discrepancy (MMD)—either require massive amounts of data to approximate accurately or are computationally intractable.
Worse yet, bias often hides at the intersections of protected attributes (e.g., discrimination that specifically targets young, low-income individuals, rather than youth or low-income groups generally). Testing every possible combination of attributes creates an exponential explosion of subgroups—the curse of dimensionality. For instance, US Census data can yield over 5.7 billion potential subgroups. Existing fairness toolkits either ignore these intersections entirely or rely on greedy, sub-optimal search methods that fail when data is scarce.
Methods
The toolkit introduces two primary algorithmic approaches to make intersectional bias auditing practical:
- Maximum Subgroup Discrepancy (MSD): Instead of checking every subgroup one by one, MSD treats bias detection as an optimization problem to find the subgroup with the highest difference in probability between two distributions (e.g., the favored vs. disfavored populations). Powered by mixed-integer optimization, it guarantees finding the globally most biased subgroup. Crucially, it achieves a sample complexity that scales linearly rather than exponentially with the number of protected attributes.
- Subsampled $\ell_\infty$ Distances: For massive datasets where full evaluation is too slow, this method subsamples the data to test whether a specific subgroup's bias falls within a user-defined tolerance threshold ($\Delta$), backed by Probably Approximately Correct (PAC) learning guarantees.
The toolkit exposes these methods through a clean, unified API featuring detect (to find the worst-off subgroup) and evaluate (to measure bias for a specific subgroup) functions.
Datasets
The authors demonstrate the toolkit using a synthetic dataset featuring categorical attributes: Race (Green, Blue, Purple), Age buckets (0-18, 18-30, 30-45, 45-60, 60+), and a binary Target variable (such as loan or job approval). They also reference the scale of US Census data conceptually to highlight the real-world necessity of their linear sample complexity approach.
Key Insights and Ideas
- The Illusion of Marginal Fairness: A dataset can appear perfectly fair on the surface. In the authors' synthetic example, every race and every age group has the exact same overall approval rate (statistical parity). Yet, the underlying model completely rejects one specific intersection: young, blue individuals. Standard auditing tools look at attributes in isolation and miss this entirely.
- Breaking the Curse of Dimensionality: By proving that MSD has linear sample complexity relative to the number of protected attributes, the authors show that you don't need exponentially larger datasets to audit complex, multi-attribute intersectional groups.
- Global Optimality Over Greedy Search: Other toolkits that handle intersections often rely on greedy decision trees, which can make short-sighted splits and miss severely impacted groups.
humancompatible.detectuses exact optimization to guarantee mathematical optimality.
Key Results
- In the synthetic experiment, the toolkit successfully pinpointed the exact disadvantaged subgroup (
Race = Blue AND Age = 0-18) and quantified its bias score (MSD = 0.111111), exposing an 11.1% gap that marginal metrics missed. - For a threshold of $\Delta = 0.125$ using the subsampled $\ell_\infty$ norm, the toolkit successfully flagged when a subgroup's distribution deviated unacceptably from the general population.
- The authors provide a feature matrix comparing their toolkit to established frameworks like Fairlearn and AI Fairness 360, demonstrating that
humancompatible.detectis uniquely positioned to handle intersectional detection with low sample complexity and optimality guarantees.
Limitations and Future Work
The authors note that the toolkit's architecture is highly modular and designed for easy extensibility. For future work, they mention plans to integrate alternative subgroup fairness auditing methods, such as Subgroup Pairwise Statistical Fairness (SPSF). Deeper limitations regarding non-tabular data formats (like text or images) or continuous target variables are not explicitly detailed in this paper.
Summary updated