# 少样本学习

少样本学习（Few-shot learning，FSL）是一种机器学习方法，模型从少量带有监督信息的样本中学习新任务，通常通过迁移从相关任务中获得的知识来实现。单样本的情形称为单样本学习（one-shot learning），而在没有任何目标类别标注样本的情况下、借助关于这些类别的辅助信息来学习识别目标类别，则称为零样本学习（zero-shot learning）。<sup>[1](https://arxiv.org/pdf/1904.05046v3.pdf)</sup> 标准形式是 N-way K-shot 分类：训练集 \( D_{\text{train}} \) 包含从 \( N \) 个类别中抽取的 \( I = K \cdot N \) 个样本，每类 \( K \) 个，因此一个 5-way 1-shot 任务呈现 5 个类别、每类 1 个样本。<sup>[1](https://arxiv.org/pdf/1904.05046v3.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 标准任务格式 | N-way K-shot 分类，含 \( I = K \cdot N \) 个标注样本<sup>[1](https://arxiv.org/pdf/1904.05046v3.pdf)</sup> |
| Prototypical Networks，miniImageNet 5-way | 49.42 ± 0.78%（1-shot），68.20 ± 0.66%（5-shot），conv-4 骨干，欧氏距离<sup>[2](https://proceedings.neurips.cc/paper_files/paper/2017/file/cb8da6767461f2812ae4290eac7cbc42-Paper.pdf)</sup> |
| MAML，miniImageNet 5-way | 48.70 ± 1.84%（1-shot），63.11 ± 0.92%（5-shot）<sup>[3](https://proceedings.mlr.press/v70/finn17a/finn17a.pdf)</sup> |
| FEAT，miniImageNet 5-way（ResNet） | 66.78%（1-shot），82.05%（5-shot）<sup>[4](https://ar5iv.labs.arxiv.org/html/1812.03664)</sup> |
| 基准饱和 | mini-ImageNet 已达到 95.3%（5-way 1-shot）和 98.4%（5-way 5-shot）<sup>[5](https://psycnet.apa.org/doi/10.1145/3582688)</sup> |
| 最强的简单竞争者 | 监督预训练加标准微调；跨域 miniImageNet→CUB 上为 65.57 ± 0.70%，而 ProtoNet 为 62.02%<sup>[6](https://arxiv.org/abs/1904.04232)</sup> |

## 工作原理

少样本方法分为三个机制类别。基于度量的方法学习一个嵌入空间，在其中可以通过比较对新类别进行分类。Matching Networks 将一个小型带标签支持集加上一个无标签样本映射到其标签，无需微调，可以解释为在嵌入空间内应用的一种加权最近邻分类器。<sup>[7](https://proceedings.neurips.cc/paper_files/paper/2016/file/90e1357833654983612fb05e3ec9148c-Paper.pdf)</sup> Prototypical Networks 将每个类别的原型取为其支持集在嵌入空间中的均值，并通过距离上的 softmax 对查询进行分类，<sup>[2](https://proceedings.neurips.cc/paper_files/paper/2017/file/cb8da6767461f2812ae4290eac7cbc42-Paper.pdf)</sup>

\[ p_{\phi}(y=k \mid x) = \frac{\exp(-d(f_{\phi}(x), c_k))}{\sum_{k'} \exp(-d(f_{\phi}(x), c_{k'}))} \]

其中 \( c_k \) 是类别 \( k \) 的原型，\( d \) 是距离函数。更早的时候，一个在图像对上训练的孪生卷积验证模型被复用于单样本 Omniglot 分类，无需重新训练。<sup>[8](https://www.cs.cmu.edu/%7Ersalakhu/papers/oneshot1.pdf)</sup>

基于优化的方法学习的是初始化而非度量。MAML 显式地训练参数，使得在新任务上少量梯度步就能产生良好的泛化；实际上，模型被训练得易于微调，跨任务的[元优化](https://www.edgepedia.org/zh/meta-optimization)通过对参数 \( \theta \) 的随机梯度下降执行，并在更新后的参数 \( \theta' \) 处评估。<sup>[3](https://proceedings.mlr.press/v70/finn17a/finn17a.pdf)</sup>

表示与先验迁移是第三个类别：一篇综述按先验知识是增广数据、收缩模型的假设空间，还是改变对最佳假设的搜索（例如通过良好的初始化）来组织 FSL 方法。<sup>[1](https://arxiv.org/pdf/1904.05046v3.pdf)</sup>

## 如何实施

主流做法是情景式训练（episodic training）。其原则是测试与训练条件必须匹配：从任务分布中采样一个标签集，然后采样支持集 \( S \) 和一批样本 \( B \)，并以 \( S \) 为条件最小化 \( B \) 上的误差。<sup>[7](https://proceedings.neurips.cc/paper_files/paper/2016/file/90e1357833654983612fb05e3ec9148c-Paper.pdf)</sup> 每个情景是一个微型的 N-way K-shot 分类问题，因此模型练习的是适应本身，而非任何固定的类别集。

评估使用基类和新类划分。miniImageNet 划分将 100 个类别分为 64 个训练类、16 个验证类和 20 个测试类。<sup>[2](https://proceedings.neurips.cc/paper_files/paper/2017/file/cb8da6767461f2812ae4290eac7cbc42-Paper.pdf)</sup> miniImageNet 本身由 60,000 张大小为 84 × 84 的彩色图像组成，共 100 个类别，每类 600 个样本。<sup>[7](https://proceedings.neurips.cc/paper_files/paper/2016/file/90e1357833654983612fb05e3ec9148c-Paper.pdf)</sup> 在实践中，一个 Prototypical Network 情景会嵌入支持集，按类别对嵌入求平均，并通过距离上的 softmax 规则对查询进行分类；一个 MAML 情景在支持集上采取梯度步并在查询集上评估，外层循环跨情景更新初始化。<sup>[2](https://proceedings.neurips.cc/paper_files/paper/2017/file/cb8da6767461f2812ae4290eac7cbc42-Paper.pdf)</sup><sup> • </sup><sup>[3](https://proceedings.mlr.press/v70/finn17a/finn17a.pdf)</sup>

## 起源

少样本学习的现代情景时代始于 Matching Networks，由奥里[奥尔·维尼亚尔斯](https://www.edgepedia.org/zh/oriol-vinyals)（Oriol Vinyals）及其同事于 2016 年在 arXiv 上提出。<sup>[9](https://doi.org/10.48550/arxiv.1606.04080)</sup> 随后是杰克·斯内尔（Jake Snell）、凯文·斯沃斯基（Kevin Swersky）和理查德·S·泽梅尔（Richard S. Zemel）于 2017 年在 arXiv 上提出的 Prototypical Networks，<sup>[10](https://doi.org/10.48550/arxiv.1703.05175)</sup> 以及[切尔西·芬恩](https://www.edgepedia.org/zh/chelsea-finn)（Chelsea Finn）、彼得·阿贝耳（Pieter Abbeel）和[谢尔盖·莱文](https://www.edgepedia.org/zh/sergey-levine)（Sergey Levine）于 2017 年在 arXiv 上提出的 Model-Agnostic Meta-Learning。<sup>[11](https://doi.org/10.48550/arxiv.1703.03400)</sup> 更早的基础包括布雷登·M·莱克（Brenden M. Lake）、鲁斯兰·萨拉胡季诺夫（Ruslan Salakhutdinov）和约书亚·B·特南鲍姆（Joshua B. Tenenbaum）于 2015 年在《科学》上发表的通过概率程序归纳进行人类水平的概念学习，<sup>[12](https://doi.org/10.1126/science.aab3050)</sup> 以及亚历克斯·格雷夫斯（Alex Graves）、格雷格·韦恩（Greg Wayne）和伊沃·达尼赫尔卡（Ivo Danihelka）于 2014 年在 arXiv 上提出的神经图灵机。<sup>[13](https://doi.org/10.48550/arxiv.1410.5401)</sup>

## 变体

**Reptile** 是一种一阶元学习算法，其工作方式是反复采样一个任务、在其上训练，并将初始化移向该任务上训练后的权重；其表现与 MAML 相当，在 Mini-ImageNet 上略好，在 Omniglot 上略差。<sup>[14](https://gwern.net/doc/www/arxiv.org/7a5a1555cc3605a9dec4d94785a924f6a659c3f9.pdf)</sup> 尼科尔（Nichol）、阿奇亚姆（Achiam）和舒尔曼（Schulman）于 2018 年在 arXiv 上提出了它。<sup>[15](https://doi.org/10.48550/arxiv.1803.02999)</sup> **Relation Networks** 端到端地学习比较度量，包括比较支持嵌入和查询嵌入的模块，而非使用预定义的距离。<sup>[16](https://www.procancer-i.eu/wp-content/uploads/2025/05/1-s2.0-S093336572400191X-main.pdf)</sup> MAML 的变体针对其计算量问题：安东尼亚乌（Antoniou）、爱德华兹（Edwards）和斯托基（Storkey）于 2018 年提出的《如何训练你的 MAML》是其中一条路线，<sup>[17](https://doi.org/10.48550/arxiv.1810.09502)</sup> 一篇综述指出了简化 MAML、使用动量更新、忽略二阶导数或使用进化算法的变体。<sup>[5](https://psycnet.apa.org/doi/10.1145/3582688)</sup> 岳（Yue）及其同事于 2020 年提出的 Interventional Few-Shot Learning 是另一个有名称的变体。<sup>[18](https://doi.org/10.48550/arxiv.2009.13000)</sup> [上下文学习](https://www.edgepedia.org/zh/in-context-learning)（in-context learning）是一种无需参数更新的变体：大型语言模型在推理时以少量演示为条件，而不进行任何参数更新。<sup>[19](https://aclanthology.org/2024.emnlp-main.64.pdf)</sup>

## 应用

[医学影像](https://www.edgepedia.org/zh/medical-imaging)是记录最充分的部署领域。那里的数据集受隐私顾虑、高数据获取成本和费力的专家标注所限，而罕见病症使大型数据集不切实际，这正是 FSL 的价值所在。<sup>[16](https://www.procancer-i.eu/wp-content/uploads/2025/05/1-s2.0-S093336572400191X-main.pdf)</sup> 一项 2026 年对 2015 至 2025 年 FSL 工作的系统综述发现，支撑大部分方法学的情景式训练范式与真实部署条件存在结构性错位，且跨任务的平均准确率不足以作为部署性能的代理指标。<sup>[20](https://link.springer.com/article/10.1007/s10462-026-11584-9)</sup>

## 局限与替代方案

**评估差距。** 标准基准从与基类相同的数据集中采样新类，因此它们之间没有域偏移，这使得评估场景不切实际。<sup>[6](https://arxiv.org/abs/1904.04232)</sup> 当支持集和查询集来自相关但不同的分布（支持-查询偏移）时，既有的 FSL 算法会遭受相当大的准确率下降；转导方法，包括最优传输结合 Prototypical Networks，可以限制这种效应。<sup>[21](https://link.springer.com/chapter/10.1007/978-3-030-86486-6_34)</sup> 较新的协议工作记录了一种采样结果取决于运气的现象：在 EuroSAT 上使用 DINOv2-small 的 1-shot 性能，根据任务采样的不同，在置信区间内从低于 50% 到高于 80% 不等；以及一种验证集幻觉：超参数在大型目标域验证集上调优，而这些验证集在真正的少样本设定中并不可用。<sup>[22](https://arxiv.org/html/2603.00478)</sup> mini-ImageNet 此后在 5-way 1-shot 上达到 95.3%，在 5-way 5-shot 上达到 98.4%，这种饱和程度限制了方法之间的进一步区分。<sup>[5](https://psycnet.apa.org/doi/10.1145/3582688)</sup>

**简单基线很强。** 监督预训练加标准微调的基线相比最先进的少样本算法表现更优，在跨域评估（miniImageNet→CUB）下达到 65.57 ± 0.70%，而 ProtoNet 为 62.02%，RelationNet 为 57.71%，MatchingNet 为 53.07%，MAML 为 51.34%。<sup>[6](https://arxiv.org/abs/1904.04232)</sup> 在域差异有限的数据集上，更深的骨干显著减小方法之间的性能差异，因此许多已报告的进展反映的是骨干选择而非算法进步。<sup>[6](https://arxiv.org/abs/1904.04232)</sup> 在 6000 个任务上配合成对统计检验，复杂迁移算法（部分微调、LoRA、适配器、提示调优、元学习）相对于简单微调的实际优势往往可以忽略不计，而预训练模型的选择才是主导因素。<sup>[22](https://arxiv.org/html/2603.00478)</sup> 一项 2026 年的系统综述同样得出结论：表示质量始终胜过算法复杂度，是性能提升的主要驱动力。<sup>[20](https://link.springer.com/article/10.1007/s10462-026-11584-9)</sup>

**大语言模型时代。** GPT-3 在推理时利用 FSL，通过接触少量演示作为条件而不更新其参数，<sup>[20](https://link.springer.com/article/10.1007/s10462-026-11584-9)</sup> 而上下文学习的定义特征就是没有参数更新，这与监督学习的反向梯度训练不同。<sup>[19](https://aclanthology.org/2024.emnlp-main.64.pdf)</sup> 更多演示不一定有帮助，甚至可能有害。<sup>[19](https://aclanthology.org/2024.emnlp-main.64.pdf)</sup> 多模态 CLIP 模型在细粒度数据集（如真菌和植物病害，其类别名称多为罕见词）上表现不佳，这是一种文本域偏移，仅使用视觉编码器可以胜过同时使用两者。<sup>[22](https://arxiv.org/html/2603.00478)</sup>

## References

1. [Generalizing from a Few Examples: A Survey on Few-Shot Learning (Wang et al., ACM Computing Surveys 2020)](https://arxiv.org/pdf/1904.05046v3.pdf)
2. [Prototypical Networks for Few-shot Learning (Snell, Swersky, Zemel, NeurIPS 2017)](https://proceedings.neurips.cc/paper_files/paper/2017/file/cb8da6767461f2812ae4290eac7cbc42-Paper.pdf)
3. [Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks (Finn et al., ICML 2017)](https://proceedings.mlr.press/v70/finn17a/finn17a.pdf)
4. [Few-Shot Learning via Embedding Adaptation with Set-to-Set Functions (FEAT, Ye et al., CVPR 2020)](https://ar5iv.labs.arxiv.org/html/1812.03664)
5. [A Comprehensive Survey of Few-shot Learning: Evolution, Applications, Challenges, and Opportunities (ACM Computing Surveys)](https://psycnet.apa.org/doi/10.1145/3582688)
6. [A Closer Look at Few-shot Classification (Chen et al., ICLR 2019)](https://arxiv.org/abs/1904.04232)
7. [Matching Networks for One Shot Learning (Vinyals et al., NeurIPS 2016)](https://proceedings.neurips.cc/paper_files/paper/2016/file/90e1357833654983612fb05e3ec9148c-Paper.pdf)
8. [Siamese Neural Networks for One-shot Image Recognition (Koch, Zemel, Salakhutdinov, ICML 2015 workshop)](https://www.cs.cmu.edu/%7Ersalakhu/papers/oneshot1.pdf)
9. [Vinyals, Oriol and colleagues (2016). Matching Networks for One Shot Learning. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1606.04080)
10. [Snell, Jake, Swersky, Kevin, Zemel, Richard S. (2017). Prototypical Networks for Few-shot Learning. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1703.05175)
11. [Finn, Chelsea, Abbeel, Pieter, Levine, Sergey (2017). Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1703.03400)
12. [Brenden M. Lake, Ruslan Salakhutdinov, Joshua B. Tenenbaum (2015). Human-level concept learning through probabilistic program induction. Science.](https://doi.org/10.1126/science.aab3050)
13. [Graves, Alex, Wayne, Greg, Danihelka, Ivo (2014). Neural Turing Machines. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1410.5401)
14. [On First-Order Meta-Learning Algorithms (Reptile; Nichol, Achiam, Schulman, arXiv 1803.02999), arXiv copy](https://gwern.net/doc/www/arxiv.org/7a5a1555cc3605a9dec4d94785a924f6a659c3f9.pdf)
15. [Nichol, Alex, Achiam, Joshua, Schulman, John (2018). On First-Order Meta-Learning Algorithms. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1803.02999)
16. [A systematic review of few-shot learning in medical imaging](https://www.procancer-i.eu/wp-content/uploads/2025/05/1-s2.0-S093336572400191X-main.pdf)
17. [Antoniou, Antreas, Edwards, Harrison, Storkey, Amos (2018). How to train your MAML. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1810.09502)
18. [Yue, Zhongqi and colleagues (2020). Interventional Few-Shot Learning. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2009.13000)
19. [A Survey on In-context Learning (EMNLP 2024)](https://aclanthology.org/2024.emnlp-main.64.pdf)
20. [Addressing data scarcity with Few-Shot Learning: a systematic literature review (Artificial Intelligence Review, 2026)](https://link.springer.com/article/10.1007/s10462-026-11584-9)
21. [Bridging Few-Shot Learning and Adaptation: New Challenges of Support-Query Shift (FSQS, ECCV Workshops)](https://link.springer.com/chapter/10.1007/978-3-030-86486-6_34)
22. [Benchmarking Few-shot Transferability of Pre-trained Models with Improved Evaluation Protocols (FewTrans, 2026)](https://arxiv.org/html/2603.00478)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › 机器学习与神经计算 › 机器学习方法 › 集成、提升与迁移方法 › 迁移学习与域适应

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/few-shot-learning

English original: https://www.edgepedia.org/few-shot-learning
