Contrastive Predictive Coding (CPC) is a self-supervised representation learning method that learns useful features from sequential data by maximizing the mutual information between a context vector and future observations. The architecture employs an autoregressive model to summarize past information into a compact context representation, then uses a probabilistic contrastive loss—specifically InfoNCE—to distinguish positive future samples from negative distractors in a learned latent space.
Glossary
Contrastive Predictive Coding (CPC)

What is Contrastive Predictive Coding (CPC)?
Contrastive Predictive Coding is a self-supervised learning framework that extracts useful representations from high-dimensional data by training an autoregressive model to predict future latent representations using a probabilistic contrastive loss.
In the context of automatic modulation classification, CPC can be pre-trained on vast amounts of unlabeled raw IQ samples to learn rich, structured representations of signal dynamics before fine-tuning on scarce labeled data. This approach is particularly valuable for few-shot modulation learning, where the encoder trained via CPC captures the temporal structure and latent features of waveforms, enabling rapid adaptation to novel or rare modulation schemes with minimal supervision.
Key Features of CPC
A self-supervised framework that learns powerful representations by training an autoregressive model to predict future latent states using a probabilistic contrastive loss, excelling in domains with high-dimensional, sequential structure.
Autoregressive Context Modeling
CPC employs a recurrent neural network (often a GRU) as an autoregressive model to summarize the history of past latent representations into a single compact context vector.
- The context vector aggregates information from all previous timesteps.
- It discards low-level noise and retains high-level, slowly varying features useful for prediction.
- This forces the model to capture the underlying structure of the data rather than trivial local statistics.
Probabilistic Contrastive Loss (InfoNCE)
Instead of predicting exact future values, CPC maximizes the mutual information between the context vector and future observations using a contrastive loss called InfoNCE.
- A density ratio is estimated via a log-bilinear model:
f_k(x_{t+k}, c_t) = exp(z_{t+k}^T W_k c_t). - The model is trained to score the true future sample higher than a set of negative samples drawn from a proposal distribution.
- This avoids costly generative modeling of high-dimensional data and focuses on capturing shared information.
Slow Feature Extraction
CPC learns representations that vary slowly over time, aligning with the principle that high-level semantic content changes more gradually than raw signal values.
- A non-linear encoder maps raw observations to a lower-dimensional latent space.
- The autoregressive model is trained to predict future latents up to
Ksteps ahead. - This encourages the encoder to filter out high-frequency noise and retain features that persist across multiple timesteps, making it ideal for speech, video, and RF signal analysis.
Multi-Scale Prediction
CPC can be extended to learn representations at multiple temporal scales by applying the contrastive loss to predictions at various offsets simultaneously.
- Separate context networks can be trained for different prediction horizons.
- This captures both short-term dynamics (e.g., phoneme transitions) and long-term structure (e.g., speaker identity).
- In automatic modulation classification, this allows the model to learn both rapid symbol-rate features and slower frame-level protocol structures from raw IQ samples.
Unsupervised Pre-Training for Downstream Tasks
The representations learned by CPC serve as powerful, general-purpose features that transfer effectively to supervised tasks with limited labeled data.
- After pre-training on unlabeled data, the encoder can be frozen or fine-tuned for classification.
- CPC features have achieved state-of-the-art results in phoneme recognition, speaker identification, and image classification without using any labels during pre-training.
- For few-shot modulation learning, a CPC encoder pre-trained on raw, unlabeled spectrum captures provides a robust initialization, drastically reducing the number of labeled examples needed to identify novel signal types.
Negative Sampling Strategy
The quality of CPC representations depends heavily on the choice of negative samples used in the InfoNCE loss.
- Negatives can be drawn uniformly from the same sequence or from other sequences in the batch.
- Hard negative mining—selecting negatives that are most similar to the positive—improves the discriminative power of the learned features.
- In RF applications, negatives can be sampled from signals with different modulation schemes, forcing the model to learn features that are invariant to noise but discriminative across modulation types.
Frequently Asked Questions
Clear, technical answers to the most common questions about Contrastive Predictive Coding and its role in self-supervised representation learning for signal intelligence.
Contrastive Predictive Coding (CPC) is a self-supervised representation learning method that extracts useful features from high-dimensional data by training an autoregressive model to predict future latent representations using a probabilistic contrastive loss. The architecture consists of a non-linear encoder g_enc that maps raw observations x_t to a sequence of latent representations z_t, followed by an autoregressive context model g_ar that summarizes all past latents z_{≤t} into a single context vector c_t. The core innovation is the InfoNCE loss (Noise-Contrastive Estimation), which maximizes the mutual information between the context c_t and future latents z_{t+k} by distinguishing the true future sample from a set of negative samples drawn from a proposal distribution. This forces the model to encode slow features and high-level semantics that are shared across time steps while discarding low-level noise, making it exceptionally effective for learning representations from sequential data like raw IQ samples in automatic modulation classification.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Contrastive Predictive Coding (CPC) is a foundational self-supervised method that learns representations by predicting future latent states. The following concepts are essential for understanding its application in few-shot modulation learning.
InfoNCE Loss
The probabilistic contrastive loss at the heart of CPC. It uses noise-contrastive estimation to maximize the mutual information between a context vector and future latent representations. The model must correctly identify the true future sample from a set of negative distractors.
- Mechanism: A categorical cross-entropy loss over a batch of samples
- Objective: Pulls positive pairs (context, future) together; pushes negatives apart
- Key property: The density ratio estimated by the loss preserves the mutual information between the signal's past and future
Autoregressive Context Model
CPC employs a unidirectional recurrent or masked convolutional network to summarize the history of latent representations into a single compact context vector. This context is then used to predict multiple future time steps.
- Common architectures: Gated Recurrent Units (GRUs) or causal Transformers
- RF application: Summarizes the sequential structure of IQ samples to capture the temporal dynamics of a modulation scheme
- Contrast with: Bidirectional models like BERT, which are not suitable for predictive tasks
Mutual Information Maximization
The theoretical underpinning of CPC. Rather than predicting raw signal values, CPC maximizes the mutual information between the context representation and future observations. This encourages the model to extract slow features—high-level characteristics that persist over time.
- Benefit: Filters out low-level noise and focuses on semantically meaningful signal structure
- Outcome: Learned representations are excellent for downstream tasks like modulation classification with very few labels
Negative Sampling Strategies
The choice of negative samples critically impacts representation quality. Effective strategies for RF signals include:
- Temporal negatives: Samples from other time steps in the same signal recording
- Cross-signal negatives: Samples from different modulation types or noise-only segments
- Hard negative mining: Selecting negatives that are most easily confused with the positive, forcing the model to learn more discriminative features for similar constellations like QAM16 vs. QAM64
Pretext Task Design for RF
CPC is a pretext task—a self-supervised objective whose byproduct is a useful representation. For modulation recognition, effective pretext tasks include:
- Future latent prediction: Standard CPC applied to raw IQ sequences
- Temporal shuffling detection: Identifying whether signal segments are in the correct order
- Contrastive multiview coding: Learning representations that are invariant to known channel impairments by contrasting differently augmented views of the same signal
Linear Evaluation Protocol
The standard benchmark for self-supervised representation quality. After CPC pre-training on unlabeled signals, a frozen feature extractor is used to generate embeddings. A simple linear classifier is then trained on top using a small labeled support set.
- Metric: Classification accuracy with limited labels (e.g., 5-shot)
- Relevance: Directly measures how well CPC representations enable few-shot modulation learning without fine-tuning the entire network

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us