TL;DR
While prior literature claimed deep networks fundamentally struggle with basic abstract relational concepts like same-versus-different, this paper shows that vision transformers (ViTs)—specifically those pretrained with CLIP—can learn a robust, abstract concept of equality. When fine-tuned on simple, textureless 2D shapes, CLIP-pretrained ViTs generalize with near-perfect accuracy to out-of-distribution 2D stimuli and transfer zero-shot (up to 90% accuracy) to photorealistic 3D scenes.
What Problem Does This Paper Address?
Recognizing whether two objects are identical is trivial for adult humans, 3-month-old infants, and even honeybees, serving as a primitive building block for higher-order reasoning. In contrast, several prominent studies found that standard convolutional neural networks (CNNs) fail at this task—tending to memorize training pairs rather than learning abstract equality, unless augmented with specialized relational modules or hand-crafted inductive biases.
The authors investigate whether standard neural architectures can acquire an abstract same-different relation without specialized architectural modifications. Crucially, they test whether models learn an authentic, abstract relation that generalizes out-of-distribution (OOD) to completely novel visual stimuli, rather than relying on pixel-level matching or dataset-specific shortcuts.
Methods
The authors frame the task as binary classification: given an image displaying two objects, predict whether they are "same" or "different."
They systematically evaluate:
- Architectures: ResNet-50 vs. ViT-B/16 (supplemented by ConvNeXt-B and DeiT-S to control for parameter count).
- Pretraining Regimes: Random initialization (from scratch), supervised ImageNet pretraining, and multimodal contrastive language-image pretraining (CLIP).
- Probing & Bias Diagnostic Experiments: Linear probing on frozen embeddings, patch-grid alignment tests, and fine-grained feature dissociation (systematically varying color, texture, and shape congruency).
- Transfer to 3D: Zero-shot evaluation of 2D fine-tuned models on complex, photorealistic 3D rendered scenes without further training.
Datasets
The study evaluates four primary 2D datasets (each with 1,600 unique objects split into disjoint train, validation, and test sets; 6,400 image pairs per set):
- Squiggles (SQU): Randomly generated closed line contours (Fleuret et al., 2011).
- Alphanumeric (ALPH): Handwritten characters from Omniglot.
- Shapes (SHA): Abstract shapes with variations in shape, texture, and color (along with grayscale
SHA-Gand silhouetteSHA-Mvariants). - Naturalistic (NAT): Isolated photographs of real-world objects on white backgrounds.
Additionally, the authors evaluate on:
- Photorealistic 3D Benchmark (New): 1,024 Blender-rendered scenes containing 16 distinct 3D objects with realistic textures, lighting, shadows, camera angles, and 3D rotations.
- Puebla & Bowers (2022) Benchmarks: 13 challenge sets (e.g., Irregular, Connected Squares, Scrambled, Lines, Arrows).
Key Insights and Ideas
- Attention Over Convolution: ViTs dramatically outperform CNNs on out-of-distribution generalization. Because self-attention allows early, direct pairwise comparisons across distant image patches, ViTs integrate global relational structure more effectively than CNNs, whose receptive fields expand hierarchically.
- Abstract Shapes Force Generalization: Models fine-tuned on colored or naturalistic objects (
SHA,NAT) exploit color and texture as shortcuts, failing to generalize when shape is the only distinguishing feature. Conversely, training on visually sparse, textureless shapes (SQU) forces the model to rely on shape, yielding the strongest OOD transfer across all datasets. - CLIP Provides Relational Semantics: Multimodal contrastive pretraining exposes the network to captions containing relational phrasing (e.g., "two of", "same"), producing visual feature spaces that separate same/different pairs far better than ImageNet pretraining alone.
- "Fuzzy" Equality Enables 3D Transfer, but Introduces Invariance Pitfalls: CLIP ViT does not simply perform pixel-wise matching. Instead, it computes relational similarity in embedding space. This allows it to recognize 3D objects as "same" despite lighting and viewpoint shifts, but also causes it to treat mirror reflections as identical and fail when distinct OOD objects share very high visual similarity.
Key Results
- In-Distribution: While randomly initialized models fail on Squiggles (~50% chance level), CLIP ViT-B/16 attains nearly 100% accuracy across all datasets.
- Out-of-Distribution (OOD): CLIP ViT-B/16 fine-tuned on Squiggles achieves 97.8% average accuracy on OOD test sets (97.7% on ALPH, 99.1% on SHA, 96.7% on NAT).
- Zero-Shot 3D Generalization: Despite never seeing 3D data, CLIP ViT-B/16 achieves 80–90% median accuracy (and up to 0.96 AUC-ROC) on photorealistic 3D scenes. ResNets, by comparison, linger near chance (~50–55%).
- Controls for Model Size: Comparing ConvNeXt-B (89M params) to DeiT-S (22M params) confirmed that architecture, rather than parameter scale, drives ViT's relational advantage.
Limitations and Future Work
- Extreme Sample Inefficiency: While human infants infer sameness from fewer than 10 examples, these models require pretraining on 400M image-caption pairs and thousands of fine-tuning examples.
- Reflection Invariance: Pretraining data augmentations induce an unintended horizontal reflection invariance: CLIP ViT misclassifies reflected line drawings as "same" with high confidence.
- Optimization Sensitivity: The best configurations display bimodal seed sensitivity (e.g., 1 out of 5 seeds fails to find the generalizing minimum), showing that training data presentation order still impacts relational convergence.
Summary updated