All models

Contrastive Predictive Coding visual hierarchy (CPC-v2/AMDIM-style neuro use)

Self-supervised patch encoder trained to predict the features of neighboring image patches with a contrastive loss.

Image classification · 723 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (595 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
3.7M
Operations
723
Framework
PyTorch
Recurrent
Yes
Published
ICML 2020
Cited by
1,014 (as of 29 October 2026)
Authors
Olivier J. Hénaff, Aravind Srinivas, Jeffrey De Fauw and others
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m15430
Graph hash
fe086befda61563171bd6e2c1ee522b71acdf60142aa53544591d87d0bca84fb
Skeleton hash
5b12a1b50fcf03ed8a07a7e56bb5f94122075c695d63bfecbef4b6d07f7d9cd2
Architecture hash
d04dba1751daee1d3e16ac5440083d33c96c63b5a27f8433333f8344b1c9a15e
Diagram SHA-256
0d6831c27ed8782f79870c4cf55b9fb452ffd1f567551cb5f0815bd1a40f7276
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

Contrastive Predictive Coding (CPC) is an unsupervised objective for learning image representations, and this paper revisits and improves it. The paper's hypothesis is that recognizing images from few labels is enabled by representations that make the variability in natural signals more predictable.

Each image is first divided into a grid of overlapping patches, and an encoder network turns each patch into a single vector. A masked convolutional network then builds a context vector at each position from the feature vectors above it. Feature vectors further down are predicted linearly from the context vectors, and the prediction is scored with a contrastive loss called InfoNCE. The negative samples come from other locations in the image and other images in the mini-batch.

The paper identifies four axes of change: model capacity, layer normalization, predictions in all four directions, and more extensive patch-based augmentation. It found that batch normalization harms downstream performance of large models trained with CPC, and used layer normalization instead. Where the original predicted each patch only from the context above, the revised model also predicts it from below, the right and the left, with separate context networks. The paper reports that linear classification accuracy on ImageNet rises from 48.7% to 71.5% Top-1. This model is the CIFAR10 configuration of a PyTorch implementation, with a Wideresnet-28-2 encoder and a smaller grid size.

Key idea. The paper revisits Contrastive Predictive Coding with a larger encoder, layer normalization, four-direction prediction and patch augmentation, raising ImageNet linear classification from 48.7% to 71.5% Top-1.

  • CPC
  • CPC v2
  • Contrastive Predictive Coding
  • InfoNCE
  • self-supervised learning
  • contrastive learning
  • data-efficient image recognition
  • unsupervised representation learning

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{hénaff2020dataefficientimagerecognitioncontrastive,
      title={Data-Efficient Image Recognition with Contrastive Predictive Coding}, 
      author={Olivier J. Hénaff and Aravind Srinivas and Jeffrey De Fauw and Ali Razavi and Carl Doersch and S. M. Ali Eslami and Aaron van den Oord},
      year={2020},
      eprint={1905.09272},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/1905.09272}, 
}