Lune

ACM MM2024Top-tier venue

KNN Transformer with Pyramid Prompts for Few-Shot Learning

Wenhao Li, Qiangchang Wang, Peng Zhao, Yilong Yin

Abstract

Few-Shot Learning (FSL) aims to recognize new classes with limited labeled data. Recent studies have attempted to address the challenge of rare samples with textual prompts to modulate visual features. However, they usually struggle to capture complex semantic relationships between textual and visual features. Moreover, vanilla self-attention is heavily affected by useless information in images, severely constraining the potential of semantic priors in FSL due to the confusion of numerous irrelevant tokens during interaction. To address these aforementioned issues, a K-NN Transformer with Pyramid Prompts (KTPP) is proposed to select discriminative information with K-NN Context Attention (KCA) and adaptively modulate visual features with Pyramid Cross-modal Prompts (PCP). First, for each token, the KCA only selects the K most relevant tokens to compute the self-attention matrix and incorporates the mean of all tokens as the context prompt to provide the global context in three cascaded stages. As a result, irrelevant tokens can be progressively suppressed. Secondly, pyramid prompts are introduced in the PCP to emphasize visual features via interactions between text-based class-aware prompts and multi-scale visual features. This allows the ViT to dynamically adjust the importance weights of visual features based on rich semantic information at different scales, making models robust to spatial variations. Finally, augmented visual features and class-aware prompts are interacted via the KCA to extract class-specific features. Consequently, our model further enhances noise-free visual representations via deep cross-modal interactions, extracting generalized visual representation in scenarios with few labeled samples. Extensive experiments on four benchmark datasets demonstrate significant gains over the state-of-the-art methods, especially for the 1-shot task with 2.28% improvement on average due to semantically enhanced visual representations.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Global Prompt Refinement with Non-Interfering Attention Masking for One-Shot Federated Learning cites Learning Transferable Visual Models From Natural Language Supervision
  • Segment Anything cites Learning Transferable Visual Models From Natural Language Supervision
  • VT-FSL: Bridging Vision and Text with LLMs for Few-Shot Learning cites Learning Transferable Visual Models From Natural Language Supervision
  • DVLA-RL: Dual-Level Vision-Language Alignment with Reinforcement Learning Gating for Few-Shot Learning cites VT-FSL: Bridging Vision and Text with LLMs for Few-Shot Learning
  • DVLA-RL: Dual-Level Vision-Language Alignment with Reinforcement Learning Gating for Few-Shot Learning cites From Pretraining to Pathology: How Noise Leads to Catastrophic Inheritance in Medical Models
  • DVLA-RL: Dual-Level Vision-Language Alignment with Reinforcement Learning Gating for Few-Shot Learning cites CAST-LUT: Tokenizer-Guided HSV Look-Up Tables for Purple Flare Removal
  • DVLA-RL: Dual-Level Vision-Language Alignment with Reinforcement Learning Gating for Few-Shot Learning cites Learning Transferable Visual Models From Natural Language Supervision
  • From Pretraining to Pathology: How Noise Leads to Catastrophic Inheritance in Medical Models cites VT-FSL: Bridging Vision and Text with LLMs for Few-Shot Learning
  • From Pretraining to Pathology: How Noise Leads to Catastrophic Inheritance in Medical Models cites Learning Transferable Visual Models From Natural Language Supervision
  • Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites Learning Transferable Visual Models From Natural Language Supervision
  • CAST-LUT: Tokenizer-Guided HSV Look-Up Tables for Purple Flare Removal cites VT-FSL: Bridging Vision and Text with LLMs for Few-Shot Learning
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. VT-FSL: Bridging Vision and Text with LLMs for Few-Shot LearningWenhao Li, Qiangchang Wang, Xianjing Meng, Zhibin Wu et al.NeurIPS 2025 · 10 citations
  2. Global Prompt Refinement with Non-Interfering Attention Masking for One-Shot Federated LearningZhuang Qi, Pan Yu, Lei Meng, Sijin Zhou et al.NeurIPS 2025 · 4 citations
  3. DVLA-RL: Dual-Level Vision-Language Alignment with Reinforcement Learning Gating for Few-Shot LearningWenhao Li, Xianjing Meng, Qiangchang Wang, Zhongyi Han et al.ICLR 2026 · 4 citations
  4. From Pretraining to Pathology: How Noise Leads to Catastrophic Inheritance in Medical ModelsHao Sun, Zhongyi Han, Hao Chen, Jindong Wang et al.NeurIPS 2025 · 4 citations
  5. CAST-LUT: Tokenizer-Guided HSV Look-Up Tables for Purple Flare RemovalPu Wang, Shuning Sun, Jialang Lu, Chen Wu et al.AAAI 2026 · 2 citations

Builds on40

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  2. Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
  3. Segment AnythingAlexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao et al.ICCV 2023 · 13,211 citations
  4. ViViT: A Video Vision TransformerAnurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun et al.ICCV 2021 · 2,947 citations
  5. CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image ClassificationChun-Fu (Richard) Chen, Quanfu Fan, Rameswar PandaICCV 2021 · 2,072 citations

Related papers

  1. Semantic Prompt for Few-Shot Image RecognitionCVPR 2023
  2. Kernel-Aware Graph Prompt Learning for Few-Shot Anomaly DetectionFenfang Tao, Guo-Sen Xie, Fang Zhao, Xiangbo ShuAAAI 2025 · 24 citations
  3. Self-Prompt Mechanism for Few-Shot Image RecognitionMingchen Song, Huiqiang Wang, Guoqiang ZhongAAAI 2024
  4. Visual Prompting for Generalized Few-shot Segmentation: A Multi-scale ApproachMir Rayat Imtiaz Hossain, Mennatullah Siam, Leonid Sigal, James J. LittleCVPR 2024
  5. DSS-Prompt: Dynamic-Static Synergistic Prompting for Few-Shot Class-Incremental LearningLinpu He, Yanan Li, Bingze Li, Elvis Han Cui et al.ACM MM 2025 · 2 citations
Dusk over the sea between two cliffs drawn in fine vertical lines