NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ResCLIP: Residual Attention for Training-free Dense Vision-language Inference

Yuhang Yang, Jinhong Deng, Wen Li, Lixin Duan

Abstract

ResCLIP is a novel, training-free framework designed to enable CLIP to perform high-quality semantic segmentation by "recycling" spatial information from its intermediate layers. By combining a residual attention mechanism with a semantic feedback loop, it significantly boosts the localization accuracy of existing vision-language models without requiring any additional gradient updates.

The Problem: Spatial Invariance in VLMs

Vision-Language Models (VLMs) like CLIP have revolutionized zero-shot image classification, but they notoriously struggle with "dense" tasks like semantic segmentation, which requires predicting a label for every pixel.

The root of the problem lies in CLIP’s architecture: as the model processes an image, the final self-attention layers become "spatial-invariant." They focus on global features to help the model decide what is in the image (e.g., "a cat"), but they lose the fine-grained details of where the object is. Previous training-free attempts to fix this often modified the last layer to focus on local self-correlation, but these methods frequently overlooked the rich spatial correspondence already captured in the model's earlier stages.

Visualizing the loss of spatial information: intermediate layers (3, 5, 11) maintain clear object localization, while the last layer becomes blurry and spatially invariant.

Methodology

The authors introduce two primary modules that can be plugged into existing CLIP-based pipelines:

  1. Residual Cross-correlation Self-attention (RCS): The authors discovered that while the last layer of CLIP is spatially blurry, the intermediate layers (like layers 6 through 9) actually maintain excellent localization properties. RCS extracts the query-key attention maps from these intermediate layers and fuses them as a "residual" connection into the final layer. This essentially "heals" the final layer's lack of detail using the model's own internal memory.
  2. Semantic Feedback Refinement (SFR): This is a refinement loop. The model generates an initial, rough segmentation mask. SFR then uses this mask as feedback to adjust the attention scores. It encourages pixels predicted to be the same category to have higher attention weights with each other while using a distance-based decay (Chebyshev distance) to maintain local consistency.
The ResCLIP architecture (c) compared to baselines (a, b), alongside performance improvements (d) across different ViT backbones.

Because these modules don't require new parameters, ResCLIP is entirely training-free, making it a "plug-and-play" solution for researchers using pre-trained CLIP models.

Key Insights and Results

The most significant insight is that CLIP doesn't actually "lose" spatial information; it just moves it. By the time features reach the final layer, they are optimized for global contrastive learning, but the "blueprints" for objects are still clearly visible in the middle layers. Furthermore, the SFR module demonstrates that a model's own noisy predictions can be used as a prior to "clean up" its internal attention mechanisms, leading to much sharper object boundaries.

ResCLIP consistently outperformed state-of-the-art training-free methods across eight standard semantic segmentation benchmarks:

  • Performance Boost: When integrated with existing models like SCLIP or NACLIP, ResCLIP provided mIoU (mean Intersection over Union) gains ranging from 1.7% to 13.1%.
  • ViT-L/14 Gains: On the PASCAL VOC dataset using a ViT-L/14 backbone, ResCLIP boosted the baseline SCLIP score from 60.3% to 83.9% mIoU—a massive leap for a training-free intervention.
  • Qualitative Improvement: Visualizations show that ResCLIP eliminates the "hollow" effect (where the center of an object is misclassified) and produces much cleaner, more cohesive masks compared to previous methods.

Limitations and Future Work

While effective, the method relies on two trade-off parameters ($\lambda_{rcs}$ and $\lambda_{sfr}$) that may require manual oversight. Additionally, the feedback loop and the need to aggregate multiple layers add a small amount of computational cost during the inference phase. The SFR module's success also depends on the initial mask from the RCS module being reasonably accurate. Future work could explore more dynamic ways to select which intermediate layers to aggregate based on input complexity.

Summary updated

BibTeX
@inproceedings{yang2025resclip,
  author = {Yuhang Yang and Jinhong Deng and Wen Li and Lixin Duan},
  title = {{ResCLIP: Residual Attention for Training-free Dense Vision-language Inference}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02789},
}
Figure