SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.20088 · NeurIPS · 2023

Improving CLIP Training with Language Rewrites

Phillip Isola, Yonglong Tian, Dilip Krishnan, Dina Katabi, Lijie Fan

arXiv · PDF · Open in the Atlas

Code that ran

2 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-23; 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/2305.20088.json · badge: /api/ran/2305.20088.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
LijieFan/LaCLIP canonical (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
lijiefan/laclip community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
CsvDatasetAugCap Ran
ran on a synthesized input · constructed an object; no result was computed
lijiefan/laclip/data.py
code served (permissive licence) · get_code("b781cd857f7e6956")
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 an instance of its own class, CsvDatasetAugCap: the run constructed the object and did not call it, so no result was computed. 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 Dataset
from torchvision import transforms
from PIL import Image
import tempfile
import os
import csv

torch.manual_seed(0)

# Create a temporary directory for test files
tmpdir = tempfile.mkdtemp()

# Create a minimal CSV file with image paths and captions
csv_file = os.path.join(tmpdir, "test.csv")
with open(csv_file, 'w', newline='') as f:
    writer = csv.writer(f)
    writer.writerow(["image1.png", "a cat sitting"])
    writer.writerow(["image2.jpg", "a dog running"])

# Create dummy image files
img1_path = os.path.join(tmpdir, "image1.png")
img2_path = os.path.join(tmpdir, "image2.jpg")
dummy_img = Image.new('RGB', (32, 32), color='red')
dummy_img.save(img1_path)
dummy_img.save(img2_path)

# Create augmented caption files
aug_cap_file1 = os.path.join(tmpdir, "aug_captions1.txt")
aug_cap_file2 = os.path.join(tmpdir, "aug_captions2.txt")

with open(aug_cap_file1, 'w') as f:
    f.write("a feline sitting down\n")
    f.write("a canine running fast\n")

with open(aug_cap_file2, 'w') as f:
    f.write("the cat is seated\n")
    f.write("the dog is in motion\n")

# Create a simple tokenizer class
class SimpleTokenizer:
    def __call__(self, text):
        # Return a simple token representation as a tensor
        tokens = text.split()[:10]  # Limit to 10 tokens
        # Pad or truncate to fixed length
        token_ids = [hash(t) % 1000 for t in tokens]
        while len(token_ids) < 10:
            token_ids.append(0)
        return torch.tensor(token_ids[:10], dtype=torch.long)

# Create image transforms
image_transforms = transforms.Compose([
    transforms.Resize((32, 32)),
    transforms.ToTensor(),
])

# Define the arguments dictionary
ARGS = {
    'input_filename': csv_file,
    'transforms': image_transforms,
    'tokenizer': SimpleTokenizer(),
    'root': tmpdir,
    'augmented_caption_filelist': [aug_cap_file1, aug_cap_file2]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CsvDatasetAugCap — the run constructed an instance of its own class and did not call it; no shape 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
validate_zeroshot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
LijieFan/LaCLIP/eval_zeroshot_imagenet.py
code served (permissive licence) · get_code("c2c68e245f932a2c")
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 float, ndim 0, 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.nn as nn
import torch.utils.data

torch.manual_seed(0)

# Stand-in model with encode_text and encode_image methods
class MockCLIPModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.text_proj = nn.Linear(512, 256)
        self.image_proj = nn.Linear(512, 256)
    
    def encode_text(self, text_tokens):
        # text_tokens shape: (batch, 77)
        batch_size = text_tokens.shape[0]
        # Return embeddings of size 256
        return self.text_proj(torch.randn(batch_size, 512))
    
    def encode_image(self, images):
        # images shape: (batch, 3, 224, 224) or similar
        batch_size = images.shape[0]
        # Return embeddings of size 256
        return self.image_proj(torch.randn(batch_size, 512))

# Stand-in tokenizer
class MockTokenizer:
    def __call__(self, texts):
        # Return token ids of shape (len(texts), 77)
        if isinstance(texts, list):
            batch_size = len(texts)
        else:
            batch_size = 1
        return torch.randint(0, 1000, (batch_size, 77))

# Create model
model = MockCLIPModel()

# Create tokenizer
tokenizer = MockTokenizer()

# Create templates
templates = ["a photo of a {}"]

# Create labels
labels = ["cat", "dog"]

# Create validation loader with 2 batches
val_loader = [
    (torch.randn(2, 3, 224, 224), torch.tensor([0, 1])),
    (torch.randn(2, 3, 224, 224), torch.tensor([1, 0])),
]

ARGS = {
    "val_loader": val_loader,
    "templates": templates,
    "labels": labels,
    "model": model,
    "tokenizer": tokenizer,
}
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 float, ndim 0, dtype family float — no output shape is stated: observe_signature.py could not observe it (call:AssertionError)
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_model Not yet run
unverified (harvested, no recorded run)
LijieFan/LaCLIP/eval_zeroshot_imagenet.py
code served (permissive licence) · get_code("626a720ea2f648be")
How it ran

no invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 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
get_model 4 other papers
1 dated earlier, 2 later, 1 same year, order not determinable
2212.04501 (2022-12)
Learning Video Representations from Large Language Models
2402.01832 (2024-02)
SynthCLIP: Are We Ready for a Fully Synthetic CLIP Training?
and 1 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-23.

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 Language-Image Pre-training (CLIP) stands as one of the most effective and scalable methods for training transferable vision models using paired image and text data. CLIP models are trained using contrastive loss, which typically relies on data augmentations to prevent overfitting and shortcuts. However, in the CLIP training paradigm, data augmentations are exclusively applied to image inputs, while language inputs remain unchanged throughout the entire training process, limiting the exposure of diverse texts to the same image. In this paper, we introduce Language augmented CLIP (LaCLIP), a simple yet highly effective approach to enhance CLIP training through language rewrites. Leveraging the in-context learning capability of large language models, we rewrite the text descriptions associated with each image. These rewritten texts exhibit diversity in sentence structure and vocabulary while preserving the original key concepts and meanings. During training, LaCLIP randomly selects either the original texts or the rewritten versions as text augmentations for each image. Extensive experiments on CC3M, CC12M, RedCaps and LAION-400M datasets show that CLIP pre-training with language rewrites significantly improves the transfer performance without computation or memory overhead during training. Specifically for ImageNet zero-shot accuracy, LaCLIP outperforms CLIP by 8.2% on CC12M and 2.4% on LAION-400M. Code is available at https://github.com/LijieFan/LaCLIP. 37th Conference on Neural Information Processing Systems (NeurIPS 2023).

For agents

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

get_harvested_code_for_paper("2305.20088")
get_code_for_paper("2305.20088")
have("2305.20088")

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

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

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

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

Connect an agent — have() is free.