SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.16999 · NeurIPS · 2023

Three Towers: Flexible Contrastive Learning with Pretrained Image Models

Rodolphe Jenatton, Mark Collier, Efi Kokiopoulou, Jesse Berent, Lucas Beyer, Xiaohua Zhai, Xiao Wang, Jannik Kossen, Basil Mustafa, Andreas Steiner

arXiv · PDF · Open in the Atlas

Code that ran

1 of 1 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; 0 failures of our instrument; 0 no recorded run), measured 2026-11-24; 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.16999.json · badge: /api/ran/2305.16999.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
google-research/big_vision canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Model Ran
ran on a synthesized input · constructed an object; no result was computed
google-research/big_vision/big_vision/models/proj/image_text/two_towers.py
code served (permissive licence) · get_code("08150689cafdfb7f")
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, Model: 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 jax
import jax.numpy as jnp
import flax.linen as nn
from typing import Any, Optional, Tuple, Union

# Stand-in text model module
class TextTransformerModel(nn.Module):
    num_classes: int = 128
    name: str = 'txt'
    
    @nn.compact
    def __call__(self, text, **kw):
        # Return (batch_size, num_classes) embeddings and dict of outputs
        batch_size = text.shape[0]
        embeddings = nn.Dense(self.num_classes)(text)
        outputs = {'logits': embeddings}
        return embeddings, outputs

# Stand-in image model module
class VitModel(nn.Module):
    num_classes: int = 128
    name: str = 'img'
    
    @nn.compact
    def __call__(self, image, **kw):
        # Return (batch_size, num_classes) embeddings and dict of outputs
        batch_size = image.shape[0]
        embeddings = nn.Dense(self.num_classes)(image)
        outputs = {'logits': embeddings}
        return embeddings, outputs

# Create a mock module structure for importlib
import sys
from types import ModuleType

# Mock big_vision.models modules
proj_image_text_text_transformer = ModuleType('proj.image_text.text_transformer')
proj_image_text_text_transformer.Model = TextTransformerModel

vit_module = ModuleType('vit')
vit_module.Model = VitModel

big_vision = ModuleType('big_vision')
big_vision_models = ModuleType('big_vision.models')
big_vision_models.proj = ModuleType('big_vision.models.proj')
big_vision_models.proj.image_text = ModuleType('big_vision.models.proj.image_text')
big_vision_models.proj.image_text.text_transformer = proj_image_text_text_transformer
big_vision_models.vit = vit_module

sys.modules['big_vision'] = big_vision
sys.modules['big_vision.models'] = big_vision_models
sys.modules['big_vision.models.proj'] = big_vision_models.proj
sys.modules['big_vision.models.proj.image_text'] = big_vision_models.proj.image_text
sys.modules['big_vision.models.proj.image_text.text_transformer'] = proj_image_text_text_transformer
sys.modules['big_vision.models.vit'] = vit_module

# Small jax random key for initialization
key = jax.random.PRNGKey(0)

# Create small sample tensors (batch_size=2)
batch_size = 2
image_dim = 4
text_dim = 3
embedding_dim = 4

sample_image = jnp.ones((batch_size, image_dim))
sample_text = jnp.ones((batch_size, text_dim))

# Build config dicts
image_config = {'hidden_dim': 8}
text_config = {'hidden_dim': 6}

ARGS = {
    'image': image_config,
    'text': text_config,
    'text_model': 'proj.image_text.text_transformer',
    'image_model': 'vit',
    'out_dim': (embedding_dim, embedding_dim),
    'temperature_init': 1.0,
    'bias_init': 0.1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Model — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Model 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 1 samples lifted from this paper's linked repositories, 1 carry a function identity and 0 do not. Of the 1 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 1 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-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We introduce Three Towers (3T), a flexible method to improve the contrastive learning of vision-language models by incorporating pretrained image classifiers. While contrastive models are usually trained from scratch, LiT [85] has recently shown performance gains from using pretrained classifier embeddings. However, LiT directly replaces the image tower with the frozen embeddings, excluding any potential benefits from training the image tower contrastively. With 3T, we propose a more flexible strategy that allows the image tower to benefit from both pretrained embeddings and contrastive training. To achieve this, we introduce a third tower that contains the frozen pretrained embeddings, and we encourage alignment between this third tower and the main image-text towers. Empirically, 3T consistently improves over LiT and the CLIP-style from-scratch baseline for retrieval tasks. For classification, 3T reliably improves over the from-scratch baseline, and while it underperforms relative to LiT for JFT-pretrained models, it outperforms LiT for ImageNet-21k and Places365 pretraining.

For agents

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

get_harvested_code_for_paper("2305.16999")
get_code_for_paper("2305.16999")
have("2305.16999")

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

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

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

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

Connect an agent — have() is free.