acceptodds
Published as a conference paper at NeurIPS 2026

Fair Bubble Sort: Provably Optimal Fair Ranking with Continuous Sensitive Attributes

Antonio Ferrara, Fabio Vitale, Atsushi Miyauchi, Francesco Bonchi

Abstract

Algorithmic ranking systems increasingly dictate high-stakes outcomes, yet most fairness interventions implicitly assume that protected attributes are categorical. When sensitive attributes are inherently continuous (e.g., age, income, or health scores), standard practices rely on arbitrary discretization, which discards crucial fine-grained information and destroys the natural ordinality of the data. In this paper, we study the problem of fair ranking with continuous protected attributes without relying on thresholding. We formalize fairness via the Kendall correlation between the ranking and the continuous attribute, and measure utility loss via the Kemeny distance from an initial score-based ranking. To solve this, we propose Fair Bubble Sort (FBS), a highly efficient adjacent-swap algorithm that minimizes utility loss subject to a strict continuous fairness constraint. We provide strong theoretical guarantees, proving that FBS is exactly optimal for the unweighted Kemeny distance. Extensive experiments on synthetic and real-world datasets show that FBS is scalable and consistently outperforms discretization-based baselines, achieving a superior fairness-accuracy Pareto front.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Bottom 49%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.33 over 3 reviews, above 49% of the others.
Reviewer_VsHqOpenReview ↗
Rating
5
Clarity
3
Confidence
4
Originality
3
Quality
4
Significance
3
Read review
Summary

The authors consider the problem of fair ranking with a continuous protected attribute. Given some set of scored items with continuous attributes, the goal is to produce a ranking of items that has minimal distance to the score-ordered ranking while having a low absolute Kendall-tau correlation with the attribute ranking. In particular, this is framed as an optimization problem with a hard constraint on fairness (attribute correlation). The authors propose a greedy adjacent-swap algorithm that makes progress towards an attribute-uncorrelated ranking, which they term fair bubble sort (FBS). For unweighted rank distance, the authors show FBS is optimal. For weighted distance, they provide a bound based on the weight spread (ratio of max to min weight), as well as asymptotic and uniform approximation ratios when scores are maximally correlated with attributes and nn is a power of 2. Experiments on synthetic examples suggest the special case approximation ratio of 2 holds generally. In experiments, the authors compare against brute force for small nn and a MILP for intermediate nn. Finally, the authors compare their approach to existing discrete-attribute-based baselines on four real-world fairness datasets. FBS consistently achieves better fairness with lower distance from the score ranking. Runtime experiments align with the authors' algorithm runtime analysis.

Strengths and weaknesses

This is a very nice theoretical fairness paper with interesting analysis and thorough experiments.

Strengths

  1. The paper is for the most part very clear.
  2. Overall quality is great, with clear notation and very good attention to detail. The paper addresses the problem from several angles, providing algorithms with analyses in different cases, synthetic experiments, and real-data experiments.
  3. The problem is natural and the proposed method is intuitive and effective.

Weaknesses

  1. A few minor clarifications / corrections can be made (see questions section).
Questions
  1. Are there formal relationships between CPP and existing discrete-attribute ranking fairness metrics? E.g., if we discretize an attribute and then apply CPP, does it become equivalent to some existing metric?
  2. Is there a theory-based reason to think the FBS weighted approximation ratio might be around 1.5 given the experimental results?
  3. Have you tried constructing instances with poor approximation ratios? (worse than the 1.207... case)

Minor

  • Regarding terminology, I'm more familiar with the number of inversions between two rankings being called "Kendall tau distance" (e.g., https://dl.acm.org/doi/abs/10.1145/1055558.1055568), and the Kemeny ranking referring to the ranking minimizing the sum of Kendall tau distances to a set (e.g., https://cdn.aaai.org/AAAI/2006/AAAI06-099.pdf). In this case, this might be called "normalized weighted Kendall tau distance." (This is admittedly wordier than "Kemeny distance," but I don't believe "Kemeny distance" is standard.)
  • The caption of Figure 1b doesn't match the plot. The caption mentions grey and square markers, but the plot has only colors and circles.
  • In some places, it isn't clear that Prop 3 applies only for nn equal to a power of 2. (e.g., lines 254-256)
  • Why does the y-axiis for Figure 3(a) extend up to 10^11 when the largest y value is < 10^3?
Limitations

yes

Paper formatting concerns

None

Final justification

The authors addressed my concerns/questions well. This is a nice paper that I believe merits acceptance.

