SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.06720 · NeurIPS · 2021

Fairness in Ranking under Uncertainty

Thorsten Joachims, Ashudeep Singh, David Kempe

arXiv · PDF · Open in the Atlas

Code that ran

10 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2107.06720.json · badge: /api/ran/2107.06720.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ashudeep/ranking-fairness-uncertainty marked official in Papers with Code
Papers with Code archive
10 ran · 4 no recorded run
FunctionStatusWhere it lives
_sample_ranking_bernoulli Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("ccf9a1ee09d47c35")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set seed for reproducibility
np.random.seed(0)

# The function takes bernoulli_posteriors as input
# Looking at the function body:
# - It checks if any value > 1.0 (should be between 0 and 1)
# - It iterates through bernoulli_posteriors with "for p in bernoulli_posteriors"
# - It calls np.random.choice(2, p=[1-p, p]) for each p
# - It adds random noise: scores += np.random.random(len(bernoulli_posteriors)) * 1e-10
# - It returns np.argsort(-scores)
# So bernoulli_posteriors should be a numpy array or list of floats between 0 and 1

# Create valid bernoulli posteriors (probabilities between 0 and 1)
bernoulli_posteriors = np.array([0.3, 0.7, 0.5, 0.2])

ARGS = {
    'bernoulli_posteriors': bernoulli_posteriors
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_constraint_probability Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("cc181d67ff91f42b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample rankings data
# sampled_rankings should be a list of rankings (arrays/lists of document indices)
# Each ranking is a permutation of document IDs
# For a small example with 4 documents, we'll create 5 sample rankings

sampled_rankings = [
    np.array([0, 1, 2, 3]),
    np.array([1, 0, 3, 2]),
    np.array([2, 3, 0, 1]),
    np.array([3, 2, 1, 0]),
    np.array([0, 2, 1, 3]),
]

ARGS = {
    'sampled_rankings': sampled_rankings,
    'plot_marginal_rank_distribution': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
matplotlib, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_marginal_rank_probabilities Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("277eaf193b100851")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create sample rankings data
# sampled_rankings should be a list of rankings (permutations)
# Each ranking is a list/array of document indices in ranked order
# For example, if we have 4 documents, a ranking might be [2, 0, 3, 1]
# meaning document 2 is ranked 1st, document 0 is ranked 2nd, etc.

num_docs = 4
num_rankings = 3

# Create sample rankings as lists of indices
sampled_rankings = [
    [0, 1, 2, 3],  # First ranking: docs in order 0,1,2,3
    [3, 2, 1, 0],  # Second ranking: docs in reverse order
    [1, 3, 0, 2],  # Third ranking: mixed order
]

ARGS = {
    "sampled_rankings": sampled_rankings
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_dcg Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("0503ae5484ea6888")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Analyze the function:
# - ranking: used as index into np.array(means), so should be array-like of integers
# - means: converted to np.array and indexed by ranking, so should be array-like of numbers
# - v: used in np.dot with indexed means, so should be array-like of numbers

# Create small test data
ranking = np.array([0, 2, 1])  # indices into means
means = np.array([1.5, 2.0, 3.5, 4.2])  # 4 distinct mean values
v = np.array([0.1, 0.2, 0.3])  # 3 values to dot with selected means

ARGS = {
    "ranking": ranking,
    "means": means,
    "v": v
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_fairness_day_dcg Ran
ran; our contract draft was wrong, not the code
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("fd39aedfc2029e77")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Construct arguments for get_fairness_day_dcg
posteriors = np.array([0.7, 0.5, 0.3, 0.6])  # 4 documents with Bernoulli probabilities between 0 and 1
alpha = 0.5  # Blend factor between fairness-aware and optimal ranking
v = None  # Will use default v from get_v inside the function
num_days = 100  # Number of days to sample rankings

ARGS = {
    'posteriors': posteriors,
    'alpha': alpha,
    'v': v,
    'num_days': num_days
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_mean_dcg Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("dd1133e2363da4d0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float64, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct arguments for get_mean_dcg
# The function expects:
# - sampled_rankings: a list of rankings (each ranking is an index array)
# - means: a list/array of mean values (one per document)
# - v_vec: a vector to dot product with

num_docs = 4
num_samples = 2

# Create means - one mean value per document
means = np.array([0.5, 1.2, 0.8, 0.3])

# Create v_vec - a vector to dot product with
v_vec = np.array([1.0, 2.0, 3.0, 4.0])

# Create sampled_rankings - list of permutations/rankings of document indices
# Each ranking is a list of indices into the documents
sampled_rankings = [
    [0, 1, 2, 3],  # First ranking
    [3, 2, 1, 0],  # Second ranking
]

ARGS = {
    "sampled_rankings": sampled_rankings,
    "means": means,
    "v_vec": v_vec,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_v Ran
ran, honoured the contract we drafted
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("b4908cbf65a88643")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    'num_docs': 10,
    'v_distr': 'expo',
    'v_beta': 1.1,
    'v_num1': 2,
    'v_gamma': 0.99,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
optimal_ranking Ran
ran, violated the contract we drafted
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("39d54a02d52fdcf6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Construct valid arguments for optimal_ranking
# The function takes 'means' as parameter and:
# 1. Adds random noise scaled by NOISE_MAGNITUDE to it
# 2. Sorts indices by negative noisy means (descending order)
# So 'means' needs to be array-like with numeric values

means = np.array([0.5, 0.2, 0.9, 0.1, 0.7])

ARGS = {
    "means": means
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (5,) — shape (5,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_ranking_bernoulli Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("fdfc93d23e7f4bbc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

ARGS = {
    "posteriors": np.array([0.3, 0.7, 0.2, 0.9])
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (4,) — shape (4,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_rankings Ran
ran; our contract draft was wrong, not the code
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("15f4255768a4cfa8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

np.random.seed(42)

posteriors = np.array([0.2, 0.5, 0.8, 0.1])

ARGS = {
    "posteriors": posteriors,
    "num_samples": 100
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compare_fairness_day_with_linprog Not yet run
unverified (harvested, no recorded run)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("f5cc0d9de7be2ff0")
How it ran

no invocation recorded.

get_linprog_coeffs_all_permutations Not yet run
unverified (harvested, no recorded run)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("d51b5a28d5e2f300")
How it ran

no invocation recorded.

plot_marginal_rank_distribution Not yet run
unverified (harvested, no recorded run)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("cd3c58440660f744")
How it ran

no invocation recorded.

plot_matrix Not yet run
unverified (harvested, no recorded run)
ashudeep/ranking-fairness-uncertainty/fairnessday_vs_linprog.py
code served (permissive licence) · get_code("b2c79a45a970607c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Fairness has emerged as an important consideration in algorithmic decision making. Unfairness occurs when an agent with higher merit obtains a worse outcome than an agent with lower merit. Our central point is that a primary cause of unfairness is uncertainty. A principal or algorithm making decisions never has access to the agents' true merit, and instead uses proxy features that only imperfectly predict merit (e.g., GPA, star ratings, recommendation letters). None of these ever fully capture an agent's merit; yet existing approaches have mostly been defining fairness notions directly based on observed features and outcomes. Our primary point is that it is more principled to acknowledge and model the uncertainty explicitly. The role of observed features is to give rise to a posterior distribution of the agents' merits. We use this viewpoint to define a notion of approximate fairness in ranking. We call an algorithm φ-fair (for φ ∈ [0, 1]) if it has the following property for all agents x and all k: if agent x is among the top k agents with respect to merit with probability at least ρ (according to the posterior merit distribution), then the algorithm places the agent among the top k agents in its ranking with probability at least φρ. We show how to compute rankings that optimally trade off approximate fairness against utility to the principal. In addition to the theoretical characterization, we present an empirical analysis of the potential impact of the approach in simulation studies. For real-world validation, we applied the approach in the context of a paper recommendation system that we built and fielded at the KDD 2020 conference.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2107.06720")
get_code_for_paper("2107.06720")
have("2107.06720")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2107.06720.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2107.06720.svg)](https://syntology.ai/paper/2107.06720)

Connect an agent — have() is free.