Javier Ródenas
CVPR Workshops 2025 · LXCV

SAFF: Slot Attention-based Feature Filtering for Few-Shot Learning

Javier Ródenas1 Eduardo Aguilar1,2 Petia Radeva1,3
1AIBA, Universitat de Barcelona 2Universidad Católica del Norte 3Institute of Neuroscience, Universitat de Barcelona
Attention of each slot over the image; green ticks mark slots kept by the filter and red crosses slots discarded.
Attention assigned to each of the five slots. Green ticks mark slots that pass the filter (they agree with the class representation); red crosses mark slots that are discarded, typically background.
TL;DR. With only a few examples, background patches easily dominate the match between query and support images. SAFF decomposes each image into slots with slot attention, keeps only the slots that agree with the class token, and uses them as a soft mask over the patch embeddings before comparing query and support.

Abstract

Irrelevant features can significantly degrade few-shot learning performance. This problem is used to match queries and support images based on meaningful similarities despite the limited data. However, in this process, non-relevant features such as background elements can easily lead to confusion and misclassification. To address this issue, we propose Slot Attention-based Feature Filtering for Few-Shot Learning (SAFF) that leverages slot attention mechanisms to discriminate and filter weak features, thereby improving few-shot classification performance. The key innovation of SAFF lies in its integration of slot attention with patch embeddings, unifying class-aware slots into a single attention mechanism to filter irrelevant features effectively. We introduce a similarity matrix that computes across support and query images to quantify the relevance of filtered embeddings for classification. Through experiments, we demonstrate that Slot Attention performs better than other attention mechanisms, capturing discriminative features while reducing irrelevant information. We validate our approach through extensive experiments on few-shot learning benchmarks: CIFAR-FS, FC100, miniImageNet and tieredImageNet, outperforming several state-of-the-art methods.

Method

SAFF pipeline for support and query images.
SAFF pipeline. A ViT-S/16 produces patch embeddings and a class-aware embedding for support and query images. Slot attention splits the patches into slots, slots that are not similar to the class-aware embedding are removed, and the remaining ones form an attention mask that re-weights the patches. A dense similarity matrix between refined query and support patches is turned into a score by an MLP.
01

Patch embeddings

A pretrained ViT-S/16 turns each 224×224 image into 196 patch embeddings (384-D) plus a class token that summarizes the image.

02

Slot attention

Slots, initialized from the class token, compete for groups of patches over several iterations. Each slot ends up covering a different region.

03

Slot filtering

Slots far from the class token are discarded. The kept slots are averaged into one combined attention mask that re-weights the patches.

04

Patch matching

Refined patches (plus the class token, scaled by a class-aware factor) of query and support are compared with a cosine similarity matrix and scored by an MLP.

Attention maps per slot, iterative refinement and the final combined mask.
Each of the five slots attends to a different region; iterative refinement sharpens them, and the combined mask built from the slots above the similarity threshold highlights the class-specific regions while down-weighting the rest.

Results

90.30%
CIFAR-FS 5-shot
87.19%
miniImageNet 5-shot
88.97%
tieredImageNet 5-shot
22M
parameters (ViT-S/16)

5-way accuracy (%)

MethodBackboneCIFAR-FS 1/5FC100 1/5miniImageNet 1/5tieredImageNet 1/5
FewTUREViT-S/1676.10 / 86.1446.20 / 63.1468.02 / 84.5172.96 / 86.43
CPEA*ViT-S/1678.32 / 89.5046.70 / 65.7071.34 / 86.7374.58 / 88.71
SAFF (ours)ViT-S/1678.48 / 90.3047.17 / 66.0071.51 / 87.1974.73 / 88.97

* Median of our runs of CPEA. Full tables with confidence intervals and more baselines are in the paper.

Findings

BibTeX

@inproceedings{rodenas2025saff,
  title     = {Slot Attention-based Feature Filtering for Few-Shot Learning},
  author    = {R{\'o}denas Cumplido, Javier and Aguilar, Eduardo and Radeva, Petia},
  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
  pages     = {30--40},
  year      = {2025}
}