Teacher-Student Self-Distillation (DINO Framework):
The DINO framework, which underlies all three versions (DINO, DINOv2, DINOv3), uses a teacher-student architecture where collapse is prevented through three specific mechanisms: EMA updates, centering, and temperature sharpening.
The Architecture:
-
Student Network fθs: A standard Vision Transformer (ViT-S/16: 21M params, 384-d, 6 heads, 12 blocks; or ViT-B/16: 86M params, 768-d, 12 heads, 12 blocks; up to ViT-g in DINOv2 and 7B in DINOv3). Receives gradient updates through backpropagation. Processes both global and local crops.
-
Teacher Network fθt: Identical architecture to the student, but receives NO gradients. Its weights are updated exclusively via exponential moving average (EMA) of the student's weights after each training step.
-
Projection Head: Both student and teacher share the same architecture for their projection heads — a 3-layer MLP (e.g., 2048-d hidden layers with GELU activation) followed by L2 normalization and a final linear layer to a K-dimensional output (K=65,536 in original DINO). This head is used only during training and discarded for downstream tasks.
EMA Teacher Update (after each training step):
θt←m⋅θt+(1−m)⋅θs
The momentum m follows a cosine schedule from 0.996 to 1.0 over the course of training. At the start (m=0.996), the teacher tracks the student relatively quickly — 0.4% of the student's weights are incorporated per step. As training progresses, m approaches 1.0, making the teacher increasingly stable and slow-moving. This creates an ensemble effect: the teacher represents a temporal average of many past student states, producing smoother, more stable output distributions than the student.
Why EMA prevents collapse: If the teacher simply copied the student (m=0), teacher and student would always agree, providing no learning signal. If the teacher were completely frozen (m=1), it would become stale. The EMA interpolation creates a "soft target" that is slightly behind the student — stable enough to guide learning, but responsive enough to track improving representations.
Multi-Crop Training Strategy:
Each image is augmented into multiple views at two scales:
- 2 global crops (224×224, covering >50% of the image area): Random resized crop, horizontal flip, color jitter, Gaussian blur, solarization. These capture the overall scene structure and object identity.
- N local crops (96×96, covering <50% of the image, typically N=6-10): Smaller random crops that capture fine details — textures, edges, object parts. These force the model to recognize that a paw is part of a dog, a wheel is part of a car.
Asymmetric input assignment:
- Teacher processes only global crops → produces 2 output distributions
- Student processes all crops (2 global + N local) → produces 2+N output distributions
This asymmetry is critical: the student must learn to match the teacher's global-view distribution using only local crops as input. Predicting the global structure from a small local patch forces the student to learn features that generalize beyond the immediate visible context — understanding object identity, scene layout, and semantic meaning from partial information.
Collapse Prevention — Centering + Sharpening:
Centering the teacher's output prevents any single dimension from dominating:
gt(x)=fθt(x)−c,c←mc⋅c+(1−mc)⋅B1∑i=1Bfθt(xi)
where c is a running mean of teacher outputs across the batch (momentum mc=0.9). Without centering, the teacher could collapse by making one output dimension much larger than others, effectively mapping all inputs to the same point. Centering ensures the output distribution is balanced across all K dimensions.
Sharpening via temperature creates a sharper (more peaked) distribution for the teacher:
Pt(x)(k)=∑k′exp(gt(x)(k′)/τt)exp(gt(x)(k)/τt),τt=0.04
Ps(x)(k)=∑k′exp(fθs(x)(k′)/τs)exp(fθs(x)(k)/τs),τs=0.1
The teacher uses a lower temperature (τt=0.04) than the student (τs=0.1), producing a sharper probability distribution. This forces the student to commit to clear semantic assignments rather than spreading probability mass uniformly. The sharp teacher distribution acts as a "confident target" — similar to how hard labels in supervised learning give a clearer gradient signal than soft labels.
Cross-Entropy Loss:
The loss minimizes cross-entropy between teacher and student distributions across all crop pairs (excluding same-crop pairs):
L=−∑x∈{global crops}∑x′=x,x′∈{all crops}∑k=1KPt(x)(k)logPs(x′)(k)
For 2 global + 6 local crops, this produces 2×(2+6−1)=14 loss terms per image (each global teacher output compared to 7 student outputs from different crops, excluding self-pairs). Gradients flow only through the student; the teacher is updated via EMA.
Why DINO produces remarkable attention maps:
A striking property of DINO-trained ViTs is that the self-attention maps of the [CLS] token in the final layer naturally segment objects — without any segmentation training. This emerges because the multi-crop training forces the [CLS] token to identify which patches belong to the same object across different views. The local crops show only parts of objects, and matching these to global views requires understanding object boundaries. The attention maps reveal this learned segmentation as a byproduct of the self-distillation objective.