CLOOB: Modern Hopfield Networks with InfoLOOB Outperform CLIP

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

TL;DR

CLIP is a powerful vision-language foundation model, but it suffers from an "explaining away" problem where it focuses on a few dominant features and ignores other relevant visual information. This paper introduces CLOOB, a novel architecture that uses modern Hopfield networks to enrich feature covariance and a new InfoLOOB objective to prevent training saturation. CLOOB consistently outperforms CLIP on zero-shot transfer learning tasks across multiple architectures and datasets.

What Problem Does This Paper Address?

Contrastive Language-Image Pre-training (CLIP) learns highly expressive multi-modal embeddings by pulling matching image-text pairs together and pushing unmatched pairs apart using the InfoNCE loss function. However, CLIP suffers from the "explaining away" problem: once the model finds a strong feature that confirms a match between an image and text, it stops learning other relevant features. It fails to capture the rich, underlying covariance structure of the data.

To fix this, researchers can use associative memory (like modern Hopfield networks) to reinforce co-occurring features. However, doing so makes the matched embeddings so similar that the standard InfoNCE loss saturates. In InfoNCE, as the similarity of positive pairs gets very high, the gradients vanish, and the model stops pushing dissimilar items apart. The authors needed a way to extract rich features without stalling the learning process.

Methods

The authors propose CLOOB (Contrastive Leave One Out Boost), which modifies the standard CLIP training pipeline to address these issues.

CLOOB Architecture Diagram

CLOOB introduces two key innovations:

  1. Modern Hopfield Networks for Covariance Enrichment: Instead of directly contrasting the raw image and text embeddings, CLOOB uses them as queries to retrieve enriched embeddings from a continuous modern Hopfield network. By storing the current mini-batch in this memory network, the retrieval process amplifies features that frequently co-occur and averages out spurious, sample-specific noise.
  2. The InfoLOOB Objective: To solve the saturation problem caused by the highly similar Hopfield retrievals, CLOOB replaces the InfoNCE loss with InfoLOOB (Leave One Out Bound). InfoNCE takes the mathematical form $a/(a+b)$ (where $a$ is the similarity of matched pairs and $b$ is the similarity of unmatched pairs). Because of this structure, it saturates when $a$ gets large. InfoLOOB, on the other hand, uses the form $a/b$. This prevents the loss from saturating, ensuring the model continues to distribute negative samples uniformly across the embedding space even when positive pairs are highly aligned.

Datasets

  • Pre-training: Conceptual Captions (CC) (2.9 million image-text pairs) and a 15 million sample subset of YFCC100M.
  • Zero-shot & Linear Probing Evaluation: ImageNet, ImageNet V2, Birdsnap, Country211, Flowers102, GTSRB, UCF101, and Stanford Cars.

Key Insights and Ideas

  • A Perfect Balancing Act: Ablation studies reveal a strong synergistic effect. Using InfoLOOB without Hopfield networks leads to overfitting (unmatched pairs get too similar). Using Hopfield networks without InfoLOOB leads to underfitting (InfoNCE saturates too early). Together, they balance each other perfectly, keeping the model in an effective learning regime.
  • Measurable Covariance Enrichment: The authors proved that modern Hopfield networks actually extract more covariance structure by measuring the "effective eigenvalues" of the embedding covariance matrices. CLOOB steadily increases this number during training, meaning the embeddings capture a wider, richer variety of features rather than collapsing to just a few dominant ones.
  • Theoretical Justification for InfoLOOB: The paper provides theoretical backing showing that InfoLOOB is a valid objective for contrastive learning. Unlike InfoNCE, it does not act as an upper bound on mutual information when used with neural networks, allowing it to avoid gradient scaling issues.

Key Results

CLOOB consistently outperforms CLIP in zero-shot transfer learning across all tested datasets and ResNet architectures (RN-50, RN-101, RN-50x4).

Zero-shot transfer learning performance comparison
  • Conceptual Captions Pre-training: When pre-trained on CC for 128 epochs using a ResNet-50 encoder, CLOOB achieved 25.67% zero-shot accuracy on ImageNet compared to CLIP's 21.3%. It also saw massive gains on datasets like UCF101 (23.03% vs 21.63%).
  • YFCC Pre-training: When pre-trained on the larger YFCC dataset, CLOOB beat CLIP on 7 out of 8 zero-shot tasks. For example, it achieved 35.7% on ImageNet (vs CLIP's 34.6%) and 55.1% on Flowers102 (vs CLIP's 48.0%).
  • Scalability: The performance gap between CLOOB and CLIP is maintained or widens as the vision encoder scales up from ResNet-50 to ResNet-101 and ResNet-50x4.

Limitations and Future Work

  • Domain Limitations: The method is currently limited to natural images and short text prompts. Its effectiveness on specialized domains, such as medical or biological imaging, remains unexplored.
  • Compute Constraints: Due to computational limits, the authors could not pre-train CLOOB on the massive 400M+ proprietary dataset used by OpenAI for the original CLIP, limiting direct comparisons at the absolute largest scales.
  • Data Bias: Like all models trained on scraped web data, CLOOB relies on human-annotated datasets (like YFCC and CC) and inherits the social biases present in those datasets.

Summary updated

BibTeX
@inproceedings{furst2022cloob,
  author = {Andreas Fürst and Elisabeth Rumetshofer and Viet Thuong Tran and Hubert Ramsauer and Fei Tang and Johannes Lehner and D P Kreil and Michael K Kopp and Günter Klambauer and Angela Bitto-Nemling and Sepp Hochreiter},
  title = {{CLOOB: Modern Hopfield Networks with InfoLOOB Outperform CLIP}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=qw674L9PfQE},
}
Figure