Reviewer_jDDsOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper studies fair ranking with continuous sensitive attributes. The goal is to produce a ranking close to an initial score-based ranking while reducing dependence between ranking position and the continuous attribute. The authors define Continuous Pairwise Parity (CPP) through the Kendall correlation between the ranking and the sensitive attribute, and formulate the optimization problem as minimizing Kemeny distance subject to a CPP fairness constraint. They propose Fair Bubble Sort (FBS), an adjacent-swap post-processing algorithm. The theoretical result is optimality for the unweighted Kemeny distance, and for the weighted score-gap distance the paper provides a weight-spread bound, a sharper asymptotic result in a special all-ascending case. The paper further compares FBS against discretization-based fair-ranking baselines on synthetic and real-world datasets, showing the effectiveness of the proposed method.

Strengths and weaknesses
  • The paper is well-motivated in fair ranking. Most existing methods assume categorical protected groups, while many sensitive attributes such as age, income, or health scores are continuous. The proposed CPP notion is simple and natural: it measures monotone dependence between ranking positions and continuous attributes via Kendall correlation. This avoids arbitrary binning and preserves the ordinal nature of the sensitive attribute.

  • The theoretical result for the unweighted problem is a strength. The proof strategy is intuitive: each adjacent swap changes the Kendall imbalance by exactly two and changes the Kemeny distance by one inversion, so the algorithm reaches the feasibility threshold using the minimum possible number of swaps. This leads to a clean optimality guarantee for the unweighted Kemeny distance. The runtime characterization in terms of the required number of swaps is also useful, since it separates preprocessing cost from the instance-dependent fairness correction cost.

  • The proposed heap-based FBS is reasonable, but the strongest general guarantee is a weight-spread bound, which can be loose when score gaps vary widely. The more interesting constant-factor analysis is restricted to integer scores and the all-ascending attribute case. The paper conjectures a general 2-approximation and supports it empirically, but this remains unproved. Since the weighted Kemeny distance is arguably the more practically meaningful utility metric, this weakens the theoretical contribution somewhat.

  • Another concern is the fairness notion itself. CPP captures only monotone pairwise dependence between ranking position and the sensitive attribute. This is appropriate for many ranking scenarios, but it does not rule out non-monotone unfairness patterns. For example, rankings where high- and low-attribute individuals are concentrated in the middle while mid-attribute individuals appear at the extremes may have small Kendall correlation while still exhibiting problematic distributional behavior. The paper acknowledges this limitation, but the main experiments mostly evaluate the same CPP metric used for optimization, so the empirical section does not fully test whether FBS improves broader notions of continuous-attribute fairness.

  • The experimental section is solid but could be stronger. Comparing against discretization-based baselines is appropriate given the paper’s motivation, and the real-data results show FBS dominating the baselines. However, because the baselines optimize different group-based constraints after discretization, the comparison partly favors FBS on the CPP metric. It would be better to include additional continuous dependence metrics, such as Spearman correlation, distance correlation, HSIC, or position-wise distributional discrepancy, to show that the method is not just optimizing Kendall correlation at the expense of other dependence measures.

Questions
  • The weighted Kemeny distance seems more practically meaningful than the unweighted version because swapping candidates with nearly identical scores should cost less than swapping candidates with very different scores. Can the authors provide either a stronger general approximation guarantee for the weighted case or a clearer explanation of when the current empirical 2-approximation evidence should be expected to hold?

  • CPP only captures monotone dependence through Kendall correlation. Could the authors report additional continuous dependence/fairness metrics, such as Spearman correlation, distance correlation, HSIC, or distributional discrepancy across ranking positions? This would help show whether FBS improves continuous fairness more broadly rather than only the metric it directly optimizes.

Limitations

yes

Paper formatting concerns

none

Final justification

The rebuttal addressed my main concerns.

Reviewer_1mbCOpenReview ↗
Rating
4
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
3
Read review
Summary

The paper introduces Continuous Pairwise Parity (CPP), a fairness measure for ranking based on the Kendall correlation between the generated permutation and a continuous sensitive attribute, without discretization. It proposes Fair Bubble Sort (FBS), a greedy algorithm based on adjacent swaps that minimizes the Kemeny distance to the initial ranking under the CPP fairness constraint. FBS is proven to be exactly optimal in the unweighted case, and an approximation bound of (1+2/2)(1+\sqrt 2 /2) is established for a restricted weighted case (integer scores, all-ascending configuration), with a general 2-approximation conjecture supported empirically. The paper validates FBS on four real-world datasets and demonstrates dominance on the Pareto front of fairness versus cost compared to discretization baselines.

