SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.08552 · 2021

Virtual Augmentation Supported Contrastive Learning of Sentence Representations

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 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 5 have no contract verdict; 0 failures of our instrument; 3 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/2110.08552.json · badge: /api/ran/2110.08552.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
amazon-science/sentence-representations community (classifier label)
classifier basis not recorded on the link
5 ran · 3 no recorded run
FunctionStatusWhere it lives
cluster_acc Ran
ran on a synthesized input
amazon-science/sentence-representations/DownstreamEval/clustering/metric.py
code served (permissive licence) · get_code("4faa67ba46a4ff24")
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 float64, ndim 0, 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 numpy as np

# Create simple test data for cluster_acc
# y_true: ground truth cluster labels
# y_pred: predicted cluster labels
# Both should be 1D arrays of integers

y_true = np.array([0, 0, 1, 1, 2, 2], dtype=np.int64)
y_pred = np.array([0, 0, 1, 2, 2, 1], dtype=np.int64)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
cluster_data_loader Ran
ran on a synthesized input
amazon-science/sentence-representations/DownstreamEval/clustering/dataloader.py
code served (permissive licence) · get_code("4747601818307a49")
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 DataLoader. 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 pandas as pd
import torch.utils.data as util_data
from torch.utils.data import Dataset
import tempfile
import os

# Create a temporary CSV file with sample data
temp_dir = tempfile.mkdtemp()
csv_path = os.path.join(temp_dir, "sample_data.csv")

# Create sample CSV data
df = pd.DataFrame({
    'text_column': ['hello world', 'foo bar', 'test data', 'sample text'],
    'label_column': [0, 1, 0, 1]
})
df.to_csv(csv_path, index=False)

ARGS = {
    'datapath': csv_path,
    'text': 'text_column',
    'label': 'label_column',
    'batch_size': 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
get_args Ran
ran on a synthesized input
amazon-science/sentence-representations/DownstreamEval/configs/configure.py
code served (permissive licence) · get_code("7758f15f5fb8c76a")
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 Namespace. 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 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 argparse
import torch
import numpy as np

torch.manual_seed(0)

ARGS = {
    'argv': [
        '--device_id', '0',
        '--device', 'cpu',
        '--seed', '42',
        '--respath', '/tmp/results/',
        '--resprefix', 'sts_test',
        '--path_to_sts_data', '/tmp/sts_data/',
        '--path_to_cluster_data', '/tmp/cluster_data/',
        '--max_length', '64',
        '--batch_size', '32',
        '--pretrained_dir', '/tmp/models/',
        '--pretrained_model', 'PairSupCon',
        '--bert', 'bertbase'
    ]
}
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 Namespace — a Namespace output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Namespace 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
get_embeddings Ran
ran on a synthesized input
amazon-science/sentence-representations/DownstreamEval/clustering/clustering_eval.py
code served (permissive licence) · get_code("13e3886c6d762ec6")
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)

# Create a mock transformer model
class MockTransformer(nn.Module):
    def __init__(self, hidden_size=4):
        super().__init__()
        self.hidden_size = hidden_size
        self.dense = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, input_ids, attention_mask):
        # Return a tuple where first element is token embeddings
        batch_size = input_ids.shape[0]
        seq_len = input_ids.shape[1]
        embeddings = torch.randn(batch_size, seq_len, self.hidden_size)
        return (embeddings,)

# Create a mock tokenizer
class MockTokenizer:
    def batch_encode_plus(self, text, max_length=64, return_tensors='pt', padding='max_length', truncation=True):
        batch_size = len(text)
        return {
            'input_ids': torch.randint(0, 100, (batch_size, max_length)),
            'attention_mask': torch.ones(batch_size, max_length)
        }

# Create a mock data loader
def create_mock_loader():
    loader = []
    for _ in range(2):
        batch = {
            'text': ['sample text one', 'sample text two'],
            'label': torch.tensor([0, 1])
        }
        loader.append(batch)
    return loader

