Intro to Self-Supervised Representation Learning for Astrophysics
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10879242/Screenshot_20231008_220411.png)
Francois Lanusse
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184099/logo_cnrs.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184104/simons_logo.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/8657737/aim.png)
- 1000 images each night, 15 TB/night for 10 years
- 18,000 square degrees, observed once every few days
- Tens of billions of objects, each one observed ∼1000 times
SDSS
Image credit: Peter Melchior
DES
Image credit: Peter Melchior
Image credit: Peter Melchior
HSC (proxy for LSST)
The Deep Learning Boom in Astrophysics
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184205/pasted-from-clipboard.png)
astro-ph abstracts mentioning Deep Learning, CNN, or Neural Networks
The vast majority of these results has relied on supervised learning and networks trained from scratch.
The Limits of Traditional Deep Learning
-
Limited Supervised Training Data
- Rare or novel objects have by definition few labeled examples
- In Simulation Based Inference (SBI), training a neural compression model requires many simulations
- Rare or novel objects have by definition few labeled examples
-
Limited Reusability
- Existing models are trained supervised on a specific task, and specific data.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184701/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184733/pasted-from-clipboard.png)
=> Limits in practice the ease of using deep learning for analysis and discovery
Can we make use of all the unlabeled data we have access to?
The Rise of The Foundation Model Paradigm
-
Foundation Model approach
- Pretrain models on pretext tasks, without supervision, on very large scale datasets.
- Adapt pretrained models to downstream tasks.
- Combine pretrained modules in more complex systems.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10886697/pasted-from-clipboard.png)
The Advantage of Scale of Data and Compute
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185011/pasted-from-clipboard.png)
Linearly Accessible Information
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185470/pasted-from-clipboard.png)
- Backbone of modern architectures embed input images as vectors in where d can typically be between 512 to 2048.
- Linear probing refers to training a single matrix to adapt this vector representation to the desired downstream task.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185515/pasted-from-clipboard.png)
What This New Paradigm Could Mean for Us
-
Never have to retrain my own neural networks from scratch
- Existing pre-trained models would already be near optimal, no matter the task at hand
-
Saves a lot of time and energy
- Practical large scale Deep Learning even in very few example regime
- Searching for very rare objects in large surveys like Euclid or LSST becomes possible
-
Pretraining on data itself ensures that all sorts of image artifacts are already folded in the training.
- If the information is embedded in a space where it becomes linearly accessible, very simple analysis tools are enough for downstream analysis
- In the future, survey pipelines may add vector embedding of detected objects into catalogs, these would be enough for most tasks, without the need to go back to pixels
![](https://media1.giphy.com/media/SVH9y2LQUVVCRcqD7o/giphy.gif)
... but how does it work?
Masked Modeling
Sometimes, the simplest things just work...
An idea that comes from language models
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442166/pasted-from-clipboard.png)
i.e. BERT (Devlin et al. 2018)
Masked Autoencoders Are Scalable Vision Learners (He et al. 2021)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10886965/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442117/pasted-from-clipboard.png)
Masked Auto Encoding (MAE)
How to use such a model for classification
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442185/pasted-from-clipboard.png)
Credit: (Liang et al. 2022)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442194/pasted-from-clipboard.png)
Application to Dense Prediction Tasks
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442237/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442239/pasted-from-clipboard.png)
Example of Application on Astronomical Data: Specformer
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185863/pasted-from-clipboard.png)
- Pre-Training Galaxy Spectra Representation by Masked Modeling
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442215/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442220/pasted-from-clipboard.png)
Multi-View Self-Supervised Contrastive Learning
MultiView Contrastive Learning e.g. SimCLR (Chen et al. 2000)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442270/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442277/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442285/pasted-from-clipboard.png)
Contrastive Learning in Astrophysics
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816081/pasted-from-clipboard.png)
Self-Supervised similarity search for large scientific datasets (Stein et al. 2021)
Detecting Galaxy Tidal Features Using Self-Supervised Representation Learning
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184602/plexus-atoms-neutrons-electrons-wallpaper-79a0785d113a8d2b6647683f10e1068d.jpg)
Project led by Alice Desmons, Francois Lanusse, Sarah Brough
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184583/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10887208/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184585/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184587/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184603/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184606/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184609/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442291/pasted-from-clipboard.png)
DiNOv2 (Oquab et al. 2023) A State of the Art Model (as of early 2024)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185816/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185820/pasted-from-clipboard.png)
PCA of patch features
Dense Semantic Segmentation
Dense Depth Estimation
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185831/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185836/pasted-from-clipboard.png)
Weakly Supervised Contrastive Learning
Or what you can do when you do have independent views of an object...
Contrastive Language Image Pretraining
Contrastive Language Image Pretraining (CLIP)
(Radford et al. 2021)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816072/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816074/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816085/pasted-from-clipboard.png)
The Information Point of View
- The InfoNCE loss is a lower bound on the Mutual Information between modalities
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818771/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816085/pasted-from-clipboard.png)
Shared information
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442417/pasted-from-clipboard.png)
One model, many downstream applications!
Flamingo: a Visual Language Model for Few-Shot Learning (Alayrac et al. 2022)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816075/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816077/pasted-from-clipboard.png)
Hierarchical Text-Conditional Image Generation with CLIP Latents (Ramesh et al. 2022)
AstroCLIP
Cross-Modal Pre-Training for Astronomical Foundation Models
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816056/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816057/pasted-from-clipboard.png)
Project led by Francois Lanusse, Liam Parker, Siavash Golkar, Miles Cranmer
Accepted contribution at the NeurIPS 2023 AI4Science Workshop
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10887208/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10887209/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10887212/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10887214/pasted-from-clipboard.png)
The AstroCLIP approach
- We use spectra and multi-band images as our two different views for the same underlying object.
- DESI Legacy Surveys (g,r,z) images, and DESI EDR galaxy spectra.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818084/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10816085/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818084/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818934/pasted-from-clipboard.png)
Cosine similarity search
The AstroCLIP Model (v2, Parker et al. in prep.)
- For images, we use a ViT-L Transformer.
- For spectra, we use a decoder only Transformer working at the level of spectral patches.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11184261/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11442547/pasted-from-clipboard.png)
Evaluation of the model
- Cross-Modal similarity search
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185900/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185920/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185930/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818933/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818934/pasted-from-clipboard.png)
Image Similarity
Spectral Similarity
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/10818942/pasted-from-clipboard.png)
Image-Spectral Similarity
- Redshift Estimation From Images
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185939/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185944/pasted-from-clipboard.png)
Supervised baseline
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11185965/pasted-from-clipboard.png)
- Zero-shot prediction
- k-NN regression
- Few-shot prediction
- MLP head trained on top of frozen backbone
- Galaxy Physical Property Estimation from Images and Spectra
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11186000/pasted-from-clipboard.png)
We use estimates of galaxy properties from the PROVABGS catalog (Hahn et al. 2023) (Bayesian spectral energy distribution (SED) modeling of DESI spectroscopy and photometry method)
of regression
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11186018/pasted-from-clipboard.png)
Negative Log Likelihood of Neural Posterior Inference
- Galaxy Morphology Classification
Classification Accuracy
We test a galaxy morphology classification task using as labels the GZ-5 dataset (Walmsley et al. 2021)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11186274/pasted-from-clipboard.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/866922/images/11275248/Screenshot_20240418_103557.png)
Intro to Self Supervised Representation Learning for Astrophysics
By eiffl
Intro to Self Supervised Representation Learning for Astrophysics
- 92