SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.08564 · 2020

Intra-Processing Methods for Debiasing Neural Networks

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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 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/2006.08564.json · badge: /api/ran/2006.08564.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
realityengines/post_hoc_debiasing canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
abacusai/intraprocessing_debiasing canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_bias Ran
ran; our contract draft was wrong, not the code
realityengines/post_hoc_debiasing/post_hoc_lib.py
code served (permissive licence) · get_code("53d8bc44e5112bfb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 small tensors for predictions, true labels, and privileged group indicator
# Using 10 samples to have enough data for different groups and labels
n_samples = 10

# y_pred: predicted probabilities or scores (continuous values between 0 and 1)
y_pred = torch.rand(n_samples)

# y_true: binary true labels (0 or 1)
y_true = torch.tensor([0, 1, 0, 1, 1, 0, 1, 0, 1, 0], dtype=torch.float32)

# priv: binary privileged group indicator (0 or 1)
priv = torch.tensor([1, 1, 0, 0, 1, 0, 1, 0, 1, 0], dtype=torch.float32)

# metric: one of the supported metrics
metric = 'spd'

ARGS = {
    'y_pred': y_pred,
    'y_true': y_true,
    'priv': priv,
    'metric': metric
}
Setup block drafted by
a language model, Claude Sonnet 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 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
compute_bias Ran
ran; our contract draft was wrong, not the code
abacusai/intraprocessing_debiasing/intraproc_celeba.py
code served (permissive licence) · get_code("aa041e2ad3437517")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 small tensors for predictions, true labels, and protected attribute
# y_pred: predicted probabilities/scores (continuous values between 0 and 1)
y_pred = torch.tensor([0.8, 0.3, 0.6, 0.9, 0.2, 0.7])

# y_true: binary ground truth labels (0 or 1)
y_true = torch.tensor([1.0, 0.0, 1.0, 1.0, 0.0, 0.0])

# prot: binary protected attribute indicator (0 or 1)
prot = torch.tensor([1.0, 1.0, 0.0, 0.0, 1.0, 0.0])

# metric: one of the supported bias metrics
metric = 'spd'  # could also be 'aod' or 'eod'

ARGS = {
    'y_pred': y_pred,
    'y_true': y_true,
    'prot': prot,
    'metric': metric
}
Setup block drafted by
a language model, Claude Sonnet 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 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_best_accuracy Ran
ran; our contract draft was wrong, not the code
realityengines/post_hoc_debiasing/post_hoc_lib.py
code served (permissive licence) · get_code("d3368b0f34abf978")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple, 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

torch.manual_seed(0)

# Create small binary classification ground truth and predictions
# y_true should be boolean or 0/1 values
# y_pred should be continuous values between 0 and 1 (probabilities)

y_true = torch.tensor([True, False, True, False, True, True])
y_pred = torch.tensor([0.8, 0.3, 0.9, 0.2, 0.6, 0.7])

# The function signature has *_ which means it accepts additional positional arguments
# but ignores them. We can pass empty or None values, or just not include them.

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred
}
Setup block drafted by
a language model, Claude Sonnet 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 tuple, ndim 1, dtype family float — a tuple 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
val_model Ran
ran, honoured the contract we drafted
realityengines/post_hoc_debiasing/post_hoc_lib.py
code served (permissive licence) · get_code("96d2e5b01c6f59f9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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)

# Build a simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(5, 1)
    
    def forward(self, x):
        return self.fc(x)

model = SimpleModel()

# Build a simple data loader (list of (inputs, labels) tuples)
# inputs: batch of 2, feature dim 5
# labels: batch of 2, with 3 columns (so we can index different columns)
loader = [
    (torch.randn(2, 5), torch.randn(2, 3)),
    (torch.randn(2, 5), torch.randn(2, 3)),
]

# Build a criterion function
def criterion(y_true, y_pred, y_prot, lam, bias_measure):
    # Simple dummy criterion that returns a scalar
    loss = torch.mean((y_true - y_pred) ** 2)
    bias = torch.mean(torch.abs(y_prot - y_pred))
    return loss + lam * bias

# Set indices
protected_index = 0
prediction_index = 1

# Set lambda
lam = 0.75

# Set bias measure
bias_measure = 'aod'

ARGS = {
    'model': model,
    'loader': loader,
    'criterion': criterion,
    'protected_index': protected_index,
    'prediction_index': prediction_index,
    'lam': lam,
    'bias_measure': bias_measure
}
Setup block drafted by
a language model, Claude Sonnet 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 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
val_model Ran
ran, honoured the contract we drafted
abacusai/intraprocessing_debiasing/intraproc_celeba.py
code served (permissive licence) · get_code("dd4f64a67087a214")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 0, dtype family float, shape () as a later run recorded it. 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, 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)

# Build a simple model
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc = nn.Linear(5, 3)
    
    def forward(self, x):
        return self.fc(x)

model = SimpleModel()

# Create a simple data loader (list of (inputs, labels) tuples)
# inputs: batch_size x input_dim (2 x 5)
# full_labels: batch_size x num_labels (2 x 3) - contains both prediction and protected labels
loader = [
    (torch.randn(2, 5), torch.randint(0, 2, (2, 3))),
    (torch.randn(2, 5), torch.randint(0, 2, (2, 3))),
]

# Simple criterion function that takes y_true, y_pred, y_prot
def criterion(y_true, y_pred, y_prot):
    # Simple binary cross entropy loss
    loss = nn.functional.binary_cross_entropy(y_pred, y_true)
    return loss

# Indices for which column in full_labels to use
protected_index = 1
prediction_index = 0

ARGS = {
    'model': model,
    'loader': loader,
    'criterion': criterion,
    'protected_index': protected_index,
    'prediction_index': prediction_index
}
Setup block drafted by
a language model, Claude Sonnet 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 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

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

As deep learning models become tasked with more and more decisions that impact human lives, such as criminal recidivism, loan repayment, and face recognition for law enforcement, bias is becoming a growing concern. Debiasing algorithms are typically split into three paradigms: pre-processing, in-processing, and post-processing. However, in computer vision or natural language applications, it is common to start with a large generic model and then fine-tune to a specific use-case. Pre- or in-processing methods would require retraining the entire model from scratch, while post-processing methods only have black-box access to the model, so they do not leverage the weights of the trained model. Creating debiasing algorithms specifically for this fine-tuning use-case has largely been neglected. In this work, we initiate the study of a new paradigm in debiasing research, intra-processing, which sits between in-processing and post-processing methods. Intra-processing methods are designed specifically to debias large models which have been trained on a generic dataset and fine-tuned on a more specific task. We show how to repurpose existing in-processing methods for this use-case, and we also propose three baseline algorithms: random perturbation, layerwise optimization, and adversarial fine-tuning. All of our techniques can be used for all popular group fairness measures such as equalized odds or statistical parity difference. We evaluate these methods across three popular datasets from the AIF360 toolkit, as well as on the CelebA faces dataset. Our code is available at https://github.com/abacusai/intraprocessing_debiasing.

For agents

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

get_harvested_code_for_paper("2006.08564")
get_code_for_paper("2006.08564")
have("2006.08564")

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

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

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

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

Connect an agent — have() is free.