SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.10837 · NeurIPS · 2022

On Learning Fairness and Accuracy on Multiple Subgroups

Boyu Wang, Qi Chen, Changjian Shui, Gezheng Xu, Jiaqi Li, Charles Ling, Tal Arbel, Christian Gagné

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 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; 3 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 2 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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/2210.10837.json · badge: /api/ran/2210.10837.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
xugezheng/fams canonical (classifier label)
classifier basis: classifier_2025
6 ran · 4 no recorded run
FunctionStatusWhere it lives
add_noise Ran
ran; our contract draft was wrong, not the code
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("bc31f0e26e8ea404")
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 Tensor, ndim 2, dtype family float, shape (2, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small parameter tensor (2x4)
param = nn.Parameter(torch.randn(2, 4))

# Standard deviation for noise
std = 0.1

ARGS = {
    "param": param,
    "std": std
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 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_KLD Ran
ran, honoured the contract we drafted
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("1874c147a89b1a91")
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 int, ndim 0, dtype family int, 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 torch
import torch.nn as nn
from functools import reduce

torch.manual_seed(0)

# Helper functions from the provided code
def get_param(shape):
    if isinstance(shape, int):
        shape = (shape,)
    return nn.Parameter(torch.empty(*shape))

def list_mult(L):
    return reduce(lambda x, y: x * y, L)

# Define StochasticLayer class
class StochasticLayer(nn.Module):
    def __init__(self, weights_shape, bias_size=None):
        super().__init__()
        self.use_bias = bias_size is not None
        self.eps_std = 0.0
        self.create_stochastic_layer(weights_shape, bias_size)
        self.operation = self._dummy_operation
    
    def _dummy_operation(self, x, weights, bias=None):
        # Dummy operation that returns appropriate shape
        return torch.ones(x.shape[0], 2)
    
    def create_stochastic_layer(self, weights_shape, bias_size):
        self.weights_shape = weights_shape
        self.weights_count = list_mult(weights_shape)
        if bias_size is not None:
            self.weights_count = self.weights_count + bias_size
        self.w_mu = get_param(weights_shape)
        self.w_log_var = get_param(weights_shape)
        self.w = {'mean': self.w_mu, 'log_var': self.w_log_var}
        if bias_size is not None:
            self.b_mu = get_param(bias_size)
            self.b_log_var = get_param(bias_size)
            self.b = {'mean': self.b_mu, 'log_var': self.b_log_var}
    
    def forward(self, x):
        return x

# Build prior model with StochasticLayer
prior_model = nn.Sequential(
    StochasticLayer(weights_shape=(3, 4), bias_size=2)
)

# Build post model with StochasticLayer
post_model = nn.Sequential(
    StochasticLayer(weights_shape=(3, 4), bias_size=2)
)

# Create parameter object with required attributes
class ParamConfig:
    def __init__(self):
        self.kappa_post = 0.1
        self.divergence_type = 'KL'

prm = ParamConfig()

# Define ARGS dictionary
ARGS = {
    'prior_model': prior_model,
    'post_model': post_model,
    'prm': prm,
    'noised_prior': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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_dvrg_element Ran
ran, honoured the contract we drafted
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("65eda595a079e970")
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 Tensor, 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 torch

torch.manual_seed(0)

# Create a small parameter/config object with required attributes
class ParamConfig:
    def __init__(self, kappa_post=0.1, divergence_type='KL'):
        self.kappa_post = kappa_post
        self.divergence_type = divergence_type

# Create small Gaussian distribution dicts with log_var and mean tensors
post = {
    'log_var': torch.randn(2, 4),
    'mean': torch.randn(2, 4)
}

prior = {
    'log_var': torch.randn(2, 4),
    'mean': torch.randn(2, 4)
}

prm = ParamConfig(kappa_post=0.1, divergence_type='KL')

ARGS = {
    'post': post,
    'prior': prior,
    'prm': prm,
    'noised_prior': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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_param Ran
ran, honoured the contract we drafted
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("848d9716cf25c800")
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 Parameter, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The function get_param takes a 'shape' parameter
# It can be either an int or a tuple
# It creates an nn.Parameter with torch.empty(*shape)

# Test case 1: shape as an int
shape_int = 5

# Test case 2: shape as a tuple
shape_tuple = (3, 4, 2)

# We'll use the int case for ARGS
ARGS = {
    "shape": 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Parameter, ndim 1, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 1, which disagrees with the fixture run
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
inference Ran
ran; our contract draft was wrong, not the code
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("a593b3d91b959af8")
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; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class PrmConfig:
    def __init__(self):
        self.n_MC = 5

model = SimpleModel()
inputs = [[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]
prm = PrmConfig()

ARGS = {
    "model": model,
    "inputs": inputs,
    "prm": prm,
    "n_Mc": 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — 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 — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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
list_mult Ran
ran, violated the contract we drafted
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("661d725e275b6e53")
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 int, ndim 0, dtype family int, 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 torch
import numpy as np
from functools import reduce

torch.manual_seed(0)

# The function list_mult takes a list L and multiplies all elements together
# using reduce with a lambda function that multiplies x and y

# Create a simple list of numbers to multiply
L = [2, 3, 4, 5]

ARGS = {
    "L": L
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
StochasticLayer Not yet run
unverified (harvested, no recorded run)
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("c78c54e45045899d")
How it ran

no invocation recorded.

model_activate Not yet run
unverified (harvested, no recorded run)
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("db791e29bc69fe59")
How it ran

no invocation recorded.

model_freeze Not yet run
unverified (harvested, no recorded run)
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("7cd40db042e38f54")
How it ran

no invocation recorded.

train_one_task Not yet run
unverified (harvested, no recorded run)
xugezheng/fams/engine/fair_training.py
code served (permissive licence) · get_code("c818c85b714bf469")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 8 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.

FunctionAlso present inEarliest-datedOthers named
get_param
brick of this paper's assembly: helper
1 other paper
1 later
2402.04054 (2024-02)
More Flexible PAC-Bayesian Meta-Learning by Learning Learning Algorithms
list_mult
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2402.04054 (2024-02)
More Flexible PAC-Bayesian Meta-Learning by Learning Learning Algorithms

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-23.

Repositories linked to this paper

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

Abstract

We propose an analysis in fair learning that preserves the utility of the data while reducing prediction disparities under the criteria of group sufficiency. We focus on the scenario where the data contains multiple or even many subgroups, each with limited number of samples. As a result, we present a principled method for learning a fair predictor for all subgroups via formulating it as a bilevel objective. In the lower-level, the subgroup-specific predictors are learned through a small amount of data and the fair predictor. In the upper-level, the fair predictor is updated to be close to all subgroup specific predictors. We further prove that such a bilevel objective can effectively control the group sufficiency and generalization error. We evaluate the proposed framework on real-world datasets. Empirical evidence suggests the consistently improved fair predictions, as well as the comparable accuracy to the baselines.

For agents

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

get_harvested_code_for_paper("2210.10837")
get_code_for_paper("2210.10837")
have("2210.10837")

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

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

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

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

Connect an agent — have() is free.