{"notes":[{"id":"contrastive-learning/dinov2","category":"contrastive-learning","legacyPath":"contrastive-learning/2304-dinov2","legacySlug":"2304-dinov2","legacyPaths":[],"title":"DINOv2","subtitle":"Universal Feature Forging Method","author":"Z. Yuan","paperDate":"2023-04-14","publishedOn":"2025-07-01","paperTitle":"DINOv2: Learning Robust Visual Features without Supervision","paperUrl":"https://arxiv.org/abs/2304.07193","bibliography":{"title":"DINOv2: Learning Robust Visual Features without Supervision","authors":["Maxime Oquab","Timothée Darcet","Théo Moutakanni","Huy V. Vo","Marc Szafraniec","Vasil Khalidov","Pierre Fernandez","Daniel Haziza","Francisco Massa","Alaaeldin El-Nouby","Mahmoud Assran","Nicolas Ballas","Wojciech Galuba","Russell Howes","Po-Yao Huang","Shang-Wen Li","Ishan Misra","Michael Rabbat","Vasu Sharma","Gabriel Synnaeve","Hu Xu","Hervé Jégou","Julien Mairal","Patrick Labatut","Armand Joulin","Piotr Bojanowski"],"url":"https://arxiv.org/abs/2304.07193","pdfUrl":"https://arxiv.org/pdf/2304.07193","codeUrl":"https://github.com/facebookresearch/dinov2","preprint":{"id":"2304.07193","submittedOn":"2023-04-14","url":"https://arxiv.org/abs/2304.07193"},"publication":{"venue":"Transactions on Machine Learning Research","shortVenue":"TMLR","year":2024,"kind":"journal","url":"https://openreview.net/forum?id=a68SUt6zFt"},"citation":"@misc{contrastivelearningdinov22023,\n  title = {{DINOv2: Learning Robust Visual Features without Supervision}},\n  author = {Maxime Oquab and Timothée Darcet and Théo Moutakanni and Huy V. Vo and Marc Szafraniec and Vasil Khalidov and Pierre Fernandez and Daniel Haziza and Francisco Massa and Alaaeldin El-Nouby and Mahmoud Assran and Nicolas Ballas and Wojciech Galuba and Russell Howes and Po-Yao Huang and Shang-Wen Li and Ishan Misra and Michael Rabbat and Vasu Sharma and Gabriel Synnaeve and Hu Xu and Hervé Jégou and Julien Mairal and Patrick Labatut and Armand Joulin and Piotr Bojanowski},\n  year = {2023},\n  eprint = {2304.07193},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2304.07193}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/dinov2.e904e3854892.bib"},"thumbnail":{"src":"/content/papers/assets/9c68ef105804d4462aee8950a1bfd9f0929511f494b1a29690d857bf931da892.jpg","width":1224,"height":368},"locale":"en","path":"/content/papers/en/contrastive-learning/dinov2.2d46c57f4666.md","headings":[{"id":"problem-definition","text":"Problem Definition","depth":2},{"id":"data-collection","text":"Data Collection","depth":2},{"id":"1-preparing-the-data-pool","text":"1. Preparing the Data Pool","depth":3},{"id":"2-removing-duplicates","text":"2. Removing Duplicates","depth":3},{"id":"3-self-supervised-retrieval","text":"3. Self-Supervised Retrieval","depth":3},{"id":"engineering-scale-and-efficiency","text":"Engineering Scale and Efficiency","depth":3},{"id":"solution","text":"Solution","depth":2},{"id":"image-level-feature-alignment","text":"Image-Level Feature Alignment","depth":3},{"id":"patch-level-prediction-task","text":"Patch-Level Prediction Task","depth":3},{"id":"head-design","text":"Head Design","depth":3},{"id":"sinkhorn-knopp-centering","text":"Sinkhorn-Knopp Centering","depth":3},{"id":"koleo-regularization","text":"KoLeo Regularization","depth":3},{"id":"high-resolution-training-phase","text":"High-Resolution Training Phase","depth":3},{"id":"engineering-implementation","text":"Engineering Implementation","depth":2},{"id":"flashattention","text":"FlashAttention","depth":3},{"id":"sequence-packing","text":"Sequence Packing","depth":3},{"id":"stochastic-depth","text":"Stochastic Depth","depth":3},{"id":"distributed-training","text":"Distributed Training","depth":3},{"id":"model-distillation","text":"Model Distillation","depth":3},{"id":"ablation-experiments","text":"Ablation Experiments","depth":2},{"id":"model-training-process","text":"Model Training Process","depth":3},{"id":"pretraining-data","text":"Pretraining Data","depth":3},{"id":"importance-of-loss-components","text":"Importance of Loss Components","depth":3},{"id":"knowledge-distillation-effect","text":"Knowledge Distillation Effect","depth":3},{"id":"high-resolution-training","text":"High-Resolution Training","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"imagenet-classification","text":"ImageNet Classification","depth":3},{"id":"video-classification","text":"Video Classification","depth":3},{"id":"instance-recognition","text":"Instance Recognition","depth":3},{"id":"semantic-segmentation","text":"Semantic Segmentation","depth":3},{"id":"qualitative-results","text":"Qualitative Results","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/dino","relation":"background","topic":"Self-distillation for visual representations"}]},{"id":"contrastive-learning/dino","category":"contrastive-learning","legacyPath":"contrastive-learning/2104-dino","legacySlug":"2104-dino","legacyPaths":[],"title":"DINO","subtitle":"Self-Distillation With No Labels","author":"Z. Yuan","paperDate":"2021-04-29","publishedOn":"2025-03-18","paperTitle":"Emerging Properties in Self-Supervised Vision Transformers","paperUrl":"https://arxiv.org/abs/2104.14294","bibliography":{"title":"Emerging Properties in Self-Supervised Vision Transformers","authors":["Mathilde Caron","Hugo Touvron","Ishan Misra","Hervé Jégou","Julien Mairal","Piotr Bojanowski","Armand Joulin"],"url":"https://arxiv.org/abs/2104.14294","pdfUrl":"https://arxiv.org/pdf/2104.14294","codeUrl":null,"preprint":{"id":"2104.14294","submittedOn":"2021-04-29","url":"https://arxiv.org/abs/2104.14294"},"publication":{"venue":"ICCV","year":2021,"kind":"conference","url":"https://doi.org/10.1109/iccv48922.2021.00951"},"citation":"@misc{contrastivelearningdino2021,\n  title = {{Emerging Properties in Self-Supervised Vision Transformers}},\n  author = {Mathilde Caron and Hugo Touvron and Ishan Misra and Hervé Jégou and Julien Mairal and Piotr Bojanowski and Armand Joulin},\n  year = {2021},\n  eprint = {2104.14294},\n  archivePrefix = {arXiv},\n  url = {https://arxiv.org/abs/2104.14294}\n}\n","citationPath":"/content/papers/citations/contrastive-learning/dino.20875c1e301c.bib"},"thumbnail":{"src":"/content/papers/assets/c2d0ab75afb02750e17183e186f29b0ef6e184eda12673a31c96f199e338188f.jpg","width":664,"height":642},"locale":"en","path":"/content/papers/en/contrastive-learning/dino.df5756884ee0.md","headings":[{"id":"defining-the-problem","text":"Defining the Problem","depth":2},{"id":"solving-the-problem","text":"Solving the Problem","depth":2},{"id":"preventing-model-collapse","text":"Preventing Model Collapse","depth":3},{"id":"discussion","text":"Discussion","depth":2},{"id":"comparison-with-other-methods","text":"Comparison with Other Methods","depth":3},{"id":"importance-of-different-components","text":"Importance of Different Components","depth":3},{"id":"model-collapse-testing","text":"Model Collapse Testing","depth":3},{"id":"conclusion","text":"Conclusion","depth":2}],"anchorAliases":{},"guide":null,"relatedReading":[{"id":"contrastive-learning/dinov2","relation":"next","topic":"Self-distillation for visual representations"}]}],"text":"We have already reviewed the first generation of DINO.\n\nAfter two years, let’s see what improvements Meta AI Research has made on this architecture.\n\n\n> [!TIP]\n> \n> This paper is nearly 20 pages long—perfect for passing the time.\n\n\n## Problem Definition\n\nIn recent years, the mainstream development trend of visual models has become polarized:\n\nOn one hand, methods like CLIP and ALIGN learn through image-text alignment, using language as a semantic supervisory axis, successfully training foundational models with semantic understanding capabilities. These methods show strong performance in classification, retrieval, and multimodal tasks.\n\nOn the other hand, another route chooses not to rely on language, even rejecting external annotation for pretraining. This is a purer self-supervised perspective, letting images “speak for themselves,” enabling models to learn recognition, memory, abstraction, and generalization silently.\n\nThis route attempts to answer a more fundamental question:\n\n> **In a world without language, can images still understand themselves?**\n\nThis is the core pursuit of Self-Supervised Learning (SSL) techniques.\n\nThese methods can be roughly divided into two categories:\n\n1. **Intra-image pretext tasks**, such as predicting masked patches, reconstructing original images, color restoration, or patch order prediction. These are similar in form to “fill-in-the-blank” tasks in language models, with typical examples including MAE and BEiT.\n\n2. **Discriminative self-supervision** draws on contrastive learning, instance classification, or clustering. Representative methods include SimCLR, MoCo, BYOL, and DINO; they do not all use explicit negative pairs.\n\nOn standard datasets like ImageNet-1k, these methods have shown that frozen features can generalize, even approaching supervised training in some evaluations. Yet when scaling up model size, extending training, or using uncurated data, they can face unstable training and degraded features.\n\nPerhaps the quality and diversity of data are even more critical factors?\n\nAlthough self-supervised learning does not rely on manual annotation, it depends more heavily on the breadth and structural balance of the input data itself. When datasets suffer from topic shifts, long-tail imbalance, or excessive repetition, models tend to learn partial and hard-to-transfer representations.\n\nDespite accumulating many impressive academic and industrial results, there remain several key unresolved issues for pushing these methods toward stable and usable visual foundational models:\n\n- **Can existing self-supervised techniques maintain sufficient stability and scalability when scaled up?**\n- **Can learning without language or annotation during pretraining still produce general features useful for downstream applications?**\n- **How can we effectively and automatically perform data filtering and distribution balancing when facing massive, uncurated image collections?**\n\nThese questions remain open.\n\nDINOv2 starts from the first generation’s foundation, further adjusting data strategies, enhancing architectural stability, and reconsidering the systematic design of self-supervised learning. If the data is better and the architecture more stable, perhaps we can go further—enabling models that do not rely on language to become a universal foundation for modern visual systems.\n\n## Data Collection\n\nTo enable the model to learn solid, generalizable visual features, data quality is the first priority.\n\nWhen the goal is pretraining without labels, the responsibility of data selection no longer lies on target labels but on **the diversity and representativeness of the images themselves**. The curation pipeline does, however, start from existing datasets.\n\nThe data processing pipeline planned by the authors can be roughly divided into three steps, as illustrated below:\n\n\n\n![data arch](/content/papers/assets/9c68ef105804d4462aee8950a1bfd9f0929511f494b1a29690d857bf931da892.jpg)\n\n\n\nThis is [Figure 3 of the paper](https://arxiv.org/html/2304.07193#S3.F3): images from both pools are embedded, duplicates are removed, and curated images guide retrieval from the web pool.\n\n### 1. Preparing the Data Pool\n\nThe chosen target dataset LVD-142M consists of two parts:\n\n- **Curated portion**: based on ImageNet-1k/22k, Google Landmarks, and multiple fine-grained datasets, serving as sources of “representative samples”;\n- **Uncurated portion**: web images from a public crawl. The authors discard unsafe or restricted URLs, deduplicate, filter NSFW content, and blur identifiable faces, leaving about 1.2 billion candidate images before retrieval.\n\nThese uncurated images have not been manually selected by semantic class, but they have undergone the safety filtering and initial deduplication above.\n\n\n> [!NOTE]\n> \n> The paper uses the term “curated” extensively, so a brief reminder for readers:\n> \n> - **Curated data**: data selected, cleaned, or organized for a purpose, manually or automatically;\n> - **Uncurated data**: here, candidate images not yet selected by visual retrieval against the curated set; they may already have undergone safety filtering and deduplication.\n\n\n### 2. Removing Duplicates\n\nTo avoid bias caused by duplicate training data, the authors introduced a specialized copy detection process to remove highly similar images, not only within the uncurated set but also excluding samples similar to test sets to prevent data leakage.\n\nThe implementation of this step builds on Pizzi et al. (2022), helping to keep the dataset diverse and clean.\n\n\n> [!TIP]\n> \n> Reference: Pizzi et al. [**[22.02] A self-supervised descriptor for image copy detection**](https://arxiv.org/abs/2202.10261)\n\n\n### 3. Self-Supervised Retrieval\n\nHere lies the truly ingenious design.\n\nThe authors first use a ViT-H/16 model previously self-supervised trained on ImageNet-22k to compute embedding representations for all images. Using cosine similarity as the distance metric, they retrieve uncurated images that “look like curated data.”\n\nThis retrieval is neither manual annotation nor keyword filtering but purely based on visual similarity of image features.\n\nNext, the uncurated images are clustered by K-means. Depending on the scenario (large or small query datasets), for each base image, the top N nearest neighbors (N=4) or M images from the corresponding cluster are selected.\n\nThis choice balances data overlap and retrieval diversity.\n\n### Engineering Scale and Efficiency\n\nSuch large-scale data processing and retrieval require powerful computational resources.\n\nThe entire pipeline is built on the FAISS framework, using GPU-accelerated inverted indexing and quantization coding, distributed across 20 computing nodes each equipped with 8 V100 GPUs. It took less than two days to complete the cleaning and organization of 142 million high-quality training images.\n\nOverall, DINOv2’s data preparation cleverly combines “existing high-quality datasets” with “visually similar web images,” using self-supervision to automatically select training samples and lay a foundation for what the model learns next.\n\n## Solution\n\nThe training strategy adopted by DINOv2 belongs to **Discriminative Self-Supervised Learning**. Overall, it can be seen as a hybrid design combining DINO and iBOT with SwAV’s centering mechanism, augmented by regularization terms and a high-resolution training strategy.\n\n\n> [!TIP]\n> \n> Wait—this sudden flood of terms might catch readers off guard.\n> \n> For those unfamiliar with the above terms, you can refer to the following papers:\n> \n> - [**[20.06] SwAV: Swapping Cluster Predictions**](/blog/papers/contrastive-learning/swav)\n> - [**[21.04] DINO: Self-Distillation With No Labels**](/blog/papers/contrastive-learning/dino)\n> - [**[21.11] iBOT: Image BERT Pre-Training with Online Tokenizer**](https://arxiv.org/abs/2111.07832)\n\n\n### Image-Level Feature Alignment\n\n\n\n![Original DINO student–teacher self-distillation diagram](/content/papers/assets/c2d0ab75afb02750e17183e186f29b0ef6e184eda12673a31c96f199e338188f.jpg)\n\n\n\nThis is [Figure 2 from the original DINO paper](https://arxiv.org/html/2104.14294#S1.F2), illustrating student, teacher, and EMA. DINOv2 later changes teacher normalization to Sinkhorn–Knopp; the predecessor diagram is not its complete architecture.\n\nThis part is based on the core idea of the DINO method, as illustrated above.\n\nUsing the DINO loss function, the goal is to ensure that the semantic representations of images under different views (augmentations), processed by the student and teacher networks respectively, remain consistent.\n\nThe specific procedure is as follows:\n\n- Take two different crops (called views) from the same image and input them separately into the **student and teacher** models;\n\n- Both models are Vision Transformers, and their class tokens are taken as the overall semantic vector representing the image;\n\n- The class tokens are then passed through separate MLP heads to produce vectors called “prototype scores.” The student uses softmax to obtain its prediction distribution, while the teacher obtains its target distribution through Sinkhorn–Knopp (SK):\n\n  $$\n  \\mathbf{p}_s = \\mathrm{softmax}(h_s(z_s)), \\quad \\mathbf{p}_t = \\mathrm{SK}(h_t(z_t))\n  $$\n\n- DINOv2 uses SK to balance the teacher targets within a batch, replacing the moving-average centering used in DINO and iBOT. It does not simply smooth an already computed softmax output;\n\n- The final loss is the cross-entropy between the two distributions:\n\n  $$\n  \\mathcal{L}_{\\text{DINO}} = - \\sum_{k} p_t^{(k)} \\log p_s^{(k)}\n  $$\n\nHere, the student is the training target, while the teacher is an exponential moving average (EMA) of the student weights and does not participate in backpropagation.\n\n### Patch-Level Prediction Task\n\n\n\n![Original iBOT diagram of masked patches and teacher targets](/content/papers/assets/1bb798699387998f4b5f6c276ed0698ace2945286deb8af07484052942b9a651.jpg)\n\n\n\nThis is [Figure 3 from the iBOT paper](https://arxiv.org/html/2111.07832#S3.F3). The MIM path at right shows prediction at masked patches. DINOv2 borrows this objective while changing the heads and teacher balancing.\n\nTo learn local details, the authors add iBOT's **patch-level masked prediction** objective:\n\n- Randomly mask certain patches in the student input, forming masked tokens;\n- These patches remain fully visible in the teacher input;\n- For each masked patch, the student predicts a distribution $\\mathbf{p}_{s}^{(i)}$ against the teacher's target $\\mathbf{p}_{t}^{(i)}$ from the corresponding visible patch. The student uses softmax and the teacher uses SK:\n\n  $$\n  \\mathcal{L}_{\\text{iBOT}} = - \\sum_{i \\in \\mathcal{M}} \\sum_{k} p_t^{(i, k)} \\log p_s^{(i, k)}\n  $$\n\nwhere $\\mathcal{M}$ is the index set of all masked patches. This task provides finer spatial-level supervision, aiding downstream pixel-level tasks such as segmentation.\n\n### Head Design\n\nBoth DINOv2 and iBOT require additional MLP projection heads to map transformer outputs into logits.\n\nAlthough the original iBOT paper reports better results sharing the heads, DINOv2’s large-scale experiments found **using two separate heads performs better**, thus the two are fully decoupled.\n\n### Sinkhorn-Knopp Centering\n\nTo stabilize the teacher’s predicted distributions, DINOv2 adopts the **Sinkhorn-Knopp normalization (SK)** from SwAV to balance batch distributions.\n\nThis method iteratively normalizes rows and columns toward specified batch and prototype marginals. For a rectangular matrix, the rows and columns cannot each all sum to one. The implementation runs three normalization iterations.\n\nUsing SK reduces the risk of model collapse by preventing the output from concentrating on a single prototype.\n\n### KoLeo Regularization\n\nDINOv2 introduces a rarely seen regularizer in this domain: **KoLeo Regularizer (Kozachenko-Leonenko Regularizer)**, which encourages feature embeddings to be evenly and widely distributed in embedding space.\n\nThis term originates from differential entropy estimation and is formulated as:\n\n$$\n\\mathcal{L}_{\\text{KoLeo}} = -\\frac{1}{n} \\sum_{i=1}^{n} \\log d_{n,i}\n$$\n\nwhere:\n\n- $d_{n,i} = \\min_{j \\ne i} \\| \\mathbf{x}_i - \\mathbf{x}_j \\|$ is the nearest-neighbor distance for vector $i$;\n- All vectors $\\mathbf{x}_i$ are $\\ell_2$ normalized beforehand.\n\nThis regularization prevents features from over-concentrating during training, promoting coverage and diversity in feature representation.\n\n### High-Resolution Training Phase\n\nAlthough high-resolution images are critical for tasks like segmentation and detection, directly using high resolution during pretraining is computationally expensive. Therefore, the authors adopt a compromise: **briefly switch to 518×518 high-resolution images in the later pretraining phase** to enhance detail signals.\n\nThe resolution ramp-up resembles UniViT and FlexiViT. The paper's smaller ablation compares 224 and 416 pixels; the final training recipe uses 518 pixels. A short high-resolution phase has a cost, but costs less than training at high resolution throughout.\n\nDINOv2 combines image-level alignment, masked-patch prediction, balanced teacher targets, and KoLeo regularization. The ablations below show what each part contributes in the tested settings.\n\n## Engineering Implementation\n\nThe authors dedicate a chapter to introducing how to accelerate the training pipeline and reduce memory usage. Compared to iBOT, with the same hardware, DINOv2 achieves roughly 2× speedup and only 1/3 memory usage.\n\n### FlashAttention\n\nSelf-attention layers are the biggest computational bottleneck in ViT architectures.\n\nThe team developed an optimized FlashAttention implementation that outperforms the original in both memory and speed, and supports more hardware platforms and architectural variants.\n\nThey found that aligning embedding dimensions with GPU-friendly sizes (e.g., 64 per head, total embedding multiple of 256) further improves efficiency.\n\nTherefore, ViT-g uses 1536 dimensions and 24 heads (64 dims per head), replacing the commonly used 1408 dims / 16 heads design.\n\nExperiments show comparable accuracy with better efficiency.\n\n### Sequence Packing\n\nViT inputs are patch tokens, and DINO-style methods process two crops simultaneously:\n\n- Large crops (resolution 224) produce long sequences;\n- Small crops (resolution 98) produce short sequences.\n\nPrevious approaches forwarded these separately, causing batch size inconsistency and wasted computation.\n\nDINOv2 introduces a technique from NLP: **Sequence Packing**.\n\nMultiple token sequences of varying lengths are concatenated into one long sequence, and a block-diagonal attention mask prevents cross-attention between different sequences. This yields the same effect as separate forwards but significantly improves computational efficiency.\n\nThis design relies on low-level support and is implemented on top of the `xFormers` library.\n\n### Stochastic Depth\n\nStochastic Depth is a form of regularization that randomly skips the residual branch for some samples during training.\n\nTraditionally, the residual branch is computed before its output is masked for dropped samples. DINOv2 instead skips that residual computation while retaining the shortcut, saving memory and compute.\n\nThis requires a special kernel that randomly permutes samples in the batch dimension and only computes the first $(1-d) \\cdot B$ samples for the affected branch. At the paper's $d=40\\%$ drop rate, roughly 40% of the samples skip that branch on each layer; this is not a 40% reduction in total training cost.\n\n### Distributed Training\n\nTraining billion-scale models (e.g., ViT-g with \\~1.1B parameters) is bottlenecked by memory.\n\nDINOv2 employs **Fully-Sharded Data Parallel (FSDP)** to shard model replicas across GPUs, including:\n\n- Student network,\n- Teacher network,\n- Optimizer first- and second-moment parameters (AdamW).\n\nFour float32 copies of a billion parameters occupy about 16 GB, before gradients, activations, and temporary buffers. At 1.1 billion parameters the four copies alone are about 17.6 GB. FSDP shards them across GPUs rather than requiring all copies on one device.\n\nThe backbone communicates weights and gradients in float16, while MLP-head gradients are reduced in float32 for stability. The paper reports about 50% less communication than its float32 DDP comparison; the gain depends on the setup.\n\nIn the authors' measured configurations, PyTorch FSDP with mixed precision was generally faster than DDP with autocast.\n\n### Model Distillation\n\nAfter training large models like ViT-g, DINOv2 does not directly train smaller models like ViT-B or ViT-L from scratch. Instead, knowledge distillation is used to let smaller models mimic the large one’s outputs.\n\nThe training strategy reuses the teacher-student framework with these modifications:\n\n- The pretrained ViT-g is frozen as teacher;\n- Masking and stochastic depth are disabled to simplify training;\n- The iBOT loss is applied to two global crops;\n- The student’s EMA is kept as the final model output.\n\nThis design is similar to Duval et al.’s method but without changing the loss function structure, reusing the original pipeline for simplicity and practicality.\n\nExperiments show that even ViT-L distilled this way outperforms training from scratch significantly.\n\n## Ablation Experiments\n\nTo verify the effectiveness of each component design, the authors conducted several experiments covering training strategies, data sources, model sizes, loss components, and resolutions.\n\n### Model Training Process\n\n\n\n![training](/content/papers/assets/98d2b336f64d1cba4eea37fa5f8a3469e527f581fdeb24f6a912b29c10f898cc.jpg)\n\n\n\nUsing iBOT as the baseline, the authors sequentially added various DINOv2 techniques (such as dual heads, Sinkhorn centering, and KoLeo regularization) and observed performance on ImageNet-1k with k-NN and linear-probe evaluations.\n\nThe results in [Table 1 of the paper](https://arxiv.org/html/2304.07193#S6.T1) come from a ViT-L trained on ImageNet-22k. **Most steps improve at least one evaluation**, but the components are added sequentially, so each row is not an independent ablation. Adding LayerScale and stochastic depth together lowers linear-probe accuracy from 83.2 to 82.0; the authors say these changes help prevent NaN loss during training. Untying the heads at the end raises k-NN from 81.7 to 82.0, while linear-probe accuracy falls from 84.7 to 84.5. Sinkhorn–Knopp leaves both scores unchanged at that step.\n\n### Pretraining Data\n\n\n\n![pretrain data](/content/papers/assets/d871f781e70f50ff5726683037af0e31944866c47bcfa85606b2b0b8d80b5808.jpg)\n\n\n\nTo test the impact of data quality on features, the authors compared three datasets:\n\n- LVD-142M (curated set selected via visual retrieval)\n- ImageNet-22k (traditional large-scale labeled dataset)\n- Uncurated-142M (random samples from the same source web data)\n\nAll three were trained with ViT-g/14 for the same number of iterations, below the final training run and without high-resolution adaptation.\n\nThe image reproduces [Table 2 of the paper](https://arxiv.org/html/2304.07193#S6.T2). The uncurated row randomly samples 142 million images from the same web pool. Compare both the ImageNet-1k and transfer columns:\n\n- **LVD-142M outperforms random uncurated samples on most measures**, though ADE-20k is an exception (47.7 versus 48.5 mIoU);\n- LVD-142M surpasses ImageNet-22k on most benchmarks except ImageNet-1k;\n- On domains not used as references for curation (such as iNaturalist and Places205), LVD-142M also scores higher than ImageNet-22k.\n\nLVD-142M scores 85.8 on ImageNet-1k, just below ImageNet-22k's 85.9. This experiment shows that data curation remains an important design choice even for self-supervised learning.\n\n### Importance of Loss Components\n\n![KoLeo and iBOT ablation tables with classification accuracy, ADE-20k mIoU and Oxford-M mAP](/content/papers/assets/e62311f2a23524c052446c250571a4a6c648cd6747a3a16d44187a37c2de50e3.jpg)\n\nThese are [Table 3(a) and 3(b) of the paper](https://arxiv.org/html/2304.07193#S6.T3). The left table includes Oxford-M mAP, and the right includes ADE-20k mIoU. Each model uses the same iteration count, shorter than the final training run.\n\nNext, the authors evaluated the actual contribution of each loss term via ablation on:\n\n- **KoLeo Regularization**\n\n  On Oxford-M retrieval, adding KoLeo raises mAP from **55.6 to 63.9, a gain of 8.3 percentage points**. ImageNet-1k classification also rises by 0.5 points, while ADE-20k falls slightly from 47.2 to 47.1 mIoU.\n\n  This shows the regularizer successfully encourages feature dispersion, especially benefiting retrieval tasks requiring detailed feature discrimination.\n\n- **iBOT-style Masked Image Modeling**\n\n  Removing this loss changes ADE-20k mIoU from **47.1 to 44.2, a drop of 2.9 points**. This supports the value of patch-level supervision for the tested segmentation setup.\n\n### Knowledge Distillation Effect\n\n\n\n![knowledge distillation](/content/papers/assets/31b848c3ba006097ae990e08559715f1a0993c50ecf00cc564155a49da281484.jpg)\n\n\n\nTo reduce training costs of smaller models, DINOv2 uses ViT-g as a frozen teacher to distill ViT-L/14 and compares it against training from scratch.\n\nIn [Figure 5 of the paper](https://arxiv.org/html/2304.07193#S6.F5), the left panel compares 12 benchmarks and the right panel summarizes eight task groups. Distilled ViT-L/14 beats the from-scratch counterpart on all 12 in this experiment; the result is specific to these models and training conditions.\n\n### High-Resolution Training\n\n\n\n![role of resolution](/content/papers/assets/028f41921e6a45ae182376fd419263a41569e19eb63b53f16f2acccff1cc74ca.jpg)\n\n\n\nFinally, the authors tested whether high-resolution training from scratch is necessary:\n\n- Using ViT-L/16 on ImageNet-1k, compared fixed resolutions of 224 and 416 against 224 followed by 10k more iterations at 416;\n- Evaluation metrics included ImageNet classification and ADE segmentation;\n- **Training entirely at 416 gives the best results at most evaluation resolutions shown, but costs about three times as much computation as training entirely at 224**; switching to 416 only for the last 10k iterations yields a similar curve while paying the extra high-resolution cost only for that final phase.\n\n[Figure 6 of the paper](https://arxiv.org/html/2304.07193#S6.F6) shows the 224 run in orange, the full 416 run in pink, and the short 224→416 run in blue. Its horizontal axis is evaluation resolution; the panels report ImageNet-1k accuracy and ADE-20k mIoU. The final DINOv2 recipe uses a 518-pixel high-resolution phase, distinct from this 416-pixel ablation.\n\n## Discussion\n\n### ImageNet Classification\n\n\n\n![ImageNet linear evaluation of DINOv2 and earlier pretrained models](/content/papers/assets/25c267724061fbde5252a07c3b59503ec146606f227360edc3fe18fdeaf86f5f.jpg)\n\n\n\n[Table 4 in DINOv2](https://arxiv.org/html/2304.07193#S7.T4) trains a linear classifier over frozen backbones. Architectures and pretraining datasets differ across rows, so this is not a matched-size comparison.\n\nIn the ImageNet-1k linear classification task, DINOv2 demonstrates extremely strong feature representation capability.\n\nWith a frozen backbone and a trained linear classifier, ViT-g/14 reaches **86.5% Top-1 on ImageNet-1k validation**, 4.2 percentage points above the best earlier self-supervised model in the table, iBOT at 82.3%. It also slightly exceeds OpenCLIP ViT-G/14 at 86.2% and EVA-CLIP ViT-g/14 at 86.4%. These rows differ in architecture and pretraining data, so the gaps cannot all be attributed to the training method.\n\nWithout text supervision during pretraining, DINOv2 ViT-g/14 also scores 89.6% on ImageNet-ReaL and 78.4% on ImageNet-V2; the table lists 83.5% in k-NN evaluation. These are classification results from the same evaluation suite.\n\nAcross DINOv2 ViT-S/B/L/g, the table's linear classification accuracies are 81.1%, 84.5%, 86.3%, and 86.5%. The progression shows how these pretrained models perform as size grows; the table does not control every cost difference between architectures.\n\nThis table supports DINOv2's strong ImageNet linear evaluation, approaching or slightly exceeding the listed weakly supervised models. Its transfer to other tasks must still be judged by the downstream experiments below.\n\n### Video Classification\n\n\n\n![DINOv2 image and video linear evaluation table](/content/papers/assets/7655331a104c66ada5b634ec82e8360c6ec44c98165e312199c6a4a31b17c2ee.jpg)\n\n\n\n[Table 7 in DINOv2](https://arxiv.org/html/2304.07193#S7.T7) uses frozen features and trained linear classifiers. It covers iNaturalist, Places205, and three video datasets; the next image is a separate table of 12 image benchmarks.\n\nOn additional image and video classification tasks, DINOv2's representations transfer across visual domains and from images to video. The paper evaluates iNaturalist, Places205, and the 12 image tasks used by SimCLR.\n\nDINOv2 ViT-g/14 scores 81.6% and 85.7% on iNaturalist 2018 and 2021, ahead of OpenCLIP ViT-G/14 at 73.0% and 76.0%. On Places205, however, DINOv2's 67.5% trails OpenCLIP's 69.8%.\n\nFor video classification, despite seeing no video during pretraining, the authors extract eight evenly spaced frames. They average frame features for K400 and UCF-101, concatenate them for SSv2, then train a linear classifier. DINOv2 ViT-g/14 scores 78.4%, 91.2%, and 38.3% on those three datasets, versus OpenCLIP's 78.3%, 90.7%, and 35.8%. The SSv2 gap is 2.5 percentage points.\n\n\n\n![Accuracy on twelve fine-grained classification benchmarks](/content/papers/assets/a44ab250ec4a7a182f6a71b10499b1d06dc6896e502603c8acfcdfbcb5f4e8cc.jpg)\n\n\n\n[Table 8 in DINOv2](https://arxiv.org/html/2304.07193#S7.T8) covers twelve object, scene, and texture benchmarks.\n\nFinally, across these twelve image classification tasks, DINOv2 ViT-g/14 averages 92.1%, close to OpenCLIP ViT-G/14 at 91.9%. DINOv2 leads on Aircraft, 87.2% to 80.2%, but trails on Cars, 91.4% to 96.1%, and SUN, 78.7% to 84.0%. The models have different strengths across datasets.\n\n### Instance Recognition\n\n\n\n![Instance retrieval results for Oxford, Paris, Met, and AmsterTime](/content/papers/assets/3c23018e0e40278a8bc0ea3f918c6c227e429adc9fad90e4c465e03106d80b85.jpg)\n\n\n\n[Table 9 in DINOv2](https://arxiv.org/html/2304.07193#S7.T9) evaluates non-parametric retrieval with frozen features, with separate Oxford/Paris M and H difficulty settings and multiple Met metrics.\n\nIn instance-level recognition tasks, DINOv2 also exhibits strong discriminative ability.\n\nUsing non-parametric retrieval ranking by cosine similarity between query and database images, the comparison includes both self- and weakly supervised models.\n\nAcross landmarks (Oxford and Paris), artwork retrieval (Met), and historical street views (AmsterTime), DINOv2 shows strong results. ViT-L/14 reaches 54.0 mAP on Oxford-Hard, above the listed iBOT at 12.7 and OpenCLIP at 19.7; it scores 83.5 on Paris-Hard and 50.0 on AmsterTime. ViT-g/14 is not highest in every column: its Oxford-Hard score of 52.3 is below ViT-L/14.\n\nTogether with the category classification results, these retrieval scores show useful frozen features across task granularities. The table does not directly test the mechanism by which the model recognizes small differences.\n\n### Semantic Segmentation\n\n\n\n![Semantic segmentation on ADE20K, CityScapes, and Pascal VOC](/content/papers/assets/798469c541797d69efde896f41732e8080085f7508ecbd9f1b8c7ed0b73764a6.jpg)\n\n\n\n[Table 10 in DINOv2](https://arxiv.org/html/2304.07193#S7.T10) distinguishes lin. from +ms evaluation. The parenthesized numbers in the headers are reference results from other methods, not DINOv2 scores.\n\nIn dense tasks such as semantic segmentation and monocular depth estimation, the authors freeze the backbone and train downstream predictors to examine its patch-level features.\n\nFor semantic segmentation, “lin.” uses a linear layer to predict low-resolution logits from patch tokens and then upsamples them. The “+ms” setting concatenates features from the last four layers, uses higher input resolution, and evaluates at multiple scales. DINOv2 ViT-g/14 reaches 53.0 mIoU on ADE-20k in the +ms setting, near the cited fully fine-tuned MAE + UperNet result of 53.6. On Pascal VOC it scores 86.2, still below the listed best result of 89.0.\n\nThe authors also insert a frozen ViT-g/14 backbone into ViT-Adapter + Mask2Former. The adapter and head are still trained, with about 66% of the weights frozen. This setting reaches 60.2 mIoU on ADE-20k, near the cited 62.9.\n\n### Qualitative Results\n\nBeyond quantitative evaluation, the authors show segmentation, depth prediction, and feature visualizations so that we can inspect the model's output.\n\nFirst, visual comparisons of semantic segmentation and depth estimation:\n\n\n\n![DINOv2 and OpenCLIP segmentation and depth predictions](/content/papers/assets/73a9316e1ac4110598742ba6d41fc0748702ef5b21fc25f150e7eaa3beb53526.jpg)\n\n\n\n[Figure 7 in DINOv2](https://arxiv.org/html/2304.07193#S7.F7) compares frozen features with linear predictors on ADE20K, NYUd, SUN RGB-D, and KITTI. Compare Input, OpenCLIP-G, and DINOv2-g within each group.\n\nIn the ADE20K examples, with a frozen backbone and a linear predictor, DINOv2's connected regions and object boundaries look more complete than OpenCLIP's. These are qualitative examples; the overall comparison rests on the mIoU table above.\n\nThe depth examples also look smoother and less noisy. A chair in the SUN RGB-D example, for instance, has a clearer position in the DINOv2 prediction. This is depth estimation, not chair-class recognition.\n\nNext, the paper applies the trained linear segmentation and depth predictors to paintings, sketches, and images in different styles:\n\n\n\n![Segmentation and depth on examples outside the downstream predictor distribution](/content/papers/assets/f2c4f60839e22f1666177e323371493ffe1b0cd8bf05c090ab3757bae5320a72.jpg)\n\n\n\n[Figure 8 in DINOv2](https://arxiv.org/html/2304.07193#S7.F8) includes paintings and animals. Out of distribution refers to the downstream predictors.\n\nThe predictions still show parts of the object outlines and depth structure, offering qualitative examples of transfer across image styles.\n\nFinally, analysis of feature space structure is presented:\n\n\n\n![Visualization of the first three PCA components of DINOv2 patch features](/content/papers/assets/fd3e1b1e64581f9a8e2a929e4c22a13c54caab8e91429b486e230a06a302a2f9.jpg)\n\n\n\n[Figure 9 in DINOv2](https://arxiv.org/html/2304.07193#S7.F9) first separates the main object and background by the sign of the first principal component. The authors then perform a second PCA on the retained patch features and map its first three components to RGB colors.\n\nSimilar parts of related images often show similar colors. That is an interesting structure the authors observe in the features; the PCA visualization itself is not a quantitative test of part recognition.\n\n## Conclusion\n\nFrom an engineering practitioner’s perspective, DINOv2’s greatest value lies in delivering “high-quality, versatile visual features that can be directly applied to multiple tasks without fine-tuning.”\n\nThis means we can use fewer resources and simpler downstream modules for tasks that once called for full-backbone fine-tuning. Whether classification, segmentation, depth estimation, or instance retrieval, DINOv2 offers frozen features that can be paired with a relatively simple head. That head may still need labeled training, and a deployment decision requires evaluation on the target domain.\n\nMoreover, DINOv2 shows robust cross-domain performance and a sense for structural detail, making it a promising backbone for tasks with limited data, substantial variation, and demanding semantic distinctions.\n\nMore importantly, it need not remain a complete black box. Through PCA and patch matching, we can inspect some of the semantic structure and object parts encoded in the features. These views can help with error analysis, though they do not explain every prediction.\n\nIf you work on medical images, satellite imagery, retail product recognition, or even autonomous vehicle perception, DINOv2 may be a general-purpose foundation worth considering—and testing on your own data.\n","imageSizes":{"/content/papers/assets/9c68ef105804d4462aee8950a1bfd9f0929511f494b1a29690d857bf931da892.jpg":{"width":1224,"height":368},"/content/papers/assets/c2d0ab75afb02750e17183e186f29b0ef6e184eda12673a31c96f199e338188f.jpg":{"width":664,"height":642},"/content/papers/assets/1bb798699387998f4b5f6c276ed0698ace2945286deb8af07484052942b9a651.jpg":{"width":1224,"height":392},"/content/papers/assets/98d2b336f64d1cba4eea37fa5f8a3469e527f581fdeb24f6a912b29c10f898cc.jpg":{"width":1220,"height":728},"/content/papers/assets/d871f781e70f50ff5726683037af0e31944866c47bcfa85606b2b0b8d80b5808.jpg":{"width":1224,"height":216},"/content/papers/assets/e62311f2a23524c052446c250571a4a6c648cd6747a3a16d44187a37c2de50e3.jpg":{"width":1734,"height":262},"/content/papers/assets/31b848c3ba006097ae990e08559715f1a0993c50ecf00cc564155a49da281484.jpg":{"width":1224,"height":492},"/content/papers/assets/028f41921e6a45ae182376fd419263a41569e19eb63b53f16f2acccff1cc74ca.jpg":{"width":1224,"height":468},"/content/papers/assets/25c267724061fbde5252a07c3b59503ec146606f227360edc3fe18fdeaf86f5f.jpg":{"width":1224,"height":900},"/content/papers/assets/7655331a104c66ada5b634ec82e8360c6ec44c98165e312199c6a4a31b17c2ee.jpg":{"width":1224,"height":448},"/content/papers/assets/a44ab250ec4a7a182f6a71b10499b1d06dc6896e502603c8acfcdfbcb5f4e8cc.jpg":{"width":1500,"height":432},"/content/papers/assets/3c23018e0e40278a8bc0ea3f918c6c227e429adc9fad90e4c465e03106d80b85.jpg":{"width":1498,"height":490},"/content/papers/assets/798469c541797d69efde896f41732e8080085f7508ecbd9f1b8c7ed0b73764a6.jpg":{"width":1224,"height":596},"/content/papers/assets/73a9316e1ac4110598742ba6d41fc0748702ef5b21fc25f150e7eaa3beb53526.jpg":{"width":1542,"height":820},"/content/papers/assets/f2c4f60839e22f1666177e323371493ffe1b0cd8bf05c090ab3757bae5320a72.jpg":{"width":1224,"height":488},"/content/papers/assets/fd3e1b1e64581f9a8e2a929e4c22a13c54caab8e91429b486e230a06a302a2f9.jpg":{"width":1224,"height":672}}}
