FA*IR: A Fair Top-k Ranking Algorithm

Meike Zehlike, Francesco Bonchi, Carlos Castillo, Sara Hajian, Mohamed Megahed, Ricardo Baeza-Yates · DOI

Abstract

In this work, we define and solve the Fair Top-k Ranking problem, in which we want to determine a subset of k candidates from a large pool of n >> k candidates, maximizing utility (i.e., select the "best" candidates) subject to group fairness criteria. Our ranked group fairness definition extends group fairness using the standard notion of protected groups and is based on ensuring that the proportion of protected candidates in every prefix of the top-k ranking remains statistically above or indistinguishable from a given minimum. Utility is operationalized in two ways: (i) every candidate included in the top-k should be more qualified than every candidate not included; and (ii) for every pair of candidates in the top-k, the more qualified candidate should be ranked above. An efficient algorithm is presented for producing the Fair Top-k Ranking, and tested experimentally on existing datasets as well as new datasets released with this paper, showing that our approach yields small distortions with respect to rankings that maximize utility without considering fairness criteria. To the best of our knowledge, this is the first algorithm grounded in statistical tests that can mitigate biases in the representation of an under-represented group along a ranked list.

Introduction: The Visibility Problem in Ranking

In the era of "people search engines"—from professional networks like LinkedIn and XING to recruitment tools—ranking algorithms act as critical gatekeepers to opportunity. Traditionally, these algorithms are "color-blind," ranking candidates solely based on predicted quality scores. However, if the underlying data is biased due to historical systemic gaps or hiring biases, a color-blind ranking will mirror and amplify those biases.

This creates a significant visibility problem. If members of a protected group are consistently pushed to the bottom of a list, they become effectively invisible to users who rarely scroll past the first few results. As shown in the following table, real-world search results often exhibit stark gender imbalances that vary significantly by profession.

Gender representation in XING search results for different professions.

The authors argue that fairness should not just be measured at the end of a list, but at every point where a user might stop looking. This necessitates a fairness criterion that applies to every prefix of a ranked list.

Ranked Group Fairness

The core contribution of this work is the concept of Ranked Group Fairness. Instead of aiming for a total percentage of protected candidates at the end of a list, the FAIR algorithm requires that the proportion of protected candidates in every prefix* of the top-k ranking remains statistically indistinguishable from a target proportion $p$.

The algorithm treats the appearance of a protected candidate as a Bernoulli trial (a "coin toss"). If the number of protected candidates at rank $i$ is significantly lower than expected (based on a p-value and a significance level $\alpha$), the ranking is flagged as unfair. To implement this efficiently, the algorithm uses a pre-calculated table of minimum required protected candidates at each rank $k$ for a given $p$.

Minimum number of protected candidates required at each rank k for various target proportions p.

The FA*IR Algorithm

FA*IR is a greedy, efficient post-processing algorithm with a complexity of $O(n + k \log k)$. It maintains two priority queues: one for protected candidates and one for non-protected candidates. As it constructs the ranked list, it consults the fairness table. If the fairness constraint demands a protected candidate to maintain "fairness" at the current rank, it selects the highest-utility candidate from the protected queue. Otherwise, it simply picks the best available candidate from either queue to maximize utility.

Experimental Evaluation and Results

The researchers evaluated FA*IR on several high-stakes datasets, including COMPAS (recidivism risk), German Credit (credit-worthiness), and SAT scores. They also introduced a new dataset scraped from XING, highlighting gender representation fluctuations across different search queries.

Key findings include:

  • Utility Preservation: FA*IR effectively "repairs" biased rankings with minimal impact on quality. In the German Credit dataset, representation of young people in the top-k was doubled (from 15% to 30%) while maintaining an NDCG (ranking quality measure) of nearly 1.0.
  • Superiority to Baselines: Compared to standard distribution alignment methods, FA*IR consistently achieved higher ordering utility and fewer "rank drops" (the number of positions a candidate loses due to re-ranking).
  • Efficiency: The algorithm's reliance on basic priority queue operations makes it fast enough for real-time search systems.

Conclusion and Future Work

FA*IR provides a mathematically rigorous framework for enforcing fairness in rankings, grounded in statistical hypothesis testing rather than arbitrary heuristics. However, current limitations include a focus on single, binary protected attributes. Future work aims to address intersectional fairness (e.g., race and gender combined) and develop "in-processing" algorithms that integrate fairness constraints directly into the model training phase rather than correcting results after the fact.

Summary updated

BibTeX
@inproceedings{zehlike2017fa,
  author = {Meike Zehlike and Francesco Bonchi and Carlos Castillo and Sara Hajian and Mohamed Megahed and Ricardo Baeza-Yates},
  title = {{FA*IR: A Fair Top-k Ranking Algorithm}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2017},
  doi = {10.1145/3132847.3132938},
}
Figure