transformer = MockTransformer(hidden_size=4)
tokenizer = MockTokenizer()
train_loader = create_mock_loader()
device = 'cpu'

ARGS = {
    'transformer': transformer,
    'tokenizer': tokenizer,
    'train_loader': train_loader,
    'device': device
}
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
parse_results Ran
ran on a synthesized input
amazon-science/sentence-representations/DownstreamEval/eval_sts.py
code served (permissive licence) · get_code("38311fd78ec01a2b")
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 DataFrame. 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 pandas as pd
from scipy.stats import spearmanr

# Create a mock spearmanr result object with .correlation attribute
class MockSpearmanResult:
    def __init__(self, correlation_value):
        self.correlation = correlation_value

# Construct the res dictionary with all required keys
res = {
    'STS12': {
        'all': {
            'spearman': {
                'all': 0.75
            }
        }
    },
    'STS13': {
        'all': {
            'spearman': {
                'all': 0.78
            }
        }
    },
    'STS14': {
        'all': {
            'spearman': {
                'all': 0.80
            }
        }
    },
    'STS15': {
        'all': {
            'spearman': {
                'all': 0.82
            }
        }
    },
    'STS16': {
        'all': {
            'spearman': {
                'all': 0.81
            }
        }
    },
    'SICKRelatedness': {
        'test': {
            'spearman': MockSpearmanResult(0.85)
        }
    },
    'STSBenchmark': {
        'test': {
            'spearman': MockSpearmanResult(0.87)
        }
    },
    'MR': {
        'acc': 0.88
    },
    'CR': {
        'acc': 0.89
    },
    'SUBJ': {
        'acc': 0.90
    },
    'MPQA': {
        'acc': 0.91
    },
    'SST2': {
        'acc': 0.92
    },
    'SST5': {
        'acc': 0.93
    },
    'TREC': {
        'acc': 0.94
    },
    'MRPC': {
        'acc': 0.95
    },
    'SICKEntailment': {
        'acc': 0.96
    }
}

resname = 'test_model'

ARGS = {
    'res': res,
    'resname': resname
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
cluster_acc_purity Not yet run
unverified (harvested, no recorded run)
amazon-science/sentence-representations/DownstreamEval/clustering/metric.py
code served (permissive licence) · get_code("88f2b6bd78c2881a")
How it ran

no invocation recorded.

clustering_single_trial Not yet run
unverified (harvested, no recorded run)
amazon-science/sentence-representations/DownstreamEval/clustering/clustering_eval.py
code served (permissive licence) · get_code("ec7ebe20ecf2579f")
How it ran

no invocation recorded.

get_bert Not yet run
unverified (harvested, no recorded run)
amazon-science/sentence-representations/DownstreamEval/configs/configure.py
code served (permissive licence) · get_code("610528af9a82cff9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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
cluster_acc 1 other paper
1 later
2307.00524 (2023-07)
Large Language Models Enable Few-Shot Clustering

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

Despite profound successes, contrastive representation learning relies on carefully designed data augmentations using domain specific knowledge. This challenge is magnified in natural language processing where no general rules exist for data augmentation due to the discrete nature of natural language. We tackle this challenge by presenting a Virtual augmentation Supported Contrastive Learning of sentence representations (VaSCL). Originating from the interpretation that data augmentation essentially constructs the neighborhoods of each training instance, we in turn utilize the neighborhood to generate effective data augmentations. Leveraging the large training batch size of contrastive learning, we approximate the neighborhood of an instance via its K-nearest in-batch neighbors in the representation space. We then define an instance discrimination task regarding this neighborhood and generate the virtual augmentation in an adversarial training manner. We access the performance of VaSCL on a wide range of downstream tasks, and set a new state-of-the-art for unsupervised sentence representation learning.

For agents

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

get_harvested_code_for_paper("2110.08552")
get_code_for_paper("2110.08552")
have("2110.08552")

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

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

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

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

Connect an agent — have() is free.