SigLIP vs. CLIP: Overcoming the Softmax Bottleneck in Vision-Language Models
From the publisher’s feed, collected in the ZeroLabs newsroom.
Paper-explained Series 9TL;DRThe Goal: To make AI that deeply understands both vision and language, mapping images and text into the same mathematical space so they can be accurately matched together.The Breakthrough (CLIP): Models like CLIP achieved this on a massive scale using contrastive learning on image-text pairs found on the web. They take a batch of these pairs and use a “softmax” mathematical function to pull matching pairs together while pushing mismatched pairs apart. However, softmax has a massive hardware bottleneck: to calculate the loss for just one image, it requires a global view of every single text in the entire batch at the exact same time. This demands an immense amount of memory and expensive communication across many accelerator chips.The Fix (SigLIP): SigLIP fixes this bottleneck by swapping the softmax function for a simpler “sigmoid” loss. Instead of making the AI choose the best match out of the whole batch at once, SigLIP breaks the problem into independent True/False questions for every single pair (“Does Image A match Text B? Yes or No”). This small mathematical shift completely removes the need for a global view of the data, drastically cutting memory usage.This article is written in continuation to CLIP articleMethodologyTraditionally, models like CLIP use the Softmax loss.Think of Softmax like a multiple-choice test. For a given image, the model looks at all the texts in the current batch and has to pick the one correct matching text out of the lineup. Because it’s comparing the correct answer against all the wrong answers simultaneously, it requires a “global normalization”.Mathematically, the image embeddings (x_i) and text embeddings (y_i) are L2-normalized. The Softmax loss formula looks like this:The Problem with Softmax: Notice the sums (∑∣B∣) in the denominators. To calculate the loss for just one image, the computer must hold the similarity scores of that image against every single text in the entire batch. As you increase your batch size to get better results, this becomes an enormous computational and memory bottleneck.The New Way: Sigmoid LossSigLIP throws away the multiple-choice approach. Instead, it uses a Sigmoid loss, which treats the problem like a series of independent True/False questions.Instead of asking, “Which of these 32,000 texts matches this image?”, SigLIP asks 32,000 separate questions: “Does Image A match Text 1? Yes/No.”, “Does Image A match Text 2? Yes/No,” and so on.The Sigmoid loss formula is much simpler:z_ij is the label: It is set to 1 if the image and text are a true pair, and −1 if they are not.t is a learnable temperature parameter.The “Bias” Trick: Because we are looking at every possible pair independently, there is a massive imbalance. In a batch of 32,000, there is only 1 correct match and 31,999 incorrect matches for a given image. If you start training a model from scratch, this ocean of negative pairs dominates the loss, causing the model to take massive, unstable optimization steps just to guess “everything is negative”.To fix this, the authors added a learnable bias term (b). By initializing this bias to a specific negative number (b=−10), the model mathematically starts out with the assumption that “most things are negative.”. This prevents massive over-corrections and stabilizes the start of training.The “Temperature” Trick: When the model compares an L2-normalized image embedding and a text embedding, the resulting raw similarity score is just a small number between -1 and 1. If you feed these unscaled, tiny fractions directly into the loss function, the numerical difference between a match and a mismatch isn’t sharp enough to give the model a confident learning signal. To fix this, the formula uses a global, freely learnable scalar parameter called temperature (t) to multiply and stretch out these similarity scores before evaluating them.To make this work perfectly from the start, the authors parameterize this temperature as e^{t’} and initialize t’ to log 10 (meaning the actual temperature t starts exactly at 10). By initializing this specific temperature alongside the -10 bias term, the model starts its training roughly close to the prior, preventing dramatic over-correction during the early stages of optimization. This ensures the model begins learning stably rather than taking massive, chaotic steps in the first few batches.The Hardware Trick: Chunked ImplementationThe Setup: Distributed TrainingWhen training a model on a massive batch of data (let’s say a global batch size of B=32,000 image-text pairs), that data is split evenly across all available chips. If you have 32 chips, each chip only holds a “local batch” (b) of 1,000 images and 1,000 texts in its own memory at any given time.The Old Way: CLIP and the Softmax BottleneckCLIP uses a Softmax loss. The mathematical nature of Softmax is that it requires a global view: to calculate the loss for just one image, the equation needs the probability of that image against all 32,000 texts in the entire batch.Here is what that forces the hardware to do:The “All-Gather” Traffic Jam: Because Chip 1 only has 1,000 texts, it must pause and request the other 31,000 texts from all the other chips on the network simultaneously. This network communication is called an expensive “all-gather” operation.The Memory Explosion: Once Chip 1 receives all 32,000 texts, it has to calculate the similarity of its 1,000 images against all 32,000 texts at the exact same time. When you look at the entire system as a whole, it is materializing a massive similarity matrix of size ∣B∣[citestart]×∣B∣ in memory.The Limit: Because this process is quadratic (scaling as ∣B∣2), doubling your batch size quadruples your memory requirement. Very quickly, the vanilla Softmax computation bottlenecks scaling because the chips simply run out of RAM.The New Way: SigLIP and the “Chunked” TrickSigLIP uses a Sigmoid loss, which treats every single image-text pair as an independent True/False equation. Because the math for Image 1 vs Text 1 doesn’t depend on the math for Image 1 vs Text 2, the model does not need to see the entire global batch at the same time.The authors exploited this independence to create a “chunked” workflow that never gathers all the data at once.Here is how SigLIP handles the exact same 32,000 batch across 32 chips:Calculate Locally: Chip 1 calculates the True/False loss for just its local chunk of data — its 1,000 images compared against its own 1,000 texts. The memory used right now is strictly limited to the local batch size (b2), not the massive global batch size (∣B∣2).Pass the Data (Permute): Instead of an expensive “all-gather” where everyone talks to everyone, the chips play musical chairs. Chip 1 simply passes its 1,000 texts to Chip 2, Chip 2 passes to Chip 3, and so on. This is called a “collective permute,” and shifting data to a neighbor is much faster than an all-gather.Calculate the Next Chunk: Chip 1 now holds its original 1,000 images, plus a new set of 1,000 texts from its neighbor. It computes the loss for this new b×b chunk and simply adds the result to its running total.Repeat and Sum: The chips keep passing the text data in a circle until every image has been compared against every text. Once the circle is complete, the independent running totals from all devices are just summed together.Why it is a game-changerBy chunking the math, the memory cost at any given millisecond is reduced from ∣B∣2 down to just b2. This completely removes the memory bottleneck that held CLIP back. It allowed the researchers to scale up to an extreme batch size of 1 million examples using relatively few accelerator chips.Note: When I said SigLIP “doesn’t look at other samples,” I meant that the math equation for evaluating one pair is completely independent of the other pairs. But to actually train the model, we still have to show it negative examples. We have to say, “Image 1 matches Text 1, but it does not match Text 2, Text 3, or Text 1000.”Experiments & key resultsBatch-size study: The authors evaluated batch sizes ranging from 512 up to 1 million. When the batch size is smaller than 16k, the sigmoid loss outperforms the softmax loss by a large margin. Interestingly, performance for both loss types saturates around a batch size of 32k; pushing the batch size to the extreme (like 1 million) yielded diminishing returns.Resource-efficient recipes: SigLiT is surprisingly efficient. Using just four TPU-v4 chips, a model reached 79.7% ImageNet zero-shot accuracy in one day. Upgrading to a g/14 vision tower setup on the same four chips achieved 84.5% accuracy in two days.mSigLIP (multilingual): The recipe easily scales to over 100 languages. A 32k batch size was sufficient for optimal multilingual pre-training. The scaled-up mSigLIP ViT-B model set a new state-of-the-art on the XM3600 benchmark, achieving 34.9% average text-to-image retrieval.Robustness & bias ablation: Models trained with the sigmoid loss proved increasingly robust to injected label noise (e.g., corrupted images or texts) compared to softmax baselines. Ablations also confirmed that initializing the bias term to -10 consistently improved performance across all downstream tasks.Quick How-to / TL;DR code snippetHere is a simplified pseudocode representation of the pairwise sigmoid loss:Python# img_emb : image model embedding [n, dim]# txt_emb : text model embedding [n, dim]# t_prime, b : learnable temperature and bias# n : mini-batch sizet = exp(t_prime)zimg = l2_normalize(img_emb)ztxt = l2_normalize(txt_emb)logits = dot(zimg, ztxt.T) * t + blabels = 2 * eye(n) - ones(n) # -1 with diagonal 1l = -sum(log_sigmoid(labels * logits)) / nLink to original paper: https://arxiv.org/abs/2303.15343Huge kudos to Xiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, Lucas Beyer, and the entire Google DeepMind team for this incredible milestone! Proving that a model can ditch the memory-heavy softmax bottleneck for a simple pairwise sigmoid loss — achieving 84.5% ImageNet zero-shot accuracy in just two days on only four TPUv4 chips — is an absolute paradigm shift. Thank you for championing a more memory-efficient, accessible, and highly scalable approach to language-image pre-training!Next, we will talk about CLIP 2… stay tuned 😉Until next time, folks…El Psy CongrooSigLIP vs. CLIP: Overcoming the Softmax Bottleneck in Vision-Language Models was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.