SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.13219 · ICML · 2021

Towards Understanding and Mitigating Social Biases in Language Models

Paul Liang, Ruslan Salakhutdinov, Louis-Philippe Morency, Chiyu Wu

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 (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 5 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2106.13219.json · badge: /api/ran/2106.13219.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
pliang279/LM_bias canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
doPCA Ran
ran on a synthesized input
pliang279/LM_bias/src/local_bias/utils.py
code served (permissive licence) · get_code("5b1c7ec55f83eba3")
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 PCA. 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 numpy as np

torch.manual_seed(0)

# Create pairs of small tensors
# Each pair is (a, b) where a and b are tensors that will be normalized
pair1_a = torch.randn(4, dtype=torch.float32)
pair1_b = torch.randn(4, dtype=torch.float32)
pair2_a = torch.randn(4, dtype=torch.float32)
pair2_b = torch.randn(4, dtype=torch.float32)

pairs = [
    (pair1_a, pair1_b),
    (pair2_a, pair2_b),
]

ARGS = {
    "pairs": pairs,
    "num_components": 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PCA — a PCA output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PCA 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
doPCA Ran
ran on a synthesized input
pliang279/LM_bias/src/data_preprocess/data_preprocess.py
code served (permissive licence) · get_code("47b050cb9d471720")
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 PCA. 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.decomposition import PCA

# Create sample pairs of numpy arrays
# The function expects pairs to be tuples of (a, b) where a and b are array-like
# It computes center, normalizes, and stacks them into a matrix
# The matrix will have shape (len(pairs)*2, feature_dim)

np.random.seed(0)

# Create 2 pairs of 4-dimensional vectors
pair1_a = np.random.randn(4)
pair1_b = np.random.randn(4)
pair2_a = np.random.randn(4)
pair2_b = np.random.randn(4)

pairs = [
    (pair1_a, pair1_b),
    (pair2_a, pair2_b)
]

ARGS = {
    "pairs": pairs,
    "num_components": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PCA — a PCA output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PCA 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
drop Ran
ran on a synthesized input
pliang279/LM_bias/src/global_bias/generate_full_sentence.py
code served (permissive licence) · get_code("80c3111674e64a2c")
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 1, dtype family float, 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 torch
import numpy as np

torch.manual_seed(0)

# The function drop(u, v) performs:
# u - v * u.dot(v) / v.dot(v)
# This requires:
# - u: a vector-like object with .dot() method and subtraction/multiplication support
# - v: a vector-like object with .dot() method and division support
# Both u and v should be torch tensors or numpy arrays with compatible shapes

u = torch.randn(4)
v = torch.randn(4)

ARGS = {
    "u": u,
    "v": v,
}
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 Tensor, ndim 1, dtype family float, 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
drop_bias Ran
ran on a synthesized input
pliang279/LM_bias/src/local_bias/utils.py
code served (permissive licence) · get_code("470a1bb6e1c053aa")
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 float, 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

# Construct valid arguments for drop_bias(u, v)
# The function expects two numpy arrays where:
# - u is a vector to project
# - v is a vector to project onto

# Create small numpy arrays
u = np.array([1.0, 2.0, 3.0, 4.0])
v = np.array([1.0, 0.0, 0.0, 0.0])

ARGS = {
    "u": u,
    "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 ndarray, ndim 1, dtype family float, 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
dropspace Ran
ran, violated the contract we drafted
pliang279/LM_bias/src/local_bias/utils.py
code served (permissive licence) · get_code("6799d5b5e14819a0")
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 (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

# u is a vector that gets subtracted from
# V is a matrix where we compute projections along its rows
# The function projects u onto the subspace spanned by V's rows, then subtracts it

# Create small test arrays
u = np.array([1.0, 2.0, 3.0, 4.0])  # 1D vector of dimension 4

# V should be a 2D array where each row is a basis vector
# Using shape (3, 4) - 3 basis vectors of dimension 4
V = np.array([
    [1.0, 0.0, 0.0, 0.0],
    [0.0, 1.0, 0.0, 0.0],
    [0.5, 0.5, 0.0, 0.0]
], dtype=np.float64)

ARGS = {
    "u": u,
    "V": V
}
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 1, dtype family float, 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
mean_ds Ran
ran; our contract draft was wrong, not the code
pliang279/LM_bias/src/global_bias/generate_full_sentence.py
pointer only (licence: MIT); the stored copy get_code serves, from yegcjs/diffusionllm, is pointer only (licence: NONE) · get_code("c03f38aaa6f139a4")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yegcjs/diffusionllm, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

split_dataset Ran
ran on a synthesized input
pliang279/LM_bias/src/data_preprocess/context_nullspace_projection.py
code served (permissive licence) · get_code("992ba37e8f011975")
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 numpy as np
import sklearn

# Create small feature arrays for each category
# Using distinct sizes for different dimensions
male_feat = np.random.randn(5, 10).astype(np.float32)  # 5 samples, 10 features
female_feat = np.random.randn(4, 10).astype(np.float32)  # 4 samples, 10 features
neut_feat = np.random.randn(3, 10).astype(np.float32)  # 3 samples, 10 features

ARGS = {
    'male_feat': male_feat,
    'female_feat': female_feat,
    'neut_feat': neut_feat,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
top_k_top_p_filtering Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
pliang279/LM_bias/src/global_bias/generate_full_sentence.py
code served (permissive licence) · get_code("cf42150195c933b4")
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.functional as F

torch.manual_seed(0)

# Create a small batch of logits: (batch_size=2, vocab_size=4)
logits = torch.randn(2, 4)

ARGS = {
    "logits": logits,
    "top_k": 2,
    "top_p": 0.9,
    "filter_value": -float('Inf'),
    "min_tokens_to_keep": 1,
}
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
bias_subspace Not yet run
unverified (harvested, no recorded run)
pliang279/LM_bias/src/data_preprocess/data_preprocess.py
code served (permissive licence) · get_code("f9953b5f99184573")
How it ran

no invocation recorded.

debias_effect_analysis Not yet run
unverified (harvested, no recorded run)
pliang279/LM_bias/src/data_preprocess/context_nullspace_projection.py
code served (permissive licence) · get_code("9968a9c17ca67ba8")
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, 3 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 7 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
top_k_top_p_filtering 8 other papers
7 later, 1 undated
2406.06525 (2024-06)
Autoregressive Model Beats Diffusion: Llama for Scalable Image Generation
2410.02705 (2024-10)
ControlAR: Controllable Image Generation with Autoregressive Models
2411.15867 (2024-11)
PanoLlama: Generating Endless and Coherent Panoramas with Next-Token-Prediction LLMs
and 5 more not named here
dropspace 1 other paper
1 dated earlier
2007.08100 (2020-07)
Towards Debiasing Sentence Representations
mean_ds 1 other paper
1 later
2308.12219 (2023-08)
Diffusion Language Models Can Perform Many Tasks with Scaling and Instruction-Finetuning

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

Repositories linked to this paper

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

Abstract

Warning: this paper contains model outputs that may be offensive or upsetting. As machine learning methods are deployed in realworld settings such as healthcare, legal systems, and social science, it is crucial to recognize how they shape social biases and stereotypes in these sensitive decision-making processes. Among such real-world deployments are large-scale pretrained language models (LMs) that can be potentially dangerous in manifesting undesirable representational biases -harmful biases resulting from stereotyping that propagate negative generalizations involving gender, race, religion, and other social constructs. As a step towards improving the fairness of LMs, we carefully define several sources of representational biases before proposing new benchmarks and metrics to measure them. With these tools, we propose steps towards mitigating social biases during text generation. Our empirical results and human evaluation demonstrate effectiveness in mitigating bias while retaining crucial contextual information for highfidelity text generation, thereby pushing forward the performance-fairness Pareto frontier.

For agents

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

get_harvested_code_for_paper("2106.13219")
get_code_for_paper("2106.13219")
have("2106.13219")

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

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

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

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

Connect an agent — have() is free.