SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.06162 · 2021

Hybrid Generative-Contrastive Representation Learning

arXiv · PDF · Open in the Atlas

Code that ran

10 of 10 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 10 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/2106.06162.json · badge: /api/ran/2106.06162.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
kakaobrain/scrl canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
FunctionStatusWhere it lives
all_gather Ran
ran on a synthesized input
kakaobrain/scrl/distributed/comm.py
code served (permissive licence) · get_code("ded50c9b95170f58")
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 3, dtype family float; no output shape is stated. 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 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.distributed as dist
import pickle

torch.manual_seed(0)

# Since the function uses dist.is_available() and dist.is_initialized(),
# and we're in a non-distributed environment, the function will return [data]
# early without actually calling distributed operations.
# We just need to provide valid picklable data.

# Test with a simple tensor
test_data = torch.randn(2, 4)

# group parameter: None is valid (function handles it)
test_group = None

ARGS = {
    "data": test_data,
    "group": test_group,
}
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 list, ndim 3, 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
bbox_iou Ran
ran on a synthesized input
kakaobrain/scrl/models/box_generator.py
code served (permissive licence) · get_code("c5744484ed18b5c3")
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)

# The function expects two bounding boxes, each represented as a sequence
# with 4 elements: [x1, y1, x2, y2] where (x1,y1) is top-left and (x2,y2) is bottom-right
boxA = [10, 20, 50, 80]
boxB = [30, 40, 70, 100]

ARGS = {
    "boxA": boxA,
    "boxB": boxB
}
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
bisect_params_with_names Ran
ran on a synthesized input
kakaobrain/scrl/optim/getters.py
code served (permissive licence) · get_code("fac6d4127f49a1a3")
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

torch.manual_seed(0)

# Create a simple model with named parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.batch_norm = nn.BatchNorm1d(3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.batch_norm(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

# Get named parameters from the model
named_params = list(model.named_parameters())

# Define criterion keywords to bisect by
# This will separate parameters with 'bias' or 'batch_norm' in their names
criterion = ['bias', 'batch_norm']

ARGS = {
    'named_params': named_params,
    'criterion': criterion
}
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 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
clip_box Ran
ran on a synthesized input
kakaobrain/scrl/models/box_generator.py
code served (permissive licence) · get_code("bee36a96a86e2857")
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

torch.manual_seed(0)

# The function takes:
# 1. box_with_inds: a list-like object with indexable elements [0], [1], [2], [3], [4]
#    where indices 1, 2, 3, 4 are numeric values representing box coordinates
# 2. input_size: a numeric value representing the boundary size for clipping

# Create a box_with_inds as a list with 5 elements
# Index 0 can be any value (not used in function)
# Indices 1-4 are the coordinates to be clipped
box_with_inds = [0, -5.0, -10.0, 150.0, 200.0]

# input_size is the boundary for clipping coordinates
input_size = 100

ARGS = {
    "box_with_inds": box_with_inds,
    "input_size": input_size
}
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 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
free_pass_trans_info Ran
ran on a synthesized input
kakaobrain/scrl/augment/transforms.py
code served (permissive licence) · get_code("b416f49365bfa24d")
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 function. 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
from functools import wraps

torch.manual_seed(0)

def free_pass_trans_info(func):
    """Wrapper to make the function bypass the second argument(transf)."""

    @wraps(func)
    def decorator(img, transf, ratio):
        return (func(img), transf, ratio)
    return decorator

# Create a simple function to be decorated
def simple_func(img):
    return img * 2

# Decorate it
decorated_func = free_pass_trans_info(simple_func)

# Create test arguments
img = torch.randn(2, 3, 4, 5)  # batch=2, channels=3, height=4, width=5
transf = {
    "rotation": 45,
    "flip": True,
    "scale": 1.2
}
ratio = 0.8

