Abstract
We introduce NeCo: Patch Neighbor Consistency, a novel self-supervised training loss that enforces patch-level nearest neighbor consistency across a student and teacher model. Compared to contrastive approaches that only yield binary learning signals, i.e., 'attract' and 'repel', this approach benefits from the more fine-grained learning signal of sorting spatially dense features relative to reference patches. Our method leverages differentiable sorting applied on top of pretrained representations, such as DINOv2-registers to bootstrap the learning signal and further improve upon them. This dense post-pretraining leads to superior performance across various models and datasets, despite requiring only 19 hours on a single GPU. This method generates high-quality dense feature encoders and establishes several new state-of-the-art results such as +5.5% and +6% for non-parametric in-context semantic segmentation on ADE20k and Pascal VOC, +7.2% and +5.7% for linear segmentation evaluations on COCO-Things and -Stuff and improvements in the 3D understanding of multi-view consistency on SPair-71k, by more than 1.5%.
Introduction: Beyond Binary Signals in Scene Understanding
While Vision Foundation Models (VFMs) like DINOv2 or CLIP excel at global image understanding, they often struggle with "dense" scene understanding—precisely identifying which pixels belong to specific object parts. Current self-supervised learning (SSL) methods typically rely on binary contrastive signals to "attract" similar features and "repel" different ones. However, this approach is often too coarse to capture semantic nuances, such as the relationship between a tire, a car door, and an unrelated background element like a cloud.
NeCo (Patch Neighbor Consistency) addresses this by providing a richer, continuous learning signal. Instead of binary labels, it teaches models to understand the structural relationships between object parts by maintaining a consistent ordering of similar image patches.
NeCo: Learning through Patch Neighbor Consistency
The core innovation of NeCo is enforcing consistency in the rank-ordering of nearest neighbors across different views of an image. The framework operates within a teacher-student paradigm where a "student" network learns from a "teacher" network (an exponential moving average of the student).
To overcome the non-differentiable nature of standard nearest-neighbor lookups, NeCo employs a differentiable sorting operator. For any given image patch, the model calculates the probability of reference patches being the $k$-th neighbor. The loss function then forces the student's neighbor-ranking to match the teacher's stable targets. This "dense post-pretraining" approach allows researchers to refine existing strong models (like DINOv2) in just 19 hours on a single NVIDIA RTX A6000, making high-performance vision research significantly more accessible.
Experimental Evaluation and Results
NeCo was trained primarily on COCO and ImageNet-100 and evaluated across a diverse suite of tasks including semantic segmentation (Pascal VOC, ADE20k, COCO-Stuff) and 3D multi-view consistency (SPair-71k).
The results establish several new state-of-the-art (SOTA) benchmarks:
- In-Context Segmentation: NeCo improved mIoU by +2.3% on ADE20k and +4.2% on Pascal VOC compared to previous leading methods.
- Linear Segmentation: Significant gains were observed on COCO-Things (+1.6%) and COCO-Stuff (+4.8%).
- 3D Consistency: On the SPair-71k benchmark, multi-view consistency improved by over 1.5%, proving the robustness of learned features across camera angles.
- Versatility: The loss consistently improved every backbone tested, including ViT-Small, ViT-Base, and vision-language models like CLIP and SigLIP.
Insights and Future Directions
NeCo demonstrates that rank-ordering provides a much denser gradient than binary signals, forcing models to learn the structural relationships between object parts. By optimizing models for nearest neighbor retrieval, the method effectively brings the "in-context learning" capabilities seen in Large Language Models to the vision domain.
However, the method's success is currently tied to the quality of the teacher model; a poor initial sorting signal can introduce noise. Future work will explore different sorting algorithms and scaling to larger datasets to determine if these performance gains continue to compound. Ultimately, NeCo proves that massive compute is not always a prerequisite for SOTA results in vision foundation models.
Summary updated