SAFF: Slot Attention-based Feature Filtering for Few-Shot Learning
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
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.
Slot attention
Slots, initialized from the class token, compete for groups of patches over several iterations. Each slot ends up covering a different region.
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.
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.
Results
5-way accuracy (%)
| Method | Backbone | CIFAR-FS 1/5 | FC100 1/5 | miniImageNet 1/5 | tieredImageNet 1/5 |
|---|---|---|---|---|---|
| FewTURE | ViT-S/16 | 76.10 / 86.14 | 46.20 / 63.14 | 68.02 / 84.51 | 72.96 / 86.43 |
| CPEA* | ViT-S/16 | 78.32 / 89.50 | 46.70 / 65.70 | 71.34 / 86.73 | 74.58 / 88.71 |
| SAFF (ours) | ViT-S/16 | 78.48 / 90.30 | 47.17 / 66.00 | 71.51 / 87.19 | 74.73 / 88.97 |
* Median of our runs of CPEA. Full tables with confidence intervals and more baselines are in the paper.
Findings
- Slot attention beats other attention modules on CIFAR-FS 5-shot: 90.30% vs. 90.00% (dot-product), 89.97% (query-support cross-attention) and 90.03% (patch-token cross-attention).
- Soft masks beat hard masks. Weighting patches by their attention keeps some context and outperforms zeroing patches below 0.5 on all three datasets tested.
- Five slots is the sweet spot. Three slots underfit and ten slots hurt; the number of iterations (3, 5 or 10) barely matters.
- Most gains are statistically significant. McNemar's test against CPEA (1-shot) gives p ≤ 0.001 on three of the four datasets; on CIFAR-FS the difference is not significant.
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}
}