# facebookresearch/dinov3 architecture

> Architecture diagram of the GitHub repository facebookresearch/dinov3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/facebookresearch/dinov3
- Repository: https://github.com/facebookresearch/dinov3
- Video tour (about a minute): https://gitdiagram.com/facebookresearch/dinov3/video

## Overview

DINOv3 is a reference PyTorch implementation for training self-supervised vision foundation models and loading pretrained backbones and task adapters. The main training workflow prepares augmented multi-crop data, trains student/teacher models with distillation losses, and saves checkpoints; pretrained features also support classification, segmentation, depth, detection, and text-related evaluation or inference. The sampled excerpts establish some training, backbone, and distributed relationships; task-specific evaluation wiring is mostly unsampled, so those links are left unverified.

Main entry points: [`dinov3/hub/backbones.py`](https://github.com/facebookresearch/dinov3/blob/main/dinov3/hub/backbones.py) (Backbone loading), [`dinov3/train/train.py`](https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/train.py) (Training runner), [`dinov3/train/ssl_meta_arch.py`](https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/ssl_meta_arch.py) (Student-teacher model), [`dinov3/data/loaders.py`](https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/loaders.py) (Loaders and transforms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["Dataset decoding<br/>[decoders.py]"]
  node_data_pipeline["Loaders and transforms<br/>[loaders.py]"]
  node_augmentation["Multi-crop augmentation<br/>[augmentations.py]"]
end

subgraph group_models["Model foundations"]
  node_vit["Vision Transformer"]
  node_convnext["ConvNeXt<br/>[convnext.py]"]
  node_layers["Transformer layers<br/>[block.py]"]
end

subgraph group_training["Training runtime"]
  node_train_entry["Training runner<br/>[train.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_ssl["Student-teacher model<br/>[ssl_meta_arch.py]"]
  node_losses["Distillation losses"]
  node_optimizer_schedule["Training schedules"]
  node_distributed["Distributed runtime"]
  node_parallelize["FSDP and compile"]
  node_checkpoint[("Checkpoint storage<br/>[checkpointer.py]")]
end

subgraph group_tasks["Evaluation and tasks"]
  node_linear_eval["Linear evaluation<br/>[linear.py]"]
  node_segmentation["Segmentation"]
  node_depth["Depth estimation"]
  node_detection["Object detection"]
  node_text["Vision-language"]
end

subgraph group_serving["Pretrained model access"]
  node_hub["Backbone loading<br/>[backbones.py]"]
  node_task_hub["Task adapters<br/>[depthers.py]"]
end

node_researcher(("Researcher"))

node_researcher -.->|"starts training"| node_train_entry
node_train_entry -->|"loads config"| node_config
node_train_entry -->|"builds loaders"| node_data_pipeline
node_train_entry -->|"trains model"| node_ssl
node_train_entry -->|"uses runtime"| node_distributed
node_train_entry -->|"uses schedule"| node_optimizer_schedule
node_train_entry -->|"saves state"| node_checkpoint
node_data_pipeline -.->|"loads samples"| node_dataset
node_data_pipeline -.->|"transforms samples"| node_augmentation
node_ssl -->|"builds backbone"| node_vit
node_ssl -.->|"builds backbone"| node_convnext
node_ssl -->|"uses objectives"| node_losses
node_ssl -->|"configures parallelism"| node_parallelize
node_vit -->|"uses blocks"| node_layers
node_researcher -->|"loads pretrained"| node_hub
node_hub -->|"constructs model"| node_vit
node_hub -->|"constructs model"| node_convnext
node_hub -.->|"loads adapters"| node_task_hub
node_hub -.->|"supports probing"| node_linear_eval
node_hub -.->|"supports evaluation"| node_segmentation
node_hub -.->|"supports evaluation"| node_depth
node_hub -.->|"supports tasks"| node_detection
node_hub -.->|"supports tasks"| node_text

click node_train_entry "https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/train.py"
click node_config "https://github.com/facebookresearch/dinov3/blob/main/dinov3/configs/config.py"
click node_dataset "https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/datasets/decoders.py"
click node_data_pipeline "https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/loaders.py"
click node_augmentation "https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/augmentations.py"
click node_vit "https://github.com/facebookresearch/dinov3/blob/main/dinov3/models/vision_transformer.py"
click node_convnext "https://github.com/facebookresearch/dinov3/blob/main/dinov3/models/convnext.py"
click node_layers "https://github.com/facebookresearch/dinov3/blob/main/dinov3/layers/block.py"
click node_ssl "https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/ssl_meta_arch.py"
click node_losses "https://github.com/facebookresearch/dinov3/blob/main/dinov3/loss/dino_clstoken_loss.py"
click node_optimizer_schedule "https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/cosine_lr_scheduler.py"
click node_distributed "https://github.com/facebookresearch/dinov3/blob/main/dinov3/distributed/torch_distributed_wrapper.py"
click node_parallelize "https://github.com/facebookresearch/dinov3/blob/main/dinov3/fsdp/ac_compile_parallelize.py"
click node_checkpoint "https://github.com/facebookresearch/dinov3/blob/main/dinov3/checkpointer/checkpointer.py"
click node_linear_eval "https://github.com/facebookresearch/dinov3/blob/main/dinov3/eval/linear.py"
click node_segmentation "https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/segmentation"
click node_depth "https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/depth"
click node_detection "https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/detection"
click node_text "https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/text"
click node_hub "https://github.com/facebookresearch/dinov3/blob/main/dinov3/hub/backbones.py"
click node_task_hub "https://github.com/facebookresearch/dinov3/blob/main/dinov3/hub/depthers.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dataset,node_data_pipeline,node_augmentation toneBlue
class node_vit,node_convnext,node_layers toneAmber
class node_train_entry,node_config,node_ssl,node_losses,node_optimizer_schedule,node_distributed,node_parallelize,node_checkpoint toneMint
class node_linear_eval,node_segmentation,node_depth,node_detection,node_text toneRose
class node_hub,node_task_hub,node_researcher toneIndigo
```

## Components

### Data preparation

- [Dataset decoding](https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/datasets/decoders.py): `dinov3/data/datasets/decoders.py`
- [Loaders and transforms](https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/loaders.py): `dinov3/data/loaders.py`
- [Multi-crop augmentation](https://github.com/facebookresearch/dinov3/blob/main/dinov3/data/augmentations.py): `dinov3/data/augmentations.py`

### Model foundations

- [Vision Transformer](https://github.com/facebookresearch/dinov3/blob/main/dinov3/models/vision_transformer.py): `dinov3/models/vision_transformer.py`
- [ConvNeXt](https://github.com/facebookresearch/dinov3/blob/main/dinov3/models/convnext.py): `dinov3/models/convnext.py`
- [Transformer layers](https://github.com/facebookresearch/dinov3/blob/main/dinov3/layers/block.py): `dinov3/layers/block.py`

### Training runtime

- [Training runner](https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/train.py): `dinov3/train/train.py`
- [Configuration](https://github.com/facebookresearch/dinov3/blob/main/dinov3/configs/config.py): `dinov3/configs/config.py`
- [Student-teacher model](https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/ssl_meta_arch.py): `dinov3/train/ssl_meta_arch.py`
- [Distillation losses](https://github.com/facebookresearch/dinov3/blob/main/dinov3/loss/dino_clstoken_loss.py): `dinov3/loss/dino_clstoken_loss.py`
- [Training schedules](https://github.com/facebookresearch/dinov3/blob/main/dinov3/train/cosine_lr_scheduler.py): `dinov3/train/cosine_lr_scheduler.py`
- [Distributed runtime](https://github.com/facebookresearch/dinov3/blob/main/dinov3/distributed/torch_distributed_wrapper.py): `dinov3/distributed/torch_distributed_wrapper.py`
- [FSDP and compile](https://github.com/facebookresearch/dinov3/blob/main/dinov3/fsdp/ac_compile_parallelize.py): `dinov3/fsdp/ac_compile_parallelize.py`
- [Checkpoint storage](https://github.com/facebookresearch/dinov3/blob/main/dinov3/checkpointer/checkpointer.py): `dinov3/checkpointer/checkpointer.py`

### Evaluation and tasks

- [Linear evaluation](https://github.com/facebookresearch/dinov3/blob/main/dinov3/eval/linear.py): `dinov3/eval/linear.py`
- [Segmentation](https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/segmentation): `dinov3/eval/segmentation`
- [Depth estimation](https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/depth): `dinov3/eval/depth`
- [Object detection](https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/detection): `dinov3/eval/detection`
- [Vision-language](https://github.com/facebookresearch/dinov3/tree/main/dinov3/eval/text): `dinov3/eval/text`

### Pretrained model access

- [Backbone loading](https://github.com/facebookresearch/dinov3/blob/main/dinov3/hub/backbones.py): `dinov3/hub/backbones.py`
- [Task adapters](https://github.com/facebookresearch/dinov3/blob/main/dinov3/hub/depthers.py): `dinov3/hub/depthers.py`

### Other components

- **Researcher**

## Connections

- Researcher → Training runner: starts training (evidence: `README.md`)
- Training runner → Configuration: loads config (evidence: `dinov3/train/train.py`)
- Training runner → Loaders and transforms: builds loaders (evidence: `dinov3/train/train.py`)
- Training runner → Student-teacher model: trains model (evidence: `dinov3/train/train.py`)
- Training runner → Distributed runtime: uses runtime (evidence: `dinov3/train/train.py`)
- Training runner → Training schedules: uses schedule (evidence: `dinov3/train/train.py`)
- Training runner → Checkpoint storage: saves state (evidence: `dinov3/train/train.py`)
- Loaders and transforms → Dataset decoding: loads samples
- Loaders and transforms → Multi-crop augmentation: transforms samples
- Student-teacher model → Vision Transformer: builds backbone (evidence: `dinov3/train/ssl_meta_arch.py`)
- Student-teacher model → ConvNeXt: builds backbone
- Student-teacher model → Distillation losses: uses objectives (evidence: `dinov3/train/ssl_meta_arch.py`)
- Student-teacher model → FSDP and compile: configures parallelism (evidence: `dinov3/train/ssl_meta_arch.py`)
- Vision Transformer → Transformer layers: uses blocks (evidence: `dinov3/models/vision_transformer.py`)
- Researcher → Backbone loading: loads pretrained (evidence: `README.md`)
- Backbone loading → Vision Transformer: constructs model (evidence: `dinov3/hub/backbones.py`)
- Backbone loading → ConvNeXt: constructs model (evidence: `dinov3/hub/backbones.py`)
- Backbone loading → Task adapters: loads adapters (evidence: `dinov3/hub/depthers.py`)
- Backbone loading → Linear evaluation: supports probing (evidence: `README.md`)
- Backbone loading → Segmentation: supports evaluation (evidence: `README.md`)
- Backbone loading → Depth estimation: supports evaluation (evidence: `README.md`)
- Backbone loading → Object detection: supports tasks
- Backbone loading → Vision-language: supports tasks
