CLIP vs SigLIP Explained: Contrastive Vision-Language Pretraining, Softmax vs Sigmoid Loss and Zero-Shot Classification

CLIP vs SigLIP Explained: Contrastive Vision-Language Pretraining, Softmax vs Sigmoid Loss and Zero-Shot Classification

CLIP vs SigLIP Explained: Contrastive Vision-Language Pretraining, Softmax vs Sigmoid Loss and Zero-Shot Classification

Swap one function in a training loss, a softmax for a sigmoid, and you change what a vision model believes a similarity score means. That single change is the whole of CLIP vs SigLIP: same dual encoders, same web-scale image-caption data, different question asked of every image-text pair. CLIP asks “which caption in this batch is the best match?” SigLIP asks “does this caption match, yes or no?” The distinction matters now because SigLIP-family encoders sit inside many open vision-language models, while CLIP embeddings still power a large installed base of image search and zero-shot classifiers. If you pick an encoder, set a retrieval threshold, or debug a VLM that cannot read a gauge, you are living with the consequences of that loss choice. You will leave this post able to compute both losses by hand, explain why the sigmoid version scales across accelerators more cheaply, run zero-shot classification with either family, and decide which one fits an industrial workload.

What this covers: the shared dual-encoder design, CLIP’s softmax (InfoNCE) loss and temperature, SigLIP’s pairwise sigmoid loss and bias, a worked 3×3 numeric example, distributed-training mechanics, SigLIP 2, the vision-tower role in VLMs, runnable code, and a defect-search pattern.

Context and Background

Contrastive language-image pretraining became mainstream in early 2021. OpenAI’s CLIP paper, “Learning Transferable Visual Models From Natural Language Supervision” by Radford et al., trained on roughly 400 million image-text pairs collected from the internet, a dataset the authors called WIT (WebImageText). Weeks earlier, Google’s ALIGN paper (Jia et al., arXiv 2102.05918) had shown the same idea working on over one billion noisy image alt-text pairs. Both replaced fixed label sets with free-form captions, and both used a contrastive objective over a dual encoder.

The payoff was zero-shot transfer. Instead of training a classifier head on 1,000 ImageNet classes, you embed the text “a photo of a {label}” for each class and pick the class whose text embedding is closest to the image embedding. CLIP’s best model, ViT-L/14 at 336-pixel resolution, reached 76.2% zero-shot top-1 accuracy on ImageNet without seeing a single ImageNet training label. That matched the original fully supervised ResNet-50, which is the headline the abstract leads with.

The open-source community then reproduced and scaled the recipe. The OpenCLIP project trained CLIP-architecture models on LAION-2B and DataComp-1B, and the accompanying paper on reproducible scaling laws (Cherti et al., CVPR 2023) showed accuracy rising predictably with data, model and compute. OpenCLIP’s ViT-bigG-14 trained on LAION-2B reports 80.1% zero-shot ImageNet accuracy in the project’s own results table.

In March 2023, Zhai, Mustafa, Kolesnikov and Beyer at Google published “Sigmoid Loss for Language Image Pre-Training”, introducing SigLIP. They kept the architecture and changed only the loss. That one change cut memory and communication cost, improved results at small batch sizes, and made the loss more tolerant of noisy captions. SigLIP 2 followed in February 2025 with multilingual training, captioning-based objectives, dense-feature improvements and a native-aspect-ratio variant.

This site has covered neighbouring ground. Our guide to contrastive fine-tuning with hard negatives for text embedding models explains InfoNCE for text-only retrieval. This post takes a different angle: it treats the softmax-versus-sigmoid choice as a statement about what a score means, and follows that through to thresholds, training systems and VLM design.

CLIP vs SigLIP: Softmax Ranking vs Sigmoid Matching

CLIP and SigLIP share one architecture: an image encoder and a text encoder that project into a common embedding space, trained on image-caption pairs. CLIP uses a softmax contrastive loss that forces each true pair to outrank every other pair in the batch. SigLIP uses an independent sigmoid on every image-text pair, a binary “match or no match” decision with a learnable bias.

CLIP vs SigLIP architecture showing shared dual encoders feeding a similarity matrix, with a softmax ranking branch and a sigmoid matching branch

Figure 1: The shared dual-encoder pipeline and where CLIP and SigLIP diverge.

Figure 1 shows a batch of N images and N captions passing through separate encoders. Both outputs are L2-normalized, so their dot product is a cosine similarity between -1 and 1. The N x N similarity matrix has true pairs on the diagonal. From there, CLIP normalizes each row and column with a softmax, while SigLIP applies a sigmoid to each of the N squared cells on its own.

The shared skeleton: dual encoders and a similarity matrix

Both families use late fusion. The image tower never sees the text and the text tower never sees the image during the forward pass; they meet only at the dot product. That design is what makes them useful for retrieval. You can embed a million product images once, store the vectors, and score any new text query with a single matrix multiply.

The image tower is usually a Vision Transformer (ViT), which cuts an image into fixed-size patches and treats each patch as a token. CLIP also trained ResNet variants, from RN50 up to RN50x64, alongside ViT-B/32, ViT-B/16 and ViT-L/14. The text tower is a Transformer that reads a tokenized caption and emits one pooled vector. Linear projections map both pooled outputs into the shared space.

The training data defines the supervision. Every caption in the batch except the one paired with an image is treated as a negative for that image. Nobody labels these negatives; they are free, and there are a lot of them. A batch of 32,768 pairs, CLIP’s batch size, holds 32,768 positives and roughly 1.07 billion negative cells (32,768 squared minus the diagonal). The losses differ in how they spend that abundance.

CLIP’s InfoNCE loss: a batch-wide ranking contest

CLIP’s loss is a symmetric cross-entropy, often called InfoNCE. For image i, take the row of similarities to all captions, multiply by a learned scale, apply a softmax, and maximize the probability on caption i. Then do the same for each caption across the column of images, and average the two directions. The SigLIP paper writes it as the mean of an image-to-text and a text-to-image softmax term.

The temperature controls sharpness. CLIP learns it as a parameter, initialized to the equivalent of 0.07, and clips it so logits are never scaled by more than 100. A scale of 100 turns a cosine gap of 0.05 into a logit gap of 5, which a softmax converts into a strong preference. The OpenCLIP README’s usage example still multiplies cosine scores by 100.0 before its softmax for exactly this reason.

The key property is coupling. A softmax row sums to one, so the gradient on the logits of that row also sums to zero. Pushing the true pair up necessarily pushes the competitors down by the same total amount. The model is rewarded for being relatively best, not for being absolutely confident. A true pair with cosine 0.30 is a perfect result if every other caption in the batch sits at 0.10.

That is why CLIP scores are awkward to threshold. A raw CLIP cosine of 0.28 does not carry a fixed meaning across queries; only its rank within the candidate set does. Practitioners who build “is this image about X?” filters on raw CLIP cosines end up tuning thresholds per concept, often by hand.

SigLIP’s sigmoid loss: N squared independent binary questions

SigLIP replaces the two softmaxes with one sigmoid per cell. For each image i and caption j, the label is +1 on the diagonal and -1 elsewhere. The logit is t times the cosine similarity plus a learnable bias b, and the loss is the binary log-loss of that logit. The total is the sum over all N squared cells, divided by N.

The paper parameterizes the scale as t = exp(t’), initializes t’ to log 10 (so t = 10), and initializes b to -10. The bias is the clever part. With b = -10, a pair with cosine zero starts with a sigmoid output of about 0.0000454. Almost every cell is a negative, so the model begins near the correct prior instead of spending its first steps learning that “no match” is the default. The authors state the bias exists to avoid large early over-correction.

Because each cell is scored on its own, there is no normalizer across the batch. The loss for pair (i, j) depends only on image i, caption j, t and b. That property has three consequences you will meet again in this post. It changes the systems cost of training at scale. It changes how the loss behaves at small batch sizes. And it gives the learned similarity an absolute anchor, because the bias defines a decision boundary that is the same for every image.

The paper also examined the obvious worry: with 16,384 positives and about 268 million negatives in a 16k batch, is the class imbalance a problem? The authors concluded the imbalance “does not seem to be a major reason for concern.” They also tested dropping negatives. Randomly removing them hurt, keeping only the easiest failed, and keeping the hardest mostly preserved quality.

A worked 3×3 example: same matrix, two verdicts

Numbers make the CLIP vs SigLIP difference concrete. Take three images and three captions with this illustrative cosine similarity matrix (rows are images, columns are captions, true pairs on the diagonal):

caption 1 caption 2 caption 3
image 1 0.62 0.55 0.10
image 2 0.48 0.50 0.20
image 3 0.05 0.15 0.40

Use a scale of t = 10 for both losses so the comparison is fair, and a bias of b = -5 for SigLIP, a value partway between its initialization and a trained state. All numbers below are computed with the code later in this post; they are arithmetic, not benchmark results.

CLIP (softmax). Row 1 logits are 6.2, 5.5 and 1.0. The softmax gives 0.666 on the true caption, so the image-to-text loss is -ln(0.666) = 0.407. Row 2 gives 0.535 on the diagonal and a loss of 0.625. Row 3 gives 0.899 and a loss of 0.106. The column direction yields losses of 0.223, 0.985 and 0.170. Averaging both directions gives a total CLIP loss of 0.419.

SigLIP (sigmoid). Each cell’s logit is 10 x cosine – 5. Cell (1,1) has logit 1.2, a match probability of 0.769, and loss 0.263. The confusable negative (1,2) has logit 0.5, a match probability of 0.622, and loss 0.974. Cell (2,2) sits at logit 0, probability 0.5, loss 0.693. The interesting cell is (3,3): logit -1.0, match probability 0.269, loss 1.313. Summing all nine cells gives 3.949, or 1.316 per image.

Look at image 3. CLIP considers it nearly solved: the true caption wins its row with 90% of the softmax mass, and the loss is 0.106. SigLIP considers it the worst pair in the batch, because a cosine of 0.40 falls below the decision boundary set by t and b. The softmax only cares that 0.40 beats 0.05 and 0.15. The sigmoid cares that 0.40 is not high enough to call a match.

The gradients tell the same story. For softmax row 3, the gradient on the true logit is -0.101. For the sigmoid, the gradient on cell (3,3) is -0.731, more than seven times stronger. Meanwhile, the sigmoid pushes the hard negative (1,2) with a gradient of +0.622 regardless of what the rest of row 1 looks like. In the softmax, that push is +0.331, set by competition within the row.

This is the thesis of the post in miniature. Softmax learns ranking. Sigmoid learns calibrated matching. Neither is universally better, but they produce embeddings whose raw scores mean different things, and that matters the moment you deploy one.

Walk-through: Scaling, Zero-Shot Code and the Vision Tower Role

The loss choice shows up in three places beyond the math: how expensive training is across many accelerators, how you run zero-shot classification, and how the encoder behaves inside a larger vision-language model. This section walks through each with figures and code.

Why the sigmoid loss decouples from the global batch

Contrastive learning likes large batches, because more captions per batch means more and harder negatives. CLIP trained with 32,768 pairs per batch. No single accelerator holds that, so the batch is split across D devices, each holding b = |B| / D pairs.

Distributed contrastive language image pretraining comparing a softmax all-gather with SigLIP's chunked sigmoid loss that passes text blocks between devices

Figure 2: Softmax needs every embedding on every device; the chunked sigmoid loss passes blocks between neighbours and sums independent pair losses.

Figure 2 contrasts the two schemes. A softmax row normalizer needs the similarity of image i against every caption in the global batch. In the usual implementation, each device all-gathers image and text embeddings from all other devices, then computes a b x |B| slice of the logit matrix. The SigLIP paper adds a further cost: a numerically stable softmax subtracts the row maximum first, which “requires another pass over the full batch,” and the normalization runs twice, once across images and once across texts.

The sigmoid loss has no normalizer, so the paper proposes a chunked implementation. Each device first computes losses for its own positives and local negatives. Devices then pass their text embeddings to a neighbour, compute the next b x b block of negatives, and repeat until every block has been visited. Per-device losses are summed. The paper states this needs no all-gathers and reduces the memory for pairwise similarities from |B| squared to b squared.

A little arithmetic shows why that matters. A naive full logit matrix at |B| = 32,768 holds about 1.07 billion entries, or roughly 4.3 GB in 32-bit floats, before any activations. Split across 256 devices, b is 128, and each chunked step materializes a 128 x 128 block of 16,384 entries. The total floating-point work is the same, since every cell is still computed once. What changes is peak memory per device and the absence of a global synchronization point. The authors report that this let them push batch sizes beyond one million on relatively few devices.

What the batch-size experiments actually showed

A common misreading is “SigLIP needs huge batches.” The paper found the opposite. Testing SigLiT (a variant with a frozen, pretrained image tower) from 512 to one million, the sigmoid loss clearly beat softmax below 16k, and the gap closed at larger sizes. Gains saturated around 32k. For full from-scratch SigLIP training, a 32k batch was best, while the softmax baseline peaked at 98k, and both degraded at 307k.

The practical lesson is that the sigmoid loss lowers the cost of good contrastive training rather than raising its ceiling. A SigLiT model with a frozen g/14 image tower reached 84.5% ImageNet zero-shot accuracy after two days on four TPUv4 chips with a 20k batch. A SigLIP B/16 trained from scratch reached 73.4% after five days on 32 TPUv4 chips with a 32k batch. Those are the paper’s numbers and hardware, not a reproduction.

The paper also tested label noise by corrupting images, texts or pairings. Its conclusion: “Models trained with sigmoid loss are increasingly robust to all kinds of added noise.” This fits the mechanism. A badly matched pair in a softmax batch distorts the normalizer for its whole row and column. In the sigmoid loss it is one bad binary label among N squared.

Zero-shot image classification in practice

Zero-shot image classification turns class names into text prompts, embeds them once, and compares every image against the cached class embeddings. CLIP’s paper quantified the prompt effect on ImageNet. The template “A photo of a {label}.” improved accuracy by 1.3 points over the bare label. Ensembling 80 context prompts added 3.5 points over the single default prompt. Combined, prompt engineering and ensembling improved accuracy by almost 5 points.

The decision rule differs between families. With CLIP, you take a softmax over the candidate labels, which forces the probabilities to sum to one even when no label fits. With SigLIP, the Hugging Face documentation applies torch.sigmoid to each image-label logit, so every label gets an independent score. That makes “none of the above” expressible, which matters for open-set inspection.

The first snippet below uses OpenCLIP’s documented API with a LAION-2B CLIP checkpoint. The second uses the transformers SigLIP 2 classes with the padding settings the docs call mandatory. Both run on CPU, though a GPU is faster.

# pip install open_clip_torch torch pillow
import torch, open_clip
from PIL import Image

model, _, preprocess = open_clip.create_model_and_transforms(
    "ViT-B-32", pretrained="laion2b_s34b_b79k")
model.eval()
tokenizer = open_clip.get_tokenizer("ViT-B-32")

labels = ["a scratch", "a dent", "rust", "a clean surface"]
templates = ["a photo of {}.", "a close-up photo of {} on metal.",
             "an inspection image showing {}."]

with torch.no_grad():
    # Prompt ensembling: average normalized text embeddings per class
    class_emb = []
    for lbl in labels:
        t = tokenizer([tp.format(lbl) for tp in templates])
        e = model.encode_text(t)
        e = e / e.norm(dim=-1, keepdim=True)
        e = e.mean(dim=0)
        class_emb.append(e / e.norm())
    class_emb = torch.stack(class_emb)

    img = preprocess(Image.open("part_0412.jpg")).unsqueeze(0)
    img_emb = model.encode_image(img)
    img_emb = img_emb / img_emb.norm(dim=-1, keepdim=True)

    probs = (100.0 * img_emb @ class_emb.T).softmax(dim=-1)  # sums to 1
print(dict(zip(labels, probs[0].tolist())))
# pip install -U transformers torch pillow  (SigLIP 2 needs a 2025+ release)
import torch
from PIL import Image
from transformers import AutoModel, AutoProcessor

ckpt = "google/siglip2-base-patch16-224"
model = AutoModel.from_pretrained(ckpt).eval()
processor = AutoProcessor.from_pretrained(ckpt)

labels = ["a scratch", "a dent", "rust", "a clean surface"]
texts = [f"This is a photo of {l}." for l in labels]
image = Image.open("part_0412.jpg")

# SigLIP was trained with fixed-length padding; the docs require it
inputs = processor(text=texts, images=image, padding="max_length",
                   max_length=64, return_tensors="pt")
with torch.no_grad():
    out = model(**inputs)
scores = torch.sigmoid(out.logits_per_image)[0]  # independent, need not sum to 1
print(dict(zip(labels, scores.tolist())))

Two details in the second snippet trip people up. The SigLIP processor must pad to max_length, because the model was trained that way; the SigLIP 2 docs warn that overriding the default padding and 64-token truncation “may lead to degraded retrieval quality.” And the scores are independent sigmoids, so a clean part might score low on every defect label at once. That is a feature, but it means you need thresholds, not an argmax.

The worked example from earlier is reproducible with a few lines of NumPy, which is a useful sanity check when you implement either loss yourself:

import numpy as np
S = np.array([[0.62, 0.55, 0.10],
              [0.48, 0.50, 0.20],
              [0.05, 0.15, 0.40]])
t, b = 10.0, -5.0
L = t * S
lse = lambda a, ax: np.log(np.exp(a).sum(ax))
clip = 0.5 * ((lse(L, 1) - np.diag(L)).mean() + (lse(L, 0) - np.diag(L)).mean())
Z = 2 * np.eye(3) - 1                       # +1 diagonal, -1 elsewhere
siglip = np.log1p(np.exp(-Z * (L + b))).sum() / 3
print(round(clip, 3), round(siglip, 3))     # 0.419 1.316

Reported zero-shot ImageNet results

For a CLIP vs SigLIP comparison on published numbers, the table below lists only figures reported by the papers or the OpenCLIP results table. Training data, resolution and samples seen differ between rows, so this is not a controlled comparison of the losses. It shows the published state of each line of work.

Model Loss Training data Reported ImageNet zero-shot top-1 Source
CLIP ViT-L/14 @336px Softmax WIT, 400M pairs 76.2% Radford et al. 2021
OpenCLIP ViT-H-14 Softmax LAION-2B, 32B samples seen 78.0% OpenCLIP README
OpenCLIP ViT-L-14 Softmax DataComp-1B, 13B samples seen 79.2% OpenCLIP README
OpenCLIP ViT-bigG-14 Softmax LAION-2B, 34B samples seen 80.1% OpenCLIP README
SigLIP B/16, from scratch Sigmoid WebLI 73.4% Zhai et al. 2023
ViT-SO400M-14-SigLIP @224px Sigmoid WebLI, 45B samples seen 82.0% OpenCLIP README
SigLIP So400m/14 @384px Sigmoid WebLI 83.2% Tschannen et al. 2025
SigLIP 2 So400m/14 @384px Sigmoid plus extras WebLI 84.1% Tschannen et al. 2025
SigLIP 2 g/16 @384px Sigmoid plus extras WebLI 85.0% Tschannen et al. 2025

Methodology caveat: these rows mix datasets, resolutions, encoder sizes and training budgets, and some come from repository tables rather than peer-reviewed papers. The only clean loss-versus-loss evidence is the controlled ablations inside the SigLIP paper. Treat the table as a map of published results, not as proof that the sigmoid loss alone is worth several points.

SigLIP 2: same loss, more objectives

SigLIP 2, by Tschannen et al. at Google, keeps the sigmoid loss and adds training signals around it. A LocCa-style decoder adds captioning, dense captioning and referring-expression prediction losses; the decoder is discarded after pretraining. Self-distillation and masked-prediction losses, drawn from the SILC and TIPS lines of work, switch on for the last 20% of training at a weight of 0.25. Smaller B/16 and B/32 models are further distilled from a teacher using active data curation (ACID).

Data and scale changed too. Training uses WebLI, which the paper describes as 10 billion images and 12 billion alt-texts across 109 languages, mixed 90% English and 10% non-English, with bias-mitigation filtering. The text tower uses the multilingual Gemma tokenizer with a 256k vocabulary, and text length is fixed at 64 tokens. Models see 40 billion examples at a 32k batch on up to 2,048 TPUv5e chips.

Four sizes were released: ViT-B (86M parameters), L (303M), So400m (400M) and g (1B). “So400m” refers to a shape-optimized ViT from Alabdulmohsin et al.’s 2023 paper “Getting ViT in Shape,” which chose width and depth with compute-optimal scaling laws.

The NaFlex variant is the most practically interesting addition. It preserves each image’s native aspect ratio and supports variable sequence lengths from a single checkpoint; the paper evaluates 64 to 1,024 tokens. In transformers, you control it with max_num_patches, which defaults to 256. For documents, receipts and wide line-scan images, avoiding a square resize reduces distortion that otherwise mangles small text.

The vision tower inside a VLM

Most open vision-language models are built by bolting a pretrained contrastive image encoder onto a language model. The encoder’s patch tokens, not its single pooled vector, pass through a small projector into the LLM’s embedding space. Our explainer on multimodal AI architecture and fusion patterns covers the fusion options in depth; here the point is which encoder gets chosen.

LLaVA-1.5 (Liu et al., arXiv 2310.03744) uses CLIP-ViT-L-336px, which the authors describe as “the highest resolution available for CLIP,” with a two-layer MLP connector. Google’s PaliGemma (arXiv 2407.07726, July 2024) pairs a SigLIP-So400m encoder with Gemma-2B. PaliGemma 2 (arXiv 2412.03555, December 2024) keeps SigLIP-So400m and pairs it with Gemma 2 models from 2B to 27B, trained at 224, 448 and 896 pixels. The SigLIP 2 paper evaluates its encoders under a PaliGemma-style recipe with Gemma 2 2B and reports gains over SigLIP.

Why would sigmoid-trained encoders suit this role? A defensible, partly speculative answer: the VLM consumes patch features, and SigLIP 2’s extra captioning and dense objectives explicitly train those patch features to carry localized meaning. The pooled contrastive score is almost irrelevant inside a VLM. So when you compare vision encoders for a VLM, compare dense and localization results, not zero-shot classification alone.

Factories rarely have labelled data for every defect. A contrastive encoder offers two useful tools: text-prompted triage and image-to-image similarity search over historical cases. Our guide to industrial machine vision defect detection at the edge covers the supervised side; this pattern complements it.

Zero-shot image classification and defect retrieval pipeline using cached prompt embeddings, a vision encoder, thresholds and a vector index

Figure 3: A zero-shot triage and defect-search pipeline. The decision rule is where CLIP and SigLIP diverge.

Figure 3 shows the flow. Defect terms are expanded with prompt templates and embedded once, then cached. Each camera frame is cropped to a region of interest, embedded, and scored against the cached class vectors. In parallel, the image embedding queries a vector index of past defects so a reviewer sees the nearest historical cases. Choosing the index is its own topic; our comparison of HNSW, DiskANN and IVF-PQ index internals applies directly.

The decision node is where the loss matters. A softmax over “scratch, dent, rust, clean” always picks something, which is fine for closed-set sorting. A per-class sigmoid threshold lets the system say “this frame matches none of my prompts,” which routes novel defects to a human. In our view, that open-set reject path is the more valuable behaviour on a real line. That is an engineering opinion, not a benchmarked result, so tune it on your own images.

Throughput is easy to reason about. Text embeddings cost nothing at runtime because they are cached. The image embedding is one forward pass of the vision tower per crop, so the image encoder’s size and input resolution dominate latency. That is the lever to pull when you move from a GPU server to an edge box.

Trade-offs, Gotchas, and What Goes Wrong

In the CLIP vs SigLIP choice, neither loss is free of failure modes, and most production problems come from misreading scores rather than from the encoder itself.

Vision encoder VLM selection flow choosing between SigLIP 2 NaFlex, SigLIP So400m, OpenCLIP and a head-to-head benchmark

Figure 4: A decision flow for choosing an encoder, driven by how its scores will be used.

Figure 4 encodes the main branches. The first question is whether you need a VLM vision tower or a standalone embedding model, because the evaluation criteria differ. The second is whether downstream code will threshold raw scores.

Sigmoid scores are not automatically calibrated probabilities. SigLIP’s bias gives scores an absolute anchor, but “0.7 match” was learned on web captions, not your defect vocabulary. Short industrial prompts can sit far from the caption distribution. Calibrate per class on a held-out set, and expect very low absolute scores on prompts the model finds unusual.

CLIP scores are not comparable across queries. A cosine of 0.30 means different things for different concepts. Use ranks, per-query normalization, or a softmax over a fixed candidate set. Do not reuse one global threshold.

Embeddings are not interchangeable. Switching from a CLIP index to a SigLIP model means re-embedding every stored image. There is no linear map you can trust without validation. Budget the re-index before you migrate.

Preprocessing mismatches silently cost accuracy. SigLIP expects fixed-length padding and lowercased text; skipping padding="max_length" is a classic bug. Resolution matters too: a 224-pixel square resize can erase a hairline crack that a 384-pixel or NaFlex input preserves.

Known CLIP-family weaknesses persist. The CLIP paper itself notes poor results on fine-grained classes such as car models and aircraft variants, and on counting. It reports only 88% on MNIST, below logistic regression on raw pixels. OpenAI’s 2021 “Multimodal Neurons” work also documented typographic attacks, where text written in the image steers the prediction. Treat printed labels and stickers on parts as an adversarial input.

Licenses and data provenance vary. OpenCLIP weights trained on LAION, Google’s SigLIP checkpoints, and OpenAI’s original CLIP weights carry different licenses and dataset histories. Check them against your deployment terms before shipping.

Practical Recommendations

Settle CLIP vs SigLIP by starting from the job the scores will do. If you need ranking inside a fixed candidate set, such as text-to-image search where the user sees the top ten, both families work, and ecosystem compatibility with an existing CLIP index can decide it. If you need thresholds, open-set rejection or multi-label tagging, prefer the SigLIP family, because its training objective already scores each pair independently.

For a VLM vision tower, start from SigLIP 2 at the So400m size, which is the encoder family behind PaliGemma and PaliGemma 2. Use the NaFlex variant when inputs are documents, screens or wide crops; our post on document AI with OCR versus vision-language models shows why aspect-ratio distortion hurts text reading.

If you train or fine-tune yourself, the sigmoid loss is the cheaper default on modest hardware. The SigLIP paper found it beats softmax at small batches and saturates around 32k, so you do not need a giant cluster to benefit. For domain adaptation, consider locking the image tower and tuning only text, as SigLiT did, before attempting full fine-tuning. Our guide to LoRA, QLoRA and full fine-tuning trade-offs covers parameter-efficient options.

Finally, never settle the CLIP vs SigLIP question from ImageNet zero-shot numbers alone. Build a few hundred labelled examples from your own cameras and compare.

  • Decide ranking versus thresholding before choosing a family.
  • Use the processor defaults: fixed padding and 64-token text for SigLIP 2.
  • Ensemble 3 to 10 prompt templates per class and cache the averaged embeddings.
  • Calibrate per-class thresholds on held-out data; log score distributions in production.
  • Benchmark at your deployment resolution, including a NaFlex run for non-square inputs.
  • Plan a full re-index whenever the encoder changes.

Frequently Asked Questions

What is the main difference between CLIP and SigLIP?

Both train an image encoder and a text encoder so matching image-caption pairs land close together. The difference is the loss. CLIP applies a softmax over each row and column of the batch similarity matrix, so a true pair only has to outrank the others. SigLIP applies an independent sigmoid to every image-text pair with a learnable bias, turning training into many binary match-or-no-match decisions. That makes SigLIP cheaper to distribute, stronger at small batch sizes, and gives its scores an absolute decision boundary rather than a purely relative ranking.

Is SigLIP better than CLIP for zero-shot image classification?

On published results, SigLIP-family models report higher ImageNet zero-shot accuracy. SigLIP 2 So400m/14 at 384 pixels reports 84.1%, against 76.2% for the original CLIP ViT-L/14 at 336 pixels. However, those models differ in data, size and training budget, not just loss. The SigLIP paper’s controlled ablations show the sigmoid loss winning mainly at batch sizes below 16k, with the gap closing at larger batches. For your own classes, run both on a labelled sample before deciding, especially for fine-grained or industrial categories.

Why does SigLIP use a bias term in its sigmoid loss?

In a batch of N pairs there are N positives and roughly N squared negatives, so nearly every cell should be “no match.” The SigLIP paper initializes the bias at -10 and the scale at 10, so a pair with zero cosine similarity starts with a match probability near 0.00005. That puts the model near the correct prior from the first step. The authors say this avoids large early over-correction. After training, the bias also acts as a learned decision threshold, which is why sigmoid scores are easier to threshold than raw CLIP cosines.

Why do SigLIP scores not sum to one across labels?

Each image-label pair is scored by its own sigmoid, so scores are independent. An image can score high on two labels, such as “rust” and “a dent,” or low on every label. CLIP-style inference instead applies a softmax across the candidate labels, which forces the probabilities to sum to one even when no label fits. The Hugging Face SigLIP documentation applies torch.sigmoid to the logits for this reason. Treat SigLIP outputs as per-label match scores and set thresholds, rather than taking an argmax and assuming the top label is correct.

Which vision encoder do VLMs like LLaVA and PaliGemma use?

LLaVA-1.5 uses OpenAI’s CLIP ViT-L at 336-pixel resolution, connected to the language model through a two-layer MLP. Google’s PaliGemma pairs a SigLIP-So400m encoder with Gemma-2B, and PaliGemma 2 keeps SigLIP-So400m while scaling the language side to Gemma 2 models from 2B to 27B. In these designs, the language model receives the encoder’s patch tokens through a projector. So the encoder’s dense, localized features matter more than its pooled zero-shot score when you compare candidates for a VLM.

What is SigLIP 2 NaFlex?

NaFlex is a SigLIP 2 variant that keeps an image’s native aspect ratio and supports variable token counts from a single checkpoint. The paper evaluates sequence lengths from 64 to 1,024 tokens. In Hugging Face transformers, the max_num_patches argument controls resolution and defaults to 256. NaFlex helps with documents, screenshots and wide industrial crops, where squashing into a fixed square would distort small text or thin features. The standard fixed-resolution SigLIP 2 checkpoints remain backward-compatible with original SigLIP usage.

Further Reading

By Riju — about

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *