Inferensys

Glossary

Projection Head

A small multi-layer perceptron attached to a backbone encoder during self-supervised pre-training that maps representations to a space where contrastive loss is applied, and is typically discarded before downstream evaluation.
Data scientist reviewing AI evaluation metrics on dashboard, comparison charts visible, casual WeWork analytics setup.
SELF-SUPERVISED LEARNING ARCHITECTURE

What is Projection Head?

A small multi-layer perceptron attached to the top of a backbone encoder during self-supervised pre-training that maps representations to a space where contrastive loss is applied, and is typically discarded before downstream evaluation.

A projection head is a small neural network, typically a multi-layer perceptron (MLP) with one or two hidden layers, appended to the output of a backbone encoder during self-supervised pre-training. Its sole purpose is to map the encoder's high-dimensional representations into a lower-dimensional latent space where a contrastive or non-contrastive loss function is computed. This architectural component is a defining feature of frameworks like SimCLR, MoCo, and BYOL.

Critically, the projection head is discarded after pre-training is complete. The representations used for downstream tasks such as classification or segmentation are taken directly from the backbone encoder, not the projection head. This practice stems from the empirical finding that the projection head filters out information useful for the pretext task but detrimental to generalization, effectively preserving more transferable features in the encoder's output.

Architecture Component

Key Characteristics of a Projection Head

A projection head is a small neural network module attached during self-supervised pre-training that maps encoder representations to a space where the contrastive or predictive loss is applied. It is typically discarded after pre-training, leaving the backbone encoder to produce rich, general-purpose features for downstream tasks.

01

Architecture and Design

A projection head is typically implemented as a multi-layer perceptron (MLP) with one to three hidden layers. A common configuration is a 2-layer MLP with a hidden dimension matching the encoder output, a ReLU activation, and a final linear layer that projects to a lower-dimensional space (e.g., 128 or 256 dimensions).

  • Input: Encoder representations (e.g., 2048-d from ResNet-50)
  • Hidden layer: Linear → BatchNorm → ReLU
  • Output layer: Linear → L2-normalized embedding
  • Depth matters: SimCLR demonstrated that a 2-layer head significantly outperforms a linear head, but deeper heads (3+ layers) yield diminishing returns
02

Role in Preventing Representation Collapse

The projection head acts as a bottleneck that absorbs loss-specific invariances, preventing the backbone encoder from discarding useful information. By applying the contrastive loss in a separate, lower-dimensional space, the head shields the encoder from learning shortcut features that only optimize the pretext task.

  • The head learns to be invariant to augmentations (color jitter, rotation, cropping)
  • The backbone is free to retain semantically meaningful features useful for downstream tasks
  • Removing the head before evaluation consistently yields superior transfer performance
  • This phenomenon is known as the information bottleneck effect in self-supervised learning
03

Discarding Before Downstream Evaluation

A defining characteristic of the projection head is that it is discarded after pre-training. During the linear evaluation protocol, the frozen backbone encoder is used directly to extract features, and a new linear classifier is trained on top.

  • Pre-training: Encoder → Projection Head → Contrastive Loss
  • Evaluation: Encoder → Linear Classifier → Task Labels
  • The head's representations are loss-specific and not transferable
  • This pattern is consistent across SimCLR, MoCo, BYOL, and SwAV
  • Fine-tuning may optionally retain a new task-specific head
04

Normalization and Output Space

The final output of the projection head is typically L2-normalized to project embeddings onto the unit hypersphere. This normalization is critical for contrastive loss functions like NT-Xent (InfoNCE), which compute cosine similarity between normalized vectors.

  • L2 normalization: ||z||₂ = 1, constraining embeddings to the hypersphere
  • Enables efficient cosine similarity computation via dot product
  • Temperature parameter τ scales the similarity logits
  • Batch normalization in hidden layers stabilizes training and prevents divergence
  • The hyperspherical space encourages uniform distribution of representations
05

Impact on Learned Representations

Empirical studies show that the projection head depth and width directly influence the quality of backbone representations. A non-linear projection head consistently outperforms a linear one, as measured by downstream classification accuracy.

  • Linear head: 85.8% top-1 accuracy on ImageNet (SimCLR, ResNet-50)
  • 2-layer MLP head: 91.6% top-1 accuracy (same setup)
  • The head filters out augmentation-specific information
  • Representations before the head retain more spatial and semantic structure
  • This property is exploited in dense prediction tasks like segmentation
06

Variants Across Self-Supervised Frameworks

Different self-supervised methods employ projection heads with distinct architectures tailored to their objectives:

  • SimCLR: 2-layer MLP with ReLU, outputs 128-d normalized embeddings
  • MoCo v2: Identical MLP head on both query and momentum encoders
  • BYOL: Asymmetric design — online network has a predictor (additional MLP) on top of the projector; target network has only the projector
  • Barlow Twins: Projector outputs high-dimensional embeddings (8192-d) for cross-correlation computation
  • VICReg: Separate expander head maps to high dimensions for variance and covariance regularization
PROJECTION HEAD MECHANICS

Frequently Asked Questions

Explore the critical architectural component that enables contrastive and non-contrastive self-supervised learning by mapping backbone representations to a space where the loss function operates optimally, and understand why it is discarded before downstream evaluation.

A projection head is a small multi-layer perceptron (MLP) attached to the top of a backbone encoder during self-supervised pre-training. Its primary function is to map the high-dimensional representation produced by the encoder into a lower-dimensional latent space where a contrastive or non-contrastive loss function is applied. This architectural component is a defining feature of frameworks like SimCLR, MoCo, and BYOL. Crucially, the projection head is typically discarded after pre-training is complete; the representations from the frozen backbone encoder are then used directly for downstream tasks like medical image classification or segmentation. The projection head acts as a buffer, absorbing information that is useful for the pretext task but potentially detrimental to the generalization required for transfer learning.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.