SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2005.00669 · ACL · 2020

Contrastive Self-Supervised Learning for Commonsense Reasoning

Tassilo Klein, Moin Nabi

arXiv · PDF · Open in the Atlas

Code that ran

7 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; 2 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2005.00669.json · badge: /api/ran/2005.00669.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
SAP-samples/acl2020-commonsense canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
SAP-samples/acl2019-commonsense community (classifier label)
classifier basis not recorded on the link
3 ran · 1 no recorded run
SAP-samples/acl2019-commonsense-reasoning community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
computeMaximumAttentionScore Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SAP-samples/acl2019-commonsense-reasoning/commonsense.py
code served (permissive licence) · get_code("c5dccfcc7d0ce914")
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 (5,) 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

# Create a small attention tensor
# Shape: (num_layers, num_heads, sequence_length)
# The function iterates over shape[0] twice and accesses shape[2]
# So we need at least 2 dimensions with size > 1
activity = np.random.rand(3, 3, 5).astype(np.float32)

ARGS = {
    "activity": activity
}
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 (5,) — shape (5,) 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_accuracy Ran
ran on a synthesized input
SAP-samples/acl2020-commonsense/scorer.py
code served (permissive licence) · get_code("ff87d20ae15918c9")
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 float, 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 pickle
import numpy as np
import tempfile
import os

# Create a temporary directory for file outputs
temp_dir = tempfile.mkdtemp()

# Construct ans_stats: list of tuples (guid, ex_true, loss)
# The function expects:
# - guid: string identifier
# - ex_true: either 'other', 'err_true', 'err_false', or some other value
# - loss: float value (can be nan or inf)
ans_stats = [
    ('1', 'other', 0.5),
    ('2', 'target', 0.3),
    ('3', 'other', 0.2),
    ('4', 'target', 0.8),
    ('5', 'err_true', 0.1),
    ('6', 'target', np.nan),
    ('7', 'target', 0.4),
]

# wnli_output: optional path for output file
wnli_output = os.path.join(temp_dir, 'wnli_output')

# sort: boolean flag for sorting output
sort = True

ARGS = {
    'ans_stats': ans_stats,
    'wnli_output': wnli_output,
    'sort': sort,
}
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 float, 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_f1 Ran
ran on a synthesized input
SAP-samples/acl2020-commonsense/scorer.py
code served (permissive licence) · get_code("0f32d4ee5a8aae9f")
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 float, 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
import numpy as np

torch.manual_seed(0)

# Construct ans_stats: list of tuples (guid, ex_true, loss)
# The function expects:
# - guid: string identifier
# - ex_true: one of 'other', 'err_true', 'err_false', 'true', or some other value
# - loss: numeric value (float)

ans_stats = [
    ('sample_1A', 'true', 0.5),
    ('sample_1B', 'other', 0.3),
    ('sample_2A', 'err_true', 0.2),
    ('sample_2B', 'other', 0.6),
    ('sample_3A', 'err_false', 0.1),
    ('sample_4A', 'true', 0.7),
    ('sample_4B', 'other', 0.8),
    ('sample_5A', 'false_class', 0.4),
    ('sample_5B', 'other', 0.2),
]

# gap_output can be None (no file output) or a string path
# Since we can't do file I/O, we pass None
gap_output = None

ARGS = {
    'ans_stats': ans_stats,
    'gap_output': gap_output
}
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 float, 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
contains_word Ran
ran on a synthesized input
SAP-samples/acl2019-commonsense/commonsense.py
code served (permissive licence) · get_code("903f94fb6e6bb919")
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 bool, 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

def contains_word(s, w):
    return s.find(w) > -1

# Setup: contains_word takes two string parameters
# s: the string to search in
# w: the word to search for

ARGS = {
    "s": "the quick brown fox jumps over the lazy dog",
    "w": "fox"
}
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 bool, 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
find_sub_list Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SAP-samples/acl2019-commonsense/MAS.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from cogito233/causal-sa, is pointer only (licence: NONE) · get_code("bd63106a0416368c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from cogito233/causal-sa, 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.

format_attention Ran
ran on a synthesized input
SAP-samples/acl2019-commonsense/MAS.py
code served (permissive licence) · get_code("54f76feabdf08c8b")
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 4, dtype family float, shape (3, 2, 4, 3) 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)

# The function expects 'attention' to be an iterable of tensors
# Each tensor should have 4 dimensions (as checked in the function)
# The function squeezes dimension 0 and then stacks them

# Create a list of attention tensors with shape (batch_size, num_heads, seq_len, seq_len)
# Using distinct sizes: batch=1, heads=2, seq_len=4, seq_len=3
attention_layer_1 = torch.randn(1, 2, 4, 3)
attention_layer_2 = torch.randn(1, 2, 4, 3)
attention_layer_3 = torch.randn(1, 2, 4, 3)

attention = [attention_layer_1, attention_layer_2, attention_layer_3]

ARGS = {
    "attention": attention
}
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 4, dtype family float, shape (3, 2, 4, 3) — shape (3, 2, 4, 3) 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
scorer Ran
ran on a synthesized input
SAP-samples/acl2020-commonsense/scorer.py
code served (permissive licence) · get_code("2a4033e3885367dd")
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 float, 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 numpy as np
import tempfile
import os

# Create sample ans_stats data
# Each entry is (guid, ex_true, loss)
# ex_true can be: 'other', 'err_true', 'err_false', 'true', or other values
ans_stats = [
    ('guid_0A', 'true', 0.1),
    ('guid_0', 'other', 0.5),
    ('guid_1A', 'err_true', 0.2),
    ('guid_1', 'other', 0.3),
    ('guid_2A', 'true', 0.15),
    ('guid_2', 'other', 0.6),
    ('guid_3A', 'false', 0.25),
    ('guid_3', 'other', 0.4),
]

# Create a temporary directory for output files
temp_dir = tempfile.mkdtemp()
output_file_path = os.path.join(temp_dir, 'output.txt')

ARGS = {
    'ans_stats': ans_stats,
    'test_set': 'gap-dev',
    'output_file': None,
}
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 float, 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
MAS Not yet run
unverified (harvested, no recorded run)
SAP-samples/acl2019-commonsense/MAS.py
code served (permissive licence) · get_code("0c8ae0785f89db7b")
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
find_sub_list 2 other papers
2 later
2021.findings-emnlp.119 (2021 (year only))
End-to-end Neural Information Status Classification
2404.11055 (2024-04)
Do LLMs Think Fast and Slow? A Causal Study on Sentiment Analysis

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

Repositories linked to this paper

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

Abstract

We propose a self-supervised method to solve Pronoun Disambiguation and Winograd Schema Challenge problems. Our approach exploits the characteristic structure of training corpora related to so-called "trigger" words, which are responsible for flipping the answer in pronoun disambiguation. We achieve such commonsense reasoning by constructing pairwise contrastive auxiliary predictions. To this end, we leverage a mutual exclusive loss regularized by a contrastive margin. Our architecture is based on the recently introduced transformer networks, BERT, that exhibits strong performance on many NLP benchmarks. Empirical results show that our method alleviates the limitation of current supervised approaches for commonsense reasoning. This study opens up avenues for exploiting inexpensive self-supervision to achieve performance gain in commonsense reasoning tasks. 1

For agents

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

get_harvested_code_for_paper("2005.00669")
get_code_for_paper("2005.00669")
have("2005.00669")

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

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

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

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

Connect an agent — have() is free.