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 · DOI

TL;DR

ResCLIP introduces a training-free, plug-and-play approach that unlocks CLIP's hidden localization capabilities for dense prediction tasks like semantic segmentation. By recycling cross-correlation attention from intermediate layers and applying a semantic feedback loop, it significantly boosts open-vocabulary segmentation performance across multiple backbones without requiring a single byte of training data or fine-tuning.

What Problem Does This Paper Address?

Vision-Language Models (VLMs) like CLIP have revolutionized open-vocabulary tasks, showing an incredible ability to classify images based on arbitrary text prompts. However, they notoriously struggle with dense, pixel-level prediction tasks like semantic segmentation.

This deficiency occurs because the self-attention layer in CLIP's final block is optimized for global image-text alignment, causing it to become "spatial-invariant"—essentially washing out local details. Recent training-free methods have tried to fix this by replacing standard query-key attention with self-correlation mechanisms (like key-key or query-query attention). While this helps retain spatial structures, it completely discards cross-correlation dynamics, which are vital for capturing rich spatial correspondences across different features.

Methods

The authors propose ResCLIP, a fully training-free framework consisting of two novel components designed to rectify the final layer's attention map:

  1. Residual Cross-correlation Self-attention (RCS): The authors discovered a fascinating property: while CLIP's last layer loses its localization ability, its intermediate layers (e.g., layers 6–9) retain highly accurate, class-specific spatial maps. RCS extracts standard cross-correlation attention ($C^2SA$) from these intermediate layers, averages them, and injects them as a residual connection into the final layer's attention block.
  2. Semantic Feedback Refinement (SFR): To enforce local consistency and clean up noise, SFR introduces a feedback loop. It takes an initial rough segmentation mask generated by the model and uses it to modulate the attention scores. It amplifies attention between patches predicted to belong to the same category and applies a distance-based decay function (using Chebyshev distance) to suppress irrelevant context from disjoint regions.
ResCLIP Architecture and Attention Paradigms

Datasets

The method was comprehensively evaluated across 8 standard open-vocabulary semantic segmentation benchmarks, divided by the presence of a background class:

  • With background class: PASCAL VOC 2012 (VOC21), PASCAL Context (Context60), and COCO Object.
  • Without background class: COCO-Stuff, Cityscapes, ADE20K-150, PASCAL VOC20, and PASCAL Context59.

Key Insights and Ideas

  • CLIP Already Knows How to Localize: The most profound insight is that CLIP doesn't lack localization features; it simply "forgets" them in the final layer to favor global text alignment. Intermediate layers serve as a goldmine of spatial awareness that can be recycled.
Attention visualization across CLIP layers
  • Cross-Correlation is Crucial: Pure self-correlation methods create isotropic smoothing, which blurs boundaries. Maintaining cross-correlation (query-key) dynamics preserves the directional, feature-to-feature relationships needed for clean object boundaries.
  • Closing the Loop via Feedback: Using the model's own preliminary dense predictions to refine its internal attention maps creates a powerful, training-free refinement mechanism that acts similarly to classic post-processing (like CRFs) but operates directly within the attention mechanism.

Key Results

ResCLIP acts as a plug-and-play booster for existing state-of-the-art training-free methods like SCLIP, ClearCLIP, and NACLIP.

  • Quantitative Performance: When integrated with NACLIP on a ViT-B/16 backbone, ResCLIP achieves state-of-the-art training-free performance, reaching 43.2% mIoU on datasets with a background class.
  • Rescuing Large Backbones: Existing training-free methods often degrade severely when scaling up to larger backbones (e.g., SCLIP's performance drops by 13.5% mIoU when moving from ViT-B to ViT-L). ResCLIP completely mitigates this, boosting SCLIP on ViT-L/14 by an incredible +13.1% mIoU.
  • Qualitative Quality: Visually, ResCLIP eliminates the "hollow" centers inside large objects and delivers much cleaner segmentation masks with significantly reduced noise artifacts compared to baselines.

Limitations and Future Work

  • Optimization Overhead: While the computational impact is relatively small—increasing total FLOPs by less than 7%—the authors note that the implementation of the SFR module can be further optimized to minimize inference latency.
  • Dependence on Base VLM: Because it is training-free, ResCLIP relies entirely on the quality of the underlying VLM's intermediate representations. If the base model completely fails to form coherent features for a highly obscure category in its middle layers, the residual connection will offer limited benefit.

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