SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.07402 · 2021

Self-Supervised Learning by Estimating Twin Class Distributions

arXiv · PDF · Open in the Atlas

Code that ran

9 of 15 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; 2 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 5 failures of our instrument; 6 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.07402.json · badge: /api/ran/2110.07402.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
bytedance/TWIST canonical (classifier label)
classifier basis not recorded on the link
9 ran · 6 no recorded run
FunctionStatusWhere it lives
KL Ran
ran on a synthesized input
bytedance/TWIST/objective.py
code served (permissive licence) · get_code("a74d130de19016d6")
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 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 torch.nn as nn
from unittest.mock import MagicMock

torch.manual_seed(0)

# Create tiny probability tensors (batch=2, dim=4)
# Probabilities should sum to 1 along the last dimension
probs1 = torch.softmax(torch.randn(2, 4), dim=1)
probs2 = torch.softmax(torch.randn(2, 4), dim=1)

# Create a mock args object with EPS attribute
class Args:
    def __init__(self):
        self.EPS = 1e-8

args = Args()

# Mock torch.distributed.all_reduce to prevent actual distributed calls
original_all_reduce = torch.distributed.all_reduce
torch.distributed.all_reduce = MagicMock()

ARGS = {
    "probs1": probs1,
    "probs2": probs2,
    "args": args
}
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 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
accuracy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bytedance/TWIST/evaluate.py
code served (permissive licence) · get_code("b0f936d4d6ae3b8c")
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 list, ndim 2, 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

torch.manual_seed(0)

# Create output tensor: batch_size=2, num_classes=4
# This represents logits from a model
output = torch.randn(2, 4)

# Create target tensor: batch_size=2
# These are class indices (0-3 for 4 classes)
target = torch.tensor([1, 3])

# topk parameter: tuple of k values to compute accuracy for
topk = (1, 2)

ARGS = {
    "output": output,
    "target": target,
    "topk": topk,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, 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
calculate_cost_matrix Ran
ran; our contract draft was wrong, not the code
bytedance/TWIST/evaluate_cluster.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from XiaojianDing/2025-NeurIPS-HSACC, is pointer only (licence: NONE) · get_code("f6d031f1affc8b74")
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 XiaojianDing/2025-NeurIPS-HSACC, 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.

conv1x1 Ran
ran; our contract draft was wrong, not the code
bytedance/TWIST/widen_resnet.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from medaitech/scrd4ad, is pointer only (licence: NONE) · get_code("2a80220dabcb742a")
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 medaitech/scrd4ad, 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.

conv3x3 Ran
ran; our contract draft was wrong, not the code
bytedance/TWIST/widen_resnet.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from medaitech/scrd4ad, is pointer only (licence: NONE) · get_code("600ff2c45e0de056")
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 medaitech/scrd4ad, 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.

cosine_scheduler Ran
ran, honoured the contract we drafted
bytedance/TWIST/utils.py
code served (permissive licence) · get_code("361a6b24f11fc50a")
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 (500,) 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

ARGS = {
    "base_value": 0.1,
    "final_value": 0.001,
    "epochs": 10,
    "niter_per_ep": 50,
    "warmup_epochs": 2,
    "start_warmup_value": 0.0,
}
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 (500,) — shape (500,) 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
get_augmentations Ran
ran on a synthesized input
bytedance/TWIST/augmentation.py
code served (permissive licence) · get_code("f8fa05939509a76b")
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 MocoAugmentations. 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 random
import torch
import numpy as np
from PIL import Image
from torchvision import transforms

torch.manual_seed(0)
random.seed(0)

# Create a small dummy image for testing
def create_dummy_image():
    """Create a small PIL Image for testing"""
    img_array = np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8)
    return Image.fromarray(img_array)

# Create a simple args class with all required attributes
class ArgsConfig:
    def __init__(self, aug_type='moco'):
        self.aug = aug_type
        self.img_size = 224
        self.global_crops_scale = (0.14, 1.0)
        self.local_crops_scale = (0.05, 0.14)
        self.local_crops_number = 2

# Test with different augmentation types
args_moco = ArgsConfig(aug_type='moco')
args_barlow = ArgsConfig(aug_type='barlow')
args_multicrop = ArgsConfig(aug_type='multicrop')
args_rand = ArgsConfig(aug_type='rand')

