SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2005.10242 · ICML · 2020

Understanding Contrastive Representation Learning through Alignment and Uniformity on the Hypersphere

Tongzhou Wang, Phillip Isola

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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; 1 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 1 failure 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/2005.10242.json · badge: /api/ran/2005.10242.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
pangzss/pytorch-ctvsum community (classifier label)
classifier basis not recorded on the link
8 ran · 1 no recorded run
copy not recorded community
not in the paper's declared repositories
0 ran · 1 no recorded run
ssnl/moco_align_uniform reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
FunctionStatusWhere it lives
cosine_scheduler Ran
ran, honoured the contract we drafted
pangzss/pytorch-ctvsum/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
evaluate_summary Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/vsum_tools.py
code served (permissive licence) · get_code("4926d212a1822095")
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 numpy as np

# Create machine summary: binary vector of shape (n_frames,)
# Using 10 frames for simplicity
machine_summary = np.array([1, 0, 1, 1, 0, 1, 0, 0, 1, 1], dtype=np.int32)

# Create user summaries: multiple annotators, shape (n_users, n_frames)
# 3 users, 10 frames each
user_summary = np.array([
    [1, 0, 1, 0, 0, 1, 0, 0, 1, 1],
    [1, 0, 0, 1, 0, 1, 0, 1, 1, 0],
    [0, 0, 1, 1, 0, 1, 1, 0, 1, 1]
], dtype=np.int32)

# Evaluation metric: either 'avg' or 'max'
eval_metric = 'avg'

ARGS = {
    'machine_summary': machine_summary,
    'user_summary': user_summary,
    'eval_metric': eval_metric
}
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 — 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
evaluate_user_summaries Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/vsum_tools.py
code served (permissive licence) · get_code("94b106ddf66bb46e")
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

# Create user summary data
# Shape: (n_users, n_frames)
# We need at least 2 users to compare
n_users = 3
n_frames = 10

user_summary = np.array([
    [1, 0, 1, 1, 0, 1, 0, 0, 1, 0],
    [1, 1, 0, 1, 1, 0, 0, 1, 0, 1],
    [0, 1, 1, 0, 1, 1, 1, 0, 1, 0]
], dtype=np.int32)

ARGS = {
    'user_summary': user_summary,
    'eval_metric': 'avg'
}
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
get_rc_func Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/evaluation.py
code served (permissive licence) · get_code("7a401efe934df82d")
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 numpy as np
from scipy.stats import kendalltau, spearmanr
from scipy.stats import rankdata

torch.manual_seed(0)

# The function get_rc_func takes a metric parameter and returns a function
# The metric parameter should be a string that is either 'kendalltau' or 'spearmanr'