Strengths and weaknesses

Strengths The formalization is clear, and the shared pairwise structure between CPP and the Kemeny distance is well motivated (Appendix B). The litterature on fair ranking with continuous sensitive attributes being scarce, this paper offers an interesting and theoretically well motivated solution to this problem. The complexity analysis is empirically tested branch by branch (Figure 3a), which is also a nice contribution. Limitations are handled honestly.

Weaknesses

  1. Missing baseline. The four real datasets (COMPAS, German Credit, Law School, Communities and Crime) are standard classification-fairness benchmarks, not ranking-native datasets. A natural and easy-to-add baseline could be to apply an existing continuous-fairness method to the score (e.g. Wasserstein repair) and then sort, comparing the resulting ranking to FBS on the same (φ, Kemeny distance) axes.
  2. No independent ranking-quality measure. Utility is measured solely via Kemeny distance to rs which is precisely the quantity FBS optimizes. This is somewhat circular: FBS cannot lose on this axis by construction. A task-oriented measure (NDCG against a relevance ground truth, or top-k utility) is missing to assess whether the produced ranking remains practically useful, independently of the chosen optimization target.
  3. Flat segments in the Pareto curves (Figure 2) are not investigated. On German Credit the curve is nearly flat; the stated explanation (ϕ0=0.98, near-trivial constraint) is plausible but actually undercuts the value of that dataset as a test case rather than validating the result. More importantly, given what the Proposition 5 proof shows about FBS's behavior under strict constraints in the all-ascending case (whole-segment block reversals rather than fine-grained adjustment), I can't rule out that some plateaus at high ψ (e.g. on COMPAS or Communities) reflect a similar degenerate, block-like solution rather than a genuinely good trade-off. A qualitative inspection of a few actual rankings at plateau points, would help distinguish between the case where nothing is left to fix from a degenerate solution. Typically, the nothing is left to fix could correspond to a random ranking ?
Questions
  1. Lemma 2 is introduced as one of four pillars of the Theorem 1 proof, but I couldn't find it explicitly invoked in the proof of Proposition 1 or Theorem 1. Could you clarify where it's used?
  2. Could you show a few example rankings produced by FBS at high ψ on COMPAS/Communities, to check whether they exhibit a block-like structure similar to Proposition 5? In addition, without more traditional ranking metrics such as NDCG it is really difficule to assess the quality of the solution under fairness constraint that is found.
  3. Is a "fair classification then sort" baseline feasible on the datasets already used?

I'd be happy to revise my score based on the replies to these questions.

Limitations

yes

Paper formatting concerns

no

Final justification

The rebuttal addressed most of my concerns.

1 comment

We thank the reviewer for the careful reading and the concrete, actionable suggestions. We address each point below.


Q1. Where is Lemma 2 used in the proof?

We thank the reviewer for this careful observation. Lemma 2 is indeed not invoked in the formal algebraic proof of Proposition 1 / Theorem 1; rather, it serves as a foundational structural result that motivates and justifies the non-backtracking design of FBS.

Lemma 1 shows that we can restrict candidate moves to adjacent swaps. Lemma 2 shows that an optimal ranking is reachable via a sequence of swaps that are non-decreasing with respect to the fairness objective. Lemma 3 then guarantees that a valid majority-sign swap always exists. Together, these three lemmas formally establish the restricted search space for FBS.

Indeed, FBS is a greedy algorithm that only makes fairness-improving swaps and, as the counting shows, never undoes an inversion, so it moves monotonically away from r_s and never backtracks. A natural worry about such greedy design is whether the optimum might require first moving closer to r_s and then away, so that a no-backtracking greedy misses it. Lemma 2 addresses exactly this: an optimum is reachable by a non-decreasing (forward-only) path, i.e. the forward-only class provably contains an optimum. So a forward-only strategy is not restrictive; that is the intuition behind FBS's design, while the optimality runs entirely on the counting arguments of Lemma 1, Lemma 3, Observation 1 (each swap changes the imbalance by +-2 and the inversion count by +-1), and Proposition 1 (FBS uses exactly K* swaps, and no feasible swap sequence uses fewer).

In the revision we will clarify this point: we will mention Lemma 2 as this design justification at the beginning of Section 4, while rewording the overview sentence at the beginning of Section 5 so that it correctly credits the results actually used in the proof (Lemma 1, Lemma 3, Observation 1, Proposition 1) while listing Lemma 2 as a characterizing and motivating structural fact.


W1 / Q3. Continuous-fairness baseline

