Vision encoders: ViT, CLIP and SigLIP

How a vision transformer turns an image into vectors, and how its training signal (captions, other views, pixels) decides what those vectors are good for. Five open encoders run on the topic's running example (Apple M1 Pro, CPU); published results kept apart. A child of Topic: generative-and-multimodal. Data as of October 2026. Reading: 34 min, plus 12 in closed details.

The idea

Every encoder here is the same machine, a vision transformer that cuts an image into patches and turns each patch into a token. What it is trained to put into those tokens (a match to its caption, agreement with another view of the same image, or its missing pixels) decides what the vectors are good for: text search and VLMs, frozen per-patch features, or a starting point for fine-tuning.

Fig. 1 is the page on one card: one backbone, three training signals, two kinds of output. Its numbers are this page's linear probe at 16 labels per class on Fashion-MNIST measured and DINOv2's published dense score published.

  1. An image becomes (R / P)² patch tokens. The root's cat photo at 224 pixels, cut into 14 × 14 patches of 16 pixels: 196 tokens of width 768 (section 1).
  2. Twelve blocks mix them. Every block lets every token attend to every other; nothing about the image's 2-D layout is built in.
  3. Two kinds of output. Read one pooled vector (search, classification) or every patch token (segmentation, depth, a VLM).
  4. Captions. A text tower turns the caption into a vector and the loss pulls the true pair together against the rest of the batch (CLIP, SigLIP 2; section 4). SigLIP 2 probes at 84.0% with 16 labels per class, and only this family has a text tower.
  5. Other views. DINOv2's student network must match a slowly averaged teacher copy that sees another crop of the same image, at the pooled vector and at masked patches: probe 82.6%, and the best published frozen dense features, ADE20K 47.3 mIoU (section 5).
  6. Missing pixels. MAE hides 75% of the patches (the mask drawn here is illustrative), encodes only the visible quarter, and a small decoder redraws the rest: probe only 73.0%, but a strong start for fine-tuning (sections 5 and 6).