ARGS = {
    'metric': 'kendalltau'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, 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
knapsack Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/knapsack.py
code served (permissive licence) · get_code("26afde22fce432ac")
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 1, dtype family float, shape (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 numpy as np

# This is the classic 0/1 knapsack problem
# W: maximum weight capacity (int)
# wt: list/array of weights for each item
# val: list/array of values for each item
# n: number of items (int)

# Create small valid test case
W = 10  # maximum weight capacity
wt = [2, 3, 4, 5]  # weights of 4 items
val = [3, 4, 5, 6]  # values of 4 items
n = 4  # number of items

ARGS = {
    "W": W,
    "wt": wt,
    "val": val,
    "n": n
}
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 1, dtype family float, shape (4,) — shape (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
knapsack_dp Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/knapsack.py
code served (permissive licence) · get_code("96b2828743f88070")
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 numpy as np

# Set up arguments for knapsack_dp function
values = [10, 20, 30, 40]  # list of floats/ints representing item values
weights = [5, 10, 15, 20]  # list of ints representing item weights
n_items = 4  # int: number of items
capacity = 30  # int: knapsack capacity
return_all = True  # bool: whether to return all results

ARGS = {
    "values": values,
    "weights": weights,
    "n_items": n_items,
    "capacity": capacity,
    "return_all": return_all
}
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 — 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
test_collate Ran
ran on a synthesized input
pangzss/pytorch-ctvsum/utils.py
code served (permissive licence) · get_code("641956a2906f089f")
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 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

torch.manual_seed(0)

# The function takes a single parameter 'input' and returns input[0]
# So input must be indexable and have at least one element
# We'll create a simple list with a tensor as the first element

input_data = [
    torch.randn(2, 4),  # First element: a small tensor
    torch.randn(3, 5),  # Second element: another tensor (for distinction)
]

ARGS = {
    "input": input_data
}
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 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
trunc_normal_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
pangzss/pytorch-ctvsum/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from shvdiwnkozbw/SMTC, is pointer only (licence: NONE) · get_code("d8578a1e5c318cf9")
How it ran

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

accuracy Not yet run
unverified (harvested, no recorded run)
this paper's copy was not recorded; identical code first harvested from zbh2047/clipping-algorithms
pointer only; the stored copy get_code serves, from zbh2047/clipping-algorithms, is pointer only (licence: NONE) · get_code("9b8289076669fe4f")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. 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. No invocation recorded.

nondefault_trainer_args Not yet run
unverified (harvested, no recorded run)
pangzss/pytorch-ctvsum/main_ablations.py
code served (permissive licence) · get_code("0998ae7833d6d509")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
ssnl/moco_align_uniform/main_lincls.py
pointer only (licence: NOASSERTION) · get_code("0358792e34e9cbb2")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, ssnl/moco_align_uniform (NOASSERTION). 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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 8 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 2 the same month, 5 later) and 3 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
1 dated earlier, 159 later · 36 only as an assembly brick
1911.10194 (2019-11)
Panoptic-DeepLab: A Simple, Strong, and Fast Baseline for Bottom-Up Panoptic Segmentation
2007.12911 (2020-07)
Tighter risk certificates for neural networks
2010.11929 (2020-10)
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
and 157 more not named here
accuracy 80 other papers
36 dated earlier, 2 the same month, 42 later
1307.0414 (2013-07)
Challenges in Representation Learning: A report on three machine learning contests
1412.6553 (2014-12)
Speeding-up Convolutional Neural Networks Using Fine-tuned CP-Decomposition
1503.02531 (2015-03)
Distilling the Knowledge in a Neural Network
and 77 more not named here
cosine_scheduler 37 other papers
37 later
2103.15375 (2021-03)
AlignMixup: Improving Representations By Interpolating Aligned Features
2106.09681 (2021-06)
XCiT: Cross-Covariance Image Transformers
2109.13228 (2021-09)
PASS: An ImageNet replacement for self-supervised pretraining without humans
and 34 more not named here
validate 14 other papers
3 dated earlier, 1 the same month, 10 later
1706.02677 (2017-06)
Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour
1911.12207 (2019-11)
Orthogonal Convolutional Neural Networks
2003.04297 (2020-03)
Improved Baselines with Momentum Contrastive Learning
and 11 more not named here
nondefault_trainer_args 8 other papers
8 later
2112.10752 (2021-12)
High-Resolution Image Synthesis with Latent Diffusion Models
2211.13319 (2022-11)
Make-A-Story: Visual Memory Conditioned Consistent Story Generation
2303.18181 (2023-03)
A Closer Look at Parameter-Efficient Tuning in Diffusion Models
and 5 more not named here
knapsack_dp 2 other papers
2 dated earlier
1612.05601 (2016-12)
SonoNet: Real-Time Detection and Localisation of Fetal Standard Scan Planes in Freehand Ultrasound
1812.01969 (2018-12)
Summarizing Videos with Attention
evaluate_user_summaries 1 other paper
1 dated earlier
1812.01969 (2018-12)
Summarizing Videos with Attention
knapsack 1 other paper
1 dated earlier
1812.01969 (2018-12)
Summarizing Videos with Attention

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

Contrastive representation learning has been outstandingly successful in practice. In this work, we identify two key properties related to the contrastive loss: (1) alignment (closeness) of features from positive pairs, and (2) uniformity of the induced distribution of the (normalized) features on the hypersphere. We prove that, asymptotically, the contrastive loss optimizes these properties, and analyze their positive effects on downstream tasks. Empirically, we introduce an optimizable metric to quantify each property. Extensive experiments on standard vision and language datasets confirm the strong agreement between both metrics and downstream task performance. Directly optimizing for these two metrics leads to representations with comparable or better performance at downstream tasks than contrastive learning.

For agents

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

get_harvested_code_for_paper("2005.10242")
get_code_for_paper("2005.10242")
have("2005.10242")

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

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

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

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

Connect an agent — have() is free.