SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.09124 · 2021

DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive Learning

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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; 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/2104.09124.json · badge: /api/ran/2104.09124.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
lyqcom/DisCo community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
TwoCropsTransform Ran
ran on a synthesized input
lyqcom/DisCo/DisCo/dataset_ms.py
code served (permissive licence) · get_code("8d7b4240eee03907")
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 4, 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 torch
import torch.nn as nn
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a simple image tensor or PIL Image
# The function takes an image and returns a tuple of two copies
# We'll use a PIL Image as that's typical for TwoCropsTransform

# Create a small PIL Image (4x3 to have distinct dimensions)
img_array = np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8)
img = Image.fromarray(img_array)

ARGS = {
    "img": img
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 4, dtype family int — 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
calculate_gain Ran
ran on a synthesized input
lyqcom/DisCo/DisCo/ResNet_ms.py
code served (permissive licence) · get_code("82c48515ddda4614")
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 math
import torch
import torch.nn as nn

torch.manual_seed(0)

# Test case 1: linear nonlinearity
ARGS_1 = {
    'nonlinearity': 'linear',
    'param': None
}

# Test case 2: tanh nonlinearity
ARGS_2 = {
    'nonlinearity': 'tanh',
    'param': None
}

# Test case 3: relu nonlinearity
ARGS_3 = {
    'nonlinearity': 'relu',
    'param': None
}

# Test case 4: leaky_relu with default param
ARGS_4 = {
    'nonlinearity': 'leaky_relu',
    'param': None
}

# Test case 5: leaky_relu with float param
ARGS_5 = {
    'nonlinearity': 'leaky_relu',
    'param': 0.2
}

# Test case 6: conv1d
ARGS_6 = {
    'nonlinearity': 'conv1d',
    'param': None
}

# Test case 7: sigmoid
ARGS_7 = {
    'nonlinearity': 'sigmoid',
    'param': None
}

# Use the simplest test case as the main ARGS
ARGS = {
    'nonlinearity': 'relu',
    'param': None
}
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 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
get_last_checkpoint Ran
ran on a synthesized input
lyqcom/DisCo/MoCo/train_ms.py
code served (permissive licence) · get_code("18c07acccd255281")
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 str. 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 os
import tempfile
import shutil

# Create a temporary directory with some checkpoint files
temp_dir = tempfile.mkdtemp()

# Create mock checkpoint files
checkpoint_files = [
    'checkpoint_moco_001.ckpt',
    'checkpoint_moco_002.ckpt',
    'checkpoint_moco_010.ckpt',
]

for ckpt_file in checkpoint_files:
    filepath = os.path.join(temp_dir, ckpt_file)
    with open(filepath, 'w') as f:
        f.write('mock checkpoint content')

ARGS = {
    'checkpoint_dir': temp_dir
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
kaiming_normal Ran
ran on a synthesized input
lyqcom/DisCo/DisCo/ResNet_ms.py
code served (permissive licence) · get_code("f0a6216664197738")
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 4, dtype family float, shape (4, 3, 2, 2) 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 math
import numpy as np

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

# Define ARGS dict with all parameters for kaiming_normal
ARGS = {
    'inputs_shape': (4, 3, 2, 2),  # [out_channels, in_channels, height, width] for conv2d
    'a': 0.01,                      # negative slope for leaky_relu
    'mode': 'fan_in',               # fan calculation mode
    'nonlinearity': 'leaky_relu'    # activation function type
}
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 4, dtype family float, shape (4, 3, 2, 2) — shape (4, 3, 2, 2) 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

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 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, 2 later) and 2 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
calculate_gain 2 other papers
1 dated earlier, 1 later
1812.01187 (2018-12)
Bag of Tricks for Image Classification with Convolutional Neural Networks
2106.02898 (2021-06)
Dynamic Resolution Network
kaiming_normal 2 other papers
1 dated earlier, 1 later
1812.01187 (2018-12)
Bag of Tricks for Image Classification with Convolutional Neural Networks
2106.02898 (2021-06)
Dynamic Resolution Network

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

While self-supervised representation learning (SSL) has received widespread attention from the community, recent research argue that its performance will suffer a cliff fall when the model size decreases. The current method mainly relies on contrastive learning to train the network and in this work, we propose a simple yet effective Distilled Contrastive Learning (DisCo) to ease the issue by a large margin. Specifically, we find the final embedding obtained by the mainstream SSL methods contains the most fruitful information, and propose to distill the final embedding to maximally transmit a teacher's knowledge to a lightweight model by constraining the last embedding of the student to be consistent with that of the teacher. In addition, in the experiment, we find that there exists a phenomenon termed Distilling BottleNeck and present to enlarge the embedding dimension to alleviate this problem. Our method does not introduce any extra parameter to lightweight models during deployment. Experimental results demonstrate that our method achieves the state-of-the-art on all lightweight models. Particularly, when ResNet-101/ResNet-50 is used as teacher to teach EfficientNet-B0, the linear result of EfficientNet-B0 on ImageNet is very close to ResNet-101/ResNet-50, but the number of parameters of EfficientNet-B0 is only 9.4\%/16.3\% of ResNet-101/ResNet-50. Code is available at https://github. com/Yuting-Gao/DisCo-pytorch.

For agents

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

get_harvested_code_for_paper("2104.09124")
get_code_for_paper("2104.09124")
have("2104.09124")

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

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

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

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

Connect an agent — have() is free.