Feed a road photo to DINOv2 and draw its attention map, and you may see something odd. The brightest spots aren’t on the car or the pedestrian. They’re in a blank patch of sky, or an empty stretch of asphalt.
I’ve been working on driving video lately, and I use the spatial feature grid from a video encoder: one feature per small region of the frame, not a single vector for the whole clip. Telling a lane change from a merge depends on where the lanes are, so whether those per-region features are clean matters to me. That’s why I read Vision Transformers Need Registers by Darcet and colleagues at Meta and Inria, one of the ICLR 2024 Outstanding Papers. It explains what those bright spots are, and the fix is surprisingly simple.
A quick refresher on ViTs
A ViT reads an image by cutting it into small squares, say 14×14 pixels each. Each square is a patch, and each patch becomes a vector called a token. There’s also one special CLS token that doesn’t belong to any part of the image; its job is to summarize the whole picture, and it’s what gets used for classification.
All the tokens then go through many transformer layers. In each layer, every token looks at every other token and decides how much to take from each one. That’s attention, and an attention map shows where a given token is looking.
In principle, a patch token should keep describing its own little square: this one is sky, that one is a headlight.
The strange bright spots
The paper traces the bright spots in the picture at the top to an unusual kind of patch token: one with a very large norm, which you can think of as the vector’s volume.
What they found:
- They’re rare. About 2% of all tokens. In DINOv2 ViT-g, 2.37% of tokens have a norm above 150.
- They’re loud. Their norm is about ten times that of a normal token.
- They sit in boring places. Almost always sky, walls or road: patches that look much like their neighbours and carry little new information.
- They need scale and time. They only appear in larger models (from ViT-L up for DINOv2), only after about a third of training, and only from the middle layers on, around layer 15 of the 40-layer ViT-g.
DINOv2, OpenCLIP and DeiT-III all show them. Interestingly, the original DINO doesn’t.
What’s inside them
The authors gave these high-norm tokens a check-up: take one token and see which questions it can still answer.
The left question is “where in the image are you?” Normal patches get it right 41.7% of the time; high-norm patches only 22.8%. Asked to reconstruct their own pixels, they also do clearly worse. They’ve mostly forgotten which bit of sky they used to be.
The right question is “what is the whole image?” Using a single token for linear classification, a high-norm patch reaches 69.0%, higher than a normal patch at 65.8% and not that far from the CLS token, whose whole job this is, at 86.0%.
Put the two together and the story is clear: the model has learned to commandeer useless background patches and use them as temporary memory for global information.
Think of an exam where you need to do some working out but only have the question paper. So you pick a blank-looking spot and scribble there, and that spot happens to have an unimportant illustration printed on it. Perfectly sensible for you; nobody was looking at that picture anyway. But anyone who looks at the picture afterwards sees only your scribbles.
The model does the same. In the middle layers a large model needs to do some global computation, and the sequence has no dedicated place to keep the results. A sky patch is nearly identical to its neighbours, so overwriting it costs almost nothing. It becomes the scratch paper.
Why it matters
For classification this barely matters; the CLS token still works. The trouble is with anything that uses the individual patches:
- Attention maps and feature maps get noisy, and it’s harder to tell what the model is looking at.
- Dense prediction, like segmentation and depth, suffers, because those patches no longer describe themselves.
- Methods that find objects through attention mostly break. LOST, for example, looks for the most object-like region in the attention, and ends up finding the bright spot in the sky.
The fix: hand it some blank paper
If the model needs somewhere to scribble, give it somewhere. Besides the CLS token and the patches, add N learnable register tokens to the input sequence:
- Like CLS, they’re learned parameters that don’t correspond to anything in the image.
- They get no position embedding, since they aren’t anywhere in the image.
- They take part in attention at every layer, so they can be read from and written to.
- At the output they’re simply thrown away and used for nothing downstream.
In code it’s a couple of extra lines:
self.reg = nn.Parameter(torch.zeros(1, N, D)) # N registers, D dims each
x = torch.cat([cls, self.reg.expand(B, -1, -1), patches + pos], dim=1)
x = blocks(x) # all tokens go through the transformer
cls_out, patch_out = x[:, 0], x[:, 1 + N:] # registers are dropped here
With dedicated scratch space, the model stops taking over background patches, and every patch token goes back to describing its own square.
Results
The high-norm artifacts essentially disappear, and the attention maps become smooth and settle on objects. The biggest gains are in tasks that rely on attention maps:
DINOv2’s object-discovery score on VOC2007 goes from 35.3 to 55.4, up 20.1 points, and DeiT-III’s from 11.7 to 27.1. OpenCLIP is the exception: roughly flat, slightly lower.
Classification and dense prediction improve a little, or at least don’t get worse. Here are the results with frozen features and only a linear layer trained:
| Model | ImageNet top-1 | ADE20k segmentation mIoU | NYUd depth RMSE (lower is better) |
|---|---|---|---|
| DINOv2 | 84.3 | 46.6 | 0.378 |
| DINOv2 + registers | 84.8 | 47.9 | 0.366 |
| OpenCLIP | 78.2 | 26.6 | 0.702 |
| OpenCLIP + registers | 78.1 | 26.7 | 0.661 |
| DeiT-III | 84.7 | 38.9 | 0.511 |
| DeiT-III + registers | 84.7 | 39.1 | 0.512 |
How many do you need? In the paper’s words, one register is enough to remove the artifacts, and a few more help downstream performance a little. For dense tasks there seems to be a best number, with the first register bringing most of the benefit; for ImageNet classification, more is slightly better. They used 4 in every experiment.
The cost is negligible. A 224×224 image cut into 14×14 squares gives 256 patches, 257 tokens with CLS. Four registers make the sequence 1.6% longer.
Is this the same as attention sinks in LLMs?
It looks a lot like it. In large language models, a lot of attention piles up on the first few tokens of the sequence, which carry almost no meaning. That’s called an attention sink. The reason is similar: attention in each row has to add up to 1, so when the model doesn’t really want to take information from anywhere, it needs somewhere to dump the excess.
High-norm tokens in ViTs and attention sinks in LLMs look like the same kind of need: a position with no content of its own, where the model can dump attention or keep global information. If you don’t provide one, it finds its own.
A later paper on “massive activations” in LLMs (Sun et al., 2024) looks at ViT registers directly. It finds that registers learn values that hardly depend on the input image, so they act more like fixed biases. That’s not quite the original paper’s reading, that registers gather global information. Which explanation is closer isn’t settled yet, but both agree on the main point: the model needs a spot like this.
Can you do it without retraining?
Registers have one catch: they have to be there during training. You can’t retrain a large model from scratch just to add a few tokens.
Vision Transformers Don’t Need Trained Registers by Jiang, Dravid, Efros and Gandelsman (NeurIPS 2025) offers a way around it. They found that the high-norm tokens are produced by a small set of specific neurons, which they call register neurons. At inference time, you add one extra, untrained token to the sequence and move those neurons’ large activations onto it. The result is comparable to a model actually trained with registers. They call it a test-time register.
What it means for me
If you’re using patch features from a large ViT for segmentation, depth or object discovery, or need a spatial feature grid as I do, it’s worth checking for these artifacts first. DINOv2 already ships both versions; the ones with registers have _reg at the end of the name. This snippet compares the patch-token norms of the two (it needs GitHub access to download the models):
import torch
from PIL import Image
import torchvision.transforms as T
tf = T.Compose([
T.Resize((448, 448)), # sides must be a multiple of 14
T.ToTensor(),
T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
])
x = tf(Image.open("road.jpg").convert("RGB")).unsqueeze(0)
for name in ["dinov2_vitl14", "dinov2_vitl14_reg"]:
model = torch.hub.load("facebookresearch/dinov2", name).eval()
with torch.no_grad():
out = model.forward_features(x)
n_reg = model.num_register_tokens # 0 for the model without registers
patches = out["x_prenorm"][0, 1 + n_reg:] # drop CLS and the registers
norms = patches.norm(dim=-1)
print(f"{name}: median {norms.median():.0f}, max {norms.max():.0f}, "
f"max is {norms.max() / norms.median():.1f}x the median")
If the maximum sits far above the median for the model without registers and not for the one with them, you’re looking at the effect from the paper. Reshape norms back into a 32×32 grid and plot it, and the tall ones will mostly be on the sky and the road.
A model will always find somewhere to scribble. Give it paper, or it writes on the sky.
Useful Resources
- Vision Transformers Need Registers (Darcet, Oquab, Mairal, Bojanowski, ICLR 2024) — the paper this post is about: the artifact analysis, the probing experiments and all the results
- ICLR 2024 Outstanding Paper Awards — it was one of the five award winners that year
- Vision Transformers Don’t Need Trained Registers (Jiang, Dravid, Efros, Gandelsman, NeurIPS 2025) — test-time registers, no retraining
- Efficient Streaming Language Models with Attention Sinks (Xiao et al., 2023) — attention sinks in LLMs
- Massive Activations in Large Language Models (Sun et al., 2024) — connects massive activations in LLMs with ViT registers, and offers the “registers are fixed biases” reading
- Memory Transformer (Burtsev et al., 2020) — the earliest work adding extra memory tokens to a transformer in NLP, cited by the original paper
Comments