SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.21017 · NeurIPS · 2025

Fair Representation Learning with Controllable High Confidence Guarantees via Adversarial Inference

Philip Thomas, Yuhong Luo, Austin Hoag, Xintong Wang, Przemyslaw Grabowicz

arXiv · PDF · Open in the Atlas

Code that ran

8 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (7 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 2 no recorded run), measured 2026-11-23; 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/2510.21017.json · badge: /api/ran/2510.21017.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
JamesLuoyh/FRG community
Papers with Code archive
8 ran · 2 no recorded run
FunctionStatusWhere it lives
DecoderMLP Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("3e237d6ff3712f73")
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 an instance of its own class, DecoderMLP: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
from torch.nn import Sequential, Module, Linear, ReLU, Dropout, BCELoss, CrossEntropyLoss, Sigmoid, Tanh, Softmax

torch.manual_seed(0)

# Define ARGS dict with all parameters for DecoderMLP.__init__
ARGS = {
    "in_features": 4,
    "hidden_dim": 8,
    "latent_dim": 3,
    "activation": ReLU()
}
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 DecoderMLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DecoderMLP 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
DecoderMLPMulticlass Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("9fc360c1163519cb")
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 an instance of its own class, DecoderMLPMulticlass: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
from torch.nn import Sequential, Module, Linear, ReLU, Dropout, BCELoss, CrossEntropyLoss, Sigmoid, Tanh, Softmax

torch.manual_seed(0)

# Define the DecoderMLPMulticlass class
class DecoderMLPMulticlass(Module):
    """
     Single hidden layer MLP used for decoding.
    """

    def __init__(self, in_features, hidden_dim, latent_dim, activation):
        super().__init__()
        self.lin_encoder = Linear(in_features, hidden_dim)
        self.activation = activation
        self.lin_out = Linear(hidden_dim, latent_dim)
        self.softmax = Softmax(dim=1)

    def forward(self, inputs):
        x = self.lin_encoder(inputs)
        x = self.activation(x)
        return self.softmax(self.lin_out(x))


# Create arguments
in_features = 8
hidden_dim = 6
latent_dim = 4
activation = ReLU()

ARGS = {
    "in_features": in_features,
    "hidden_dim": hidden_dim,
    "latent_dim": latent_dim,
    "activation": activation,
}
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 DecoderMLPMulticlass — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DecoderMLPMulticlass 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
SeldonianModel Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("e46aa1a893ceddb1")
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 an instance of its own class, SeldonianModel: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# SeldonianModel.__init__ takes only 'self' and has an empty body
# No parameters need to be provided beyond self
# The class is a simple parent class with no initialization logic

ARGS = {}
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 SeldonianModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SeldonianModel 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
SupervisedModel Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("aa6876aad1214293")
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 an instance of its own class, SupervisedModel: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn

torch.manual_seed(0)

class SeldonianModel(object):
    def __init__(self):
        """ Parent class for all machine learning models """
        pass

class SupervisedModel(SeldonianModel):
    def __init__(self):
        """ Parent class for all supervised learning models """
        super().__init__()

ARGS = {}
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 SupervisedModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SupervisedModel 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
VFAELoss Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("d16db87a4234d8c9")
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 an instance of its own class, VFAELoss: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch.nn import Module, BCELoss, CrossEntropyLoss

torch.manual_seed(0)

# Create the VFAELoss instance for inspection
class VFAELoss(Module):
    """
    Loss function for training the Variational Fair Auto Encoder.
    """

    def __init__(self, alpha=1.0, beta=0.0, mmd_dim=0, mmd_gamma=1.0):
        super().__init__()
        self.alpha = alpha
        self.beta = beta
        self.bce = BCELoss(reduce='mean')
        self.ce = CrossEntropyLoss()

    def forward(self, y_pred, y_true):
        """

        :param y_pred: dict containing the vfae outputs
        :param y_true: dict of ground truth labels for x, s and y
        :return: the loss value as Tensor
        """
        import torch.nn.functional as F
        x, s, y = (y_true['x'], y_true['s'], y_true['y'])
        device = y.device
        supervised_loss = self.bce(y_pred['y_decoded'], y.to(device))
        reconstruction_loss = F.binary_cross_entropy(y_pred['x_decoded'], x, reduction='sum')
        zeros = torch.zeros_like(y_pred['z1_enc_logvar'])
        kl_loss_z1 = self._kl_gaussian(y_pred['z1_enc_logvar'], y_pred['z1_enc_mu'], zeros, zeros)
        loss = reconstruction_loss + kl_loss_z1
        loss /= len(y)
        loss += self.alpha * supervised_loss
        return loss

    @staticmethod
    def _kl_gaussian(logvar_a, mu_a, logvar_b, mu_b):
        """
        Average KL divergence between two (multivariate) gaussians based on their mean and standard deviation for a
        batch of input samples. https://arxiv.org/abs/1405.2664

        :param logvar_a: standard deviation a
        :param mu_a: mean a
        :param logvar_b: standard deviation b
        :param mu_b: mean b
        :return: kl divergence, mean averaged over batch dimension.
        """
        per_example_kl = logvar_b - logvar_a - 1 + (logvar_a.exp() + (mu_a - mu_b).square()) / logvar_b.exp()
        kl = 0.5 * torch.sum(per_example_kl, dim=1)
        return kl.sum()


# Create sample tensors for a batch of size 2
batch_size = 2
latent_dim = 4
x_dim = 5
y_dim = 3