As suggested, we apply continuous-fairness repair to the given score conditioned on the continuous attribute aa, and then re-sort. We test two repair variants:

  1. Wasserstein / Geometric Repair (Feldman et al., 2015, "Certifying and Removing Disparate Impact"): Bins attribute aa into GG ordered groups, transports each group's score distribution toward the median distribution, and sorts by the repaired score.
  2. Residual (Binning-Free) Repair (in the spirit of Johndrow & Lum, 2019, "An algorithm for removing sensitive information: Application to race-independent recidivism prediction"): Residualizes scores against aa by estimating local conditional expectation f^(a)≈E[score∣a]\hat{f}(a) \approx \mathbb{E}[\text{score} \mid a]. Items are ranked by a blend of standardized score and residual via parameter λ∈[0,1]\lambda \in [0, 1] (λ=0\lambda=0 gives rsr_s; λ=1\lambda=1 removes attribute influence).

We compute every ranking produced along their sweeps on the same (ϕ,weighted-Kemeny cost)(\phi, \text{weighted-Kemeny cost}) axes as FBS and report the ratio of the baseline and FBS costs at matched fairness ϕ\phi.

Table 1. Wasserstein repair-then-sort vs FBS

Datasetϕ0\phi_0ϕ\phi reachedcost vs FBS (median)cost vs FBS (max)
COMPAS0.720.962.1×5.8×
German Credit0.981.0018×88×
Law School0.850.981.3×11×
Communities0.560.992.0×2.8×

Table 2. Residual (binning-free) repair-then-sort vs FBS

Datasetϕ0\phi_0ϕ\phi reachedcost vs FBS (median)cost vs FBS (max)
COMPAS0.720.952.6×3.8×
German Credit0.980.9970×70×
Law School0.851.0049×189×
Communities0.560.981.4×3.2×

Note: Ratios >1×>1\times indicate FBS reaches matched fairness at lower cost. FBS is strictly cheaper across all matched points on all datasets.


W2 / Q2. Task-oriented ranking quality (NDCG) & structural utility

