Representation learning

Erik Ylipää (erik.ylipaa@liu.se)

NBIS

07-May-2026

Overview

  • Representation learning
  • Breaking down classification
  • Contrastive learning
  • Self-supervised learning
  • Multimodal learning

AI subfields

AI subfields: Representation Learning

Data representation is crucial for learning

Shallow representations – Principal Component Analysis (PCA)

Neural Networks learn representations from data

Transfer learning

The classification head

https://www.mathworks.com/discovery/convolutional-neural-network.html

The classification head typically has a fully connected layer followed by a softmax. The fully connected layer is what we’ll look at here.

What is the core mechanism of neural networks?

\vec{y} = \operatorname{softmax}(W \vec{x} + \vec{\beta})

\Leftrightarrow

\vec{y} = \operatorname{softmax}( \begin{bmatrix} \vec{w}_1^\top \\ \vdots \\ \vec{w}_n^\top \end{bmatrix} \vec{x} + \vec{\beta})

A matrix multiplication can be though of as a list of separate dot products.

The core mechanism of neural networks is the dot product

Properties of the dot product

\vec{a} \cdot \vec{b} = |\vec{a}||\vec{b}| \cos\theta

  • Dot product is directly connected to the angle (alignment) between vectors
  • Neural Network learns by aligning vectors

Graphical representations of neural networks

Different graphical representations of neural networks

Graphically representing softmax

Computational graph view of softmax

Graphically representing softmax

Computational graph view of softmax

MNIST example

Softmax angle alignment

Computational graph view of softmax

Contrastive learning

Using computed “softmax” weights

No fixed “class” vectors

Embeddings of other examples act as the “class” vectors

Contrastive learning - triplet loss

By Krishnachandranvn - Own work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=138534332

Contrastive learning

What negative samples?

  • How do we select negative samples?
    • Easiest is randomly
    • But very likely to draw “easy” negative samples
    • The model doesn’t learn as much contrasting against these

The setup learns more from hard negatives

Why do we need negative samples?

Representation collapse

Why contrastive learning

  • No need to decide on number of classes beforehand
  • We only need to know that some inputs are associated and some are not
  • By choosing what examples are negative vs. positive, we design what is learned

Supervised contrastive learning

Contrastive learning like we’ve seen here still needs labeled data, just like regular supervised learning

The practical meaning of supervised learning – labeling

Self-supervised learning

Self-supervised learning

What if we can use the data itself to drive the learning of representations?

Self-supervised learning - Yan LeCun

Basic selfsupervision – Autoencoders

An autoencoder is a neural network trained to:

  1. Encode input x into a latent representation z
  2. Decode z back to reconstruct \hat{x} \approx x

\mathcal{L} = \|x - \hat{x}\|^2

Shortcomings of autoencoders

From the Deep Learning book (Goodfellow, Bengio, Courville)

Self-supervised examples - predict in context

Pathak, Deepak, et al. “Context encoders: Feature learning by inpainting.” Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.

Noroozi, Mehdi, and Paolo Favaro. “Unsupervised learning of visual representations by solving jigsaw puzzles.” European conference on computer vision. Cham: Springer International Publishing, 2016.

Doersch, Carl, Abhinav Gupta, and Alexei A. Efros. “Unsupervised visual representation learning by context prediction.” Proceedings of the IEEE international conference on computer vision. 2015.
Figure 1

Constrastive self-supervised learning

  • Instead of relying on existing positive pairs, we can create them
  • As long as the pairs we create have a semantic association, there is something to learn
  • SimCLR is a very successful example of this

Chen, Ting, et al. “A simple framework for contrastive learning of visual representations.” International conference on machine learning. PmLR, 2020.

Beyond contrastive learning

  • The central part of contrastive learning is to bring associated examples close together
  • Why do we need negative examples?
    • To avoid representational collapse

BYOL - Bootstrap your own latents

  • Instead of avoiding representation collapse by using negative contrastive examples, what if we have two different models?
    • The main network we try to train – the online network
    • Another network we use to create the representations – the target network

Grill, Jean-Bastien, et al. “Bootstrap your own latent - a new approach to self-supervised learning.” Advances in neural information processing systems 33 (2020): 21271-21284.

DINO = BYOL + Vision Transformers

Caron, Mathilde, et al. “Emerging properties in self-supervised vision transformers.” Proceedings of the IEEE/CVF international conference on computer vision. 2021.

DINO v3

  • Development of DINO v2 to increase model scale
    • Large data with auto curation
    • Regularized patch representations with Gram matching

Siméoni, Oriane, et al. “Dinov3.” arXiv preprint arXiv:2508.10104 (2025).

DINO v3 - Gram matching

Figure 2: Siméoni, Oriane, et al. “Dinov3.” arXiv preprint arXiv:2508.10104 (2025).

\mathcal{L}_\text{Gram} = \lVert \mathbf{X}_S \cdot \mathbf{X}_S^\top - \mathbf{X}_G \cdot \mathbf{X}_G^\top \rVert_\text{F}^2

Constrain all the pairs of inner products to be similar to an earlier version of the model

Multimodal Learning

Multimodal Machine Learning tutorial - ACL2017 – https://www.cs.cmu.edu/~morency/MMML-Tutorial-ACL2017.pdf

Use modalities to label each other

With supervised contrastive learning we need to label the data

Arandjelovic, Relja, and Andrew Zisserman. “Look, listen and learn.” Proceedings of the IEEE International Conference on Computer Vision. 2017.

With multimodal data we have “natural” associations in the separate modalities.

Use modalities to label each other

Figure 3: Arandjelovic, Relja, and Andrew Zisserman. “Look, listen and learn.” Proceedings of the IEEE International Conference on Computer Vision. 2017. za

Use modalities to label each other

Afham, Mohamed, et al. “Crosspoint: Self-supervised cross-modal contrastive learning for 3d point cloud understanding.” Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 2022.

CLIP

https://github.com/openai/CLIP

CLIP

Radford, Alec, et al. “Learning transferable visual models from natural language supervision.” International Conference on Machine Learning. PMLR, 2021.

Summary

  • Contrastive learning is a general technique for learning representations
  • Self-supervised learning is about crafting ways of learning from unlabeled data
  • Clever augmentations technique can use contrastive learning without labled data
  • Multimodal data is perfect for contrastive learning, the modalities “label each other”