# y_pred dict with required keys for forward pass
y_pred = {
    'y_decoded': torch.sigmoid(torch.randn(batch_size, y_dim)),
    'x_decoded': torch.sigmoid(torch.randn(batch_size, x_dim)),
    'z1_enc_logvar': torch.randn(batch_size, latent_dim),
    'z1_enc_mu': torch.randn(batch_size, latent_dim),
}

# y_true dict with required keys
y_true = {
    'x': torch.randint(0, 2, (batch_size, x_dim)).float(),
    's': torch.randint(0, 2, (batch_size,)).long(),
    'y': torch.randint(0, 2, (batch_size, y_dim)).float(),
}

# Define ARGS dict with all parameters
ARGS = {
    'alpha': 1.0,
    'beta': 0.0,
    'mmd_dim': 0,
    'mmd_gamma': 1.0,
}
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 VFAELoss — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VFAELoss 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
VariationalFairAutoEncoder Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("642a77ec47375873")
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 an instance of its own class, VariationalFairAutoEncoder: the run constructed the object and did not call it, so no result was computed. 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 torch
import torch.nn as nn
from torch.nn import ReLU, Dropout

torch.manual_seed(0)

ARGS = {
    'x_dim': 4,
    's_dim': 2,
    'y_dim': 3,
    'z1_enc_dim': 8,
    'z2_enc_dim': 8,
    'z1_dec_dim': 8,
    'x_dec_dim': 8,
    'z_dim': 5,
    'dropout_rate': 0.1,
    'mi_version': 'v1',
    'alpha_sup': 1.0,
    'activation': ReLU()
}
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 VariationalFairAutoEncoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VariationalFairAutoEncoder 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
VariationalMLP Ran
ran on a synthesized input · constructed an object; no result was computed
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("ebe51fed0813e0be")
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 an instance of its own class, VariationalMLP: the run constructed the object and did not call it, so no result was computed. 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 torch
from torch.nn import Sequential, Module, Linear, ReLU, Dropout, BCELoss, CrossEntropyLoss, Sigmoid, Tanh, Softmax

torch.manual_seed(0)

# Define the required arguments for VariationalMLP
ARGS = {
    "in_features": 4,
    "hidden_dim": 8,
    "z_dim": 3,
    "activation": ReLU()
}
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 VariationalMLP — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a VariationalMLP 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
pytorch_predict Ran
ran; our contract draft was wrong, not the code
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("495b2c3d0a6448d8")
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 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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

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

class SupervisedPytorchBaseModel:
    def __init__(self):
        self.pytorch_model = SimpleModel()
        self.params_updated = False
        self.vae_loss = None
        self.mi_sz = None
        self.pred = None
        self.y_prob = None
    
    def update_model_params(self, theta, **kwargs):
        # Convert theta (numpy) to model weights
        offset = 0
        for param in self.pytorch_model.parameters():
            param_size = param.numel()
            param.data = torch.from_numpy(theta[offset:offset + param_size].reshape(param.shape)).float()
            offset += param_size
    
    def forward_pass(self, X, **kwargs):
        X_tensor = torch.from_numpy(X).float()
        output = self.pytorch_model(X_tensor)
        # Return loss, mi_sz, y_prob as tensors
        loss = output.sum()
        mi_sz = torch.tensor(0.5)
        y_prob = torch.softmax(output, dim=1)
        
        # Set pred attribute for the function to access
        self.pytorch_model.pred = output
        
        return loss, mi_sz, y_prob

# Create test data
theta = np.random.randn(10).astype(np.float32)  # Flattened model parameters
X = np.random.randn(2, 4).astype(np.float32)  # Batch size 2, feature dim 4
model = SupervisedPytorchBaseModel()

ARGS = {
    'theta': theta,
    'X': X,
    'model': model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd, 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
PytorchADVDP Not yet run
unverified (harvested, no recorded run)
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("5dbdd6b880c4905c")
How it ran

no invocation recorded.

SupervisedPytorchBaseModel Not yet run
unverified (harvested, no recorded run)
JamesLuoyh/FRG/seldonian/models/pytorch_advdp.py
code served (permissive licence) · get_code("0435f41e634e876b")
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, 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 10 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-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

Representation learning is increasingly applied to generate representations that generalize well across multiple downstream tasks. Ensuring fairness guarantees in representation learning is crucial to prevent unfairness toward specific demographic groups in downstream tasks. In this work, we formally introduce the task of learning representations that achieve high-confidence fairness. We aim to guarantee that demographic disparity in every downstream prediction remains bounded by a user-defined error threshold ε, with controllable high probability. To this end, we propose the Fair Representation learning with high-confidence Guarantees (FRG) framework, which provides these high-confidence fairness guarantees by leveraging an optimized adversarial model. We empirically evaluate FRG on three real-world datasets, comparing its performance to six state-of-the-art fair representation learning methods. Our results demonstrate that FRG consistently bounds unfairness across a range of downstream models and tasks. The source code for FRG is available at: https://github.com/JamesLuoyh/FRG. Fair representation learning (FRL) has been studied for at least a decade [75]. While a stream of FRL studies optimizing the representations for a specific downstream task [10,11,24,51,62,67,74,77]. numerous FRL methods learn general representations [2,30,52] that are fair, even when downstream

For agents

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

get_harvested_code_for_paper("2510.21017")
get_code_for_paper("2510.21017")
have("2510.21017")

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

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

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

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

Connect an agent — have() is free.