{"notes":[{"id":"contrastive-learning/cpc","category":"contrastive-learning","legacyPath":"contrastive-learning/1807-cpc","legacySlug":"1807-cpc","legacyPaths":[],"title":"CPC","subtitle":"Today shapes tomorrow","author":"Z. Yuan","paperDate":"2018-07-10","publishedOn":"2025-01-16","paperTitle":"Representation Learning with Contrastive Predictive Coding","paperUrl":"https://arxiv.org/abs/1807.03748","bibliography":{"title":"Representation Learning with Contrastive Predictive Coding","authors":["Aaron van den Oord","Yazhe Li","Oriol Vinyals"],"url":"https://arxiv.org/abs/1807.03748","pdfUrl":"https://arxiv.org/pdf/1807.03748","codeUrl":null,"preprint":{"id":"1807.03748","submittedOn":"2018-07-10","url":"https://arxiv.org/abs/1807.03748"},"publication":null,"citation":"@misc{contrastivelearningcpc2018,\n  title = {{Representation Learning with Contrastive Predictive Coding}},\n  author = {Aaron van den Oord and Yazhe Li and Oriol Vinyals},\n  year = {2018},\n  eprint = {1807.03748},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1807.03748}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/cpc.4cc0d1d40232.bib"},"thumbnail":{"src":"/content/papers/assets/a60b1a92f6088b36ddee7c87fed67d1e73769e003c30805f963c6b284d0c3a86.jpg","width":1382,"height":626},"locale":"en","path":"/content/papers/en/contrastive-learning/cpc.915decb4d747.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"infonce","text":"InfoNCE","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"speech-recognition","text":"Speech Recognition","depth":3},{"id":"ablation-experiments","text":"Ablation Experiments","depth":3},{"id":"speaker-identification-visualization","text":"Speaker Identification Visualization","depth":3},{"id":"image-recognition","text":"Image Recognition","depth":3},{"id":"visualization-of-image-features","text":"Visualization of Image Features","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/examplar-cnn","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/invaspread","relation":"comparison","topic":"How to define a self-supervised prediction task"}]},{"id":"contrastive-learning/examplar-cnn","category":"contrastive-learning","legacyPath":"contrastive-learning/1406-examplar-cnn","legacySlug":"1406-examplar-cnn","legacyPaths":[],"title":"Exemplar CNN","subtitle":"Finding Invariant Features","author":"Z. Yuan","paperDate":"2014-06-26","publishedOn":"2025-01-22","paperTitle":"Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks","paperUrl":"https://arxiv.org/abs/1406.6909","bibliography":{"title":"Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks","authors":["Alexey Dosovitskiy","Philipp Fischer","Jost Tobias Springenberg","Martin Riedmiller","Thomas Brox"],"url":"https://arxiv.org/abs/1406.6909","pdfUrl":"https://arxiv.org/pdf/1406.6909","codeUrl":null,"preprint":{"id":"1406.6909","submittedOn":"2014-06-26","url":"https://arxiv.org/abs/1406.6909"},"publication":{"venue":"IEEE Transactions on Pattern Analysis and Machine Intelligence","shortVenue":"IEEE TPAMI","year":2016,"kind":"journal","url":"https://doi.org/10.1109/tpami.2015.2496141"},"citation":"@misc{contrastivelearningexamplarcnn2014,\n  title = {{Discriminative Unsupervised Feature Learning with Exemplar Convolutional Neural Networks}},\n  author = {Alexey Dosovitskiy and Philipp Fischer and Jost Tobias Springenberg and Martin Riedmiller and Thomas Brox},\n  year = {2014},\n  eprint = {1406.6909},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1406.6909}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/examplar-cnn.9f293122852b.bib"},"thumbnail":{"src":"/content/papers/assets/52a4c5931d81eeedf2a0857944f10ddc3749d7195e81184efa2a80bc736d062d.jpg","width":1080,"height":418},"locale":"en","path":"/content/papers/en/contrastive-learning/examplar-cnn.be54ec33fac2.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"experimental-setup","text":"Experimental Setup","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"ablation---number-of-proxy-categories","text":"Ablation - Number of Proxy Categories","depth":3},{"id":"ablation---number-of-samples","text":"Ablation - Number of Samples","depth":3},{"id":"ablation---type-of-image-augmentation","text":"Ablation - Type of Image Augmentation","depth":3},{"id":"ablation---parameter-configuration","text":"Ablation - Parameter Configuration","depth":3},{"id":"filter-visualization","text":"Filter Visualization","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{"ablation---performance-in-image-classification":"ablation---parameter-configuration"},"guide":null,"relatedReading":[{"id":"contrastive-learning/invaspread","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/cpc","relation":"comparison","topic":"How to define a self-supervised prediction task"}]},{"id":"contrastive-learning/invaspread","category":"contrastive-learning","legacyPath":"contrastive-learning/1904-invaspread","legacySlug":"1904-invaspread","legacyPaths":[],"title":"InvaSpread","subtitle":"Traces Under Difficulties","author":"Z. Yuan","paperDate":"2019-04-06","publishedOn":"2025-01-23","paperTitle":"Unsupervised Embedding Learning via Invariant and Spreading Instance Feature","paperUrl":"https://arxiv.org/abs/1904.03436","bibliography":{"title":"Unsupervised Embedding Learning via Invariant and Spreading Instance Feature","authors":["Mang Ye","Xu Zhang","Pong C. Yuen","Shih-Fu Chang"],"url":"https://arxiv.org/abs/1904.03436","pdfUrl":"https://arxiv.org/pdf/1904.03436","codeUrl":null,"preprint":{"id":"1904.03436","submittedOn":"2019-04-06","url":"https://arxiv.org/abs/1904.03436"},"publication":{"venue":"CVPR","year":2019,"kind":"conference","url":"https://arxiv.org/abs/1904.03436"},"citation":"@misc{contrastivelearninginvaspread2019,\n  title = {{Unsupervised Embedding Learning via Invariant and Spreading Instance Feature}},\n  author = {Mang Ye and Xu Zhang and Pong C. Yuen and Shih-Fu Chang},\n  year = {2019},\n  eprint = {1904.03436},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/1904.03436}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/invaspread.a46b3f57ac16.bib"},"thumbnail":{"src":"/content/papers/assets/135f248ffa5c98e798e9cd5d75ab7cdb38fda8130eae2511547941d70f316165.jpg","width":1596,"height":524},"locale":"en","path":"/content/papers/en/contrastive-learning/invaspread.294046788c59.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"model-architecture","text":"Model Architecture","depth":3},{"id":"loss-function","text":"Loss Function","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"experiments-with-unknown-classes","text":"Experiments with Unknown Classes","depth":3},{"id":"ablation-study","text":"Ablation Study","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/examplar-cnn","relation":"comparison","topic":"How to define a self-supervised prediction task"},{"id":"contrastive-learning/cpc","relation":"comparison","topic":"How to define a self-supervised prediction task"}]}],"text":"When dealing with complex, high-dimensional data, we often encounter a profound question:\n\n> Which features are truly \"important\"? Which ones are \"insignificant\"?\n\nIn supervised tasks, in order to minimize the loss function on the training set, the model will often, without our notice, fit some irrelevant features—such as noise, camera angle biases, recording device characteristics, or the habits of the annotators.\n\nIn the short term, the model's performance on the training set improves, and it may even perform well on the test set. However, when deployed in a real environment or faced with unseen data, the model may lose the \"overfitted\" features it previously relied on, significantly diminishing its ability to generalize.\n\n## Defining the Problem\n\nAt this time, generative models are a very popular unsupervised learning approach. The goal of these models is to learn the joint distribution of the data $p(x)$ and generate new samples via a generative model $p(x \\mid z)$.\n\nAt first glance, this seems fine, but consider this:\n\nA generative objective that predicts pixels can devote substantial capacity to low-level details that are irrelevant to classification. This depends on the likelihood or reconstruction loss; generative learning does not universally require an exactly identical reconstruction.\n\nFor representation learning, that computation may not directly serve the downstream task.\n\nThe so-called \"higher-order abstract\" information in speech data might include the speaker’s gender, pitch variation, speech rate, and style. In image data, it might be object shapes, spatial relationships, or styles.\n\nThe authors argue that we should focus on: which features should be selected to reproduce the original form at the next moment (or later moments).\n\n- **The key lies in \"prediction\" not \"reconstruction.\"**\n\nAs long as we can identify the key factors that determine future directions, we can obtain highly relevant information between the \"latent representations of the past\" and the \"features of the future.\"\n\n> Instead of realistically \"reproducing\" the future, it is better to \"extract\" the higher-order semantics shared between the present and future.\n\nIsn't this what people have been discussing for thousands of years?\n\n## Solving the Problem\n\n### Model Architecture\n\n\n\n![model_arch](/content/papers/assets/a60b1a92f6088b36ddee7c87fed67d1e73769e003c30805f963c6b284d0c3a86.jpg)\n\n\n\nTo solve the problem, the authors propose the Contrastive Predictive Coding (CPC) framework.\n\nThe overall architecture is shown in the figure above. We can look at it step by step:\n\n1. **Encoder $g_{\\text{enc}}$**\n\n   The first step is to transform the raw input sequence $\\{x_t\\}$ (which could be feature vectors of each position in an image or every moment of a segmented audio signal) through a \"non-linear encoder\" $g_{\\text{enc}}$ to obtain a latent representation $\\{z_t\\}$:\n\n   $$\n   z_t \\;=\\; g_{\\text{enc}}(x_t).\n   $$\n\n   The purpose of this step is to compress the high-dimensional input into a more concise or abstract representation space, often achieved through convolutional networks (for images or sounds) or other neural network architectures.\n\n2. **Autoregressive model $g_{\\text{ar}}$**\n\n   Next, an autoregressive model $g_{\\text{ar}}$ (such as GRU, LSTM, or another form of RNN) is used to read the time sequence $\\{z_1, z_2, \\ldots, z_t\\}$ and generate a \"context representation\" $c_t$:\n\n   $$\n   c_t \\;=\\; g_{\\text{ar}}(z_{\\le t}) \\;=\\; g_{\\text{ar}}(z_1, z_2, \\ldots, z_t).\n   $$\n\n   $c_t$ can be seen as the hidden state \"the model uses to predict the future after time $t$,\" summarizing the observed $z$ representations up to that point.\n\n3. **Prediction for the Future: Estimating the \"Density Ratio\" Rather than Direct Generation**\n\n   As mentioned earlier, the goal of CPC is to predict future features $x_{t+k}$ given the context $c_t$.\n\n   However, CPC does not directly model $p(x_{t+k} \\mid c_t)$ (generating the entire $x$), but instead learns a density ratio:\n\n   $$\n   f_k(x_{t+k}, c_t) \\;\\;\\propto\\;\\; \\frac{p(x_{t+k} \\mid c_t)}{p(x_{t+k})}.\n   $$\n\n   This ratio represents the likelihood of observing $x_{t+k}$ given context $c_t$, relative to the likelihood of observing $x_{t+k}$ without any context.\n\n   The authors provide a simple implementation using a log-bilinear form:\n\n   $$\n   f_k(x_{t+k}, c_t) \\;=\\; \\exp\\bigl( z_{t+k}^\\mathsf{T} \\, W_k \\, c_t \\bigr),\n   $$\n\n   where $z_{t+k}$ is the representation of $x_{t+k}$ after passing through the encoder, and $W_k$ is a learnable linear transformation. Different $W_k$ can be used for the future $k$-th time step.\n\n---\n\nHere, directly generating high-dimensional data (e.g., images or speech) requires complex models; however, the goal is simply to use \"information related to the context.\" In other words, the model doesn't need to reproduce all the background noise, only to perform contrastive recognition or differentiation of the captured abstract features.\n\nIn practice, the learned representations $z_t$ or $c_t$ from this framework can be used for downstream tasks.\n\nIf more \"historical context\" is needed (e.g., for speech recognition, which requires capturing longer speech segments), use $c_t$. If the task can be handled immediately (e.g., some localized recognition), $z_t$ may suffice. Pooling across the entire image or sequence can also be used to obtain an overall representation.\n\n### InfoNCE\n\nNext, let's look at the loss function used by the authors: **InfoNCE**.\n\nExplaining InfoNCE directly might catch you off guard, so let’s begin with the simple cross-entropy.\n\nIn binary classification, the predicted positive-class probability should approach 1 for positive examples and 0 for negative examples. This can be written as the \"cross-entropy loss\":\n\n$$\n\\mathrm{CE} = - \\Bigl[\\, y \\log(\\hat{y}) \\;+\\; (1-y)\\log(1-\\hat{y}) \\Bigr]\n$$\n\n- If $y=1$ (positive class), the loss becomes $-\\log(\\hat{y})$.\n- If $y=0$ (negative class), the loss becomes $-\\log(1-\\hat{y})$.\n\nCross-entropy here plays the role of \"forcing the model to output the correct probabilities.\" If we treat the \"positive sample\" as class 1 and the \"negative sample\" as class 0, we can train using cross-entropy.\n\nFor $K$ classes, each input $x$ corresponds to one of the classes $k$.\n\nThe model outputs a score $\\{s_1(x), \\dots, s_K(x)\\}$ for each class, and we convert this into probabilities $\\hat{y}_k$ using softmax:\n\n$$\n\\hat{y}_k = \\frac{\\exp(s_k(x))}{\\sum_{j=1}^K \\exp(s_j(x))}.\n$$\n\nIf the true label is \"class $i$\", the entire cross-entropy loss becomes\n\n$$\n\\mathrm{CE}\n\\;=\\;\n-\\, \\log \\Bigl(\\hat{y}_i\\Bigr)\n\\;=\\;\n-\\, \\log \\biggl(\n    \\frac{\\exp(s_i(x))}{\\sum_{j=1}^K \\exp(s_j(x))}\n\\biggr).\n$$\n\nIn other words, we want to **maximize** $\\exp(s_i(x))$ while **relatively** lowering the other $\\exp(s_j(x))$ ($j \\neq i$) to ensure the \"correct class\" has the highest probability.\n\nIn **contrastive learning**, we often encounter the situation:\n\n> In a batch of samples, only one corresponds to your condition/context, and the others are either \"mismatched\" or pure \"noise.\"\n\nFor example, out of $N$ samples, only 1 sample is positive, and the remaining $N-1$ are negative. We want to use the **same cross-entropy** to \"select which one is the positive sample.\"\n\nAt this point, we can use multiclass classification with $K = N$: each candidate position is one choice.\n\n- The \"positive sample\" occupies one position,\n- The remaining $N-1$ positions hold negative samples.\n\nIn practice, we don't treat each negative sample as a distinct semantic class; we treat \"which sample is the positive one\" as a **one-of-many** problem.\n\nInfoNCE uses multiclass cross-entropy to perform the \"positive vs. negative\" contrast.\n\nIn the paper, the loss for InfoNCE is defined over a candidate set as follows:\n\n$$\nL_N\n=\n-\\, \\mathbb{E}_{X} \\Biggl[\n    \\log \\frac{ f_k(x_{\\text{pos}}, c) }\n               { \\sum_{x_j \\in X} f_k(x_j, c) }\n\\Biggr]\n$$\n\nWhere:\n\n- $X = \\{x_1, x_2, ..., x_N\\}$ includes 1 **positive sample** $x_{\\text{pos}}$ (which truly matches the context $c$), and $N-1$ **negative samples**.\n- $f_k(x, c)$ is a positive score, analogous to $\\exp(s_i(x))$ above.\n- The candidate set $X$ need not be a training batch. For the mutual-information bound below, the positive is drawn conditionally on $c$ and the negatives independently from the marginal distribution $p(x)$.\n\nIn this one-of-many problem, the $N$ candidates occupy $N$ positions, and the model must find the position of the positive sample.\n\nThe name InfoNCE comes from the fact that the authors further prove:\n\n- **Minimizing** this contrastive cross-entropy ($L_N$)\n- **Raises** the **lower bound** of the mutual information between the context $c$ and the target sample $x_{\\text{pos}}$.\n\nIn other words, when we use this contrastive method to differentiate between \"positive vs. negative samples,\" the model is forced to learn the \"shared information between the context and the positive sample.\"\n\n- Mathematically, it can be proven that: $I(x, c) \\ge \\log(N) - L_N$.\n- Under the paper's sampling assumptions, a larger $N$ can make this bound tighter; its actual value still depends on $L_N$.\n\n\n> [!TIP]\n> \n> **How does it differ from the original NCE?**\n> \n> **NCE (Noise Contrastive Estimation)** was earlier used to estimate the \"density ratio of a target distribution $p(x)$ to a noise distribution $q(x)$\"; it’s commonly used in word vectors, word probability distributions, etc., aiming to reduce the difficult-to-compute normalization constant.\n> \n> **InfoNCE** specifically focuses on \"contrastive learning\" and \"maximizing mutual information.\" Its mathematical form still uses cross-entropy, but it emphasizes \"which $x$ is the positive sample given context $c$\"; minimizing the loss raises the mutual-information lower bound given in the paper.\n> \n> Looking purely at the mathematical form, InfoNCE can also be considered a \"variant of NCE,\" but it is applied in the context of \"contrastive self-supervised learning\" and \"maximizing mutual information.\"\n\n\n## Discussion\n\nThe authors applied the CPC method to four different domains:\n\n1. **Speech**\n2. **Images**\n3. **Natural Language**\n4. **Reinforcement Learning**\n\nThe authors explored how much distinguishable information the model learned through \"linear classification\" or qualitative evaluations. In reinforcement learning, they incorporated the CPC auxiliary loss function into the agent model to observe improvements in convergence speed.\n\nHowever, due to space constraints, we will only look at the results of CPC in the speech and image domains. For the other domains, readers are encouraged to refer to the original paper.\n\n### Speech Recognition\n\nIn the speech domain, the authors used a 100-hour subset from the publicly available LibriSpeech dataset. Although the dataset primarily provides raw speech and transcribed text, the authors used the Kaldi toolkit and its pretrained model on LibriSpeech to generate corresponding \"phoneme sequence\" labels.\n\nThe authors have uploaded the aligned phone labels and their training/test split to Google Drive for easy reproduction of the experiments. The dataset contains 251 different speakers.\n\n\n> [!TIP]\n> \n> Interested readers can download the data here: [**CPC Phone Labels**](https://drive.google.com/drive/folders/1BhJ2umKH3whguxMwifaKtSra0TgAbtfb)\n\n\nThe model architecture, as described earlier, uses a 5-layer convolutional network as the encoder, with each layer's stride and filter size being $[5, 4, 2, 2, 2]$ and $[10, 8, 4, 4, 4]$, respectively. Each layer has 512 hidden units, and the ReLU activation function is used.\n\nIn the autoregressive model, the authors used a GRU with a hidden layer dimension of 256. During training, the Adam optimizer was used with a learning rate of $2 \\times 10^{-4}$, and the training was conducted on 8 GPUs.\n\nThe figure below shows, for 1 to 20 future steps, the average fraction of comparisons in which the positive sample scores above the negative samples:\n\n\n\n![phone_classification](/content/papers/assets/6be22194035966f6f04da910a30e43e23ba380b408826e5be4c0e9118a8468f3.jpg)\n\n\n\nOverall, predicting further into the future (e.g., $t+20$) becomes more challenging, and the fraction of positive scores above negative scores falls. This is a result for the contrastive prediction task, not downstream phone-classification accuracy.\n\nTo better understand the representations learned by CPC, after training, the authors extracted the GRU outputs (i.e., $c_t$, 256 dimensions) and used this vector as a feature to perform **linear classification** for multiclass recognition across the entire dataset.\n\nThe results are shown in the table below:\n\n\n\n![phone_classification](/content/papers/assets/3c21c91bbbbbedae6f503670ccba1ade9c224b99eb59cdf1396e41f83c42b84b.jpg)\n\n\n\nThe terms in the table represent:\n\n- **Random initialization**: Features from a randomly initialized encoder, evaluated with a trained classifier.\n- **MFCC**: Traditional speech features (Mel-frequency cepstral coefficients) used to train the same linear classifier.\n- **Supervised**: End-to-end training using labeled data (the same convolutional + GRU architecture), used as a supervised reference, not a theoretical upper bound.\n\nFor phone classification, CPC reaches 64.6%, above MFCC's 39.7% but below the fully supervised model's 74.6%. Speaker classification reaches 97.4%, close to the supervised model's 98.5%. If the phone-classification probe has one hidden layer, its accuracy rises from 64.6% to 72.5%; that is a different setting from the linear probe in the table.\n\n### Ablation Experiments\n\n\n\n![future_prediction](/content/papers/assets/6634e7be73e8c927e6a0b3c7e6fbee29ce8eef3c8c62c903844e1af10c0849ee.jpg)\n\n\n\nTo validate whether the design of CPC truly helps, the authors conducted two types of ablation experiments:\n\n1. **Changing the prediction time steps**: Predicting 2, 4, 8, 12, and 16 future steps gives phone-classification accuracies of 28.5%, 57.6%, 63.6%, 64.6%, and 63.8%, respectively. Predicting multiple steps helps in this setting, though more steps are not always better.\n2. **Different negative sample strategies**:\n   - \"Mixed speakers\" vs. \"Same speaker\": Whether to include slices from different speakers in the negative samples.\n   - Whether to exclude the current sequence itself as a source of negative samples (`excl.` in the table).\n   - Drawing negative samples only from the current sequence vs. from other sequences in the batch.\n\nThese strategies change the phone-classification results: same-speaker negatives give 65.5%, compared with 64.6% for mixed-speaker negatives; excluding the current sequence gives 64.6% and 57.3%, respectively. Drawing only from the current sequence gives 65.2%. The table does not support saying that one sampling strategy is always best.\n\n### Speaker Identification Visualization\n\n\n\n![speaker_classification](/content/papers/assets/9b98245a1303036817a4e3a3c9a420cd92495f2c5ab7d32e2f9cc49b7b0eb421.jpg)\n\n\n\nThe authors used t-SNE to project CPC speech representations from 10 of the 251 speakers onto a 2D plane.\n\nIn this qualitative example, the representations of those 10 speakers are mostly separated. The 97.4% speaker-classification accuracy in Table 1 gives more direct quantitative evidence.\n\n### Image Recognition\n\nIn the image domain experiments, the authors used the ILSVRC ImageNet dataset, which is a common benchmark for evaluating various unsupervised visual models.\n\nThe authors followed the approach from past literature:\n\n- [**Multi-task self-supervised visual learning**](https://arxiv.org/abs/1708.07860)\n\nThe encoder was an initially untrained ResNet v2-101 without Batch Normalization. After unsupervised training, a linear classifier was trained using ImageNet labels for evaluation.\n\nTraining first randomly cropped a 256×256 image from a 300×300 image. A 7×7 grid was then extracted from that crop, with each patch measuring 64×64 and overlapping its neighbors by 32 pixels.\n\n\n\n![img_patch](/content/papers/assets/6a07db2392b673f50a4aa7720d3479b6c802b0ef7b8cd134edc30c989447046d.jpg)\n\n\n\n\n> [!TIP]\n> \n> This process is similar to the patching process in ViT.\n\n\nTraining also used horizontal flipping (50% chance) and conversion to grayscale. Each 64×64 patch was randomly cropped to 60×60 and then padded back to 64×64.\n\nThe representations extracted by ResNet v2-101 came from the third residual module, followed by spatial average pooling to obtain a 1024-dimensional vector, forming a 7×7×1024 tensor. The next step used a PixelCNN-like architecture to perform \"autoregressive\" predictions on the 7×7 grid: from top to bottom, each row tried to predict the features up to 5 rows ahead, with contrastive loss applied to each patch in the target row.\n\nThe experimental results are shown in the table below:\n\n\n\n![imagenet_results](/content/papers/assets/a49255ec45ab06ad26c4885e6127b9c58d7291b4e4a0bfc7e07e78da38b33912.jpg)\n\n\n\nThe metrics are top-1 and top-5 classification accuracy on ImageNet. CPC reaches 48.7% top-1, 9.1 percentage points above the previous best 39.6% within the table's ResNet-v2 group. Its 73.6% top-5 is 4.3 percentage points above the 69.3% four-task combination listed as the previous best.\n\n- The table groups AlexNet and ResNet-v2 top-1 results separately; they should not be read as comparisons using the same backbone.\n- The CPC linear classifier spatially average-pools the 7×7×1024 representation first. The cited prior method uses a different feature size and classifier setup.\n\nThese ImageNet linear evaluations show higher accuracy for CPC under the reported settings; the backbone and probe differences still matter when comparing methods.\n\n### Visualization of Image Features\n\n![image_features](/content/papers/assets/568227be95974280e501d15470474303cc4065ed76555eaecc2ca9c73fbccb6a.jpg)\n\nFinally, the authors show image patches that strongly activate the same neuron, one neuron per row. Eyes, wheels, sky, and other similar appearances recur within rows. This is a qualitative view of feature preferences; the classification results in the table remain the evidence for accuracy.\n\n## Conclusion\n\nCPC offers a flexible and efficient approach in the field of unsupervised learning, combining autoregressive models with noise contrastive loss to automatically extract more abstract and generalizable representations from high-dimensional inputs.\n\nIn the past, we often had to tailor specific feature extraction methods for different data modalities or application scenarios. However, CPC shows that representation learning can be performed with a similar mechanism across tasks in speech, image, and text, and this universality opens up more possibilities for future research and applications.\n\n\n> [!TIP]\n> \n> The same learning principle is tested separately across modalities. This is not joint training that aligns paired image, audio, and text representations, though it suggests a useful direction for later work.\n","imageSizes":{"/content/papers/assets/a60b1a92f6088b36ddee7c87fed67d1e73769e003c30805f963c6b284d0c3a86.jpg":{"width":1382,"height":626},"/content/papers/assets/6be22194035966f6f04da910a30e43e23ba380b408826e5be4c0e9118a8468f3.jpg":{"width":928,"height":604},"/content/papers/assets/3c21c91bbbbbedae6f503670ccba1ade9c224b99eb59cdf1396e41f83c42b84b.jpg":{"width":820,"height":720},"/content/papers/assets/6634e7be73e8c927e6a0b3c7e6fbee29ce8eef3c8c62c903844e1af10c0849ee.jpg":{"width":820,"height":804},"/content/papers/assets/9b98245a1303036817a4e3a3c9a420cd92495f2c5ab7d32e2f9cc49b7b0eb421.jpg":{"width":964,"height":564},"/content/papers/assets/6a07db2392b673f50a4aa7720d3479b6c802b0ef7b8cd134edc30c989447046d.jpg":{"width":1224,"height":604},"/content/papers/assets/a49255ec45ab06ad26c4885e6127b9c58d7291b4e4a0bfc7e07e78da38b33912.jpg":{"width":1432,"height":602},"/content/papers/assets/568227be95974280e501d15470474303cc4065ed76555eaecc2ca9c73fbccb6a.jpg":{"width":1682,"height":994}}}
