Improving Visual Discriminability of CLIP for Training-Free Open-Vocabulary Semantic Segmentation

Jinxin Zhou, Jiachen Jiang, Zhihui Zhu · Submission to ICLR 2026 · Withdrawn

TL;DR

CLIP's image-level pretraining causes deeper vision transformer layers to sacrifice fine-grained visual discriminability in favor of global text alignment, driven in part by high-norm "abnormal tokens." LHT-CLIP introduces a plug-and-play, training-free framework that systematically intervenes across the Layer, Head, and Token levels—suppressing abnormal tokens, reweighting residual pathways, and amplifying discriminative attention heads—to achieve state-of-the-art open-vocabulary semantic segmentation without auxiliary models or post-processing heuristics.

What Problem Does This Paper Address?

Pretrained vision-language models like CLIP excel at zero-shot image classification, but adapting them to dense prediction tasks such as open-vocabulary semantic segmentation remains tricky. Because CLIP is trained with a global image-text contrastive loss, patch tokens in the deepest layers collapse toward a shared global semantic representation rather than preserving distinct, localized spatial boundaries.

Most existing training-free approaches attempt to fix this issue only at the very final layer (e.g., by stripping residual connections, discarding the feed-forward network, or redesigning self-attention). Other approaches incorporate heavy external models like DINO, SAM, or Stable Diffusion. However, the author's analysis reveals that token features arriving at the final layer are already corrupted by global bias and anomalous activations.

Methods

LHT-CLIP introduces three complementary, inference-only interventions targeting earlier representations inside the visual encoder:

  1. Abnormal Token Replacement (ATR) [Token-Level]:
    In deeper layers, a small set of "abnormal" tokens exhibits extreme activation norms and high sparsity. ATR detects these outliers at the penultimate layer ($L-1$) using the Hoyer sparsity metric ($H(x_i) > \tau$) and replaces each abnormal token with an average of its non-anomalous spatial neighbors.

  2. Spatial-Semantic Reweighting (SSR) [Layer-Level]:
    To prevent deeper layers from excessively overwriting local detail with global semantic noise, SSR modulates the forward pass of the final few layers (layers 10–11 for ViT-B/16; 17–23 for ViT-L/14). It boosts the residual path by $(1+\alpha)$ while damping the multi-head self-attention (MSA) and feed-forward (FFN) submodules by $(1-\alpha)$.

  3. Selective Head Enhancement (SHE) [Head-Level]:
    Rather than treating all attention heads equally, SHE computes a cross-dataset discriminability score for each head, identifies the top-$k$ most discriminative heads, and aggregates their representations. It thresholds this affinity matrix to create a soft pseudo-mask ($S_\beta$), which refines the penultimate layer features ($X^{L-1} \leftarrow \text{Norm}(S_\beta)X^{L-1}$) before final projection.

       [ Input Image ]
              │
    ┌─────────┴─────────┐
    │  Early ViT Layers │
    └─────────┬─────────┘
              ▼
    ┌───────────────────┐ ◄─── SSR: Upweight residual (1+α),
    │  Deep ViT Layers  │          downweight MSA/FFN (1-α)
    └─────────┬─────────┘
              ▼
    ┌───────────────────┐ ◄─── ATR: Detect sparse outlier tokens
    │ Penultimate Layer │          & replace with spatial neighbors
    │      (L - 1)      │ ◄─── SHE: Refine with pseudo-masks
    └─────────┬─────────┘          from top-k discriminative heads
              ▼
    ┌───────────────────┐
    │  Final Prediction │ ──── Text Embeddings ──► Segmentation Mask
    └───────────────────┘

Datasets

The authors evaluate on eight benchmark semantic segmentation datasets across two regimes:

  • Without background class: Pascal VOC 2012 (VOC20), PASCAL Context (C59), COCO-Stuff (Stuff), ADE20K (ADE), and Cityscapes (City).
  • With background class: VOC21, PASCAL Context (C60), and COCO-Object (Object).

Hyperparameters were tuned once on a combined subset of 1,000 images from PASCAL Context, ADE20K, and COCO-Stuff, and kept fixed across all evaluation benchmarks without per-dataset tuning. ImageNet validation images were also used for layer-wise diagnostic experiments.

Key Insights and Ideas

  • The Alignment–Discriminability Trade-Off: Token-level discriminability follows an inverted U-curve across ViT depth—peaking in intermediate layers and dropping steeply in the final 2–7 layers. Conversely, semantic alignment saturates early, meaning the final layers degrade spatial grouping for negligible semantic gains.
  • Abnormal Tokens Act as a Global Bias: In deeper layers, a small number of tokens display extreme sparsity (only a few activated channels) and share pairwise cosine similarities $>0.98$ across positions, layers, and even distinct images. Rather than encoding image content, they behave like static bias vectors pulling representations toward text alignment at the expense of local boundaries.
  • Discriminability is Concentrated in Specific Heads: Out of 144 heads in ViT-B/16, only a compact subset (e.g., Head 11 in Layer 6) consistently retains high visual discriminability across different datasets. Selecting individual heads performs substantially better than taking entire intermediate layers.

Key Results

  • Consistent SOTA Gains: Integrated into existing training-free baselines on ViT-B/16, LHT-CLIP boosts average mIoU across 8 benchmarks:
  • SCLIP: $39.1 \to 42.4$ (+3.3 mIoU)
  • ClearCLIP: $39.2 \to 42.7$ (+3.5 mIoU)
  • ResCLIP: $40.6 \to 42.8$ (+2.2 mIoU)
  • Fixing the ViT-L Performance Drop: Baseline training-free methods typically degrade when switching from ViT-B/16 to ViT-L/14 (e.g., ClearCLIP drops from 39.2 to 34.9 mIoU). LHT-CLIP eliminates this drop, elevating ClearCLIP to 42.7 mIoU (+7.8) and ResCLIP to 42.9 mIoU (+4.8).
  • Efficiency and Speed: Compared to ResCLIP, which relies on costly PAMR post-processing, LHT-CLIP drops post-processing entirely: inference speed increases from 3.0 to 8.2 FPS while computation drops from 141.34G to 102.65G FLOPs.
  • Broad Applicability: Tested on SigLIP (which breaks final-layer methods like ClearCLIP due to its AttentionPool head), LHT-CLIP lifts vanilla SigLIP from 22.1 to 26.9 mIoU.

Limitations and Future Work

  • Heuristic Layer Selection: While hyperparameters ($\tau, \alpha, k, \beta$) prove robust across datasets, their selection relies on empirical diagnostic curves that may vary across fundamentally different model architectures.
  • Upstream Bias Inherited from Pretraining: Because the method is strictly training-free, it cannot rectify inherent social or contextual biases present in CLIP's image-text training corpus.
  • Future Directions: Extending these token-, head-, and layer-level insights beyond dense segmentation to improve visual grounding in frozen multimodal LLM vision backbones (e.g., LLaVA).

Summary updated

BibTeX
@article{zhou2025improving,
  author = {Jinxin Zhou and Jiachen Jiang and Zhihui Zhu},
  title = {{Improving Visual Discriminability of CLIP for Training-Free Open-Vocabulary Semantic Segmentation}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=9spNW3DXg5},
}
Figure