What DINO saw: ALiBi positional encoding reduces positional bias in Vision Transformers
Organizations: Center for Materials Research, Justus Liebig University, 35392 Giessen · Dyson School of Design Engineering, Imperial College London, London · Finden ltd, Building R71, Rutherford Appleton Laboratory, Harwell Science and Innovation Campus · Department of Materials, Imperial College London, London
Abstract
Vision transformers (ViTs) - especially feature foundation models like DINOv2 - learn rich representations useful for many downstream tasks. However, architectural choices (such as positional encoding) can lead to these models displaying positional biases and artefacts independent of semantic content. This makes zero-shot adaption difficult in fields like material science, where images are often cross-sections of homogeneous microstructure (i.e. having no preferred direction). In this work, we investigate the positional bias in ViTs via linear probing, finding it present across a range of objectives and positional encodings, and subsequently reduce it by finetuning models to use ALiBi relative positional encoding. We demonstrate that these models retain desirable general semantics and their unbiased features can be used successfully in trainable segmentation of complex microscopy images.
Figures & tables
| Model | d | PE | Supervised | |||
|---|---|---|---|---|---|---|
| DINO | S | Learned | 0.57 | 0.53 | 0.53 | |
| B | Learned | 0.64 | 0.59 | 0.54 | ||
| DINOv2 | S | Learned | 0.83 | 0.71 | 0.89 | |
| B | Learned | 0.69 | 0.58 | 0.89 | ||
| DINOv3 | S+ | RoPE | 0.97 | 0.90 | 0.98 | |
| ViT (MAE) | B | Learned | 0.71 | 0.61 | 0.71 |
| Model | d | PE | |||
|---|---|---|---|---|---|
| DINOv2 | S | Learned | 0.83 | 0.71 | 0.89 |
| B | Learned | 0.68 | 0.58 | 0.89 | |
| DINOv2 (CB) | S | Learned | 0.78 | 0.67 | 0.89 |
| DVT | S | Learned | 0.75 | 0.68 | 0.83 |
| ALiBi-Dv2 | S | ALiBI | -0.23 | 0.32 | -0.85 |
| ALiBi-Dv3 | S+ | ALiBI | -0.51 | 0.16 | -0.93 |
| Model | VOC07 | VOC12 | ADE20k |
|---|---|---|---|
| DINOv2 | 0.680 | 0.762 | 0.240 |
| NoPE | 0.689 | 0.757 | 0.235 |
| ALiBi-Dv2 | 0.692 | 0.769 | 0.239 |
| ALiBi-Dv2 | low resolution | high resolution |
|---|---|---|
| image size | (224, 224) | (518, 518) |
| learning rate | 1e-4 | 1e-5 |
| batch size | 256 | 32 |
| num epochs | 15 | 5 |
| optimizer | AdamW ( ) | AdamW ( ) |
| loss | cosine similarity | cosine similarity |
| VOC07 | VOC12 | ADE20K | |
| image size | (518, 518) | (518, 518) | (518, 518) |
| learning rate | 1e-3 | 1e-3 | 1e-3 |
| batch size | 64 | 64 | 32 |
| num epochs | 75 | 50 | 50 |
| samples per epoch | 209 | 1,4k | 1k |
| optimizer | AdamW( ) | AdamW( ) | AdamW( ) |
| Model | none | flip-ud | roll | rot90 |
|---|---|---|---|---|
| DINOv2 | 0.762 | 0.4759 | 0.7601 | 0.456 |
| NoPE | 0.757 | 0.482 | 0.757 | 0.436 |
| ALiBi-Dv2 | 0.769 | 0.499 | 0.769 | 0.445 |