Repository navigation
[Feature] Add CorInfoMax - #468
ChandradithyaJ wants to merge 3 commits into
Conversation
Leon-Leyang
left a comment
There was a problem hiding this comment.
Hi @ChandradithyaJ, I've gone through the PR. Please check the issues below:
stable_pretraining/tests/unit/test_corinfomax.py: no test trainsCorInfoMaxthroughspt.Manager(a small model and a few training steps are enough) and resumes from a checkpoint, showing that the running means and covariances survive.- There's no real two-process DDP test of
CorInfoMaxLoss, which gathers the projections across GPUs for its batch statistics and running history (stable_pretraining/losses/joint_embedding.py:185). stable_pretraining/tests/unit/test_corinfomax.py: no test checks that the loss and gradients stay finite on extreme inputs.examples/corinfomax_cifar10.py: please move the script behind the reported results tobenchmarks/cifar10/, and update its docstring (line 7), which points to aCorInfoMax.mdthat isn't in the PR.- PR description: the batch size of the reported run isn't stated.
stable_pretraining/losses/joint_embedding.py:209-212: withstatistics_dtype=torch.float32andnormalize=False, the loss turns NaN when the batch is smaller than the projection width and the projections are large, since float32 rounding makes the covariance passed totorch.logdetindefinite. Please guard against it (e.g. a larger ε relative to the covariance scale) or document that this combination needs float64.
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #468 +/- ##
==========================================
- Coverage 98.17% 98.15% -0.03%
==========================================
Files 163 164 +1
Lines 16406 16465 +59
==========================================
+ Hits 16107 16161 +54
- Misses 299 304 +5 🚀 New features to boost your workflow:
|
|
Thanks for the detailed review, @Leon-Leyang. I’ve addressed the implementation and test requests and completed a fresh CIFAR-10 run after the numerical fix.
Using a CIFAR-resolution ResNet-18, a 2048–2048–64 projector:
Both training phases completed their configured epochs and saved their final checkpoints. Standalone evaluation reloaded the final linear checkpoint and reproduced 92.76% top-1 / 99.83% top-5 on all 10,000 CIFAR-10 test images. The primary result uses the final epoch. Best observed test accuracy is descriptive, and standalone evaluation reloads the same checkpoint rather than adding an independent training seed. The accuracy rerun preserves the original recipe’s normalized projections and float64 running statistics. The reported float32 configuration is covered separately by the extreme-input regression tests. Validation completed:
|
Leon-Leyang
left a comment
There was a problem hiding this comment.
Hi @ChandradithyaJ, I've gone through the changes and it looks good to me.
Description
Adds CorInfoMax, a self-supervised method that learns from two augmented views using a shared encoder and projector. The objective combines mean-squared agreement between normalized projections with covariance log-determinants that discourage dimensional collapse. Running means and covariances incorporate previous batches. Current-batch statistics remain differentiable, while retained history is detached and checkpointed.
Reference: Ozsoy et al., “Self-Supervised Learning with an Information Maximization Criterion” (NeurIPS 2022).
What's included
stable_pretraining/losses/joint_embedding.pystable_pretraining/losses/__init__.pystable_pretraining/methods/corinfomax.pystable_pretraining/methods/__init__.pystable_pretraining/forward.pystable_pretraining/__init__.pystable_pretraining/__init__.pyiexamples/corinfomax_cifar10.pystable_pretraining/tests/unit/test_corinfomax.pyMETHODS.mdRELEASES.rstdocs/source/api/methods.rstdocs/source/api/losses.rstdocs/source/api/forward.rstVerification
Completed CIFAR-10 training with ResNet-18: 1,000 self-supervised pretraining epochs followed by 100 epochs of frozen-backbone linear evaluation.
Final-epoch top-1 accuracy is 0.43 percentage points below the paper. The best observed test top-1 was 92.85%; this is reported separately because checkpoint selection used test accuracy. Standalone evaluation is not an independent training seed.
Test Results
Checklist