Papers
Topics
Authors
Recent
Search
2000 character limit reached

ProjNCE: Unified Contrastive Learning

Updated 16 January 2026
  • ProjNCE is a generalized contrastive learning framework that extends InfoNCE by incorporating flexible projection functions and an adjustment term.
  • It unifies self-supervised and supervised approaches, enabling robust class separation and a tighter mutual information lower bound.
  • Empirical evaluations on multiple datasets and noise regimes demonstrate its superiority over SupCon and cross-entropy baselines.

ProjNCE is a generalized framework for contrastive learning that extends the classical InfoNCE objective to unify self-supervised and supervised contrastive approaches. By introducing flexible projection functions and an adjustment term, ProjNCE achieves a valid mutual information (MI) bound, enabling improved representation learning with robust class separation. This formulation accommodates diverse strategies for embedding class information and demonstrates empirical superiority over SupCon and cross-entropy baselines across various datasets, noise regimes, and evaluation criteria (Jeong et al., 11 Jun 2025).

1. Formal Definition and Mathematical Foundation

The multi-sample InfoNCE objective (for self-supervised scenarios) is traditionally:

INCEself(X;C)=1Ni=1NEp(xici)jip(xj)[logexp(ψ(f(xi),f(xi))/τ)j=1Nexp(ψ(f(xi),f(xj))/τ)]I_{\mathrm{NCE}^{\rm self}}(X;C) = \frac{1}{N}\sum_{i=1}^N \mathbb{E}_{p(x_i|c_i)\prod_{j\neq i}p(x_j)} \left[ -\log \frac{\exp\left(\psi(f(x_i), f(x_i))/\tau\right)}{\sum_{j=1}^N \exp\left(\psi(f(x_i), f(x_j))/\tau\right)} \right]

where f()f(\cdot) is a normalized encoder, ψ(u,v)=uv\psi(u,v) = u \cdot v is the critic, and τ\tau is the temperature scaling.

ProjNCE introduces two projection functions:

g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}

which enable positives and negatives to use separate projections, yielding the generalized objective:

INCEself-p(X;C)=1Ni=1NEp(xici)jip(xj)[logexp(ψ(f(xi),g+(ci)))j=1Nexp(ψ(f(xi),g(cj)))]I_{\mathrm{NCE}^{\rm self\text{-}p}}(X;C) = \frac{1}{N}\sum_{i=1}^N \mathbb{E}_{p(x_i|c_i)\prod_{j\neq i}p(x_j)} \left[ -\log \frac{\exp\left(\psi(f(x_i), g_+(c_i))\right)}{\sum_{j=1}^N \exp\left(\psi(f(x_i), g_-(c_j))\right)} \right]

To ensure this variant forms a valid MI lower bound, an adjustment term is introduced:

R(X,C)=Ep(x)j=1Np(xj)[k=1Nexp(ψ(f(x),g+(ck)))k=1Nexp(ψ(f(x),g(ck)))]R(X,C) = \mathbb{E}_{p(x)\prod_{j=1}^N p(x_j)} \left[ \frac{\sum_{k=1}^N \exp(\psi(f(x), g_+(c_k)))}{\sum_{k=1}^N \exp(\psi(f(x), g_-(c_k)))} \right]

The ProjNCE loss is thus:

LProjNCE(X;C)=INCEself-p(X;C)+R(X,C)\mathcal{L}_{\mathrm{ProjNCE}}(X;C) = I_{\mathrm{NCE}^{\rm self\text{-}p}}(X;C) + R(X,C)

This setup enables the encoder to pull representations toward positive class projections and push away from negative projections, with the adjustment term insuring that the overall loss remains a tight MI lower bound.

2. Mutual Information Bound Properties

The principal theoretical result is a multi-sample NWJ-type bound:

I(X;C)1+logNINCEself-p(X;C)R(X,C)I(X;C) \ge 1 + \log N - I_{\mathrm{NCE}^{\rm self\text{-}p}}(X;C) - R(X,C)

or equivalently,

LProjNCEI(X;C)(1+logN)-\mathcal{L}_{\mathrm{ProjNCE}} \le I(X;C) - (1 + \log N)

Here, minimizing the ProjNCE loss tightens the lower bound on f()f(\cdot)0 regardless of the specific choices of critic or projections. The proof leverages the NWJ variational MI estimator, rearranging terms to recover the generalized InfoNCE and adjustment expectations. The formulation encompasses both self-supervised and supervised scenarios and generalizes the relationship between SupCon and MI estimation.

3. Projection Function Strategies

ProjNCE’s core flexibility lies in the arbitrary choice of f()f(\cdot)1 projection strategies. Key variants include:

  • Centroid-based (SupCon-style):

f()f(\cdot)2

This recovers the standard SupCon loss plus the f()f(\cdot)3 term.

  • Orthogonal (conditional-expectation/Soft variants):

f()f(\cdot)4

Estimated via kernel regression (Nadaraya–Watson estimator):

