SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.08571 · NeurIPS · 2024

Multi-Group Proportional Representation in Retrieval

Flavio Calmon, Claudio Mayrink Verdun, Alex Oesterling, Carol Long, Alexander Glynn, Lucas Paes, Sajani Vithana, Martina Cardone

arXiv · PDF · Open in the Atlas

Code that ran

5 of 5 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 0 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/2407.08571.json · badge: /api/ran/2407.08571.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
alex-oesterling/multigroup-proportional-representation canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
RunlongYu/BPR_MPR reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
argmax_probe_labels Ran
ran, violated the contract we drafted
alex-oesterling/multigroup-proportional-representation/experiments/benchmark_retrieval.py
code served (permissive licence) · get_code("beaea7ef32f3d733")
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) and returned ndarray, ndim 2, dtype family float, shape (2, 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

# Create probe_embeds: shape (batch_size, embedding_dim)
# The function expects:
# - Column 0: some embedding values
# - Column 1: age values (will be thresholded at 0.5)
# - Columns 2+: race logits (will be argmaxed)
# Using shape (2, 5) for batch_size=2, embedding_dim=5

probe_embeds = np.array([
    [0.1, 0.3, 0.9, 0.2, 0.1],  # First sample: age<0.5, race argmax at index 0
    [0.2, 0.7, 0.1, 0.8, 0.3],  # Second sample: age>0.5, race argmax at index 1
], dtype=np.float32)

ARGS = {
    "probe_embeds": probe_embeds
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 (2, 5) — shape (2, 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
get_argsup Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
alex-oesterling/multigroup-proportional-representation/mpr/mpr.py
code served (permissive licence) · get_code("6d935dda756f725c")
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) and returned LinearRegression. The image it ran in was not recorded. If your copy returns the same type 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
from sklearn.linear_model import LinearRegression

# Create a small dataset with shape (5, 3)
dataset = np.random.randn(5, 3).astype(np.float32)

# Create a small curation set with shape (2, 3)
curation_set = np.random.randn(2, 3).astype(np.float32)

# Create indices array with shape (5,) containing binary values
indices = np.array([1, 0, 1, 0, 1], dtype=np.float32)

# Create a sklearn regressor
sklearn_regressor = LinearRegression()

ARGS = {
    "dataset": dataset,
    "curation_set": curation_set,
    "indices": indices,
    "sklearn_regressor": sklearn_regressor,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LinearRegression — a LinearRegression output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LinearRegression output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
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_top_embeddings_labels_ids Ran
ran; our contract draft was wrong, not the code
alex-oesterling/multigroup-proportional-representation/experiments/benchmark_retrieval.py
code served (permissive licence) · get_code("7f4ffc901786396d")
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) and returned tuple. The image it ran in was not recorded. If your copy returns the same type 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
import torch
import torch.nn as nn
from unittest.mock import Mock, patch, MagicMock
import tempfile
import os

torch.manual_seed(0)

# Create a mock dataset
class MockDataset:
    def __init__(self):
        self.img_paths = ['image1.jpg', 'image2.jpg', 'image3.jpg', 'image4.jpg']
        self.labels = torch.tensor([
            [1.0, 0.0, 1.0],
            [0.0, 1.0, 0.0],
            [1.0, 1.0, 0.0],
            [0.0, 0.0, 1.0]
        ])

dataset = MockDataset()

# Create mock query
query = "test_query"

# Create mock embedding model name
embedding_model = "test_model"

# Create temporary directory structure with mock files
tmpdir = tempfile.mkdtemp()
embed_path = os.path.join(tmpdir, 'embeddings')
os.makedirs(embed_path, exist_ok=True)

# Create subdirectory for non-occupations case
datadir_path = os.path.join(embed_path, 'test_datadir', embedding_model, query)
os.makedirs(datadir_path, exist_ok=True)

# Create mock embedding files
embeddings_data = np.random.randn(4, 128).astype(np.float32)
probe_labels_data = np.array([0, 1, 0, 1])
np.save(os.path.join(datadir_path, 'embeds.npy'), embeddings_data)
np.save(os.path.join(datadir_path, 'probe_labels.npy'), probe_labels_data)

# Create images.txt file
with open(os.path.join(datadir_path, 'images.txt'), 'w') as f:
    f.write('image1\n')
    f.write('image2\n')
    f.write('image3\n')
    f.write('image4\n')

# Create mock args
class MockArgs:
    def __init__(self):
        self.embed_path = embed_path

args = MockArgs()

# Define datadir (not 'occupations' to avoid the glob dependency)
datadir = 'test_datadir'

ARGS = {
    'dataset': dataset,
    'query': query,
    'embedding_model': embedding_model,
    'datadir': datadir,
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
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
mpr Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
alex-oesterling/multigroup-proportional-representation/mpr/mpr.py
code served (permissive licence) · get_code("21244d91823a0516")
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) and returned float32, 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
from sklearn.linear_model import LinearRegression

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

# Create small dataset with shape (5, 3) - 5 samples, 3 features
dataset = np.random.randn(5, 3).astype(np.float32)

# Create small curation_set with shape (4, 3) - 4 samples, 3 features
curation_set = np.random.randn(4, 3).astype(np.float32)

# Create indices array with shape (5,) - binary indicators for dataset samples
# k = np.sum(indices) should be > 0
indices = np.array([1.0, 0.0, 1.0, 0.0, 1.0], dtype=np.float32)

# Create a sklearn regressor that has fit() and predict() methods
sklearn_regressor = LinearRegression()

# Construct ARGS dictionary
ARGS = {
    "dataset": dataset,
    "curation_set": curation_set,
    "indices": indices,
    "sklearn_regressor": sklearn_regressor,
    "return_cx": False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, 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
pre_handel Ran
ran; our contract draft was wrong, not the code
RunlongYu/BPR_MPR/BPR.py
code served (permissive licence) · get_code("f0c7bac63b048953")
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) and returned ndarray, ndim 1, dtype family float, shape (6,) 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 torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - set: a dict where keys are user indices (u), values are lists of item indices (j)
# - predict: a list/array that gets modified in-place
# - item_count: an integer representing total number of items

# The function iterates through set.keys() and set[u] values
# It accesses predict with index (u - 1) * item_count + j - 1
# It sets predict values to 0

# Create a small example:
# 2 users, 3 items
item_count = 3
num_users = 2

# set: dict mapping user index to list of item indices
# User 1 (key=1) interacted with items [1, 2]
# User 2 (key=2) interacted with items [2, 3]
set_dict = {
    1: [1, 2],
    2: [2, 3]
}

# predict: array large enough to hold all user-item combinations
# Size needed: max((u-1) * item_count + j - 1) for all u, j
# For u=2, j=3: (2-1)*3 + 3 - 1 = 3 + 2 = 5, so we need at least 6 elements
predict = np.ones(num_users * item_count, dtype=np.float32)

ARGS = {
    "set": set_dict,
    "predict": predict,
    "item_count": item_count
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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 float, shape (6,) — shape (6,) 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

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 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 5 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

Image search and retrieval tasks can perpetuate harmful stereotypes, erase cultural identities, and amplify social disparities. Current approaches to mitigate these representational harms balance the number of retrieved items across population groups defined by a small number of (often binary) attributes. However, most existing methods overlook intersectional groups determined by combinations of group attributes, such as gender, race, and ethnicity. We introduce Multi-Group Proportional Representation (MPR), a novel metric that measures representation across intersectional groups. We develop practical methods for estimating MPR, provide theoretical guarantees, and propose optimization algorithms to ensure MPR in retrieval. We demonstrate that existing methods optimizing for equal and proportional representation metrics may fail to promote MPR. Crucially, our work shows that optimizing MPR yields more proportional representation across multiple intersectional groups specified by a rich function class, often with minimal compromise in retrieval accuracy. Code is provided at https://github.com/ alex-oesterling/multigroup-proportional-representation.

For agents

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

get_harvested_code_for_paper("2407.08571")
get_code_for_paper("2407.08571")
have("2407.08571")

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

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

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

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

Connect an agent — have() is free.