Sparse Attention for Dense Open-Vocabulary Prediction in CLIP
Summary
A new approach enhances Contrastive Language-Image Pre-training (CLIP) for dense, open-vocabulary prediction by addressing its softmax-based self-attention. CLIP's standard attention spreads probability mass across all token pairs, including semantically irrelevant ones, generating noise that obscures fine-grained, spatially localized cues. Researchers propose an inference-time substitution of the row-wise softmax in the final visual self-attention layers with the α-entmax transform. This transform applies a data-dependent threshold, mapping low scores to zero, thereby implicitly denoising by eliminating contextually irrelevant dependencies and reallocating mass to the most relevant tokens. Evaluations on open-vocabulary tasks, including dense semantic segmentation (Pascal VOC, Pascal Context, ADE20K) and fine-grained retrieval (FG-OVD), demonstrate that the performance gain from attention sparsification directly correlates with how much the baseline attention initially spreads beyond the target class.
Key takeaway
For Machine Learning Engineers optimizing CLIP for dense open-vocabulary prediction, consider replacing the final visual self-attention's softmax with α-entmax during inference. This substitution implicitly denoises attention by zeroing irrelevant token dependencies, enhancing performance on tasks like semantic segmentation and fine-grained retrieval. You should evaluate this approach, particularly if your current CLIP models exhibit broad attention spread, as gains are proportional to the initial off-target attention.
Key insights
Sparsifying CLIP's dense attention with α-entmax at inference improves fine-grained open-vocabulary prediction by denoising irrelevant token dependencies.
Principles
- Dense softmax attention can hinder fine-grained tasks.
- Data-dependent thresholds enable implicit denoising.
- Sparsification gains scale with initial attention spread.
Method
Substitute row-wise softmax in final visual self-attention layers with α-entmax during inference, applying it across query-key and self-correlation variants.
In practice
- Apply α-entmax for dense semantic segmentation.
- Use α-entmax for fine-grained image retrieval.
- Evaluate attention spread to predict sparsification gains.
Topics
- CLIP
- Sparse Attention
- Open-Vocabulary Prediction
- Semantic Segmentation
- Alpha-entmax
- Fine-Grained Retrieval
Code references
Best for: Research Scientist, AI Scientist, Machine Learning Engineer, Computer Vision Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by Takara TLDR - Daily AI Papers.