f()f(\cdot)5

  • SoftNCE: f()f(\cdot)6 (no f()f(\cdot)7 term; f()f(\cdot)8)
  • SoftSupCon: f()f(\cdot)9, ψ(u,v)=uv\psi(u,v) = u \cdot v0 (with ψ(u,v)=uv\psi(u,v) = u \cdot v1)
    • Median-based (robust):

ψ(u,v)=uv\psi(u,v) = u \cdot v2

Yielding analogous MedNCE and MedSupCon objectives.

This generalization enables tailored class embedding selection, supporting robustness to label noise and feature corruption via median and kernel strategies.

4. Experimental Evaluation and Quantitative Performance

Experiments employ a ResNet-18 encoder with ψ(u,v)=uv\psi(u,v) = u \cdot v3, AdamW optimizer, batch sizes ψ(u,v)=uv\psi(u,v) = u \cdot v4 or ψ(u,v)=uv\psi(u,v) = u \cdot v5, and temperature ψ(u,v)=uv\psi(u,v) = u \cdot v6. Datasets include CIFAR-10/100, Tiny-ImageNet, Imagenette, Caltech256, Food101, STL-10, and synthetic mixtures for MI estimation.

Top-1 Accuracy Across Variants

Dataset CE SupCon ProjNCE SoftNCE SoftSupCon
CIFAR-10 92.79 93.47 93.90 93.15 93.36
CIFAR-100 64.71 68.89 69.47 70.44 68.52
Tiny-ImageNet 16.26 50.92 54.08 49.13 49.94
Imagenette 84.97 84.74 84.71 85.40 84.18
Caltech256 75.63 83.18 81.08 80.94 80.94
Food101 68.29 69.18 70.18 68.27 67.69

Robustness to Label Noise (STL-10, label-flip probability ψ(u,v)=uv\psi(u,v) = u \cdot v7)

Method 0.0 0.1 0.2 0.3 0.4 0.5
SupCon 77.71 71.89 67.43 62.85 51.63 50.41
ProjNCE 79.19 75.41 70.96 64.14 55.36 52.21
SoftNCE 78.10 72.94 70.39 61.89 56.58 54.94
MedSupCon 79.04 75.19 72.70 66.36 60.78 57.11

Mutual information estimates (Mixed-KSG) corroborate that ProjNCE consistently achieves higher ψ(u,v)=uv\psi(u,v) = u \cdot v8 than SupCon.

5. Ablation Studies and Empirical Insights

Experimental ablations illuminate the influence of projection choice, adjustment-term weighting, kernel parameters, and robustness properties:

  • Adjustment Term Weight (ψ(u,v)=uv\psi(u,v) = u \cdot v9): Using τ\tau0, t-SNE visualizations show τ\tau1 induces class cluster dispersion, facilitating greater false-positive separation, while τ\tau2 can lead to excessive intra-class tightness.
  • Kernel Bandwidth (τ\tau3): In SoftNCE, setting τ\tau4 with τ\tau5 distance and Epanechnikov kernel maximizes accuracy; τ\tau6 degrades performance via oversmoothing.
  • Projection Dependence: SoftNCE tightens MI bounds most for binary classification; centroid-based ProjNCE excels in multiclass contexts; median variants are most robust to feature or label noise.
  • Noisy Feature Robustness: MedSupCon achieves the highest accuracy under pixel-level Gaussian noise, and integrating ProjNCE into joint-training pipelines augments performance by approximately 1 percentage point.

A plausible implication is that the flexibility in τ\tau7 adaptation is directly responsible for the observed improvements, particularly under challenging conditions.

6. Guidelines for Practical Use

Implementation of ProjNCE requires several practical considerations:

  • Batch Size: A minimum of 256 is required to stabilize both the InfoNCE and τ\tau8 terms.
  • Temperature (τ\tau9): Default g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}0; tuning in g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}1 can optimize results.
  • Adjustment Term Weight (g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}2): Start with 1; increase for greater cluster separation, decrease if clusters are too dispersed.
  • Projections:
    • Centroid: In-batch averaging over class.
    • Orthogonal (Soft): Kernel regression; use g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}3 distance, Epanechnikov kernel, g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}4.
    • Median: Compute median dimension-wise.
  • Negative Sampling: In-batch negatives suffice; consider a memory bank for large datasets, maintaining class-independent sampling to preserve g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}5 validity.
  • Optimization: AdamW, linear learning-rate warmup, weight decay g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}6; gradient clipping of g+:{1,,M}Rdz,g:{1,,M}Rdzg_+: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}, \quad g_-: \{1, \ldots, M\} \rightarrow \mathbb{R}^{d_z}7 if necessary.
  • Downstream Tasks: After contrastive pre-training, freeze encoder and train a linear classifier for 50–100 epochs.

This methodology offers a unified view of contrastive objectives under valid MI bounds, with projection flexibility and adjustment-term refinement yielding consistent, broadly-applicable performance improvements (Jeong et al., 11 Jun 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to ProjNCE.