You need: what attention and a transformer block do (The transformer from zero), and the idea of a contrastive loss (Contrastive and self-supervised learning owns InfoNCE, DINO's self-distillation and MAE as methods; this page owns them as encoders). How a VLM plugs an encoder into a language model is on Vision-language models; image tokenizers for generation (VQ) are on Autoencoders and VAEs.

New terms

Patch, patch embedding
a P × P square of pixels, and the one shared matrix that turns each into a token of width D.
Position embedding
a vector per grid slot added to each token so the model knows where the patch was.
[CLS], pooling
how many tokens become one image vector: an extra summary token, a learned attention query (MAP), or the mean.
Contrastive loss, temperature
train image and text vectors so true pairs score higher than the other pairs in the batch; the temperature (or its inverse, the scale t) sets how sharp that choice is.
Register
an extra learned token that carries no image content, giving the model scratch space so patch tokens stay clean.
Linear probe, kNN
two tests of frozen features: train only a linear classifier on them, or label by a vote of the nearest labelled vectors.
NaFlex, NaViT
encoders that take each image at its own size and aspect ratio instead of a fixed square.
The five encoders run on this page (reference)

All five are base-size (about 86 million parameters in the image tower), so differences come from how they were trained, not from size. Each image goes through the model's own preprocessor, as anyone using the model would do.

EncoderTrained withPatch, grid at its default inputTokens outOne vector fromPositions
CLIP ViT-B/32captions, softmax contrastive loss (OpenAI, 2021)32 px, 7 × 7 at 22449 + [CLS][CLS], LayerNorm, projection to 512learned table, 50 rows
SigLIP 2 B/16captions, sigmoid loss, plus captioning and self-distillation losses (Google, 2025)16 px, 14 × 14 at 224196, no [CLS]attention-pooling head (MAP)learned table, 196 rows
DINOv2 ViT-B/14images alone, self-distillation plus masked prediction, distilled from a 1.1B teacher (Meta, 2023)14 px, 16 × 16 at 224256 + [CLS][CLS] (its paper also concatenates the mean patch token)learned table for 37 × 37 (518 px), always resized
DINOv2 B/14 with registersas above, plus 4 extra learned tokens (2024 release)14 px, 16 × 16 at 224256 + [CLS] + 4 registers[CLS]as above
MAE ViT-B/16images alone, reconstruct 75% hidden patches (Meta, 2021)16 px, 14 × 14 at 224196 + [CLS]mean of patch tokens (or [CLS])fixed 2-D sine-cosine, not learned

Shapes, accuracies and cosines are properties of the released weights and transfer to any hardware up to float rounding; no timing here is meant to transfer. The papers have their own pages: ViT and CLIP. Repos and revisions: openai/clip-vit-base-patch32 @ 3d74acf, google/siglip2-base-patch16-224 @ 75de2d5 (the root's loaders), facebook/dinov2-base @ f9e44c8, facebook/dinov2-with-registers-base @ a1d738c, facebook/vit-mae-base @ 25b184b (Apache 2.0, Hub API 2026-10-17). Parameters counted from the loaded modules: DINOv2 B 86,580,480 measured. MAE's position table is built by build_2d_sinusoidal_position_embedding and frozen (transformers v5.20.1, models/vit_mae/modeling_vit_mae.py:273); the MAE paper: "the sine-cosine version" (He et al. 2021, appendix A.1).

Measured numbers come from this page and the root's vision recordings (root src/vision/out; Apple M1 Pro CPU, float32, 2026-10-17); published ones are quoted from the paper that states them; derived ones show their formula. The test set is Fashion-MNIST, the topic's running example (grey 28-pixel clothing upscaled to 224, so it measures transfer), plus the root's 16 colour test images with captions.

1. From pixels to tokens

A 224 × 224 colour image is 150,528 numbers; as one token per pixel it would be 50,176 tokens and about 2.5 billion attention scores per head per layer derived: 224² = 50,176; 50,176². The vision transformer (ViT, Dosovitskiy et al. 2020, "An Image is Worth 16x16 Words") groups pixels into square patches instead. Fig. 2 steps through it on a real image; switch the patch size to see the three grids used on this page.

Patch size

  1. The image. 224 × 224 pixels × 3 colours = 150,528 numbers (test image p01 at the model's input). As one token per pixel that would be 50,176 tokens.
  2. Cut into patches. A 7 × 7 grid of 32-pixel patches: N = (224 / P)² = 49 patches. Halve the patch and the token count quadruples.
  3. Flatten each patch. One patch is unrolled into one vector of 3 × P × P = 3,072 numbers (48 of them drawn: 4 × 4 pixels, three colours each).
  4. One shared matrix. Every patch vector is multiplied by the same learned 3,072 × 768 matrix, the patch embedding: each patch becomes a token of width 768. Libraries write it as a convolution with kernel and stride P, the same arithmetic.
  5. Add a position vector. Each grid slot has its own learned vector (a row of the position table, section 2), added to its token so the model knows where the patch was. MAE uses a fixed sine-cosine table instead.
  6. Extra tokens. CLIP and DINOv2 put a learned [CLS] token at the front of the sequence; its final state will be the summary. SigLIP 2 adds none and pools at the end. (DINOv2 with registers adds 4 more tokens that carry no image content, section 3.)
  7. Twelve transformer blocks. Every token attends to every other in every block: 50² = 2,500 attention scores per head per layer for CLIP B/32. Locality is not built in; it is learned.
  8. Read out. For search and classification, pool to one vector of 768: the [CLS] token (CLIP, DINOv2), a learned query that attends over all tokens (MAP, SigLIP 2), or the mean of the patch tokens (MAE). A VLM pools nothing and takes every patch token.

Token colours are illustrative; shapes and counts are the models' own (configs and the loaded modules) measured.

The patch embedding is one matrix. Libraries write it as a 2-D convolution with kernel and stride equal to the patch size, which is the same arithmetic: cutting with unfold and multiplying by the convolution's weights reshaped into a matrix differs from the model's convolution by 0.0 for CLIP and 6.9e-06 for SigLIP 2 measured. Nothing convolutional happens across patches, so unlike a CNN the ViT must learn locality from data, which is why it beat 2020's best CNNs only after pre-training on hundreds of millions of images (ViT page).

What a CNN builds in, and what it costs (depth)

A convolutional network (CNN) slides small filters (3 × 3 pixels, say) over the image, so each layer only mixes neighbours and the same filter is used everywhere. Those two built-in assumptions (nearby pixels belong together; a pattern means the same thing anywhere) are its inductive bias: that inductive bias makes it learn from little data and limits what one layer sees; a stack of L such layers (stride 1) sees a window of only 2L + 1 pixels derived, so real CNNs downsample to see further. A ViT block lets every patch attend to every other from the first layer. From scratch, a CNN’s inductive bias wins on small data; in practice you start from a pretrained encoder of either kind, and pretrained ViTs (CLIP, SigLIP, DINOv2) are the default backbones for VLMs (section 6).

The check, and where pooling lives in the code (depth)

The patch-embedding check (root's src/vision/analyse.py) cuts the root's images into patches with unfold, multiplies by the convolution's own weights reshaped into a matrix, and compares with the model's convolution: CLIP's is a 768 × 3,072 matrix, no bias, 2,359,296 parameters (difference 0.0); SigLIP 2's is 768 × 768 plus a bias, 590,592 parameters (6.9e-06, float32 rounding) measured.

Pooling in transformers v5.20.1: CLIP takes pooled_output = last_hidden_state[:, 0, :] (models/clip/modeling_clip.py:641), applies a LayerNorm, then visual_projection (:941) into the space shared with text. SigLIP's head is SiglipMultiheadAttentionPoolingHead (models/siglip/modeling_siglip.py:622), a learned query self.probe that attends once over all patch tokens, then an MLP. LLaVA-1.5 drops the [CLS] token with selected_image_feature[:, 1:] (models/llava/modeling_llava.py:166-168). MAE's [CLS] is "an auxiliary dummy token" and its paper says MAE "works similarly well without this token (with average pooling)" (He et al. 2021, appendix A.1); DINOv2's own linear evaluation concatenates [CLS] and the mean.

What a token costs

Fine detail (small text, thin lines, many small objects) needs more pixels per object, and every extra patch is another token every block must process. An R × R image in P × P patches gives N = (R / P)² tokens. Each block then does four D × D projections per token (queries, keys, values, output), two N × N products for attention (scores, then the weighted sum), and two MLP matrices of D × F per token:

MACs per image ≈ 3P²·D·N + L · ( 4ND² + 2N²D + 2NDF )
N
tokens: (R/P)² patches plus any [CLS] or register tokens
D, F, L
width, MLP hidden width, number of blocks (768, 3,072, 12 for every base model here)
MACs
multiply-accumulates; FLOPs are about twice as many
Predict: a ViT-B/16 goes from 224 × 224 to 448 × 448 pixels. How much more compute per image?

Only the 2N²D term grows with the square of the token count, and at 224 pixels it is small: 4% of a ViT-B/16 and 23% of DINOv2 B/14 at its 518-pixel training size derived. Most of the cost is linear in tokens, so token count is the number to watch; quadratic attention dominates only at thousands of tokens, which is why high-resolution VLM encoders use windowed attention. The Tokens and cost tab computes the split for any configuration.

Counting FLOPs: one formula, a FLOP counter and two published cards that disagree (depth)

The formula agrees exactly with PyTorch's FLOP counter (torch.utils.flop_counter.FlopCounterMode) on transformers models built from the configs, but only when attention runs as plain matrix multiplies: with PyTorch's fused attention kernel (scaled_dot_product_attention, the default) the counter silently skips the 2N²D term measured, so a counted ViT-B/16 comes out at 16.85 GMACs instead of 17.56, and DINOv2 B/14 at 518 at 117.0 instead of 151.6. Published counts disagree for the same reason: the timm model card for ViT-B/16 at 224 says 16.9 GMACs, which matches the count without attention scores (16.85; with them, 17.56); the card for DINOv2 B/14 at 518 says 151.7, which matches the count with them (151.57; without, 116.98) derived. Two cards from one library, two accountings: state whether the N² terms are in.

From many tokens to one vector: pooling

Search and classification want one vector per image (the stepper's last step shows the three ways):

  • [CLS] token. A learned extra token joins the sequence and its final state is the summary; CLIP then applies a LayerNorm and a projection into the space shared with text.
  • Attention pooling (MAP). SigLIP has no [CLS]; a learned query vector attends over all patch tokens once, followed by an MLP. The root's vision runs found that this head puts 30 to 45% of its weight on the same four slots in every image (section 3 explains why).
  • Mean of patch tokens. Order-free and parameter-free. The choice matters: MAE's final [CLS] probes at 86.4% on Fashion-MNIST and its mean patch token at 80.6% (500 labels per class) measured, while for DINOv2 they are within half a point; and MAE's mean taken before the final LayerNorm probes at 85.2% with only 200 labels per class (section 6), against 80.6% after it. Which readout to use is an empirical question, per model and task.

A vision-language model (VLM) pools nothing: it passes every patch token, usually from the second-to-last block (LLaVA-1.5's config says "vision_feature_layer": -2), to the language model.

A trap: transformers' MAE shuffles its patch tokens even with no masking
ViTMAEModel always draws a random patch shuffle, even with mask_ratio=0: on one test image only 3 of 196 patches stayed in place and patch 0's output had cosine 0.26 with the unshuffled run, while the mean over patches was identical (1.000000) measured. Pooled features are fine; per-patch maps are scrambled. Pass noise=torch.arange(L) (or use ids_restore) to keep the order; src/runs/mae_shuffle.py.
Trusting attention maps as explanations
From the old root Vision lab: an attention map shows where one layer's weights go, averaged over heads. Earlier layers have already mixed information across all tokens, so a patch with low weight can still decide the answer.

2. Positions, and what happens when the resolution changes

Attention is permutation-invariant: without positions the model sees a bag of patches. A learned position table has one row per grid slot of the training resolution. CLIP B/32 has 49 rows for its 7 × 7 grid; give it a 336-pixel image (10 × 10 = 100 patches) and there are no rows for the extra slots. Both libraries refuse, with these exact errors measured:

CLIP ViT-B/32, 336 x 336 input:
ValueError: Input image size (336*336) doesn't match model (224*224).

SigLIP 2 B/16, 336 x 336 input:
RuntimeError: The size of tensor a (441) must match the size of tensor b (196) at non-singleton dimension 1

Pass interpolate_pos_encoding=True and transformers reshapes the table into its 2-D grid, resizes it bicubically to the new grid and flattens it back (interpolate_pos_encoding, models/clip/modeling_clip.py:161, mode="bicubic" at :194; the same code in SigLIP at modeling_siglip.py:137 and DINOv2 at modeling_dinov2.py:87). Fig. 3 steps through it on CLIP's real table.

Slot

  1. The trained grid. At 224 pixels CLIP B/32 cuts the image into 7 × 7 patches of 32 pixels, and its learned table has one position vector per slot (49, plus one for [CLS]). The columns are how similar the chosen slot's vector is to every slot's. Nobody told the model the grid is 2-D, yet the pattern is: slots close by, and slots on the same border, have similar vectors (try the centre slot).
  2. A bigger image, no rows for it. At 448 pixels the same patches make a 14 × 14 grid: 196 slots, but the table still has 49 rows. Without interpolation the model refuses (the errors above).
  3. Resize the table like an image. interpolate_pos_encoding reshapes the 49 vectors into a 7 × 7 × 768 grid and resizes it bicubically to 14 × 14: the columns grow from the old grid's values, each copied over a 2 × 2 block, to the model's own resized table. Every new vector is a smooth blend of its trained neighbours.
  4. The resized table. The similarity pattern survives, stretched over four times as many slots, but none of these 196 vectors was ever trained: the model now runs at 448 on positions it has never seen.
  5. What it costs. Four times the tokens (49 to 196) and about four times the compute by the formula of section 1 (4.41 to 17.91 GMACs); on the 16 test images the image embedding moves to an average cosine of 0.91 with its own 224-pixel version (as low as 0.76).

Heights: cosine similarity of the chosen slot's position vector to every slot's, from the released table (224) and from the model's own bicubic resize (448) measured; the image is test image p01 at the model's input size.

The cost. It runs, on positions the network never trained on. On the 16 colour test images, CLIP's image embedding at 448 pixels keeps a cosine of only 0.91 on average (as low as 0.76) with the same image at 224; SigLIP 2's keeps 0.94. Caption matching did not change on these easy pairs (CLIP still 15 of 16, SigLIP 2 still 16 of 16) measured. The published fix is to train briefly at the new size, as SigLIP 2 did for its fixed-resolution checkpoints (resumed at 95% of training with the table resized, Tschannen et al. 2025, §2.4.1) published.

Designs that avoid the table. MAE's fixed sine-cosine table can be computed for any grid. FlexiViT randomises the patch size during training so one set of weights works "across a wide range of patch sizes" (Beyer et al. 2022). NaViT packs several images of different sizes and aspect ratios into one sequence and trains on "inputs of arbitrary resolutions and aspect ratios" (Dehghani et al. 2023); SigLIP 2's NaFlex variant combines the two, resizing each image so both sides are multiples of the patch size with the aspect ratio kept as closely as possible within a token budget (256 by default). 2-D RoPE (rotary position embedding along rows and columns, Positional encodings) puts position into the attention product instead of a table, so any grid works: Qwen2.5-VL's encoder uses it (Qwen2.5-VL report, §2.1.1), and DINOv3 replaced DINOv2's learnable table with RoPE (DINOv3, Table 2).

What the processor does to a real image decides both what the encoder sees and how many tokens it costs. Type a size and compare the four rules (the last two ported line by line from transformers v5.20.1: models/siglip2/image_processing_siglip2.py:42 get_image_size_for_max_num_patches; models/qwen2_vl/image_processing_qwen2_vl.py:63 smart_resize, used by Qwen2.5-VL with min_pixels 3,136 and max_pixels 12,845,056 from its preprocessor_config.json):

A 1920 × 1080 frame: CLIP crops 44% away, a fixed square squashes it, NaFlex and Qwen keep its shape

Drawn to scale: the original (grey outline) and what each rule feeds the encoder derived. A 1920 × 1080 frame loses 44% of its area to CLIP's crop; SigLIP 2's fixed processor distorts its aspect by 78%; Qwen2.5-VL rounds to multiples of 28 and merges each 2 × 2 group of 14-pixel patches into one language-model token. Normalisation constants differ too (CLIP's ImageNet-like mean and standard deviation, SigLIP's 0.5 and 0.5).

3. High-norm tokens and registers

Large ViTs learn to dump global information into a few patch tokens in uninformative background areas. Darcet et al. (2023) found these "tokens with roughly 10x higher norm at the output", "around 2%" of the sequence, holding "less information about their original position in the image or the original pixels in their patch" published. They spoil attention maps and dense features. The fix: append a few learned register tokens that carry no image content, so the model has somewhere else to compute; "one register is sufficient to remove artefacts", and they kept 4.

Where the paper found them, and what registers bought (depth)

In DINOv2 the outliers "appear with models larger than and including ViT-Large", and after a third of training. They are not specific to DINOv2: the label-trained DeiT-III B and the caption-trained OpenCLIP ViT-B/16 the authors trained also had outliers, and registers removed them in all three (their Fig. 7). With registers, their DINOv2 ViT-L (ImageNet-22k) rose in linear ADE20K segmentation from 46.6 to 47.9 mIoU and on ImageNet from 84.3% to 84.8% (their Table 2a) published. So the paper's ViT-Large threshold is about DINOv2; a base-size caption-trained model having outliers (below) fits it.

Predict: which of the five base-size encoders here shows high-norm outlier tokens on the 16 test images?

Image

  1. SigLIP 2, one image. Each column is one patch token's L2 norm in the last block's output (before any final LayerNorm), divided by that image's median. Three slots tower over the rest, in the top row and near the right edge, in background, not on the object.
  2. SigLIP 2, all 16 images. The mean over the 16 test images keeps the same three towers: the slots are fixed by the model, not found in the picture.
  3. DINOv2 B. Milder outliers, and not in fixed slots: on the cat, one at row 2, column 2.
  4. DINOv2 B with registers. The patch tokens are flat (at most 1.4 times the median here), and two of the four register tokens carry about twice the median norm: the global computation has somewhere else to go. (This is a separately released checkpoint, so it is a comparison of two models, not of one model with and without registers.)

Registers and [CLS] are not part of the grid; one height scale for every step measured.

What it shows measured. In SigLIP 2 B/16 the same three grid slots stand out in all 16 images, wherever the object is: row 0 column 13 at 15 to 23 times the median patch norm, row 3 column 13 at 11 to 13 times and row 0 column 1 at about 4 times (a fourth, row 0 column 11, joins them in the five flat synthetic images): three bright fixed slots in every image. Two of them, (0, 1) and (3, 13), are among the four slots where SigLIP 2's attention-pooling head puts 30 to 45% of its weight: the pooled vector reads from the outliers. DINOv2 B has milder ones (up to 4.7 times the median) in 8 of the 16 images, at varying places; DINOv2 B with registers, CLIP B/32 and MAE B have none (at most 1.5 times). Look at token norms before building dense features on a model, and prefer a registers variant where one exists.

4. Training on captions: the contrastive loss

There are hundreds of millions of image-caption pairs on the web and no labels saying how similar any two are. Contrastive training uses the pairing itself as the label: in a batch of N pairs, each image's own caption is the positive and the other N − 1 captions are negatives. Two towers (a ViT for images, a transformer for text) each end in a vector scaled to length 1, so their dot product is the cosine similarity.

A real batch. The root's 16 colour test images against their 16 captions: through CLIP B/32 the matching pairs average a cosine of 0.333 and the other pairs 0.166; it puts the right caption first for 15 of 16 images (its miss is the typographic image s04, section 6). SigLIP 2 gets all 16, after its text is lowercased as its reference code does; its cosines average 0.194 and −0.019 measured. Cosines that small still make a confident choice because each is multiplied by a learned scale t (the inverse of the temperature) before the softmax: CLIP's released B/32 sits at t = 100.0, so a gap of 0.05 in cosine becomes a factor of e5 ≈ 150 in probability.

Predict first: as the scale t goes to 0, what does CLIP's softmax loss on a batch of N tend to? And as t grows very large?
  1. The batch. The first 8 test images (rows) and their 8 captions (columns, T1 to T8). Each tower turns its input into a vector scaled to length 1, so every image-caption dot product is a cosine.
  2. All 64 cosines. Through CLIP B/32 the 8 true pairs (the diagonal, lit) average 0.327 and the 56 others 0.168: small numbers, and a narrow gap.
  3. Softmax over each row. CLIP multiplies the cosines by t = 100 and asks each image to pick its caption: each row becomes probabilities that sum to 1. Seven rows put almost all their weight on the diagonal; row 8, the typographic image s04, gives 36% to its own caption and 63% to the cat's (the red column).
  4. And over each column. Each caption must also pick its image. CLIP's loss is the mean of the row and column cross-entropies: 0.071 on these 8 pairs, against ln 8 = 2.079 at t = 0, where every row is uniform.
  5. SigLIP 2's cosines. SigLIP 2 B/16 on the same batch: true pairs 0.198, others −0.018 (the negative ones hang below the plate). Its cosines are smaller still, but every row is right.
  6. A sigmoid per cell. SigLIP scales by its learned t = 112.67, adds its learned bias b = −16.77 and asks every cell its own yes-or-no question: the diagonal rises to 0.77 to 1.00, every other cell sinks to almost 0 (the worst, 0.34, is in row 8 again). No row or column is normalised, so no device needs the whole batch. Loss 0.129.
CLIP: ℓ = ½ [ CErows(t · S) + CEcolumns(t · S) ]
SigLIP: ℓ = −(1/N) Σi,j log σ( zij (t · Sij + b) )
S
the N × N matrix of cosines, images in rows, captions in columns; the diagonal holds the true pairs
CE
cross-entropy of a softmax with the diagonal as the right answer: each image must pick its caption out of the row, each caption its image out of the column (the InfoNCE loss)
t, b
learned scale and (SigLIP only) bias; SigLIP learns t′ = log t and initialises t′ and b "to log 10 and −10 respectively", so training starts from the prior that almost every pair is a mismatch (Zhai et al. 2023, §3.2)
zij
+1 on the diagonal, −1 elsewhere: every cell is a separate yes-or-no question
σ
the logistic sigmoid 1 / (1 + e−x)

Try it. The widget evaluates both losses on the same real matrix for any batch size and scale: the softmax view shows how CLIP's loss depends on t, the sigmoid view each cell on its own.

CLIP's t = 100.0 is exactly where its paper clipped the scale; SigLIP 2 learned t = 112.67 with b = −16.77 read from the weights in float32. Because SigLIP's logits carry a bias they are calibrated per pair (a sigmoid gives a yes-or-no probability); CLIP's are calibrated only relative to the other candidates.

Comparing raw cosines across models
Raw cosines do not compare across models: CLIP’s matching pairs sit around 0.3 and SigLIP 2’s around 0.1 to 0.2 (the real batch above: 0.333 against 0.194 measured), and neither number means “30% similar”. Only the order within one model is meaningful, so thresholds for retrieval or filtering must be calibrated per model.
Setting the temperature by hand
Too high a temperature (small scale) leaves the loss near ln N with weak gradients; too low lets only the hardest negatives matter and destabilises training (CLIP clipped its scale at 100, CLIP paper §2.5). The predict question above shows both limits on the real matrix.
The two losses in code (depth)

In transformers 5.20.1: CLIP's contrastive_loss is a cross-entropy against torch.arange(len(logits)) (models/clip/modeling_clip.py:47), applied to the logits and their transpose and averaged; SigLIP's logits are logits_per_text * logit_scale.exp() + logit_bias (models/siglip/modeling_siglip.py:805) and the loss is logsigmoid(m1_diag1 * logits_per_text) summed over each row and averaged (:814). CLIP's scale started at 1 / 0.07 and was clipped at 100 (CLIP paper §2.5); the released B/32 sits exactly at that clip, and SigLIP 2 learned t = 112.67 with b = −16.77 read from the weights in float32. A sigmoid of 100 × cosine is near 1 for every CLIP pair, so applying one model's rule to the other's logits is meaningless.

The loss on the real matrix: softmax asks each row to choose, sigmoid asks every cell yes or no

Left: first N images (rows) against first N captions (columns), each cell's probability under the chosen loss, diagonal outlined. Right: the loss at every scale, the dot at the current one. Real cosines from the root's vision recordings measured. Sigmoid bias: SigLIP 2's learned −16.77, or SigLIP's initial −10 for CLIP (illustrative).

Batch size, and why the sigmoid scales

The softmax learns only from the negatives in the batch, and its chance level ln N grows with it: CLIP's batch of 32,768 asked each image to pick 1 caption out of 32,768 (CLIP page), and hard negatives (two cats, two similar captions) only show up in large batches. Split over D devices, the softmax normalises each row and column over the whole batch, so every device needs every other device's embeddings (an all-gather). The sigmoid scores each cell alone, so SigLIP's "chunked" implementation keeps each device's images in place and passes text embeddings round the devices in D steps: "the memory cost at any given moment is reduced from |B|2 to b2", with b = |B| / D (SigLIP §3.3).

What the paper measured published: with locked image features (SigLiT), "when the batch size is smaller than 16 k, sigmoid loss outperforms softmax loss by a large margin", but "performance for both sigmoid and softmax saturate at around 32 k batch size" (they went up to one million), and for SigLIP proper "a very large batch size hurts both losses" (§4.1, Figure 2). With four TPUv4 chips a SigLiT model reached 84.5% ImageNet zero-shot in two days. So the sigmoid buys cost and small-batch quality, not a higher ceiling.

What the widget can and cannot say; where to train a toy (depth)

Not run here: training either loss at scale. The widget evaluates both losses on released embeddings, and each model was trained with its own rule, so a loss computed with the other rule says nothing about how that model would have trained. "D collective permutes is typically faster than two all-gathers" (SigLIP §3.3). A toy CLIP trained from scratch, with softmax against sigmoid on a toy batch, is on the CLIP page; InfoNCE on a real text batch and the temperature's effect on hard negatives are on Contrastive and self-supervised learning.

Before and after: the softmax needs every embedding on every device, the chunked sigmoid passes one block at a time

Drawn for D = 4 devices. Numbers for a global batch |B| = 32,768 on D = 256 (b = 128 per device), float32 logits: the full matrix is 4.3 GB; one device's rows b × |B| are 16.8 MB; one chunk b × b is 65.5 kB derived from SigLIP §3.3.

Why the data is the model

CLIP chose the contrastive loss for efficiency (it learned ImageNet-recognisable features 4 times faster than predicting the caption's bag of words, CLIP Figure 2), but almost every gain since 2021 came with a new dataset rather than a new loss. At fixed compute, curation moved accuracy by several points: MetaCLIP's ViT-B/32 goes from 57.4% on raw English pairs to 65.5% with its metadata balancing, and DataComp's best filter adds 6.9 points over its unfiltered pool published.

Six datasets and how each was chosen (reference)
DatasetSizeHow it was chosenWhat the paper reports
WIT (CLIP)400M pairstext must contain one of "500,000 queries", with "up to 20,000 (image, text) pairs per query" (not released; quoted by MetaCLIP)best model 76.2% ImageNet zero-shot (CLIP page)
ALIGN1.8B pairsraw alt-text with "only minimal frequency-based filtering", trading "quality for scale"scale compensates for noise (Jia et al. 2021)
LAION-5B5.85B pairsCommon Crawl pairs kept if OpenAI CLIP ViT-B/32 cosine ≥ 0.28 (English) or ≥ 0.26 (other languages); "removed around 90% of the original 50 billion images"open reproductions of CLIP (Schuhmann et al. 2022, §3.1)
DataComp12.8B candidatesa benchmark for filters: fixed training, vary only the data; best baseline keeps the intersection of a CLIP-score filter (top 30% by a ViT-L/14) and an image-based filter, 1.4B pairsbest filter +6.9 points ImageNet over the unfiltered pool; DataComp-1B trains a ViT-L/14 to 79.2%, "outperforming OpenAI's CLIP ViT-L/14 by 3.7 percentage points" at equal compute (Gadre et al. 2023)
MetaCLIP400M (also 2.5B)reconstructs that recipe in the open: 500k metadata entries (WordNet synsets, Wikipedia words and titles), substring matching, then caps each entry at 20k pairs so rare concepts are not drownedViT-B/32 at fixed steps: raw English 57.4%, curated without balance 60.8%, balanced 65.5%, against WIT 63.4% and LAION-400M 60.0% (Xu et al. 2023, Fig. 1)
WebLI (SigLIP 2)10B images, 12B alt-texts, 109 languages90% English mix; the base models then distilled from a bigger teacher with "active data curation" (picking the most useful examples online)SigLIP 2 B/16 at 224: 78.2% ImageNet zero-shot against CLIP B/16's 68.3% (Tschannen et al. 2025, §2.1, Table 1)

All rows are published by the dataset's authors published; ImageNet accuracies are zero-shot top-1 on the validation set, read from each paper's own text or table on 2026-10-17.

LAION's CLIP-score filter, on the running example. LAION used OpenAI's CLIP ViT-B/32, the very model run here, so its rule can be applied to the real 16 × 16 matrix. Move the threshold.

At 0.28 all 16 true pairs pass and 1 of the 240 wrong pairs passes too measured: good captions of simple images score only about 0.28 to 0.38, and the typographic image s04 (0.284) barely survives. A filter built from one model passes that model's blind spots into the next model's data; LAION's authors note that a small CLIP "may leave more image-text pairs with weak or no semantic connection" (§3.1).

The 0.28 threshold sits just under real matches

Dots: the 16 true pairs (top row) and the 240 mismatched image-caption pairs (bottom row), CLIP ViT-B/32 cosines measured; the line is the threshold.

SigLIP 2 keeps the sigmoid loss and adds a caption decoder that reads the un-pooled patch tokens, then, for the last 20% of training, self-distillation and masked prediction "to improve the local semantics of the (un-pooled) feature representation" (§2.2, 2.3): its patch tokens become much better for dense tasks, ADE20K linear segmentation rising from 37.6 (SigLIP So/14, 224) to 41.8 mIoU (its Table 2) published.

Locking a tower: LiT (depth)

Contrastive training does not have to start from scratch. LiT (locked-image tuning) freezes a pre-trained image model and trains only a text tower to read it, and found "locked pre-trained image models with unlocked text models work best"; with a ViT-g/14 image tower it reached 85.2% ImageNet zero-shot (Zhai et al. 2021) published. SigLIP's 84.5% in two days is a LiT-style run. SigLIP 2's caption decoder comes from LocCa.

5. Training without captions: labels, pixels, other views

Labels, the original recipe (ImageNet-21k, Google's private JFT-300M), teach only the distinctions their 1,000 or 21,000 classes ask for, and labels are expensive; captions and self-supervision both remove the labeller.

DeiT: a ViT on ImageNet alone (depth)

DeiT showed the ViT's data requirement was partly a recipe problem: "competitive convolution-free transformers by training on Imagenet only", 83.1% top-1 for an 86M model with a distillation token that learns from a CNN teacher, "on a single computer in less than 3 days" (Touvron et al. 2020) published.

Images alone. How the methods work (with MAE's real reconstructions and the collapse problem) is on Contrastive and self-supervised learning. In one line each: MAE hides 75% of the patches and trains the encoder plus a small decoder to redraw the missing pixels; DINO trains a student network so that its output for one crop matches a slowly averaged teacher copy's output for another crop, and DINOv2 adds a masked-patch version of the same loss (iBOT) that is applied to every patch token (both are drawn in Fig. 1, steps 5 and 6). As encoders they differ like this:

  • MAE's features are not linearly separable. Its paper: "the MAE representations are less linearly separable, they are stronger non-linear features" and do well "when a non-linear head is tuned"; ViT-B linear probe 68.0% on ImageNet against 83.6% fine-tuned (He et al. 2021, §4.3, Tables 3 and 12) published. MAE is a starting point for fine-tuning, not a frozen feature extractor.
  • DINOv2 was built to be used frozen. A 1.1B ViT-g trained on LVD-142M, 142 million images chosen by retrieval "close to those in several curated datasets" from an uncurated pool, then distilled into S, B and L; "the linear probe performance is lower-bounded by the k-NN performance" in their experience. Its Table 4 (frozen features, ImageNet-1k): DINOv2 B/14 82.1% kNN and 84.5% linear, against MAE ViT-H/14 49.4% kNN and 76.6% linear, and OpenAI CLIP ViT-L/14 79.8% and 84.3% (Oquab et al. 2023) published.

DINOv3 (2025) scaled the recipe to a 6.7B-parameter ViT-7B and added Gram anchoring to stop dense features degrading in long training; its weights are under Meta's own licence, so it is not run here.

DINOv3 in detail (depth)

DINOv3 scaled it again. A 6.7B-parameter ViT-7B with patch 16, RoPE and 4 registers, trained on LVD-1689M (1,689 million curated images), with a new Gram anchoring loss that fixes "the known yet unsolved issue of dense feature maps degrading during long training schedules" by keeping the patch-to-patch similarity matrix close to that of an earlier checkpoint (Siméoni et al. 2025, §3 to 4, Table 2) published. Its weights are gated under Meta's own DINOv3 licence, so it is not run here (DINOv2 is Apache 2.0).

6. What each encoder is good and bad at, on the same images

An encoder is used in one of four ways: its pooled vector for classification and search (global features), its per-patch tokens for segmentation, depth or matching (dense features), its text tower for zero-shot work (text), or all its patch tokens as the eyes of a VLM (backbone). Each training signal favours some of these.

Global features: a linear probe, nearest neighbours, search

A linear probe trains only a linear classifier on frozen features (the settings and random draws of the root's zero-shot study); kNN labels each test image by a vote of its 20 most similar labelled images (DINO's weighted protocol); image-to-image search asks whether a query's nearest neighbours share its class. A probe can rescale and rotate the features; kNN and search take the geometry as it is.

Predict: which encoder's frozen vectors are worst for nearest-neighbour search on Fashion-MNIST?

What it shows measured. SigLIP 2 and DINOv2 tie at the top with 500 labels per class (89.3% and 89.3% for DINOv2's [CLS] plus mean), CLIP B/32 is about a point and a half lower (87.8%), MAE lowest. With few labels SigLIP 2 leads (84.0% at 16 per class, DINOv2 82.6%, CLIP 79.0%). Differences under a point are not a ranking (one dataset, one resolution, one seed). With enough in-domain labels a small specialised model still wins: the root's 550,890-parameter CNN trained from scratch on all 55,000 training images reaches 92.98%; an encoder's value is needing few or no labels. Every score is in Encoder comparison; the searches in Retrieval.

SigLIP 2 and DINOv2 lead; MAE's frozen geometry is the weakest

Which layer holds the answer

Predict: for CLIP B/32, which block's patch tokens give the best linear probe?

measured Every encoder peaks before its last block (CLIP at block 8, SigLIP 2 at 10, DINOv2 at 10, MAE at 9), by 0.4 to 1.1 points, and the pooled output is lower still (CLIP 85.4%, SigLIP 2 87.4%, DINOv2 87.6%, MAE 85.4%): the last layers specialise for the training objective. Meta's Perception Encoder paper finds the same at scale, contrastive training's best embeddings "are hidden within the intermediate layers of the network" (Bolya et al. 2025) published; it is why LLaVA reads the second-to-last block. Try a few layers rather than one: the curves are noisy (DINOv2 and MAE dip at block 3).

Block 0 differs widely between encoders (depth)

Block 0 (the patch embedding plus positions): CLIP's already probes at 55.2%, DINOv2's at 31.9%, SigLIP 2's at 20.3% and MAE's at 14.4%, because in SigLIP 2 and MAE the position vectors dominate the first tokens (the dense-feature stepper below shows SigLIP 2's block-0 map as a smooth position gradient) measured. Contrastive training "can produce strong, general embeddings", in Perception Encoder's words, but not at the output.

Every encoder peaks before its last block, and its pooled output is lower still

Linear probe on each block's mean patch token: trained on 200 validation images per class, tested on the first 500 test images per class (5,000); CPU float32 measured. Script src/runs/layerwise.py.

DINOv2's colours follow object parts; SigLIP 2's last block turns noisy; MAE stays close to the pixels

Real tokens from the released models on the root's colour test images (CC0, public-domain and SD 1.5 outputs), CPU float32 measured; components computed per image and block without high-norm outlier tokens, signs aligned between blocks. The Encoder comparison tab adds DINOv2 with registers, token norms, [CLS] attention and a click-a-patch similarity view. Script src/runs/dense.py.

Dense features: the same image through four encoders

Segmentation, depth and matching need a good vector at every patch. Nothing in a contrastive loss asks for that: only the pooled vector is compared with text. Self-distillation with masked patches (DINOv2's iBOT term) does. To see it, take one block's patch tokens, find their three main directions of variation (principal components) and paint each patch with its three coordinates as red, green and blue: patches with similar vectors get similar colours.

  1. Block 0, the patch embedding plus positions. SigLIP 2's map is a smooth gradient across the grid: its position vectors dominate the tokens here (its block-0 probe reaches only about 20%, chart above). DINOv2's follows pixel content patch by patch; MAE's already looks like a blurred copy of the picture.
  2. Block 2. The layout of the picture appears in every model; colours still follow brightness and colour more than meaning.
  3. Block 4. Regions of similar texture share a colour; in SigLIP 2 and DINOv2 the object starts to separate from the background.
  4. Block 6. DINOv2 and SigLIP 2 separate the object cleanly; DINOv2 starts to colour its parts (on the cat: eyes, nose and fur get different colours).
  5. Block 8. DINOv2 colours object parts consistently (eyes, nose, fur; the puppy against the grass). In SigLIP 2 single saturated patches can appear near the corners: its high-norm tokens (section 3), left out of the fit but still drawn.
  6. Block 10. SigLIP 2's background turns speckled while the object stays; its patch tokens are being reshaped for the pooled output. DINOv2's map stays clean. MAE's stays smooth and close to the picture's own colours and edges, the mark of a pixel-reconstruction objective.
  7. Block 12, the last: what a dense head or a VLM projector reads by default. DINOv2 gives the cleanest part map, as its dense-probe scores predict; SigLIP 2's map is noisy, the object only faintly visible on some images; CLIP's 7 × 7 grid is too coarse to show shape at all.

Published, at scale. With a linear layer on frozen patch tokens, ADE20K semantic segmentation (150 classes) reaches 47.3 mIoU for DINOv2 B/14, 39.3 for OpenCLIP ViT-G/14 and 33.3 for MAE ViT-H/14 (DINOv2 Table 10); SigLIP 2's extra losses lift a caption-trained encoder to 41.8 (section 4) published. Dense quality is where self-supervised encoders still lead.

What a caption-trained embedding misses

A contrastive embedding keeps whatever helps pick the right caption out of a batch. Web captions name objects and often repeat the text in the picture; they rarely state counts, left and right, or which attribute goes with which object. So the embedding is strong on "what is it" and "what does it say", weak on structure, partly a bag of words (Yuksekgonul et al. 2022). OpenAI called the first failure a typographic attack, needing "no more technology than pen and paper" (OpenAI, March 2021, archived).

What it shows measured. CLIP B/32 flips from cat to the written word for DOG (cosine 0.2855 for dog against 0.2775 for cat) and for BIRD (0.2837 against 0.2659), whether the DOG sticker is small or large; it resists CAR, narrowly (cat 0.2890, car 0.2827). The CAT sticker raises CLIP’s cat score (0.2926 against 0.2846 plain): the written word adds to the image’s meaning in the same direction as the object. SigLIP 2 never flips, but the sticker still moves it: "dog" rises from 0.0684 to 0.1112 with the DOG sticker while "cat" stays near 0.13. Both models read text; SigLIP 2's image of the cat is strong enough to win.

The same cat before and after a sticker: CLIP reads the word, SigLIP 2 still sees the cat

Images: the scikit-image cat photo (CC0) with a white label drawn by the root's src/vision/make_probes.py. Bars: cosine of each image with "a photo of a cat / dog / bird / car"; the winner of each image is bold measured.

Minimal pairCLIP B/32SigLIP 2 B/16
Counting: 1 to 6 red circles
1 red circles2 red circles3 red circles4 red circles5 red circles6 red circles
3 of 6 right (one, three, six); two is called "three", four and five "six"; margins 0.001 to 0.008 in cosine4 of 6 (one to three, and six); four is called "five", five "six"; margins 0.02 to 0.03 on the small counts
Left and right: a scene and its mirror image
green triangle left, orange circle rightthe mirror image
the same sentence for both, so right once by construction: a coin toss, margins of a few thousandthsthe same
Binding: red circle and blue square, colours swapped
red circle and blue squareblue circle and red square
both wrongthe same sentence for both

Synthetic probes from the root's make_probes.py, cosines from the released models measured; six probes are a hint, not an accuracy. Larger sets of such minimal pairs (Winoground, ARO, SugarCrepe) found the same for many CLIP-like models.

To check a model: build minimal pairs like these and see whether the score moves the right way, and by more than a few thousandths. The fix is rarely a better prompt: it is training data with hard negatives (captions with swapped words), a VLM that reads the image tokens with a language model, or both.

Image search returns cat photos for "dog" when the photos contain the word DOG
From the old root Vision lab: the typographic attack at work. Measure it with minimal pairs like the stickers above; mitigate with an OCR step that detects text in the image, models trained with such hard negatives, or re-ranking with a VLM.

As the eyes of a vision-language model

A VLM maps an encoder's patch tokens into the language model with a small projector (the Vision-language models page owns how). Contrastive encoders (CLIP, then SigLIP) won this role because their patch tokens already line up with language; DINO-style features carry more spatial detail but no link to words. Qwen2.5-VL shows the other route: train the encoder inside the VLM at native resolution, with windowed attention.

The encoders inside four VLMs, from their configs (reference)
VLMVision encoderWhich tokensTokens per image
LLaVA-1.5CLIP ViT-L/14 at 336 (contrastive)second-to-last block, [CLS] dropped (config vision_feature_layer -2)576 = (336/14)² derived
PaliGemmaSigLIP So400m/14 (sigmoid contrastive)all patch tokens through a "(zero initialized) linear projection" (Beyer et al. 2024, §3.1)256 at 224 px derived
SmolVLM-500MSigLIP B/16 at 512 per tile (93M)last block, pixel shuffle by 4 (16 patches into one token)64 per tile; 1,088 for a 512 × 512 image split into 17 views (root VLM lab recordings; tiling: Vision-language models) measured
Qwen2.5-VLits own ViT, trained from scratch: 32 blocks, width 1,280, patch 14, 2-D RoPE, RMSNorm, SwiGLUwindowed attention (112 × 112 px windows) in all but 4 blocks; 2 × 2 patches merged per tokennative resolution: (H/28) × (W/28), up to 16,384

Configs: llava-hf/llava-1.5-7b-hf @ b234b80, HuggingFaceTB/SmolVLM-500M-Instruct @ a7da5b9 (scale_factor 4), Qwen/Qwen2.5-VL-3B-Instruct @ 6628554 (depth 32, window_size 112, fullatt_block_indexes [7, 15, 23, 31], spatial_merge_size 2; max_pixels 12,845,056 = 16,384 × 28²). Qwen2.5-VL's report: "only four layers employ full self-attention, while the remaining layers utilize windowed attention with a maximum window size of 112×112" (§2.1.1). The SmolVLM token count was measured with its processor in the root's VLM runs.

7. Evaluating and choosing an encoder

Zero-shot classification is what a text tower buys: embed one sentence per class ("a photo of a sneaker.") and pick the class whose sentence is nearest to the image; the ten text vectors are the classifier's weights. On Fashion-MNIST CLIP B/32 lands between 61.3% and 66.7% over ten prompt sets and SigLIP 2 B/16 between 20.0% and 74.5%, and a linear probe with 16 labels per class beats every prompt set for both (79.0% and 84.0%) measured (root Zero-shot lab). SigLIP 2's 20% is a preprocessing bug: its reference code lowercases text and the transformers processor alone does not; with one template it scores 22.3% on the class names as written ("T-shirt/top", "Trouser") and 70.2% lowercased.

Feeding SigLIP text: case and padding (depth)

CLIP's tokenizer lowercases on its own, so code written for CLIP silently passes capitals to SigLIP 2. SigLIP was also trained on text padded to a fixed 64 tokens (padding="max_length", max_length=64 in the processor call); padding to the longest in the batch, as CLIP code does, changes its text embeddings. The root's loaders and this page pass both explicitly.

Each protocol answers a different question, and each has a setting that can move the result by more than the gap between two models:

ProtocolQuestion it answersWhat moves itHere
Zero-shot classificationcan text alone name the classes?prompt wording, case, templates, ensembling (5 to 50 points)CLIP 61.3 to 66.7%, SigLIP 2 20.0 to 74.5% across prompt sets measured
Linear probeis the class information linearly readable?feature scaling, regularisation, labels per class, which layerunscaled features underfit by 5 to 8 points (root zero-shot study); the best CLIP block beats its output (section 6)
kNNis the geometry itself right, with no training?k, temperature, normalisationMAE's mean vector is lowest on kNN and search (section 6)
Retrieval recall@K or precision@Kdoes the right item come first?gallery size, what counts as relevant, duplicatesRetrieval tab
Dense probesare patch tokens useful per location?input resolution, head (linear or decoder), multi-scalepublished only (ADE20K needs its own data)
Inside a VLMdoes the VLM answer better with it?projector, LLM, training data, token count; confounded by all of themthe VLM page; VLM benchmarks on Long-context and multimodal benchmarks
Predict: encoder A beats encoder B by 5 points of ImageNet zero-shot accuracy. Does A have better image features?
How to read a paper's encoder table (depth)

Check the resolution (a "B/16" at 384 sees 2.9 times the tokens of one at 224), whether numbers are zero-shot, probe or fine-tuned (MAE ViT-B: 68.0% linear, 83.6% fine-tuned), whether the probe ran on the [CLS], the mean or several layers, and who ran it (DINOv2's Table 4 re-ran every baseline "with our code", which is why its CLIP ViT-L/14 linear score is its own measurement, not OpenAI's). And check what the training data could have seen: DFN, the closest rival in SigLIP 2's table, "uses a network fine-tuned on ImageNet, COCO, and Flickr (i.e. the main benchmarks in Table 1) as a filter" (SigLIP 2, §3.1) published. Cosines are not comparable across models either: CLIP's matching pairs sit near 0.3, SigLIP 2's near 0.2, so any threshold is per model.

Choosing

You needStart withWhy, and the check
Search by text, zero-shot labels, filtering a dataseta caption-trained encoder (SigLIP 2, or an OpenCLIP / MetaCLIP model)only these have a text tower; check the processor (case, padding, crop) and calibrate any threshold per model
Image-to-image search, near duplicates, few-shot classificationDINOv2 or SigLIP 2, frozen, with kNN or a linear probeboth lead on the running example; measure precision@K on your own images with your own relevance
Segmentation, depth, correspondence, trackingDINOv2 (with registers) or DINOv3 if its licence fitsbest published frozen dense features; check token norms and patch-similarity maps for artefacts
A VLM backboneSigLIP or SigLIP 2 (So400m), NaFlex if documents or odd aspect ratios matterlanguage-aligned patch tokens; count tokens per image first (Tokens and cost tab)
Fine-tuning on a large labelled taskany of them; MAE initialisation is strong when the whole network is trainedfrozen-feature scores do not predict fine-tuned scores well (MAE §4.3)
Predict: you have 5,000 product photos per category and need pixel-accurate masks of the product with a frozen backbone and a linear head. Which pre-training signal do you want?

Depth: design questions

Design: an image search over 10 million product photos, by text and by example image.
Embed every image once with a caption-trained encoder (SigLIP 2 at a resolution matched to product detail; NaFlex if aspect ratios vary), store unit vectors in an approximate-nearest-neighbour index, embed queries with the same model's text tower (lowercased, padded as trained). For "more like this", consider a second index of DINOv2 vectors, which group visually similar items better. Evaluate on a labelled sample with recall@K for paired queries and precision@K for category queries; watch for typographic hits (product text in the photo) and calibrate any score threshold per model. Cost: one encoder pass per image (about 17 GMACs at B/16, 224) offline, one text pass per query online.
Design: choosing the vision encoder for a VLM that must read documents and charts.
Text in images needs resolution: count tokens per page at the encoder's patch size and the projector's merge factor, and prefer a native-resolution encoder (NaFlex SigLIP 2, or a Qwen2.5-VL-style ViT with 2-D RoPE and windowed attention) over a fixed 224 or 336 square that would squash or crop the page. Check high-norm tokens, pick the feature layer (second-to-last is the default), and evaluate the encoder inside the VLM on OCR-heavy benchmarks, since frozen-feature probes do not measure reading.
Zero-shot accuracy is poor on your domain. What do you try, in order?
Check preprocessing (case, padding, crop); try class wordings and templates and an ensemble; measure a linear probe on a few labels per class (if it is much higher, the features are fine and you need labels or prompt tuning); if the probe is also poor, fine-tune or pick an encoder trained on closer data.
Scripts and recorded outputs: src/runs/ and src/out/ in this page's folder (embed_ssl.py, dense.py, probes.py, layerwise.py, resolution.py, flops.py, textq.py, mae_shuffle.py; make_data.py and make_lab_data.py build the page data; fill_prose.py writes the numbers into the text). The contrastive-loss and minimal-pair data come from the root's Vision lab recordings (src/vision/out/ in the root folder). Published numbers transcribed in src/inputs/published.json; model configs in src/inputs/configs/.