ARGS = {
    "func": decorated_func,
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
gather Ran
ran on a synthesized input
kakaobrain/scrl/distributed/comm.py
code served (permissive licence) · get_code("0ae40a93ce2b44c0")
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. 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 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.distributed as dist
import pickle

torch.manual_seed(0)

# Since we're not actually running distributed code, we'll set up a minimal
# environment where dist functions won't actually be called in a way that fails.
# The function checks get_world_size() == 1 early and returns [data] immediately.

# Create some simple picklable data objects to pass
simple_data = {"key": "value", "number": 42}
list_data = [1, 2, 3, 4, 5]
tensor_data = torch.randn(2, 4)

ARGS = {
    "data": simple_data,
    "dst": 0,
    "group": 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 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_dist_url Ran
ran on a synthesized input
kakaobrain/scrl/distributed/getters.py
code served (permissive licence) · get_code("5c3bb378846a1c57")
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 logging
import socket
import time
from urllib.parse import urlsplit, urlunsplit

log = logging.getLogger('main')

def _find_free_port():
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind(('', 0))
    port = sock.getsockname()[1]
    sock.close()
    return port

def _maybe_gethostbyname(dist_url):
    """to be compatible with Braincloud on which one can access the nodes by their task names.
    Each node has to wait until all the tasks in the group are up on the cloud."""
    url = list(urlsplit(dist_url))
    if url[1][0].isdigit():
        return dist_url
    done = False
    retry = 0
    ind = url[1].find(':')
    log.info(f"[DDP] Get URL by the given hostname '{dist_url}' in Braincloud..")
    while not done:
        try:
            url[1] = socket.gethostbyname(url[1][:ind]) + url[1][ind:]
            dist_url = urlunsplit(url)
            done = True
        except:
            retry += 1
            log.info(f'[DDP] Retrying count: {retry}')
            time.sleep(3)
    log.info(f'[DDP] Found the host.')
    return dist_url

def get_dist_url(dist_url, num_machines):
    if dist_url == 'local':
        assert num_machines == 1, 'dist_url=auto not supported in multi-machine jobs.'
        port = _find_free_port()
        dist_url = f'tcp://127.0.0.1:{port}'
    elif dist_url == 'auto':
        ip = socket.gethostbyname(socket.gethostname())
        port = _find_free_port()
        dist_url = f'tcp://{ip}:{port}'
    else:
        dist_url = _maybe_gethostbyname(dist_url)
    if num_machines > 1 and dist_url.startswith('file://'):
        raise ValueError("Support dist_url that starts with 'tcp://' only")
    return dist_url

ARGS = {
    'dist_url': 'local',
    'num_machines': 1
}
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
get_mean_and_std Ran
ran on a synthesized input
kakaobrain/scrl/augment/normalize.py
code served (permissive licence) · get_code("1bc251af2efa1bd9")
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 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
import torch.nn as nn

torch.manual_seed(0)

# The function takes a single parameter 'dataset' which is a string
# It checks the dataset name against known values: 'cifar10', 'cifar100', 'svhn', 'imagenet'
# and returns corresponding means and stds tuples

ARGS = {
    'dataset': 'cifar10'
}
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 tuple, ndim 2, dtype family float — 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
jitter_box Ran
ran on a synthesized input
kakaobrain/scrl/models/box_generator.py
code served (permissive licence) · get_code("df3c1450c6cebedb")
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 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 numpy as np

np.random.seed(0)

ARGS = {
    "box_t": 10.0,
    "box_l": 20.0,
    "box_b": 100.0,
    "box_r": 150.0,
    "box_jittering_ratio": 0.1,
    "input_size": 256,
}
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 tuple, ndim 1, dtype family float — 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
scatter Ran
ran on a synthesized input
kakaobrain/scrl/distributed/comm.py
code served (permissive licence) · get_code("e1d95008530ae31a")
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. 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 torch
import torch.distributed as dist
import pickle
import functools

torch.manual_seed(0)

# Since the function uses dist.scatter and related distributed operations,
# we need to set up a minimal distributed environment or mock it.
# However, the function has guards for when dist is not initialized,
# so we can call it in a non-distributed setting.

# The scatter function takes:
# - data: any picklable object
# - src: int (source rank)
# - group: torch process group or None

# For non-distributed execution, we just need valid picklable data
test_data = {
    "tensor": torch.randn(2, 4),
    "list": [1, 2, 3],
    "string": "hello",
    "nested": {"a": 1, "b": [4.5, 6.7]}
}

ARGS = {
    "data": test_data,
    "src": 0,
    "group": 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 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

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 8 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
free_pass_trans_info 1 other paper
1 later
2206.06293 (2022-06)
Learning Domain Adaptive Object Detection with Probabilistic Teacher
get_mean_and_std 1 other paper
1 later
2206.06293 (2022-06)
Learning Domain Adaptive Object Detection with Probabilistic Teacher

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

Unsupervised representation learning has recently received lots of interest due to its powerful generalizability through effectively leveraging large-scale unlabeled data. There are two prevalent approaches for this, contrastive learning and generative pre-training, where the former learns representations from instance-wise discrimination tasks and the latter learns them from estimating the likelihood. These seemingly orthogonal approaches have their own strengths and weaknesses. Contrastive learning tends to extract semantic information and discards details irrelevant for classifying objects, making the representations effective for discriminative tasks while degrading robustness to out-of-distribution data. On the other hand, the generative pre-training directly estimates the data distribution, so the representations tend to be robust but not optimal for discriminative tasks. In this paper, we show that we could achieve the best of both worlds by a hybrid training scheme. Specifically, we demonstrated that a transformer-based encoder-decoder architecture trained with both contrastive and generative losses can learn highly discriminative and robust representations without hurting the generative performance. We extensively validate our approach on various tasks.

For agents

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

get_harvested_code_for_paper("2106.06162")
get_code_for_paper("2106.06162")
have("2106.06162")

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

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

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

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

Connect an agent — have() is free.