SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.09371 · 2022

Is BERT Robust to Label Noise? A Study on Learning with Noisy Labels in Text Classification

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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, 0 violated it and 6 have no contract verdict; 0 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/2204.09371.json · badge: /api/ran/2204.09371.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
uds-lsv/bert-lnl canonical (classifier label)
classifier basis not recorded on the link
6 ran · 0 no recorded run
FunctionStatusWhere it lives
get_training_validation_set Ran
ran on a synthesized input
uds-lsv/bert-lnl/loading_utils.py
code served (permissive licence) · get_code("77fa1f9b92dda266")
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, 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 os
import numpy as np
import pickle
import torch
from unittest.mock import MagicMock, patch
import tempfile
import shutil

torch.manual_seed(0)

# Create a temporary directory structure for the test
temp_dir = tempfile.mkdtemp()
data_root = temp_dir
dataset_name = 'test_dataset'
dataset_dir = os.path.join(data_root, dataset_name)
txt_data_dir = os.path.join(dataset_dir, 'txt_data')
bert_preprocessed_dir = os.path.join(dataset_dir, 'bert_preprocessed')
val_indices_dir = os.path.join(dataset_dir, 'val_indices')

os.makedirs(txt_data_dir, exist_ok=True)
os.makedirs(bert_preprocessed_dir, exist_ok=True)
os.makedirs(val_indices_dir, exist_ok=True)

# Create dummy text files
train_txt_path = os.path.join(txt_data_dir, 'train.txt')
with open(train_txt_path, 'w', encoding='utf-8') as f:
    f.write("hello world test\n")
    f.write("another document here\n")

# Create dummy label files
train_labels_path = os.path.join(txt_data_dir, 'train_labels.pickle')
with open(train_labels_path, 'wb') as f:
    pickle.dump([0, 1], f)

# Create validation indices file
val_indices_path = os.path.join(val_indices_dir, f'{dataset_name}_val_indices.pickle')
with open(val_indices_path, 'wb') as f:
    pickle.dump([1], f)

# Create a mock tokenizer
class MockTokenizer:
    def __init__(self):
        self.cls_token_id = 101
        self.sep_token_id = 102
        self.vocab = {
            'hello': 7592,
            'world': 2088,
            'test': 3231,
            'another': 2178,
            'document': 3231,
            'here': 2272,
            '[CLS]': 101,
            '[SEP]': 102,
        }
    
    def tokenize(self, text):
        return text.split()
    
    def convert_tokens_to_ids(self, tokens):
        return [self.vocab.get(token, 100) for token in tokens]

tokenizer = MockTokenizer()

# Create a mock logger
class MockLogger:
    def info(self, msg):
        pass

logger = MockLogger()

# Create args object
class Args:
    def __init__(self):
        self.data_root = data_root
        self.dataset = dataset_name
        self.truncate_mode = 'last'
        self.max_sen_len = 512
        self.special_token_offsets = 2
        self.gen_val = True

args = Args()

# For random state
r_state = np.random.RandomState(42)

# Number of classes
num_classes = 2

# has_val flag
has_val = False

ARGS = {
    'args': args,
    'logger': logger,
    'tokenizer': tokenizer,
    'r_state': r_state,
    'has_val': has_val,
    'num_classes': num_classes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — 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
load_config Ran
ran on a synthesized input
uds-lsv/bert-lnl/utils.py
code served (permissive licence) · get_code("1b41a800d7b663c8")
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 dict. 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)

class Args:
    def __init__(self):
        self.bert_dropout_rate = 0.1

ARGS = {
    'args': Args()
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
make_data_noisy Ran
ran on a synthesized input
uds-lsv/bert-lnl/noise_functions.py
code served (permissive licence) · get_code("84465d2583afaf6b")
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 int, shape (10,) 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

# Set random seed for reproducibility
np.random.seed(42)
rng = np.random.RandomState(42)

# Create clean data: a list of class labels
# Using 10 samples with 3 classes (0, 1, 2)
y_clean = np.array([0, 1, 2, 0, 1, 2, 0, 1, 2, 0])

# Parameters
noise_level = 0.2  # 20% noise
noise_type = 'uniform'  # One of: 'sflip', 'uniform', 'uniform_m'
num_classes = 3

ARGS = {
    'y': y_clean,
    'noise_level': noise_level,
    'noise_type': noise_type,
    'r_state': rng,
    'num_classes': num_classes
}
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 int, shape (10,) — shape (10,) 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
make_noisy_general Ran
ran on a synthesized input
uds-lsv/bert-lnl/noise_functions.py
code served (permissive licence) · get_code("8c14a3daccb4ff97")
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 list, ndim 1, dtype family int; 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 numpy as np
import copy

# Set random seed for reproducibility
np.random.seed(42)
random_state = np.random.RandomState(42)

# Define parameters for make_noisy_general
num_classes = 3

# Create clean_data as a list of class labels (indices 0 to num_classes-1)
clean_data = [0, 1, 2, 0, 1, 2]

# Create a valid noise matrix (stochastic matrix where each row sums to 1)
# This defines the probability of transitioning from true class i to observed class j
noise_matrix = np.array([
    [0.7, 0.2, 0.1],  # If true label is 0, 70% stay 0, 20% become 1, 10% become 2
    [0.1, 0.8, 0.1],  # If true label is 1, 10% become 0, 80% stay 1, 10% become 2
    [0.1, 0.1, 0.8]   # If true label is 2, 10% become 0, 10% become 1, 80% stay 2
])

ARGS = {
    'clean_data': clean_data,
    'noise_matrix': noise_matrix,
    'random_state': random_state,
    'num_classes': num_classes
}
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 list, ndim 1, dtype family int — a list 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
make_noisy_uniform Ran
ran on a synthesized input
uds-lsv/bert-lnl/noise_functions.py
code served (permissive licence) · get_code("6e347ddb4d2f0d53")
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 copy

np.random.seed(0)
random_state = np.random.RandomState(42)

# Create clean data: a list of integer labels (0, 1, 2, 3 for 4 classes)
# We need len(set(y)) == num_classes, so create labels that cover all classes
clean_data = [0, 1, 2, 3, 0, 1, 2, 3]

# Define parameters
noise_level = 0.1  # 10% noise
num_classes = 4

ARGS = {
    "y": clean_data,
    "noise_level": noise_level,
    "r_state": random_state,
    "num_classes": num_classes,
}
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 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
pickle_load Ran
ran on a synthesized input
uds-lsv/bert-lnl/utils.py
code served (permissive licence) · get_code("482640d1ff940aad")
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 dict. 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 pickle
import tempfile
import os

# Create a temporary file and pickle some test data into it
temp_dir = tempfile.mkdtemp()
test_file = os.path.join(temp_dir, "test_pickle.pkl")

# Create sample data to pickle
test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "dict"}
}

# Write the pickle file
with open(test_file, 'wb') as handle:
    pickle.dump(test_data, handle)

# Define ARGS with the file path
ARGS = {
    "file_name": test_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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

Also present in other papers' code

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

Incorrect labels in training data occur when human annotators make mistakes or when the data is generated via weak or distant supervision. It has been shown that complex noise-handling techniques - by modeling, cleaning or filtering the noisy instances - are required to prevent models from fitting this label noise. However, we show in this work that, for text classification tasks with modern NLP models like BERT, over a variety of noise types, existing noisehandling methods do not always improve its performance, and may even deteriorate it, suggesting the need for further investigation. We also back our observations with a comprehensive analysis.

For agents

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

get_harvested_code_for_paper("2204.09371")
get_code_for_paper("2204.09371")
have("2204.09371")

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

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

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

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

Connect an agent — have() is free.