In-Context Symmetries: Self-Supervised Learning through Contextual World Models

At the core of self-supervised learning for vision is the idea of learning invariant or equivariant representations with respect to a set of data transformations. This approach, however, introduces strong inductive biases, which can render the representations fragile in downstream tasks that do not conform to these symmetries. In this work, drawing insights from world models, we propose to instead learn a general representation that can adapt to be invariant or equivariant to different transformations by paying attention to context -- a memory module that tracks task-specific states, actions, and future states. Here, the action is the transformation, while the current and future states respectively represent the input's representation before and after the transformation. Our proposed algorithm, Contextual Self-Supervised Learning (ContextSSL), learns equivariance to all transformations (as opposed to invariance). In this way, the model can learn to encode all relevant features as general representations while having the versatility to tail down to task-wise symmetries when given a few examples as the context. Empirically, we demonstrate significant performance gains over existing methods on equivariance-related tasks, supported by both qualitative and quantitative evaluations.

Paper

Similar papers

Peer review

Reviewer iSU15/10 · confidence 3/52024-07-12

Summary

This paper proposes ContextSSL, a novel self-supervised learning framework designed to enhance the existing joint embedding architecture by incorporating task-specific context. The main idea is to dynamically adapt symmetries by leveraging context in SSL. Consequently, ContextSSL can adapt to varying task symmetries without requiring parameter updates. The authors demonstrate the efficacy of ContextSSL on 3DIEBench and CIFAR10, showing that ContextSSL can selectively learn invariance or equivariance to transformations while maintaining general representations.

Strengths

**[S1]** This paper suggests an interesting direction for SSL, proposing that self-supervised representation incorporating context can enable dynamic adaptation to varying task symmetries. **[S2]** The overall writing is smooth and easy to follow.

Weaknesses

**[W1]** It seems possible for invariant-based approaches to achieve context lengths of 0 to 126 by training a linear classifier. Why are these results ignored? More shots could also improve the performance of SimCLR and VICReg. **[W2]** Although ContextSSL performs well on the augmentation prediction task, it underperforms compared to other important baselines in linear classification, which is the most common task. **[W3]** It seems that ContextSSL can be trained on a single augmentation type, while other Equivariant-based approaches benefit from multiple augmentations.

Questions

**[Q]** Regarding the [W2], can ContextSSL benefit from few-shot classification, e.g., ImageNet accuracy of models trained with 1% of labels [1]? I believe few-shot can serve as context, and in this setup, ContextSSL might outperform other baselines. [1] Chen, Ting, et al. "A simple framework for contrastive learning of visual representations." International conference on machine learning. PMLR, 2020.

Rating

5

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

They addressed the limitations.

Reviewer y5eJ7/10 · confidence 3/52024-07-12

Summary

This work proposes to employ context modules to learn general representations such that invariance and equivariance to specific augmentations do not bias the representations. The method utilizes a module to learn to be both invariant or equivariant based on the context of the input augmentations, thus producing highly generalized features from learnt symmetries that are capable of preserving or disregarding a variety of transformations for the downstream tasks. The resulting performance leads to improved downstream evaluations in both invariant and equivariant settings, excelling above state-of-the-art in some settings.

Strengths

⁃ The paper is generally well presented and written, describing a clear and rationale problem statement supported by appropriate examples. ⁃ The resulting framework is original and highly significant in the field of SSL. Notably, the addition of the context module could allow for a significant shift in the real-world application of SSL. ⁃ Empirical results show significant improvement in equivariant downstream tasks further justifying this works significance in the field. Additionally, an extensive ablation and sensitivity analysis is performed guiding the reader into a greater understanding of the behavior of the method and the rationale behind implementation decisions. ⁃ Extensive details to support replication are provided.

Weaknesses

⁃ How does the method handle more complex augmentation strategies, the proof of concept in the setting of 3DIE and CIFAR demonstrate strong performance yet these transformations, especially equivariance are highly controlled and unique to these datasets. It therefore would have been good to see more generalized augmentations including multiple combinations in the downstream context that better adapt to the real world setting and thus support the generalization claim of the work. ⁃ Does not the choice of context length to extract representations for inference require significant supervision? Such an implementation requires the practitioner to construct augmentations per context and then provide such information for the downstream. Please correct my understanding if incorrect. ⁃ From the latter point, this method claims to not hard code symmetries. However, from my understanding this method is still hard coding symmetries to some extent as the practitioner is selecting which augmentations to select. In this case the context is enabling separability between representations that belong to each group symmetry. They are still hand-coded just conditioned on the learnt context for determining whether to be invariant or equivariant. Minor: ⁃ Figure 1 and 2 could perhaps be made clearer or positioned differently in the paper. It is not overly clear or useful in supporting the written explanation. ⁃ Context length should be headed in the tables.

Questions

⁃ I’m intrigued to understand how does “out of context” augmentations for downstream tasks impact performance? I assume given the automatically learnt symmetries that applying a full context would result in better performance to downstream cases where the context would be vastly different to the training data. ⁃ See weaknesses

Rating

7

Confidence

3

Soundness

3

Presentation

3

Contribution

4

Limitations

The limitations are appropriately addressed

Reviewer WVFD6/10 · confidence 3/52024-07-14

Summary

This paper focuses on the problem of symmetry discovery in self-supervised learning. In particular, the goal is to learn models that are either sensitive to certain features like rotations and lightning or invariant to them, depending on the task. The authors propose to learn a world model that models transformations of the input images as a sequence of state, action, next state tuples. The major contribution is learning to adapt the representation of the world model based on the provided context of the task.

Strengths

1. The authors present a novel combination of in-context learning and symmetry discovery. Their method successfully adapts its representation to be equivariant or invariant to different transformations 2. The experimental evaluation uses a large number of strong baselines in self-supervised representation learning and learning of symmetric representations. The proposed method is superior in its ability to be sensitive to or invariant to certain features based on the context of the task. 3. The paper contains an extensive ablation study to justify all components of the method.

Weaknesses

1. I am not sure if it is meaningful to call this property equivariance: “if H(A|Z) is relatively small, the representation Z is nearly equivariant to the augmentation A”. Equivariance is specifically defined as the transformation of the input to the model having a predictable effect on the transformation of the output. This is different from simply having features that are predictive of a particular features (hence low entropy H(A|Z)). Would it be better to call this property something like sensitivity to a transformation? 2. Section 4.1 does not make a strong case for ContextSSL outperforming the baselines. The results in Table 1 are somewhat mixed. Table 2 is not explained well. 3. The paper does not make a clear case for the application of the proposed method outside of synthetic tasks. The 3DIEBench is artificially created to test equivariance and invariance to specific properties and the CIFAR-10 experiments do not actually demonstrate an improvement in classification accuracy. It is unclear how this method could be applied to more general and practical visual pre-training settings, such as CLIP [1] or DINO [2] self-supervised pre-training. References: [1] https://arxiv.org/abs/2103.00020 [2] https://arxiv.org/abs/2304.07193 ## Comments: * Table 1 is difficult to read. It is not immediately clear why ContextSSL is missing from the Rotation + Color section and why the context length != 14 fields for other methods are empty. Moreover, depending on the place in the table, a high or a low R^2 score could be the best result. That is very non-intuitive. * Clipped sentence: “We further test this at For all our equivariant baselines on 3DIEBench”. * The text “Contextual Self-Supervised Learning” in Figure 1 should be rotated by 180 degrees.

Questions

What is the path towards making this method discover or adapt to naturally occurring symmetries?

Rating

6

Confidence

3

Soundness

3

Presentation

2

Contribution

3

Limitations

Despite stating “Limitations of our work are discussed in Section 5” in the paper checklist, the discussion of the limitations in Section 5 is insufficient.

Authorsrebuttal2024-08-13

Gentle reminder to respond to our rebuttal

Dear reviewer WVFD, As the discussion period is drawing to a close, we wanted to kindly request your feedback on our rebuttal. In our response, we have carefully tried to address all your concerns and also included additional experiments to further demonstrate the strengths of our work. We would greatly appreciate it if you could provide your feedback at your earliest convenience. Thank you for your time. Best regards, Authors

Authorsrebuttal2024-08-14