As requested, we evaluate NDCG with the original score as relevance (i.e., the score-based ranking rsr_s is ideal and gives NDCG = 1.0). At matched fairness we report, per dataset: FBS (the paper's algorithm), FBS-NDCG (defined next), the strongest baseline, and a random ϕ\phi-fair ranking as a reference.

FBS-NDCG When the target is NDCG we can optimize it directly. At each step FBS makes the cheapest fairness-improving adjacent swap under a per-swap cost. Any utility whose marginal change under a single adjacent swap is cheap to evaluate, i.e., that decomposes over adjacent swaps, can be used as such cost. We report two such utilities: with element weights, swapping items i,ji, j costs the score gap ∣si−sj∣|s_i - s_j| and FBS minimizes the weighted Kemeny distance (the paper's default); with position weights, the swap cost is the NDCG log-discount of the positions involved, so swaps near the top are expensive and FBS protects the head of the list (FBS-NDCG). Both perform exactly K∗K^* majority-sign swaps and reach identical fairness; they differ only in which swaps they choose, i.e. where displacement is spent. So targeting NDCG needs no new algorithm, only the NDCG cost within the same routine.

Table 3. Task-Oriented Utility (NDCG, NDCG@10, NDCG@100) at Matched High Fairness (ϕ\phi)

NDCG

Datasetmatched ϕ\phirandom (ϕ\phi-fair)Best baselineFBSFBS-NDCG
COMPAS0.9950.920.995 (DetConstSort G=10)0.9910.998
German Credit1.0000.790.999 (DetConstSort G=3)1.0001.000
Law School0.9980.981.000 (DetConstSort G=10)0.9991.000
Communities0.9910.810.951 (DetConstSort G=10)0.9800.995

NDCG@10

Datasetmatched ϕ\phirandom (ϕ\phi-fair)Best baselineFBSFBS-NDCG
COMPAS0.9950.401.000 (DetConstSort G=10)0.8891.000
German Credit1.0000.210.992 (DetConstSort G=3)1.0001.000
Law School0.9980.781.000 (DetConstSort G=10)0.9321.000
Communities0.9910.180.944 (DetConstSort G=10)0.8261.000

NDCG@100

Datasetmatched ϕ\phirandom (ϕ\phi-fair)Best baselineFBSFBS-NDCG
COMPAS0.9950.440.997 (DetConstSort G=10)0.8721.000
German Credit1.0000.290.996 (DetConstSort G=3)1.0001.000
Law School0.9980.781.000 (DetConstSort G=10)0.9511.000
Communities0.9910.240.753 (DetConstSort G=10)0.9431.000

Two key takeaways:

  1. Fair rankings remain practical: Unconstrained random fair rankings drop severely on top-heavy metrics (e.g., NDCG@10 drops to 0.18−0.780.18 - 0.78), whereas Default FBS remains always high (0.82−1.000.82 - 1.00).

  2. FBS keeps full-list displacement small but sheds some top-k on coarse-score data (COMPAS, LSAT), exactly the regime where FBS-NDCG, by pricing top swaps higher, recovers ~1.0 top-k utility at the same fairness. So one does not trade fairness for top-k usefulness: if top-k is the objective, FBS-NDCG optimizes it directly.

We will add this framing to the paper as a light addition in the Appendix: FBS is a cost-agnostic post-processing framework that minimizes any per-swap utility cost under the CPP constraint, and FBS-NDCG is an instance.

About rankings at high ψ\psi: see W3 next.


W3. Flat Pareto segments are not investigated; possible degenerate block-like solutions

Thanks for raising this. The flat segments are an expected consequence of how FBS spends utility cost, not a pathology; we next make the mechanism explicit and confirm the strict-fairness rankings are genuine, not degenerate. A flat segment corresponds to FBS improving fairness at (near) zero utility cost by reordering items with (near) same scores. Flat segments are thus located closer to ϕ0\phi_0. Datasets with more tied scores have longer zero-cost segments (COMPAS and Law School have many ties; Communities less; German Credit has essentially no ties).

German Credit's flat curve is a strength, not a weak test case: ϕ0=0.98\phi_0=0.98, so little correction is needed and FBS reaches ϕ=1\phi=1 at cost ≈10−4\approx10^{-4}, whereas the strongest baseline (DetConstSort) pays $\sim$19$\times$ more to reach comparable fairness (ϕ=0.9999\phi=0.9999). Flat here means FBS achieves fairness at near-zero cost.

To check that the fair rankings at high ψ\psi are genuine, we compare FBS at ψ=1\psi=1 against a random permutation, which also has ϕ≈1\phi\approx1. This addresses the reviewer's worry that a fully fair ranking might be effectively random.

Table 4. Normalized mean displacement

Datasetrankingϕ\phiWeighted KemenyNormalized mean displacementWithin tie-group
COMPASFBS1.000.0350.0940.46
random perm1.000.4970.3320.12
CommunitiesFBS1.000.0610.1440.05
random perm0.990.5020.3310.03
Law SchoolFBS1.000.0120.0490.38
random perm1.000.5000.3330.05

Normalized mean displacement = |new − old position| per item, averaged over items, and normalized by dividing by nn. Column "within tie-group" indicates the fraction of items staying within their equal-score group.

The same table rules out the block-like solution too. Across the three datasets, FBS's normalized mean displacement is 0.05-0.14 of the list, well below the random ranking's. The corrections are therefore fine-grained and local, not the whole-segment reversals of the all-ascending Proposition 5 case (which requires distinct integer scores with a=sa=s and does not arise here).

Comments on the paper

1 comment
Meta-review

The paper addresses the problem of fair ranking with a continuous sensitive attribute. It introduces a fairness notion called Continuous Pairwise Parity (CPP) and proposes a greedy algorithm to minimize a distance to the original ranking subject to a CPP constraint. Bounds are shown (and conjectured) on the performance of this algorithm in different cases.

All reviewers found this to be a meaningful contribution to the space of fair ranking where continuous sensitive attributes are not often handled. The complexity analysis is also appreciated.

However, the reviewers also identify shortcomings that would need to be clarified in order for the paper to be strongly considered, in particular:

  • baselines and independent ranking quality measures: Reviewers 1mbC and jDDs find that the experiments are biased in that they favor the paper's own metric FBS. This should be addressed to strengthen the experimental evidence (please see details in the reviews).
  • weighted results: Reviewer jDDs questions whether the authors can provide stronger results or at least more intuition/explanation of what results can be expected. Here, providing extra results is not a must for acceptance, but a more extended discussion of the case would help. Please also address related questions by Reviewer VsHq.
  • Motivation for CPP: Reviewer jDDs questions the motivation for the CPP notion and comparison with alternative options.

I encourage the authors to respond to the all reviewers questions/weaknesses as I find that all are reasonable and contribute towards the summarized points above that would clarify our understanding of the paper's contribution significance.

UPDATE AFTER REBUTTAL

The rebuttal has addressed the above concerns and all reviewers now support acceptance.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.