SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.01936 · 2024

Optimizing CLIP Models for Image Retrieval with Maintained Joint-Embedding Alignment

Konstantin Schall, Kai Uwe, Barthel 0000-0001-6309-572x], Nico Hezel, Klaus Jung

arXiv · PDF · Open in the Atlas

Code that ran

11 of 14 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, 4 violated it and 1 has no contract verdict; 5 failures of our instrument; 3 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/2409.01936.json · badge: /api/ran/2409.01936.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
Visual-Computing/MCIP canonical (classifier label)
classifier basis: census
11 ran · 3 no recorded run
FunctionStatusWhere it lives
const_lr Ran
ran; our contract draft was wrong, not the code
Visual-Computing/MCIP/MCIP/src/realignment/scheduler.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("04508bbd793cdfb9")
How it ran

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

const_lr_cooldown Ran
ran; our contract draft was wrong, not the code
Visual-Computing/MCIP/MCIP/src/realignment/scheduler.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("cc0d607a8934307d")
How it ran

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

cosine_lr Ran
ran; our contract draft was wrong, not the code
Visual-Computing/MCIP/MCIP/src/realignment/scheduler.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from VivienLu/UCAT, is pointer only (licence: NONE) · get_code("932d44bbf8bd0e3f")
How it ran

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

find_unique_indices Ran
ran, honoured the contract we drafted
Visual-Computing/MCIP/MCIP/src/gpr-ft/create_pseudo_captions.py
code served (permissive licence) · get_code("e6be8251c4651cfa")
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 int, 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

# Construct valid arguments for find_unique_indices
string_list = ["apple", "banana", "apple", "cherry", "banana", "date"]

ARGS = {
    "string_list": string_list
}
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 int, 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
get_autocast Ran
ran on a synthesized input
Visual-Computing/MCIP/MCIP/src/realignment/precision.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("94a4076103662faf")
How it ran

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

get_default_params Ran
ran; our contract draft was wrong, not the code
Visual-Computing/MCIP/MCIP/src/realignment/params.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from explainableml/flair, is pointer only (licence: NONE) · get_code("575ba28efe232215")
How it ran

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

get_imagenet Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Visual-Computing/MCIP/MCIP/src/realignment/data.py
code served (permissive licence) · get_code("0aa04fa0c06a8973")
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 DataInfo. 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 torch.utils.data import DataLoader, Dataset
from torchvision import transforms

torch.manual_seed(0)
np.random.seed(0)

class MockImageFolder:
    """Mock ImageFolder dataset"""
    def __init__(self, path, transform=None):
        self.transform = transform
        # Create 1000 classes with 100 samples each (simplified)
        self.targets = np.tile(np.arange(1000), 100)[:100000]
        self.samples = [(f"img_{i}.jpg", int(self.targets[i])) for i in range(len(self.targets))]
    
    def __len__(self):
        return len(self.targets)
    
    def __getitem__(self, idx):
        # Return a small dummy image (3, 32, 32) and label
        img = torch.randn(3, 32, 32)
        label = int(self.targets[idx])
        if self.transform:
            img = self.transform(img)
        return img, label

class MockArgs:
    """Mock args object with required attributes"""
    def __init__(self):
        self.imagenet_train = "/fake/imagenet/train"
        self.imagenet_val = "/fake/imagenet/val"
        self.imagenet_v2 = "/fake/imagenetv2"
        self.workers = 0

# Patch datasets.ImageFolder to use our mock
import torchvision.datasets as datasets
original_imagefolder = datasets.ImageFolder
datasets.ImageFolder = MockImageFolder

# Create preprocessing functions
preprocess_train = transforms.Compose([
    transforms.RandomCrop(32),
])
preprocess_val = transforms.Compose([
    transforms.CenterCrop(32),
])

preprocess_fns = (preprocess_train, preprocess_val)

args = MockArgs()
split = 'train'

ARGS = {
    'args': args,
    'preprocess_fns': preprocess_fns,
    'split': split,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
imagenetv2_pytorch, numpy, torch, torchvision — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataInfo — a DataInfo output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataInfo 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
is_global_master Ran
ran, violated the contract we drafted
Visual-Computing/MCIP/MCIP/src/realignment/distributed.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from tileb1/simzss, is pointer only (licence: NONE) · get_code("7c29b374198bddcd")
How it ran

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

is_local_master Ran
ran, violated the contract we drafted
Visual-Computing/MCIP/MCIP/src/realignment/distributed.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from tileb1/simzss, is pointer only (licence: NONE) · get_code("0377e309e95cfc3e")
How it ran

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

is_master Ran
ran, violated the contract we drafted
Visual-Computing/MCIP/MCIP/src/realignment/distributed.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from tileb1/simzss, is pointer only (licence: NONE) · get_code("b092791002b40e8a")
How it ran

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

remote_sync_fsspec Ran
ran, violated the contract we drafted
Visual-Computing/MCIP/MCIP/src/realignment/file_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("5ef1e6fce93e5928")
How it ran

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

parse_args Not yet run
unverified (harvested, no recorded run)
Visual-Computing/MCIP/MCIP/src/realignment/params.py
code served (permissive licence) · get_code("a44b7dfe82f0d1af")
How it ran

no invocation recorded.

remote_sync Not yet run
unverified (harvested, no recorded run)
Visual-Computing/MCIP/MCIP/src/realignment/file_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("c8826eee91bf0f73")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from MediaBrain-SJTU/DISSect, 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. No invocation recorded.

remote_sync_s3 Not yet run
unverified (harvested, no recorded run)
Visual-Computing/MCIP/MCIP/src/realignment/file_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from MediaBrain-SJTU/DISSect, is pointer only (licence: NONE) · get_code("0cf5fb2e3a3a9114")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from MediaBrain-SJTU/DISSect, 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. No invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 11 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 0 the same month, 11 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
cosine_lr 12 other papers
8 dated earlier, 4 later
2203.17274 (2022-03)
Exploring Visual Prompts for Adapting Large-Scale Models
2209.00179 (2022-09)
Universal Vision-Language Dense Retrieval: Learning A Unified Representation Space for Multi-Modal Retrieval
2302.14042 (2023-02)
Knowledge-enhanced Visual-Language Pre-training on Chest Radiology Images
and 9 more not named here
is_global_master 10 other papers
9 dated earlier, 1 later
2003.04297 (2020-03)
Improved Baselines with Momentum Contrastive Learning
2302.14042 (2023-02)
Knowledge-enhanced Visual-Language Pre-training on Chest Radiology Images
2308.05734 (2023-08)
AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining
and 7 more not named here
is_master 9 other papers
8 dated earlier, 1 later
2302.14042 (2023-02)
Knowledge-enhanced Visual-Language Pre-training on Chest Radiology Images
2304.14636 (2023-04)
PreNAS: Preferred One-Shot Learning Towards Efficient Neural Architecture Search
2308.05734 (2023-08)
AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining
and 6 more not named here
is_local_master 8 other papers
7 dated earlier, 1 later
2302.14042 (2023-02)
Knowledge-enhanced Visual-Language Pre-training on Chest Radiology Images
2308.05734 (2023-08)
AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining
2311.17048 (2023-11)
Zero-shot Referring Expression Comprehension via Structural Similarity Between Images and Captions
and 5 more not named here
get_default_params 5 other papers
4 dated earlier, 1 later
2308.05734 (2023-08)
AudioLDM 2: Learning Holistic Audio Generation with Self-supervised Pretraining
2310.00108 (2023-10)
Practical Membership Inference Attacks Against Large-Scale Multi-Modal Models: A Pilot Study
2312.12856 (2023-12)
SkyScript: A Large and Semantically Diverse Vision-Language Dataset for Remote Sensing
and 2 more not named here
remote_sync 4 other papers
3 dated earlier, 1 later
2405.06640 (2024-05)
Linearizing Large Language Models
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2406.17639 (2024-06)
Mitigate the Gap: Investigating Approaches for Improving Cross-Modal Alignment in CLIP
and 1 more not named here
remote_sync_fsspec 4 other papers
3 dated earlier, 1 later
2405.06640 (2024-05)
Linearizing Large Language Models
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2406.17639 (2024-06)
Mitigate the Gap: Investigating Approaches for Improving Cross-Modal Alignment in CLIP
and 1 more not named here
remote_sync_s3 4 other papers
3 dated earlier, 1 later
2405.06640 (2024-05)
Linearizing Large Language Models
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2406.17639 (2024-06)
Mitigate the Gap: Investigating Approaches for Improving Cross-Modal Alignment in CLIP
and 1 more not named here
const_lr 3 other papers
1 dated earlier, 2 later
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2411.19331 (2024-11)
Talking to DINO: Bridging Self-Supervised Vision Backbones with Language for Open-Vocabulary Segmentation
2507.12998 (2025-07)
Differential-informed Sample Selection Accelerates Multimodal Contrastive Learning
get_autocast 3 other papers
2 dated earlier, 1 later
2311.04219 (2023-11)
OtterHD: A High-Resolution Multi-modality Model
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2507.12998 (2025-07)
Differential-informed Sample Selection Accelerates Multimodal Contrastive Learning
const_lr_cooldown 2 other papers
1 dated earlier, 1 later
2405.08815 (2024-05)
Efficient Vision-Language Pre-training by Cluster Masking
2507.12998 (2025-07)
Differential-informed Sample Selection Accelerates Multimodal Contrastive Learning

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 Language and Image Pairing (CLIP), a transformative method in multimedia retrieval, typically trains two neural networks concurrently to generate joint embeddings for text and image pairs. However, when applied directly, these models often struggle to differentiate between visually distinct images that have similar captions, resulting in suboptimal performance for image-based similarity searches. This paper addresses the challenge of optimizing CLIP models for various image-based similarity search scenarios, while maintaining their effectiveness in text-based search tasks such as text-to-image retrieval and zero-shot classification. We propose and evaluate two novel methods aimed at refining the retrieval capabilities of CLIP without compromising the alignment between text and image embeddings. The first method involves a sequential fine-tuning process: initially optimizing the image encoder for more precise image retrieval and subsequently realigning the text encoder to these optimized image embeddings. The second approach integrates pseudo-captions during the retrieval-optimization phase to foster direct alignment within the embedding space. Through comprehensive experiments, we demonstrate that these methods enhance CLIP's performance on various benchmarks, including image retrieval, k-NN classification, and zero-shot text-based classification, while maintaining robustness in text-to-image retrieval. Our optimized models permit maintaining a single embedding per image, significantly simplifying the infrastructure needed for large-scale multi-modal similarity search systems.

For agents

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

get_harvested_code_for_paper("2409.01936")
get_code_for_paper("2409.01936")
have("2409.01936")

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

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

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

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

Connect an agent — have() is free.