SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2110.11316 · NeurIPS · 2022

CLOOB: Modern Hopfield Networks with InfoLOOB Outperform CLIP

Andreas Fürst, Elisabeth Rumetshofer, Johannes Lehner, Viet Tran, Fei Tang, Hubert Ramsauer, David Kreil, Michael Kopp, Günter Klambauer, Angela Bitto-Nemling, Sepp Hochreiter

arXiv · PDF · Open in the Atlas

Code that ran

7 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 0 have no contract verdict; 6 failures of our instrument; 4 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/2110.11316.json · badge: /api/ran/2110.11316.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
ml-jku/cloob canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
crowsonkb/cloob-training canonical (classifier label)
classifier basis: classifier_2025
0 ran · 4 no recorded run
JD-P/cloob-latent-diffusion extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
cloob Ran
ran; our contract draft was wrong, not the code
ml-jku/cloob/src/training/methods.py
pointer only (licence: NOASSERTION) · get_code("6dd41de81496f6ba")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, ml-jku/cloob (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. A run is recorded.

eval_mode Ran
ran; our contract draft was wrong, not the code
JD-P/cloob-latent-diffusion/train_latent_diffusion.py
code served (permissive licence) · get_code("1d4710b26e6ea9f5")
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 _GeneratorContextManager. 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

torch.manual_seed(0)

# Build a minimal model that has the required interface
# The function calls model.modules() and accesses module.training attribute
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = MinimalModel()

ARGS = {
    "model": model,
}
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 _GeneratorContextManager — a _GeneratorContextManager output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _GeneratorContextManager 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
get_alphas_sigmas Ran
ran, honoured the contract we drafted
JD-P/cloob-latent-diffusion/train_latent_diffusion.py
code served (permissive licence) · get_code("7543087fb92417f3")
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 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 math

torch.manual_seed(0)

# The function takes a single parameter 't' which is used in:
# torch.cos(t * math.pi / 2) and torch.sin(t * math.pi / 2)
# So 't' should be a tensor or scalar that can be multiplied by a float

t = torch.tensor(0.5)

ARGS = {
    "t": t
}
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 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
hopfield Ran
ran; our contract draft was wrong, not the code
ml-jku/cloob/src/training/methods.py
pointer only (licence: NOASSERTION) · get_code("e0792a694e05deeb")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, ml-jku/cloob (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. A run is recorded.

hopfield_retrieval Ran
ran; our contract draft was wrong, not the code
ml-jku/cloob/src/training/methods.py
pointer only (licence: NOASSERTION) · get_code("4d5e096e98580645")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, ml-jku/cloob (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. A run is recorded.

infoLOOB_loss Ran
ran; our contract draft was wrong, not the code
ml-jku/cloob/src/training/methods.py
pointer only (licence: NOASSERTION) · get_code("f14e4cd457038dcb")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, ml-jku/cloob (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. A run is recorded.

parse_prompt Ran
ran; our contract draft was wrong, not the code
JD-P/cloob-latent-diffusion/cfg_sample.py
code served (permissive licence) · get_code("1fdcc5450a1266f3")
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 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)

# Analyze the function:
# - parse_prompt takes a 'prompt' string and optional 'default_weight' float
# - It processes the prompt string by checking for http/https prefixes
# - It splits on ':' and converts the last part to float
# - Returns a tuple of (string, float)

ARGS = {
    'prompt': 'https://example.com:2.5',
    'default_weight': 3.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — 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
download_checkpoint Not yet run
unverified (harvested, no recorded run)
crowsonkb/cloob-training/cloob_training/pretrained.py
code served (permissive licence) · get_code("07006f9eb4731a60")
How it ran

no invocation recorded.

get_and_init_model Not yet run
unverified (harvested, no recorded run)
crowsonkb/cloob-training/cloob_training/model.py
code served (permissive licence) · get_code("1b433f466bd550fe")
How it ran

no invocation recorded.

get_config Not yet run
unverified (harvested, no recorded run)
crowsonkb/cloob-training/cloob_training/pretrained.py
code served (permissive licence) · get_code("704cbcc71dd35d3d")
How it ran

no invocation recorded.

get_hk_model Not yet run
unverified (harvested, no recorded run)
crowsonkb/cloob-training/cloob_training/model.py
code served (permissive licence) · get_code("1e3e01f4209f0a95")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

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, 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 11 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-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

CLIP yielded impressive results on zero-shot transfer learning tasks and is considered as a foundation model like BERT or GPT3. CLIP vision models that have a rich representation are pre-trained using the InfoNCE objective and natural language supervision before they are fine-tuned on particular tasks. Though CLIP excels at zero-shot transfer learning, it suffers from an explaining away problem, that is, it focuses on one or few features, while neglecting other relevant features. This problem is caused by insufficiently extracting the covariance structure in the original multi-modal data. We suggest to use modern Hopfield networks to tackle the problem of explaining away. Their retrieved embeddings have an enriched covariance structure derived from co-occurrences of features in the stored embeddings. However, modern Hopfield networks increase the saturation effect of the InfoNCE objective which hampers learning. We propose to use the InfoLOOB objective to mitigate this saturation effect. We introduce the novel "Contrastive Leave One Out Boost" (CLOOB), which uses modern Hopfield networks for covariance enrichment together with the InfoLOOB objective. In experiments we compare CLOOB to CLIP after pre-training on the Conceptual Captions and the YFCC dataset with respect to their zero-shot transfer learning performance on other datasets. CLOOB consistently outperforms CLIP at zero-shot transfer learning across all considered architectures and datasets.

For agents

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

get_harvested_code_for_paper("2110.11316")
get_code_for_paper("2110.11316")
have("2110.11316")

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

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

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

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

Connect an agent — have() is free.