SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2302.12248 · CVPR · 2023

Learning Visual Representations via Language-Guided Sampling

Karan Desai, Justin Johnson, Mohamed Banani

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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; 2 no recorded run), measured 2026-11-22; 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/2302.12248.json · badge: /api/ran/2302.12248.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
mbanani/lgssl canonical (classifier label)
classifier basis not recorded on the link
4 ran · 2 no recorded run
FunctionStatusWhere it lives
evaluate_fewshot Ran
ran on a synthesized input
mbanani/lgssl/lgssl/evaluation/fewshot.py
code served (permissive licence) · get_code("0cea07d9944473ac")
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 torch
import numpy as np

torch.manual_seed(0)

# Create small feature tensors and labels
# feats_train: shape (num_train_samples, feature_dim)
# labels_train: shape (num_train_samples,)
# feats_test: shape (num_test_samples, feature_dim)
# labels_test: shape (num_test_samples,)

num_train_samples = 24
num_test_samples = 12
feature_dim = 4

feats_train = torch.randn(num_train_samples, feature_dim)
labels_train = torch.tensor([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3])

feats_test = torch.randn(num_test_samples, feature_dim)
labels_test = torch.tensor([0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3])

# Create a config class with the required attributes
class FewShotConfig:
    def __init__(self):
        self.n_iter = 2
        self.n_way = 2
        self.n_shot = 3
        self.n_query = 3
        self.center_feats = True
        self.normalize_feats = True
        self.average_feats = True

fs_cfg = FewShotConfig()

ARGS = {
    'feats_train': feats_train,
    'labels_train': labels_train,
    'feats_test': feats_test,
    'labels_test': labels_test,
    'fs_cfg': fs_cfg
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, tqdm — 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_linear_scaled_lr Ran
ran on a synthesized input
mbanani/lgssl/lgssl/optim.py
code served (permissive licence) · get_code("f213c5e2b63f33b7")
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 get_linear_scaled_lr takes three float/int parameters
# and computes a linear scaling rule for learning rates

ARGS = {
    "base_lr": 0.1,           # Base learning rate
    "batch_size": 256,         # Current batch size
    "base_batch_size": 128,    # Reference batch 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 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
set_weight_decay_per_param Ran
ran on a synthesized input
mbanani/lgssl/lgssl/optim.py
code served (permissive licence) · get_code("5cc774959c0dda85")
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 torch.nn as nn

torch.manual_seed(0)

# Create a small model with various parameter types
class SmallModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Regular conv layer
        self.conv = nn.Conv2d(3, 4, kernel_size=3)
        # BatchNorm layer (should get gain_bias_decay)
        self.bn = nn.BatchNorm2d(4)
        # LayerNorm layer (should get gain_bias_decay)
        self.ln = nn.LayerNorm(4)
        # Linear layer with bias (bias should get gain_bias_decay)
        self.fc = nn.Linear(4, 2)
        # Learnable parameter to exclude
        self.temperature = nn.Parameter(torch.tensor(1.0), requires_grad=True)
        # GroupNorm layer (should get gain_bias_decay)
        self.gn = nn.GroupNorm(2, 4)

model = SmallModel()

ARGS = {
    "model": model,
    "weight_decay": 0.01,
    "gain_bias_decay": 0.001,
    "exclude_params": ["temperature"]
}
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
skip_bad_collate Ran
ran on a synthesized input
mbanani/lgssl/lgssl/datasets/builder.py
code served (permissive licence) · get_code("8fcf93fd377505d2")
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. 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 torch.utils.data import DataLoader, default_collate

torch.manual_seed(0)

# Create a sample batch: list of dicts with various keys
# The function expects batch to be a list of dicts
def create_sample_batch():
    batch = [
        {
            'cap_token_ids': [1, 2, 3],
            'cap_token_mask': [1, 1, 0],
            'augmentation_params': {'scale': 0.9},
            'features': torch.randn(4),
            'labels': torch.tensor([0]),
        },
        {
            'cap_token_ids': [4, 5],
            'cap_token_mask': [1, 1],
            'augmentation_params': {'scale': 0.9},
            'features': torch.randn(4),
            'labels': torch.tensor([1]),
        },
    ]
    return batch

sample_batch = create_sample_batch()

ARGS = {
    'batch': sample_batch,
}
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
build_loader Not yet run
unverified (harvested, no recorded run)
mbanani/lgssl/lgssl/datasets/builder.py
code served (permissive licence) · get_code("12b3211e371682cf")
How it ran

no invocation recorded.

get_downstream_dataset Not yet run
unverified (harvested, no recorded run)
mbanani/lgssl/lgssl/datasets/builder.py
code served (permissive licence) · get_code("a6257ea120fda2cb")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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

Although an object may appear in numerous contexts, we often describe it in a limited number of ways. Language allows us to abstract away visual variation to represent and communicate concepts. Building on this intuition, we propose an alternative approach to visual representation learning: using language similarity to sample semantically similar image pairs for contrastive learning. Our approach diverges from image-based contrastive learning by sampling view pairs using language similarity instead of handcrafted augmentations or learned clusters. Our approach also differs from image-text contrastive learning by relying on pre-trained language models to guide the learning rather than directly minimizing a cross-modal loss. Through a series of experiments, we show that language-guided learning yields better features than image-based and image-text representation learning approaches.

For agents

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

get_harvested_code_for_paper("2302.12248")
get_code_for_paper("2302.12248")
have("2302.12248")

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

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

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

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

Connect an agent — have() is free.