Papers › Representation Learning with Contrastive Predictive Coding

Representation Learning with Contrastive Predictive Coding

10 Jul 2018arXiv:1807.03748archive 2025-07-28

Aaron van den Oord, Yazhe Li, Oriol Vinyals

While supervised learning has enabled great progress in many applications, unsupervised learning has not seen such widespread adoption, and remains an important and challenging endeavor for artificial intelligence. In this work, we propose a universal unsupervised learning approach to extract useful representations from high-dimensional data, which we call Contrastive Predictive Coding. The key insight of our model is to learn such representations by predicting the future in latent space by using powerful autoregressive models. We use a probabilistic contrastive loss which induces the latent space to capture information that is maximally useful to predict future samples. It also makes the model tractable by using negative sampling. While most prior work has focused on evaluating representations for a particular modality, we demonstrate that our approach is able to learn useful representations achieving strong performance on four distinct domains: speech, images, text and reinforcement learning in 3D environments.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1807.03748")

Code

Syntology Ran 29 of 45 code samples harvested from 19 repositories linked to this paper; 16 have no recorded run. Of those that ran: 1 ran · honoured contract; 3 ran · our draft was wrong; 2 ran · fixture could not drive it; 23 ran with no contract checked.

By repository: community (archive-listed): 45 samples from 19 repositories, 29 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

28 repositories listed; official and paper-mentioned ones first.

Linear95/CLUB mentioned on GitHubtf report
Medabid1/CPC mentioned on GitHubpytorch report
RElbers/info-nce-pytorch mentioned on GitHubpytorchMIT report
SPEECHCOG/cpc_pytorch mentioned on GitHubpytorch report
bshall/VectorQuantizedCPC mentioned on GitHubpytorch report
cbg-ethz/bmi mentioned on GitHubjaxMIT report
chorowski-lab/CPC_audio mentioned on GitHubpytorch report
chorowski-lab/hcpc mentioned on GitHubpytorchMIT report
emadeldeen24/eval_ssl_ssc mentioned on GitHubpytorch report
ex4sperans/freesound-classification mentioned on GitHubpytorchApache-2.0 report
facebookresearch/CPC_audio mentioned on GitHubpytorch report
flrngel/cpc-tensorflow mentioned on GitHubtf report
gbarello/CPCLibriSpeech mentioned on GitHubpytorch report
jqhoogland/rgpy mentioned on GitHubtf report
lee-seon-woo/tscp2_pytorch mentioned on GitHubpytorch report
linear95/tc-estimation mentioned on GitHubpytorch report
loeweX/Greedy_InfoMax mentioned on GitHubpytorchMIT report
reallygooday/60daysofudacity mentioned on GitHubpytorchMIT report
talipucar/PyFlow_CPC mentioned on GitHubpytorch report
theolepage/ssl-for-slr mentioned on GitHubtf report
vendyv/CodeSpeedy_Internship mentioned on GitHubtf report
ziqiao-shang/aunce mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

45 samples harvested; 29 ran; 1 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
3ran · our draft was wrong
2ran · fixture could not drive it
23ran
16unverified

Licence: 22 of the 45 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 19 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

