DINO (self-DIstillation with NO labels; Caron and colleagues, ICCV 2021) trains a student network to match the output distribution of a teacher network on different crops of the same image. The teacher is a momentum average of the student. Two simple operations on the teacher prevent collapse. Centring subtracts a running mean of its outputs, so no single dimension can win for every image. Sharpening applies a low temperature, so outputs cannot become uniform. With Vision Transformers, DINO's attention maps segment objects without supervision. DINOv2 (2023) scaled the recipe to curated data for general-purpose visual features. This page covers self-distillation, centring and sharpening, multi-crop and the two collapse modes. In the exercises you implement these operations, then train DINO and two ablations. Full DINO reached probe accuracy 0.75 with 13 of 32 output dimensions in use. Without centring, one dimension dominated (0.47). Without sharpening, the teacher's outputs became exactly uniform (0.25).
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.
A student copying a slightly wiser teacher
DINO trains two copies of a network: a student and a teacher. The teacher is a slow average of the student. Both see different crops of the same image, and the student learns to give the same answer as the teacher. Left alone, this could go wrong in two ways: one answer could win for every image, or every answer could become equally likely. DINO adds two tweaks to the teacher, centring and sharpening, that block both failures. The demo shows how temperature controls sharpness.
Self-supervised learning lab
Probability on the positive (green): 0.571; InfoNCE loss 0.560. Low τ sharpens the softmax and focuses on the hardest negatives; high τ treats all negatives alike.
Why engineers care
DINO-trained Vision Transformers give features that locate objects without labels, and DINOv2 features work off the shelf for depth estimation, segmentation and retrieval, which is useful for robots and remote sensing.
📝 Quick check (Level 0)
0/3 answered
1. In DINO the teacher is…
2. Centring prevents…
3. Sharpening prevents…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.
By hand
Outputs: a K-dimensional head (K = 65,536 in DINO); P_s = softmax(g_s(x)/τ_s), P_t = softmax((g_t(x’) − c)/τ_t).
Loss: −Σ P_t log P_s over pairs of different crops, with the teacher’s output held fixed.
Teacher: θ_t ← mθ_t + (1 − m)θ_s, with m from 0.996 toward 1. The student sees all crops (2 global + several local); the teacher sees only the global ones.
Centring: c ← 0.9c + 0.1·(batch mean of the teacher’s outputs). Subtracting c stops one dimension being large for every image.
Sharpening: τ_t = 0.04 against τ_s = 0.1. With logits (1, 0), τ = 0.04 gives above 0.9999 on the first entry.
Collapse signatures:
uniform: the teacher’s entropy equals ln K (3.47 for K = 32);
one-dimension: the batch-average output uses about 1 dimension.
📝 Quick check (Level 1)
0/3 answered
1. Entropy of a uniform distribution over 32 outputs:
2. Centre after one update from 1 toward 0 (m = 0.9):
3. Which crops does the teacher see?
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.
DINO in code
Exercise 1.
A very high teacher temperature gave uniform outputs and a low one gave sharp outputs.
Centring removed a dimension that won for every image.
The loss was 0 for matching sharp distributions, and the centre updated as an EMA.
Practice.
The official DINO and DINOv2 repositories provide ViT backbones. Typical settings: τ_t warmed from 0.04 to 0.07, τ_s = 0.1, centre momentum 0.9, teacher momentum 0.996 → 1, multi-crop with 2 × 224 and 10 × 96 crops.
Use DINOv2 features frozen with a linear head or k-NN for quick transfer.
Visualise the last-layer attention of the [CLS] token to see object masks.
t_out = [teacher(x) for x in global_crops] # no grads_out = [student(x) for x in global_crops + local_crops]loss = 0for i, t in enumerate(t_out): pt = F.softmax((t - center) / tau_t, dim=-1) # centre + sharpen for j, s in enumerate(s_out): if j != i: loss = loss - (pt * F.log_softmax(s / tau_s, dim=-1)).sum(-1).mean()center = 0.9 * center + 0.1 * torch.cat(t_out).mean(0)
🐍 Exercise 1: centring and sharpening
Implement the teacher's centred, sharpened probabilities, the DINO loss and the centre update.
📝 Quick check (Level 2)
0/3 answered
1. Typical teacher temperature:
2. DINO ViT attention maps show…
3. DINOv2 features are used…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.
Theory
Two opposite collapse modes.
Centring alone pushes toward uniform outputs, because subtracting the mean flattens the logits.
Sharpening alone pushes toward one dominant dimension, because a low temperature amplifies whatever is largest.
Applied together on the teacher, they balance: outputs stay confident per image (low entropy) but spread over many dimensions across images (high marginal entropy). That is exactly what makes the targets informative.
Self-distillation as clustering. With a K-way softmax head, DINO behaves like online clustering: each image is assigned confidently to some output “cluster,” and centring keeps clusters balanced. This is similar in spirit to SwAV’s equipartition, but achieved with a running mean instead of Sinkhorn.
Why ViTs. DINO’s training encourages the [CLS] token to attend to the object regions that are consistent across crops, so attention maps act as unsupervised segmentations, a property much weaker in supervised ViTs.
📝 Quick check (Level 3)
0/3 answered
1. Centring alone leads toward…
2. Sharpening alone leads toward…
3. DINO resembles…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.
What do centring and sharpening each prevent?
History.
M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski and A. Joulin, “Emerging properties in self-supervised Vision Transformers” (ICCV 2021).
M. Oquab et al., “DINOv2: learning robust visual features without supervision” (2023).
Exercise 2.
Setup: the same style-dominated world as before, with encoder 32 → 64 → 16, a head 16 → 32 → 32 outputs, an EMA teacher (m = 0.99), τ_s = 0.1 and 1500 steps.
Variants: full DINO (centring, τ_t = 0.04); without centring; and without sharpening (τ_t = 1.0).
Measurements: probe accuracy, the teacher’s mean per-image entropy, and the perplexity of its batch-average output (output dimensions used, of 32).
variant
probe accuracy
teacher entropy
output dims used
raw observations
0.522
—
—
DINO
0.750
0.88
12.95
no centring
0.472
0.05
1.60
no sharpening
0.246
3.47
32.0
Without centring, one dimension takes over: the teacher is extremely confident (entropy 0.05), but about the same dimension for every image (1.6 used). The targets carry almost no information.
Without sharpening, the teacher becomes uniform: entropy 3.47 = ln 32 exactly, so every target is the same flat distribution. The probe falls to 0.25, worse than raw.
With both, DINO learns: confident per-image outputs spread over about 13 dimensions, and probe accuracy 0.75.
Seeds: seeds 1 and 2 reproduced both collapse modes exactly (uniform entropy 3.47; one-dimension usage 1.0 and 1.6). Full DINO reached 0.74 and 0.57; the second seed learned less well, but still beat both ablations.
🐍 Exercise 2 (research): what do centring and sharpening each prevent?
Train DINO and ablations without centring and without sharpening, measuring probe accuracy, teacher entropy and output usage.
DINO in AI, robotics and aerospace
Foundation features: DINOv2 backbones for depth, segmentation and place recognition on robots and drones without task-specific pre-training.
Unsupervised object discovery: attention maps that highlight objects in aerial or inspection imagery.
Design lesson: when a method can collapse in two opposite directions, pair two opposite safeguards and check both diagnostics.
References
M. Caron et al. (2021). “Emerging properties in self-supervised Vision Transformers.” Proc. ICCV.
M. Oquab et al. (2023). “DINOv2: learning robust visual features without supervision.” arXiv:2304.07193.
If the teacher’s distribution is uniform over K outputs, its entropy is ln K and every target is identical, so it carries no information about the image.
No centring: 1.6 dims used (probe 0.47). No sharpening: entropy ln 32 (probe 0.25). DINO: 13 dims, probe 0.75.
Practice
Show:
Level 0
Problem 1Level 0
Year DINO appeared at ICCV?
2021.
Problem 2Level 0
Entropy of a uniform distribution over 32 outputs (4 decimals)?
ln 32 = 3.4657.
Problem 3Level 0
Centre after one update from 1 toward 0 with m = 0.9?
0.9.
Level 1
Problem 4Level 1
Crops seen by the student with 2 global and 10 local crops?
12.
Problem 5Level 1
Teacher temperature in exercise 2’s full DINO?
0.04.
Problem 6Level 1
Uniform entropy for K = 65,536 (2 decimals)?
11.09.
Problem 7Level 1
Softmax of equal logits (1, 1) at any temperature, first entry?
0.5.
Level 2
Problem 8Level 2
DINO probe accuracy in exercise 2?
0.75.
Problem 9Level 2
Output dimensions used without centring?
1.6.
Problem 10Level 2
Probe accuracy without sharpening?
0.246.
Problem 11Level 2
Output dimensions used by full DINO?
12.95.
Problem 12Level 2
Teacher entropy without centring?
0.05.
Problem 13Level 2
Probe accuracy without centring?
0.472.
Level 3
Problem 14Level 3
Prove that centring by the batch mean removes a dimension that is equally large for every image.
If logit k exceeds the others by the same amount a for every image, the batch mean of logit k exceeds the others’ means by a as well. After subtracting the mean vector c, that constant advantage cancels, so dimension k no longer wins by default; only image-specific differences remain. ∎
Problem 15Level 3
Explain why the no-sharpening variant collapsed to exactly uniform outputs.
With τ_t = 1 and centring, the teacher’s distribution is flat unless its logits differ strongly. Centring keeps pulling the mean logit to zero, and the student is trained toward these flat targets, which in turn flattens the EMA teacher. The fixed point is the uniform distribution, with entropy ln 32 = 3.47 and no information about the image. ∎
Problem 16Level 3
Compare DINO with BYOL.
Both use an EMA teacher and no negatives. BYOL regresses normalised embeddings through a predictor; DINO matches K-way probability distributions with cross-entropy and prevents collapse with centring and sharpening on the teacher, with no predictor. DINO’s distribution matching behaves like balanced online clustering and gives striking attention maps with ViTs. ∎
Problem 17Level 3
Advise on using DINOv2 features for a drone navigation stack.
Use a frozen DINOv2 backbone to extract features for place recognition (k-NN on global features) and for depth or segmentation heads trained with few labels. Check performance across lighting, season and altitude; consider distilling a smaller model for onboard compute; and validate in closed-loop flight tests. ∎
Level 4
Problem 18Level 4
DINO probe accuracy with seed 1?
0.742.
Problem 19Level 4
Full DINO teacher entropy?
0.88.
Problem 20Level 4
Output dimensions of the head in exercise 2?
32.
Coding practice
🐍 Code 1 (Level 0): uniform entropy
ln K.
🐍 Code 2 (Level 0): centre update
EMA of batch means.
🐍 Code 3 (Level 0): crops
Student and teacher views.
🐍 Code 4 (Level 0): softmax with temperature
exp(z/τ) normalised.
🐍 Code 5 (Level 0): collapse diagnosis
Uniform, one-dimension or healthy.
Topic test
A timed test drawn at random from this topic's question bank. Each attempt gets new questions. For a longer test across the whole chapter, see the chapter test, or mix topics in the question bag.
DINO / DINOv2: topic test
10 questions, drawn at random from a bank of 21. Every attempt is different.
⏱ Time limit: 15 minutes. The test submits itself when time runs out.
Levels covered: 0, 1, 2, 3, 4. No hints or solutions until you submit.