For a positive pair (x,y)∼p(x,y) and K−1 independent negative samples y2,…,yK∼p(y) with critic score f(x,y), how do you prove that minimising the InfoNCE loss LK=−E[log⁡ef(x,y)ef(x,y)+∑j=2Kef(x,yj)] maximises a lower bound on the mutual information I(X;Y)≥log⁡K−LK, and what is the optimal critic f∗(x,y)?

Deep learning, Self-supervised learning
Level L5 Expert. Length Long. Nature Mat Mathematical.

What's being asked

Whether you can prove the finite-K InfoNCE mutual information bound cleanly and identify the density-ratio optimal critic.

Key idea

Introduce a uniform index M∈{1,…,K} that hides which sample YM came from p(y∣x) while the other K−1 come from p(y). Decomposing I(X;Y) via the joint tuple S=(Y1,…,YK) gives I(X;Y)≥I(M;S∣X)=log⁡K−H(M∣X,S)≥log⁡K−LK, because any softmax classifier’s cross-entropy upper-bounds conditional entropy.

Steps

  1. Set up the symmetry trick: draw M∼Uniform⁡{1,…,K} independently of X∼p(x), sample YM∼p(y∣X) and sample the remaining K−1 items Yj≠M∼i.i.d.p(y). Let S=(Y1,…,YK) and note the marginal product distribution is p(S)=∏j=1Kp(Yj).
  2. Relate I(X;Y) to S: for every i, EX,S∣M=i[log⁡p(S∣X,M=i)p(S)]=EX,Yi[log⁡p(Yi∣X)p(Yi)]=I(X;Y), because the K−1 marginal factors ∏j≠ip(Yj) cancel. Averaging over M and factoring p(S∣X,M)/p(S)=[p(S∣X,M)/p(S∣X)]⋅[p(S∣X)/p(S)] yields I(X;Y)=EX,M,S[log⁡p(S∣X,M)p(S∣X)]+EX[DKL(p(S∣X)∥p(S))].
  3. Drop the non-negative KL term and apply Bayes’ rule inside the first expectation: p(S∣X,M)p(S∣X)=p(M∣X,S)p(M∣X)=K p(M∣X,S) (since p(M∣X)=1/K). Hence I(X;Y)≥log⁡K+EX,M,S[log⁡p(M∣X,S)]=log⁡K−H(M∣X,S).
  4. Bound conditional entropy by InfoNCE cross-entropy: let qf(i∣x,S)=ef(x,yi)∑j=1Kef(x,yj) be the softmax classifier induced by f. By symmetry across M, LK=−EX,M,S[log⁡qf(M∣X,S)]=H(M∣X,S)+EX,S[DKL(p(M∣X,S)∥qf(M∣X,S))]≥H(M∣X,S). Rearranging gives I(X;Y)≥log⁡K−LK.
  5. Find f∗(x,y): equality qf=p(M∣X,S) holds when qf(i∣x,S)=p(S∣x,M=i)∑jp(S∣x,M=j)=p(yi∣x)/p(yi)∑jp(yj∣x)/p(yj), which matches ef∗(x,y)=c(x)p(y∣x)p(y), so f∗(x,y)=log⁡p(y∣x)p(y)+c~(x) (the pointwise mutual information up to any function of x alone).

Common mistakes

How long your answer should be

One page; 8–10 minutes.

Last checked on 4 December 2026.

Read this

Previous in Deep learning: In a DDPM, why is the reverse-time conditional q(xt−1∣xt,x0) tractable when conditioned on x0 even though q(xt−1∣xt) is not, and how do you derive its mean μ~t(xt,x0) and variance β~t by completing the square in Bayes’ rule?
Next in Deep learning: Why is the expressive power of standard message-passing GNNs bounded by the 1-Weisfeiler–Lehman (1-WL) graph isomorphism test, what is an explicit pair of non-isomorphic graphs (with identical node features) that GCNs cannot distinguish, and what architectural changes go beyond 1-WL?