TL;DR
DINOv2 is a large vision transformer trained with no labels. It learns from 142 million images picked automatically from a much larger web pool, using a self-distillation objective that works on whole images and on single patches. The frozen features it produces work for classification, segmentation and depth without fine-tuning, and in the paper's comparisons they match or beat models trained on captions.
Where you'll see it: as a frozen backbone for segmentation, depth estimation and image retrieval, where one encoder serves many tasks.
The problem
Language models are pretrained on raw text with no labels, and their features work across tasks without fine-tuning. Vision had no matching recipe. The most successful image encoders were trained on captions (text-guided models such as CLIP and OpenCLIP). Captions describe an image in a few words, so they discard fine detail such as exact object boundaries, textures and the position of small parts. Image-only self-supervised methods avoid that loss, but they were mostly trained on ImageNet-1k, a small curated set of about 1.3 million images. When people scaled them to large uncurated web images, the features got worse. The authors' diagnosis was that the data, not the objective, was the bottleneck: without control over quality and diversity, the features do not generalise.
The goal of DINOv2 is a set of frozen visual features that work out of the box, both for whole-image questions such as "what is this?" and for pixel-level questions such as "which pixels belong to the dog?"
Key idea
Two changes, working together.
- Curate the data automatically. Start from a large pool of uncurated web images. Keep only the images that look like a small set of curated datasets, found by nearest-neighbour search in an embedding space. No captions and no metadata are used.
- Train a strong self-supervised objective at scale. Combine two self-distillation losses (one for the whole image, one for each patch), a regulariser that spreads the features out, and a short high-resolution phase, then distil the large model into smaller ones.
flowchart LR U[1.2B uncurated web images] --> D[Deduplicate] C[Curated sets: ImageNet-22k, Landmarks, fine-grained] --> R D --> R[Nearest-neighbour retrieval in embedding space] R --> L[LVD-142M: 142M curated images] L --> P[Self-supervised pretraining of ViT-g] P --> K[Distil into ViT-S, B, L] P --> F[Frozen features for any task] K --> F
The image is the only input. The model learns by predicting its own output on one view of the image from another view, which is why no label is needed.
The method
Data
The curated dataset LVD-142M is built from two sources. The uncurated pool has 1.2 billion unique images, after deduplication and filtering of unsafe content. Each image is embedded with a self-supervised ViT pretrained on ImageNet-22k. Distance is cosine similarity. The uncurated embeddings are grouped with k-means. For each image in a curated set, the pipeline retrieves its N = 4 nearest neighbours from the pool (or, for small query sets, samples from the matching cluster). The paper settles on N = 4 because larger values produce more images that are neighbours of several queries at once. The retrieval index uses Faiss with GPU inverted-file and product-quantisation indices, and the whole pipeline runs in under two days on 20 nodes with eight V100 GPUs.
Image-level loss (DINO)
Take two augmented crops of one image. The student network sees one crop and the teacher network sees another. Both produce a class token from a ViT. Each class token goes through a small MLP head that outputs a vector of prototype scores. The loss is the cross-entropy between the two distributions:
Here is the student's distribution over prototypes, is the teacher's, and indexes the prototypes. The student's scores go through a softmax. The teacher's scores go through a softmax and a centering step (in DINOv2, Sinkhorn-Knopp, described below). The student is trained by gradient descent. The teacher is not trained by gradients. Its weights are an exponential moving average of the student's weights, so each step it moves a small fraction toward the student.
To stop the teacher from collapsing to one prototype, the original DINO subtracts a running mean of the teacher's scores (centering). DINOv2 replaces that centering step with the Sinkhorn-Knopp normalisation used in SwAV, run for three iterations. In the paper's Table 1 this step shows no change in k-NN or linear accuracy.
Patch-level loss (iBOT)
Some input patches are masked for the student but not for the teacher. The student's head has to predict the teacher's output at the masked positions, using the visible patches as context. This is the masked-image-modelling term from iBOT. It is the same cross-entropy form as above, summed over the masked patch indices :
This term makes the patch features useful for segmentation and depth, which need the features of single patches.
Two heads, one regulariser
DINO and iBOT each use their own projection head. The iBOT paper found that sharing heads helped at small scale. At large scale the authors found the opposite, so they untie the heads. A final term, KoLeo, spreads the features within a batch. For normalised feature vectors ,
is the distance from to its nearest other point in the batch. Maximising the nearest-neighbour distances spreads the points out. It comes from the Kozachenko-Leonenko entropy estimator. The final loss is the sum of the DINO, iBOT and KoLeo terms.
Resolution and efficiency
Pixel-level tasks need fine detail, so the last phase of pretraining raises the crop resolution to 518 by 518 for a short period. In the paper's small ablation, training at 416 pixels costs about three times as much compute as training at 224. A short high-resolution phase at the end gets almost all of the benefit for a fraction of the cost.
Most of the paper's engineering work is about speed and memory at scale. The authors write their own FlashAttention variant, pack the large-crop and small-crop token sequences into one attention call with a block-diagonal mask, skip dropped residual blocks entirely instead of masking them, and shard the 16 GB of float32 model state across GPUs with FSDP. Their code runs about twice as fast as the iBOT code while using a third of the memory. The largest model, ViT-g, has 1.1 billion parameters, with embedding dimension 1536 and 24 heads of 64 dimensions each. The head size is a multiple of 64 because that is what the attention kernels run fastest on.
Distillation to small models
Small models are not trained from scratch. They are distilled from the frozen ViT-g teacher. The student is a smaller ViT trained with the same losses, with the iBOT loss applied to the two global crops, and without masking or stochastic depth. The student's EMA is kept as the final model.
Results
The evaluation has three parts: frozen features on image classification, frozen features on dense tasks, and a check that fine-tuning still works.
ImageNet-1k, linear probe on frozen features. The ViT-g/14 trained on LVD-142M reaches 86.5% top-1 accuracy, and its k-NN accuracy is 83.5%. The paper reports a 4.2 point gain over the previous best self-supervised model (iBOT ViT-L/16 trained on ImageNet-22k). The gain is larger on the harder ImageNet-ReaL and ImageNet-V2 test sets, which the authors read as a sign that the features are not tuned to the standard validation set.
Ablations on the training recipe (Table 1). The paper starts from an iBOT baseline and adds one change at a time. The k-NN accuracy rises from 72.9% to 82.0%. The biggest single steps are the KoLeo regulariser (+2.3 k-NN), the batch size of 3k (+1.2 k-NN and +0.9 linear), and the warm-up schedule tweak (+1.1 k-NN). Some changes lower linear-probe accuracy but help training stability, such as LayerScale and stochastic depth at rate 0.4, which avoid NaN losses.
Data source (Table 2). Models with the same ViT-g/14 setup and iteration count are trained on ImageNet-22k, on uncurated data, and on LVD-142M. Uncurated data is worse on most benchmarks, for example 68.0 on iNaturalist 2018 against 82.3 for LVD-142M. LVD-142M matches ImageNet-22k on ImageNet-1k (85.8 against 85.9) and beats it on the other benchmarks, including ADE20k segmentation (47.7 against 46.6). The data gain also holds on datasets that were not used in the curation, such as Places205.
KoLeo and masked-image-modelling (Table 3). Removing KoLeo cuts Oxford retrieval mAP from 63.9 to 55.6, so the regulariser matters most for instance retrieval. Removing the iBOT masked term costs almost 3 points on dense tasks.
Dense tasks. The authors evaluate linear segmentation on ADE20k and other datasets, and monocular depth on NYUd, KITTI and SUN RGB-D. With a frozen backbone, DINOv2 is competitive with or better than the best open self-supervised and weakly supervised models in the paper's comparisons, and the depth results are described by the authors as clearly ahead of them. The qualitative figures show the same linear head giving clean masks and depth maps on out-of-distribution images such as paintings and animals.
Fine-tuning (Table 5). Fine-tuning the ViT-g/14 on ImageNet-1k raises accuracy from 86.5% (linear) to 88.5%. The authors read the small gap as evidence that the frozen-feature recipe did not overfit the linear-probe setting.
Why it mattered
The paper showed that self-supervised features trained on curated data can match or beat text-supervised ones without captions, on the paper's own benchmarks. It released the code and a family of distilled models, so the features could be used without retraining. The pattern of curating with embedding search and then distilling a large teacher into small students is the part most reused in later work. Its impact beyond the paper is not sourced here, so this section stays at what the paper itself claims.
Reading guide
Read the paper in this order, and the lessons it depends on in the order that fits each section:
- Introduction and Related Work. Needs Self-Supervised Learning for the pretext-task idea and Masked Autoencoder for patch-level masking.
- Data processing (Section 3). Needs Cosine Similarity for the distance, K-Means Clustering for the clusters and Approximate Nearest Neighbor Search for retrieval at scale.
- Discriminative pretraining (Section 4), the image-level loss. Needs Vision Transformer (ViT) for the class token, Cross-Entropy Loss for the loss, Exponential Moving Average for the teacher, and Softmax Temperature for the sharpening. Knowledge Distillation is the frame for the teacher-student setup.
- Section 4, the patch-level loss and KoLeo. Needs the same ViT and cross-entropy ideas. The KoLeo term is self-contained, using only nearest-neighbour distances.
- Section 5, efficient implementation. Read for the engineering details. Nothing here changes the method.
- Section 6, ablations. Read Table 1 first, then Tables 2 and 3. The numbers only make sense once Section 4 is clear.
- Section 7, results. Skim the tables. Focus on the linear-probe ImageNet numbers and the dense-task setup.
Check yourself
QuestionThe image-level loss is a cross-entropy between a teacher distribution and a student distribution. Which network receives gradient updates, and how is the teacher updated instead?Show answer
Only the student receives gradient updates. The teacher is an exponential moving average of the student's weights, so after each step its weights move a small fraction toward the student's. The teacher is therefore a slow-moving copy of the student, which is what keeps the training target stable.
QuestionA teacher distribution is p_t = (0.7, 0.2, 0.1) and the student is p_s = (0.5, 0.3, 0.2) over three prototypes. What is the DINO cross-entropy loss, to three decimals?Show answer
Compute one term at a time.
- Sum is , and negating gives .
The loss is about 0.887. It is lowest when the student matches the teacher, where the loss equals the teacher's entropy. This example is illustrative and was computed by hand, not from the paper.
QuestionWhy does KoLeo help instance retrieval but barely change ImageNet linear accuracy?Show answer
KoLeo maximises the distance from each feature to its nearest neighbour in the batch. That spreads the features apart, so two different images are less likely to sit close together. Nearest-neighbour retrieval depends directly on this spacing, which is why Oxford retrieval mAP moves from 55.6 to 63.9. A linear classifier only needs the classes to be separable along a few directions, and it already gets that from the other losses, so it moves little.
QuestionIn the ablation of Table 1, which single change gives the largest k-NN gain, and how big is it?Show answer
The KoLeo regulariser, which takes k-NN accuracy from 76.6% to 78.9%, a gain of 2.3 points. The batch-size change is next at 1.2 points. The Sinkhorn-Knopp row shows no change (81.7 to 81.7 k-NN), so the paper does not credit that step with a measured gain in this table.
QuestionYou need one frozen image encoder for a robot that must segment objects and estimate depth in a new room. Which result in this paper is the strongest argument for DINOv2, and what does it not show?Show answer
The strongest argument is the frozen-feature dense results. A linear head on a frozen DINOv2 backbone gives clean segmentation and depth on images far from the training distribution, and the iBOT masked term helps the patch-level features these tasks need. What the paper does not show is closed-loop robot performance. Its dense results are offline benchmarks, so you would still need to test the features inside the robot's control stack.
Sources
- Oquab et al., DINOv2: Learning Robust Visual Features without Supervision, 2023.
- OpenReview review page for the same paper.
- Caron et al., Emerging Properties in Self-Supervised Vision Transformers, ICCV 2021. This is the DINO method.
- Zhou et al., iBOT: Image BERT Pre-training with Online Tokenizer, ICLR 2022. This is the patch-level loss.