Algorithm emadeldeen24/eval_ssl_ssc/algorithms.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · f1e8c76f248d416b · report
Autoregressive theolepage/ssl-for-slr/sslforslr/models/cpc/CPC.py community (archive-listed) ran no licence file found · pointer only · fdb79f7c30db5b04 · report
BaseCriterion facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 98a0dd46a20ece2a · report
CPCEncoder talipucar/PyFlow_CPC/utils/model_utils.py community (archive-listed) ran no licence file found · pointer only · 90540cd2dfd95c3c · report
CPCLoss bshall/VectorQuantizedCPC/model.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 8a0edf707add84b8 · report
CPCModel yusuke0519/constrastive_predictive_coding/cpc.py community (archive-listed) ran · metamorphic tier: deterministic no licence file found · pointer only · 88f5e149a4a5701e · report
CPCModel theolepage/ssl-for-slr/sslforslr/models/cpc/CPC.py community (archive-listed) ran no licence file found · pointer only · d553f5e8f537a269 · report
CPCModel chorowski-lab/hcpc/cpc/model.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · c77e423112015a3b · report
CPCModel Medabid1/CPC/model.py community (archive-listed) ran no licence file found · pointer only · 0c6aa70299e39fb2 · report
CPC_encoder SPEECHCOG/cpc_pytorch/cpc_model.py community (archive-listed) ran · metamorphic tier: invariant licence not identified · pointer only · 1c9942b4ab282406 · report
ConstrainedLayer facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 2ffe2c33220475ca · report
ContextPredictionModel mf1024/Contrastive-Predictive-Coding-for-Image-Recognition-in-PyTorch/models.py community (archive-listed) ran no licence file found · pointer only · 1fb147a76c863ded · report
EqualizedConv1d facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · a31d5f299fb67dc8 · report
EqualizedLinear facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · 20bd3807784699b5 · report
FFNetwork facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic fingerprinted MIT (permissive) · a1fa550706a4d645 · report
InfoNCE Linear95/CLUB/mi_estimators.py community (archive-listed) ran no licence file found · pointer only · ef63ae1da9a9ed0b · report
PredictionNetwork facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 1d652b465739caed · report
Predictor theolepage/ssl-for-slr/sslforslr/models/cpc/CPC.py community (archive-listed) ran no licence file found · pointer only · 61e69ae0f2b2b9d6 · report
Resblock Medabid1/CPC/model.py community (archive-listed) ran fingerprinted no licence file found · pointer only · 06beece7949a622a · report
ShiftedConv facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · 0608dabb9a52bed6 · report
au_infonce_loss ziqiao-shang/aunce/losses.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · e5a1ba36ae15b5da · report
cpc emadeldeen24/eval_ssl_ssc/algorithms.py community (archive-listed) ran · metamorphic tier: deterministic MIT (permissive) · ed486b5fa192c61f · report
cpc_loss theolepage/ssl-for-slr/sslforslr/models/cpc/CPC.py community (archive-listed) ran · fixture could not drive it fingerprinted no licence file found · pointer only · bf44986039feb903 · report
encoder Medabid1/CPC/model.py community (archive-listed) ran no licence file found · pointer only · 4f22c55f43f447da · report
getLayerNormalizationFactor facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) ran · honoured contract MIT (permissive) · 8dd3d0253826c3e4 · report
get_context yusuke0519/constrastive_predictive_coding/cpc.py community (archive-listed) ran · our draft was wrong no licence file found · pointer only · 3fd9a785ec6e3e12 · report
info_nce lee-seon-woo/tscp2_pytorch/src/models/losses.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 4bd8a922e4fd21df · report
multi_batch_InfoNCE_loss gbarello/CPCLibriSpeech/CPCLibriSpeech/model_management/build_models.py community (archive-listed) ran · metamorphic tier: invariant no licence file found · pointer only · 6d4dd79504cddf0f · report
network_autoregressive davidtellez/contrastive-predictive-coding/train_model.py community (archive-listed) ran · fixture could not drive it fingerprinted no licence file found · pointer only · 65037d99b31b9ae7 · report
CDCK2 jefflai108/Contrastive-Predictive-Coding-PyTorch/src/model/model.py community (archive-listed) unverified MIT (permissive) · bacdbc0bbfe53598 · report
CPC talipucar/PyFlow_CPC/utils/model_utils.py community (archive-listed) unverified no licence file found · pointer only · 274596d912e6af16 · report
CPC flrngel/cpc-tensorflow/model.py community (archive-listed) unverified no licence file found · pointer only · e720870fffa7cffb · report
CPCLayer davidtellez/contrastive-predictive-coding/train_model.py community (archive-listed) unverified no licence file found · pointer only · d3271e5b8a942d2c · report
CPCModel chorowski-lab/CPC_audio/cpc/model.py community (archive-listed) unverified MIT (permissive) · 591507cec9d8ebf7 · report
CPCUnsupersivedCriterion facebookresearch/CPC_audio/cpc/criterion/criterion.py community (archive-listed) unverified MIT (permissive) · 4c96c9c7dcdc4ecf · report
binary_cross_entropy ex4sperans/freesound-classification/networks/losses.py community (archive-listed) unverified Apache-2.0 (permissive) · 45983305e1fcaaef · report
find_threshold ex4sperans/freesound-classification/relabel_noisy_data.py community (archive-listed) unverified Apache-2.0 (permissive) · 9ea8495cf4597e1e · report
focal_loss ex4sperans/freesound-classification/networks/losses.py community (archive-listed) unverified Apache-2.0 (permissive) · 25b22350f74af590 · report
load_predictions ex4sperans/freesound-classification/linear_blend.py community (archive-listed) unverified Apache-2.0 (permissive) · 69d65c023623a577 · report
lsep_loss_stable ex4sperans/freesound-classification/networks/losses.py community (archive-listed) unverified Apache-2.0 (permissive) · 6a0ad9f55e1c06f2 · report
network_cpc davidtellez/contrastive-predictive-coding/train_model.py community (archive-listed) unverified no licence file found · pointer only · 6561bbee1ff09943 · report
network_encoder davidtellez/contrastive-predictive-coding/train_model.py community (archive-listed) unverified no licence file found · pointer only · 9fe706cb1512ff06 · report
network_prediction davidtellez/contrastive-predictive-coding/train_model.py community (archive-listed) unverified no licence file found · pointer only · 4e5d092bb8222498 · report
nonzero ex4sperans/freesound-classification/relabel_noisy_data.py community (archive-listed) unverified Apache-2.0 (permissive) · 7ca3643dc4275445 · report
to_ranks ex4sperans/freesound-classification/linear_blend.py community (archive-listed) unverified Apache-2.0 (permissive) · 0d20ad5fe3e59410 · report

Tasks

Reinforcement LearningRepresentation LearningSelf-Supervised Image ClassificationSemi-Supervised Image Classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Self-Supervised Image Classification ImageNet CPC (ResNet-101 V2) Number of Params 44M #134 of 144 Archive leaderboard report
Self-Supervised Image Classification ImageNet CPC (ResNet-101 V2) Top 1 Accuracy 48.7% #134 of 144 Archive leaderboard report
Self-Supervised Image Classification ImageNet CPC (ResNet-101 V2) Top 5 Accuracy 73.6% #134 of 144 Archive leaderboard report
Semi-Supervised Image Classification ImageNet - 1% labeled data CPC Top 5 Accuracy 64.03% #56 of 65 Archive leaderboard report
Semi-Supervised Image Classification ImageNet - 10% labeled data CPC Top 5 Accuracy 84.88% #57 of 75 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: Contrastive Predictive Coding

1x1 ConvolutionA2CAdamAverage PoolingBottleneck Residual BlockContrastive Predictive CodingConvolutionGRUGlobal Average PoolingInfoNCEKaiming InitializationLSTMLinear LayerMax PoolingPixelCNNRMSPropReLUResidual BlockResidual ConnectionSGD with MomentumSigmoid ActivationStep DecayTanh Activation

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections