SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.07835 · 2020

Fine-Tuning Pre-trained Language Model with Weak Supervision: A Contrastive-Regularized Self-Training Approach

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; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 1 failure of our instrument; 0 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/2010.07835.json · badge: /api/ran/2010.07835.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
yueyu1030/COSINE canonical (classifier label)
classifier basis: census
5 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
yueyu1030/COSINE/utils.py
code served (permissive licence) · get_code("643c03f907f7dc7c")
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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create small sample predictions and labels
# These should be integer class labels (0, 1, 2, etc.)
preds = np.array([0, 1, 2, 1, 0, 2, 1, 0])
labels = np.array([0, 1, 1, 1, 0, 2, 0, 0])

ARGS = {
    'preds': preds,
    'labels': labels
}
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 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
convert_examples_to_features_re Ran
ran on a synthesized input
yueyu1030/COSINE/data_loader_new.py
code served (permissive licence) · get_code("d7682df458b2fe00")
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 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 numpy as np
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create a minimal tokenizer stand-in
class MinimalTokenizer:
    def tokenize(self, text):
        # Simple split on spaces
        return text.split()
    
    def convert_tokens_to_ids(self, tokens):
        # Map tokens to simple integer IDs
        return [hash(token) % 1000 for token in tokens]

# Create a minimal example object
class Example:
    def __init__(self, guid, text_a, span_a, span_b, label, true):
        self.guid = guid
        self.text_a = text_a
        self.span_a = span_a
        self.span_b = span_b
        self.label = label
        self.true = true

# Create example data
examples = [
    Example(
        guid="example_0",
        text_a="The quick brown fox jumps over the lazy dog",
        span_a=(4, 9),      # "quick"
        span_b=(16, 19),    # "fox"
        label=1,
        true=1
    ),
    Example(
        guid="example_1",
        text_a="Alice and Bob are friends",
        span_a=(0, 5),      # "Alice"
        span_b=(10, 13),    # "Bob"
        label=0,
        true=0
    ),
]

tokenizer = MinimalTokenizer()

ARGS = {
    'examples': examples,
    'max_seq_len': 32,
    'tokenizer': tokenizer,
    'cls_token': '[CLS]',
    'cls_token_segment_id': 0,
    'sep_token': '[SEP]',
    'pad_token': 0,
    'pad_token_segment_id': 0,
    'sequence_a_segment_id': 0,
    'sequence_b_segment_id': 1,
    'add_sep_token': False,
    'mask_padding_with_zero': True,
    'task': 're',
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ipdb, numpy, torch — 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 float — 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
get_label Ran
ran on a synthesized input
yueyu1030/COSINE/utils.py
code served (permissive licence) · get_code("0f7620720c0761a8")
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 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 tempfile

# Create a temporary directory and label file for testing
temp_dir = tempfile.mkdtemp()
label_file = "labels.txt"
label_path = os.path.join(temp_dir, label_file)

# Write some sample labels to the file
with open(label_path, 'w', encoding='utf-8') as f:
    f.write("label1\n")
    f.write("  label2  \n")
    f.write("label3\n")

# Create a simple args object
class Args:
    def __init__(self, data_dir, label_file):
        self.data_dir = data_dir
        self.label_file = label_file

ARGS = {
    'args': Args(data_dir=temp_dir, label_file=label_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 list, ndim 1, dtype family float — 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
tokenize_with_2span Ran
ran on a synthesized input
yueyu1030/COSINE/data_loader_new.py
code served (permissive licence) · get_code("71e29a5bf54e04e7")
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 numpy as np

class SimpleTokenizer:
    def tokenize(self, text):
        # Simple tokenizer that splits on spaces and punctuation
        if not text:
            return []
        # Split on whitespace
        tokens = text.split()
        return tokens

tokenizer = SimpleTokenizer()

# Create a sentence with two distinct spans
sent = "The quick brown fox jumps over the lazy dog"
# span_a: indices for "quick brown" (4-16)
# span_b: indices for "lazy dog" (35-43)
span_a = (4, 16)  # "quick brown"
span_b = (35, 43)  # "lazy dog"

ARGS = {
    "tokenizer": tokenizer,
    "sent": sent,
    "span_a": span_a,
    "span_b": span_b
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
ipdb, 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
tokenize_with_span Ran
ran on a synthesized input
yueyu1030/COSINE/data_loader_new.py
code served (permissive licence) · get_code("7ac17cb99fe26c74")
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 numpy as np

class MockTokenizer:
    def tokenize(self, text):
        """Mock tokenizer that splits on spaces and returns tokens."""
        if not text:
            return []
        return text.split()

# Create a mock tokenizer instance
tokenizer = MockTokenizer()

# Define a sentence and a span
sent = "hello world this is a test"
span = (6, 11)  # span covering "world"

ARGS = {
    "tokenizer": tokenizer,
    "sent": sent,
    "span": span,
}
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 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

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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 3 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
compute_metrics 4 other papers
1 dated earlier, 3 later
1905.08284 (2019-05)
Enriching Pre-trained Language Model with Entity Information for Relation Classification
2301.03726 (2023-01)
Neighborhood-Regularized Self-Training for Learning with Few Labels
2306.15895 (2023-06)
Large Language Model as Attributed Training Data Generator: A Tale of Diversity and Bias
and 1 more not named here
get_label 2 other papers
2 dated earlier
1901.08746 (2019-01)
BioBERT: a pre-trained biomedical language representation model for biomedical text mining
1905.08284 (2019-05)
Enriching Pre-trained Language Model with Entity Information for Relation Classification

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

Fine-tuned pre-trained language models (LMs) have achieved enormous success in many natural language processing (NLP) tasks, but they still require excessive labeled data in the fine-tuning stage. We study the problem of fine-tuning pre-trained LMs using only weak supervision, without any labeled data. This problem is challenging because the high capacity of LMs makes them prone to overfitting the noisy labels generated by weak supervision. To address this problem, we develop a contrastive self-training framework, COSINE, to enable fine-tuning LMs with weak supervision. Underpinned by contrastive regularization and confidence-based reweighting, this contrastive self-training framework can gradually improve model fitting while effectively suppressing error propagation. Experiments on sequence, token, and sentence pair classification tasks show that our model outperforms the strongest baseline by large margins on 7 benchmarks in 6 tasks, and achieves competitive performance with fully-supervised fine-tuning methods.

For agents

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

get_harvested_code_for_paper("2010.07835")
get_code_for_paper("2010.07835")
have("2010.07835")

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

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

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

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

Connect an agent — have() is free.