ARGS = {
    'args': args_moco
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, timm, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MocoAugmentations — a MocoAugmentations output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MocoAugmentations 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_cluster_labels_from_indices Ran
ran, honoured the contract we drafted
bytedance/TWIST/evaluate_cluster.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from hhdxwen/pcl, is pointer only (licence: NONE) · get_code("c5807f4f8acc5c0b")
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 hhdxwen/pcl, 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.

trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
bytedance/TWIST/utils.py
code served (permissive licence) · get_code("915b71e73a54fc97")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 math

torch.manual_seed(0)

# Create a small tensor to be modified by trunc_normal_
tensor = torch.empty(2, 4)

# Define parameters for truncated normal initialization
mean = 0.0
std = 1.0
a = -2.0
b = 2.0

ARGS = {
    'tensor': tensor,
    'mean': mean,
    'std': std,
    'a': a,
    'b': b
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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
CE Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/objective.py
code served (permissive licence) · get_code("5067fd3e4ebe3111")
How it ran

no invocation recorded.

check_path Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/imagenet_lmdb.py
code served (permissive licence) · get_code("8b7b49496df1bbe5")
How it ran

no invocation recorded.

concat_all_gather Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/utils.py
code served (permissive licence) · get_code("73cecca9f3575f09")
How it ran

no invocation recorded.

evaluate Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/evaluate_cluster.py
code served (permissive licence) · get_code("e3880dee498de475")
How it ran

no invocation recorded.

loads_pyarrow Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/imagenet_lmdb.py
code served (permissive licence) · get_code("b4c154b6f0568b6b")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
bytedance/TWIST/widen_resnet.py
code served (permissive licence) · get_code("d2772e0a588e4529")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 10 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 5 the same month, 10 later) and 5 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
trunc_normal_ 160 other papers
10 dated earlier, 2 the same month, 148 later · 36 only as an assembly brick
1911.10194 (2019-11)
Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation
2005.10242 (2020-05)
Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere
2007.12911 (2020-07)
Tighter risk certificates for neural networks
and 157 more not named here
concat_all_gather 138 other papers
28 dated earlier, 108 later, 2 same year, order not determinable · 33 only as an assembly brick
1710.09412 (2017-10)
mixup: BEYOND EMPIRICAL RISK MINIMIZATION
1905.04899 (2019-05)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 135 more not named here
accuracy 116 other papers
24 dated earlier, 3 the same month, 89 later · 8 only as an assembly brick
1502.03044 (2015-02)
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
1610.05820 (2016-10)
Membership Inference Attacks Against Machine Learning Models
1905.03696 (2019-05)
HAWQ: Hessian AWare Quantization of Neural Networks with Mixed-Precision
and 113 more not named here
conv1x1 112 other papers
14 dated earlier, 2 the same month, 96 later · 6 only as an assembly brick
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
1806.01531 (2018-06)
Deep Mixture of Experts via Shallow Embedding
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 109 more not named here
conv3x3 111 other papers
12 dated earlier, 2 the same month, 97 later · 6 only as an assembly brick
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
1806.01531 (2018-06)
Deep Mixture of Experts via Shallow Embedding
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
and 108 more not named here
cosine_scheduler 37 other papers
4 dated earlier, 33 later
2005.10242 (2020-05)
Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere
2103.15375 (2021-03)
AlignMixup: Improving Representations By Interpolating Aligned Features
2106.09681 (2021-06)
XCiT: Cross-Covariance Image Transformers
and 34 more not named here
resnet18 36 other papers
6 dated earlier, 2 the same month, 28 later
1905.12794 (2019-05)
Fashion IQ: A New Dataset Towards Retrieving Images by Natural Language Feedback
2002.09564 (2020-02)
Towards Robust and Reproducible Active Learning Using Neural Networks
2003.04297 (2020-03)
Improved Baselines with Momentum Contrastive Learning
and 33 more not named here
calculate_cost_matrix 9 other papers
2 dated earlier, 7 later
1902.02693 (2019-02)
StampNet: unsupervised multi-class object discovery
2009.09687 (2020-09)
Contrastive Clustering
2301.11045 (2023-01)
Incomplete Multi-view Clustering via Prototype-based Imputation
and 6 more not named here
loads_pyarrow 6 other papers
6 later
2111.15174 (2021-11)
CRIS: CLIP-Driven Referring Image Segmentation
2202.07800 (2022-02)
Not All Patches are What You Need: Expediting Vision Transformers via Token Reorganizations
2209.04996 (2022-09)
Switchable Online Knowledge Distillation
and 3 more not named here
get_cluster_labels_from_indices 5 other papers
1 dated earlier, 4 later
2009.09687 (2020-09)
Contrastive Clustering
2310.00377 (2023-10)
Mitigating the Effect of Incidental Correlations on Part-based Learning
2310.11989 (2023-10)
Image Clustering with External Guidance
and 2 more not named here

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

We present TWIST, a simple and theoretically explainable self-supervised representation learning method by classifying large-scale unlabeled datasets in an end-to-end way. We employ a siamese network terminated by a softmax operation to produce twin class distributions of two augmented images. Without supervision, we enforce the class distributions of different augmentations to be consistent. However, simply minimizing the divergence between augmentations will cause collapsed solutions, i.e., outputting the same class probability distribution for all images. In this case, no information about the input image is left. To solve this problem, we propose to maximize the mutual information between the input and the class predictions. Specifically, we minimize the entropy of the distribution for each sample to make the class prediction for each sample assertive and maximize the entropy of the mean distribution to make the predictions of different samples diverse. In this way, TWIST can naturally avoid the collapsed solutions without specific designs such as asymmetric network, stop-gradient operation, or momentum encoder. As a result, TWIST outperforms state-of-the-art methods on a wide range of tasks. Especially, TWIST performs surprisingly well on semi-supervised learning, achieving 61.2% top-1 accuracy with 1% ImageNet labels using a ResNet-50 as backbone, surpassing previous best results by an absolute improvement of 6.2%. Codes and pre-trained models are given on: https://github.com/bytedance/TWIST

For agents

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

get_harvested_code_for_paper("2110.07402")
get_code_for_paper("2110.07402")
have("2110.07402")

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

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

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

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

Connect an agent — have() is free.