Dear reviewer WVFD, Understanding that you may be busy, and with the author-reviewer discussion period coming to a close, we would like to take this last opportunity to summarize the major updates we made during the rebuttal to address your concerns. 1. In response to your concern about the applicability of ContextSSL beyond synthetic augmentations, we demonstrated that ContextSSL extends to naturally occurring symmetries and sensitive features in fairness and physiological datasets such as MIMIC III [1] and UCI Adult [2]. 2. Based on your concerns regarding Table 1, we replaced it with a version featuring clearer annotations and captions, highlighting key strengths of our approach, ContextSSL. 3. We clarified the definition of equivariance and its connection to H(A|Z). 4. We provided additional clarification around Table 2 and added other limitations and future directions of our work. *We hope these revisions address your concerns and would be happy to answer any further questions. If you find our revisions satisfactory, we hope that you would kindly consider re-evaluating our work.* Best, Authors

Reviewer y5eJ2024-08-08

Response to Rebuttal

Many thanks for the detailed response that addresses many of the weaknesses identified and questions raised. I appreciate the addition of naturally occurring symmetries, and the rebuttal results demonstrate the capability of the method to adapt to such settings. It would also be beneficial to see more visual benchmarks given this had been the main focus of the paper, however, I understand that time restrictions do not permit this. However, for future revisions comparisons on benchmark datasets to compare against methods such as EquiMod, E-SSL, CARE, would improve the findings. Additionally, the clarification on the context length is a useful addition. I emphasise that all clarifications made during this rebuttal should be made in any revised manuscript to improve clarity of the work. Given my already positive review, I for now maintain my score.

Authorsrebuttal2024-08-09

Thanks to Reviewer y5eJ

Thank you for the prompt response and recognition of our new experiments and discussions. We will incorporate all additional experiments and clarifications into our revised manuscript. The important concerns raised by you have been very valuable in enhancing the clarity of our work. We fully concur with the suggestion to include more vision benchmarks and are currently testing our approach on them. We will ensure that they are included in the revised manuscript.

Authorsrebuttal2024-08-13

Gentle reminder to respond to our rebuttal

Dear reviewer iSU1, As the discussion period is drawing to a close, we wanted to kindly request your feedback on our rebuttal. In our response, we have carefully tried to address all your concerns and also included additional experiments to further demonstrate the strengths of our work. We would greatly appreciate it if you could provide your feedback at your earliest convenience. Thank you for your time. Best regards, Authors

Reviewer iSU12024-08-13

I'm sorry for the late response to the authors' answer. For the W1, it would be better to clarify the evaluation setup in the final manuscript. However, I think the zero-shot performance of SimCLR or VICReg underestimates the value of their representations: They can perform with the context to train a linear classifier or regressor (e.g., ContextSSL also uses the few labeled contexts too, which is not indeed zero-shot, but train-free - If I'm wrong, please correct the statement and please clarify about the unlabeled contexts in the final manuscript.) to predict the rotation/color. Similarly, for Table 4 of the attached pdf, the performance of SimCLR is also underestimated to justify the benefit of understanding the context compared to the SSLs. Overall, I agree with the author that SSLs can benefit from understanding context. but, I still couldn't find the benefit of in-context learning from the experimental justifications. SSLs can utilize linear or simple MLP headers to adapt the new tasks in a few-shot manner (like few-context), and this ability to adapt to the tasks may be better with recent state-of-the-art SSLs, like Dino (v1 or v2) or MoCo v3 too.

Authorsrebuttal2024-08-13

Reply to Reviewer iSU1

We thank the reviewer for their response. We are happy to address their remaining concerns below and hope that this revision serves as a basis for a positive review. --- > However, I think the zero-shot performance of SimCLR or VICReg underestimates the value of their representations: They can perform with the context to train a linear classifier or regressor (e.g., ContextSSL also uses the few labeled contexts too, which is not indeed zero-shot, but train-free - If I'm wrong, please correct the statement and please clarify about the unlabeled contexts in the final manuscript.) to predict the rotation/color. The key difference between ContextSSL and SimCLR/VICReg is that ContextSSL leverages knowledge from context to adapt to the “inductive bias” of downstream tasks (e.g., preferring features with rotation invariance). This is the exact purpose of our study— to train a model that can dynamically adapt to a range of downstream tasks according to the feature invariance as required. In contrast, methods like SimCLR produce features with a “fixed inductive bias”, making them less adaptable to downstream tasks. **New comparison and setup.** To highlight this difference, we additionally finetune the SimCLR model with 128 examples (same examples used as context for ContextSSL) for rotation prediction and/or color prediction. This matches the total amount of information available to ContextSSL and SimCLR. The results are shown in the table below. *SimCLR-ft(128) rot+color* is the SimCLR model finetuned with both rotation and color prediction loss. *SimCLR-ft(128) rot* is finetuned with rotation prediction only, and *SimCLR-ft(128) color* is finetuned with color prediction only. As with all results in our paper and consistent with [1], rotation prediction $R^2$ is calculated by training an MLP over frozen features, while color prediction $R^2$ and classification accuracy are based on linear probing over frozen features. **Analysis.** From the table, we can see that **ContextSSL significantly outperforms fine-tuned SimCLR in both rotation and color prediction by a large margin,** indicating clear gains of ContextSSL over previous SSL methods with fixed inductive bias. **Table S1** | $\mathcal{G}$ | Method | Rotation Prediction ($R^2$) | Color Prediction ($R^2$) | Classification (top-1) | |---------------|---------------------------|-----------------------------|--------------------------|------------------------| | | SimCLR | 0.506 | 0.148 | 85.3 | | | | *Higher is better* | *Higher is better* | | | rot+color | SimCLR-ft(128) rot+color | 0.546 | 0.319 | 82.1 | | | | *Higher is better* | *Lower is better* | | | rot | SimCLR-ft(128) rot | 0.560 | 0.222 | 83.7 | | rot | ContextSSL, rot. context | 0.744 | 0.023 | 80.4 | | | | *Lower is better* | *Higher is better* | | | color | SimCLR-ft(128) color | 0.490 | 0.411 | 76.9 | | color | ContextSSL, color context | 0.344 | 0.986 | 80.4 | [1] Self-supervised learning of split invariant equivariant representations. ICML 2023. ---

Authorsrebuttal2024-08-13

Reply to Reviewer iSU1 (Continued)

> For the W1, it would be better to clarify the evaluation setup in the final manuscript. We thank the reviewer for their suggestion. For better clarity, we have already elaborated this in our rebuttal by adding new tables and figures with captions clearly stating the evaluation configuration for all baselines and ContextSSL (as shown in the attached rebuttal document). We will make sure to add this clarification to our revised manuscript too. --- > Similarly, for Table 4 of the attached pdf, the performance of SimCLR is also underestimated to justify the benefit of understanding the context compared to the SSLs. We would like to highlight that our context merely consists of **unlabeled data** of the form $(x, a, x^+)$ and, thus, does **not** provide any information about the downstream label ($y$). These unlabeled data pairs are generated with data augmentations of training data and thus do not provide extra supervision to the model. Therefore, it is indeed a fair comparison with SimCLR/VICReg since both representations are obtained **with only unlabeled data**. We apologize for this confusion and will definitely make it clearer throughout the paper. --- > I agree with the author that SSLs can benefit from understanding context. but, I still couldn't find the benefit of in-context learning from the experimental justifications. SSLs can utilize linear or simple MLP headers to adapt the new tasks in a few-shot manner (like few-context), and this ability to adapt to the tasks may be better with recent state-of-the-art SSLs, like Dino (v1 or v2) or MoCo v3 too. In our evaluation, we trained a linear head for color prediction and an MLP head for rotation prediction on SimCLR features, following [1]. As shown in Table S1, even with fine-tuning on the same few-shot samples, SimCLR falls short in performance on equivariant tasks of color and rotation prediction compared to ContextSSL. As discussed in the paper, ContextSSL fundamentally differs from previous SSL paradigms (SimCLR, DINO, MoCo); Previous SSL methods learn features with **a given set of augmentations**, which requires the model to ignore certain augmentations, like color and rotation. Instead, ContextSSL does not drop any information during pretraining but models the feature symmetry to be dependent on the context. The experiments above clearly demonstrate this — ContextSSL significantly outperforms SimCLR in preserving color and rotation information. We believe that this comparison provides strong evidence to demonstrate that our method has clear gains over existing SSL paradigms. --- *We thank the reviewer again for their constructive feedback, which has helped us clarify and improve our work. If the reviewer finds our revisions satisfactory, we hope that they would kindly consider re-evaluating our work.* ---

Authorsrebuttal2024-08-14

We sincerely appreciate the reviewer’s continued engagement with our work and their thoughtful review. Their feedback has been very valuable in refining our paper. We also thank them for their decision to raise their score.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC