Research Frontiers & Practice
Level: 5 — Mastery (cross-domain: math + coding + systems reasoning) Time limit: 90 minutes Total marks: 60
Instructions: Answer all three questions. Show full derivations. Where code is requested, pseudocode with correct tensor shapes and complexity annotations is acceptable. Use / for mathematics.
Question 1 — Contrastive Learning: Deriving and Implementing InfoNCE (22 marks)
SimCLR trains an encoder using the normalized temperature-scaled cross-entropy (NT-Xent) loss. For a batch of images, each is augmented twice to form views. Let be the -normalized embedding of view , and (cosine similarity since normalized). For a positive pair :
(a) Prove that is a lower bound related to mutual information; specifically, show that the expected InfoNCE loss satisfies where is the number of terms in the denominator, and hence minimizing InfoNCE maximizes a lower bound on mutual information. State each assumption used. (7)
(b) Show that the gradient of with respect to the positive logit and the temperature behaves as follows: as , the loss becomes dominated by the single hardest negative. Derive for a negative and interpret the dependence. (7)
(c) Write vectorized pseudocode (batch of embeddings) computing the full NT-Xent loss. State the time and memory complexity in terms of and embedding dim , and explain why the diagonal must be masked. (8)
Question 2 — Federated Learning: Convergence & Privacy Accounting (20 marks)
Consider FedAvg over clients, each with local objective and global objective with . Each round runs local SGD steps with learning rate .
(a) Assume each is -smooth and -strongly convex, and define data heterogeneity . Explain analytically why increasing (more local steps) can increase the gap to the global optimum, and identify the term in the FedAvg convergence bound responsible ("client drift"). Derive the expression for the drift of a single client's weights after steps relative to the global model, to first order. (8)
(b) A federated system adds Gaussian noise to clipped per-client updates (clip norm ) for -differential privacy. Using the Gaussian mechanism bound , compute the minimum for , , . Then state how the noise scales the variance term in the convergence bound and the resulting privacy–utility tradeoff. (7)
(c) Contrast FedAvg with a neuro-symbolic federated design where clients share symbolic rules rather than gradients. Give one concrete advantage for communication cost and one hard open problem (e.g., rule conflict resolution). (5)
Question 3 — Reproducibility & Benchmark Rigor (18 marks)
You are reviewing a paper claiming a new self-supervised vision-language model (CLIP-style) beats the prior SOTA by "+2.1% zero-shot ImageNet accuracy."
(a) The paper reports a single run. Given a test set of images and observed accuracy , compute the 95% Wald confidence interval half-width and judge whether a claim is statistically distinguishable from noise on this test set. (6)
(b) Design a rigorous reproduction protocol. List five distinct controls (seeds, compute-matched baselines, data leakage checks between pretraining corpus and eval set, hyperparameter search parity, reporting variance). For each, state the failure it prevents. (7)
(c) The authors trained on a web-scraped corpus that may contain ImageNet test images (contrastive-language duplicates). Propose a quantitative deduplication + leakage-audit method and explain how leakage would inflate the reported metric. (5)
Answer keyMark scheme & solutions
Question 1
(a) InfoNCE mutual information bound (7)
Setup (1): Treat the positive as a classification-over- problem: the numerator is the true (positive) density, the denominator sums terms drawn as 1 positive + negatives.
Derivation (4): The optimal InfoNCE critic satisfies . Substituting the optimal critic: Bounding the negative sum by its expectation () and using Jensen: Hence : minimizing raises the MI lower bound. (2 for final inequality direction)
Assumptions (2): (i) negatives are i.i.d. from the marginal ; (ii) critic is expressive enough to reach the optimum; (iii) large-batch approximation for the expectation of the negative sum. The bound is tighter as (batch size) grows — motivating SimCLR's large batches.
(b) Gradients & temperature (7)
Let and softmax . Then:
- For a negative : gradient → loss pushes similarity down, weighted by softmax probability. (3)
- For the positive : gradient → pulls positive similarity up. (2)
Temperature interpretation (2): As , blows up; softmax concentrates on the largest (the hardest negative, highest cosine sim). Thus the gradient mass focuses on the single hardest negative — sharp, hard-negative-mining behaviour. Large → uniform → all negatives weighted equally (soft). The prefactor amplifies gradient magnitude at small .
(c) Vectorized NT-Xent pseudocode + complexity (8)
# Z: (2N, d), already L2-normalized
S = Z @ Z.T / tau # (2N, 2N) similarity/temperature
S.fill_diagonal_(-inf) # mask self-similarity (i != k)
# positive index for row i: its paired augmentation j
targets = pairing_indices # length 2N, maps i -> j
loss = cross_entropy(S, targets) # softmax over rows, pick target col
return loss.mean()
Marks: correct sim matrix (2), diagonal masking (2), positive targeting via cross-entropy (2).
Complexity (2): Matrix : time , memory for the similarity matrix. Diagonal mask explanation: term (self-similarity after norm) is excluded by the indicator ; leaving it in would place a trivial maximal logit on the self entry, corrupting the softmax normalization.
Question 2
(a) Client drift & effect of (8)
Convergence intuition (3): FedAvg bound (Li et al. 2020) has form where terms multiplying and grow with more local steps. Larger lets each client descend toward its own , which differs from by heterogeneity → the averaged model sits between local optima, not at the global one ("client drift").
Drift derivation (5): After local steps from shared , client 's weight is To first order (freeze gradient at ): . Drift relative to a global SGD step : Its magnitude scales with — proportional to and to gradient dissimilarity (heterogeneity). Hence large + high → large drift → biased average.
(b) DP noise computation (7)
. ; . (4 for value + method)
Effect (3): Added noise variance enters the convergence variance term additively (scaled by if noise averages across clients: variance term ). Tradeoff: smaller (stronger privacy) → larger → larger variance floor → higher final loss / slower convergence. Averaging over many clients mitigates it ().
(c) Neuro-symbolic federated (5)
Advantage (2): Symbolic rules (e.g., logical predicates / decision rules) are tiny compared to full gradient/weight tensors → drastically lower communication bandwidth and no per-round dense transmission. Open problem (2): Rule conflict resolution — clients may learn contradictory rules; merging requires a sound aggregation logic (truth maintenance, weighted voting, consistency checking) with no established, differentiable-friendly solution. (+1 for coherent framing.)
Question 3
(a) Confidence interval (6)
Wald 95% half-width: with . . Divide by : . Sqrt . Times : (4)
Judgement (2): 95% CI . A gap ( the half-width) exceeds the sampling noise on this test set, so it is statistically distinguishable from test-set sampling noise alone. BUT with a single run, the claim ignores training-seed/optimization variance, which is typically larger than test-sampling noise — so the claim is not established without multiple runs.
(b) Reproduction controls (7) — 5 × ~1.4 marks
- Multiple seeds + report mean±std — prevents mistaking a lucky run for real improvement (training variance).
- Compute/FLOP-matched baseline — prevents attributing gains to more compute/params rather than the method.
- Pretraining–eval data leakage audit — prevents inflated zero-shot scores from test images in the pretrain corpus.
- Hyperparameter search parity — equal tuning budget for baseline and new method; prevents unfair under-tuned baselines.
- Fixed data splits + preprocessing release — prevents evaluation-protocol drift and cherry-picked splits. (Accept: released code/checkpoints, ablations isolating the claimed component.)
(c) Deduplication + leakage audit (5)
Method (3): Embed all pretraining images and all ImageNet test images with a frozen, independent perceptual hasher or embedding model; compute nearest-neighbour cosine similarity; flag pairs above a threshold (or exact/near-dup via perceptual hashing like pHash). Also match on caption text for CLIP-style duplicates. Report the % of test images with a near-duplicate in pretraining and re-evaluate on the deduplicated subset. Why leakage inflates (2): If test images (or their captions) appear in pretraining, the model has effectively memorized the label association, so "zero-shot" accuracy measures memorization, not generalization — biasing the metric upward and voiding the SOTA comparison.
[
{"claim":"InfoNCE negative-logit gradient prefactor is 1/tau, positive is (p-1)/tau; sign of negative gradient positive","code":"tau=Rational(1,2); s0,s1,s2=symbols('s0 s1 s2'); den=exp(s0/tau)+exp(s1/tau)+exp(s2/tau); ell=-log(exp(s0/tau)/den); g_neg=diff(ell,s1); val=g_neg.subs({s0:0,s1:0,s2:0}); result=(simplify(val)>0)==True","comment":"positive gradient on a negative logit"},
{"claim":"DP sigma for eps=1, delta=1e-5, C=1 is approx 4.845","code":"sig=1.0*sqrt(2*ln(1.25/Rational(1,100000)))/1.0; result=abs(float(sig)-4.845)<0.01"},
{"claim":"Wald 95% half-width for p=0.751,n=50000 is approx 0.00379","code":"p=Rational(751,1000); n=50000; hw=1.96*sqrt(p*(1-p)/n); result=abs(float(hw)-0.00379)<0.0001"},
{"claim":"2.1% gap exceeds Wald half-width (distinguishable from sampling noise)","code":"p=Rational(751,1000); n=50000; hw=float(1.96*sqrt(p*(1-p)/n)); result=(0.021>hw)==True"}
]