# 模仿学习

模仿学习通过从专家演示中学习观测与动作之间的映射来训练智能体执行任务，而不是依赖人工指定的奖励函数。<sup>[1](https://dl.acm.org/doi/10.1145/3054912)</sup> 它介于监督学习与强化学习之间：最简单的形式——[行为克隆](https://www.edgepedia.org/zh/behavior-cloning)——是在状态-动作对上的监督学习；逆强化学习则反过来恢复专家似乎正在优化的奖励。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup> 这种方法广泛应用于机器人和游戏领域。<sup>[1](https://dl.acm.org/doi/10.1145/3054912)</sup>

| 关键事实 | 细节 |
|---|---|
| 输出 | 给出动作分布的随机策略 \( \pi(a \mid s) \)（行为克隆），或奖励函数（逆强化学习）；从状态到动作的确定性映射是一种特例<sup>[3](https://arxiv.org/pdf/2404.19456v2.pdf)</sup> |
| 核心保证 | 对于每步误差ε和时域T，行为克隆的回报缺口为Θ(εT²)，在专家状态分布下度量；在学习器自身状态分布下为O(εT)<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup> |
| 对抗目标 | GAIL最小化学习器与专家占用度量之间的詹森-香农散度<sup>[4](https://proceedings.neurips.cc/paper_files/paper/2016/file/cc7e2b878868cbae992d1fb743995d8f-Paper.pdf)</sup> |
| 典型数据 | Robomimic基准：演示数量因划分而异，PH划分每任务200条轨迹，MH划分每任务300条；扩散策略从200次人类遥操作演示中在Lift和Can上达到100%成功率<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup> |
| 计算 | 用BC-RNN和扩散策略在五个Robomimic仿真任务上对一个新算法进行基准测试约需2个GPU日<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup> |
| 现代部署 | 语言模型的监督微调是行为克隆的一个实例：上下文是状态，下一个词元是动作<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup> |

## 工作原理

形式化设置是无奖励函数的[马尔可夫决策过程](https://www.edgepedia.org/zh/markov-decision-process)。策略是将状态映射为动作的函数，演示则是从教师轨迹中取出的状态-动作对。<sup>[3](https://arxiv.org/pdf/2404.19456v2.pdf)</sup> 给定来自专家策略π*的演示Ξ = {ξ₁, ..., ξ_D}，问题是在无法获得奖励的情况下找到模仿 \( \pi^{*} \) 的策略。<sup>[6](https://web.stanford.edu/class/cs237b/pdfs/lecture/cs237b_lecture_12.pdf)</sup>

行为克隆通过最大化对数似然——也就是最小化交叉熵——将π_θ(a|s)拟合到演示对；它既不需要转移模型，也不需要奖励。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup> 最小化散度的变体则匹配占用度量，即策略诱导的状态与动作分布：GAIL的目标是找到这样的策略，使其占用度量与专家占用度量之间的詹森-香农散度减去熵奖励后的值最小。<sup>[4](https://proceedings.neurips.cc/paper_files/paper/2016/file/cc7e2b878868cbae992d1fb743995d8f-Paper.pdf)</sup> 逆强化学习把最优控制的箭头反向运行：对于线性奖励R(x,u) = wᵀφ(x,u)，奖励权重通过演示上的最大似然来估计。<sup>[6](https://web.stanford.edu/class/cs237b/pdfs/lecture/cs237b_lecture_12.pdf)</sup>

理论量化了误差累积问题：在专家状态分布下每步不一致概率为ε时，行为克隆的回报缺口为Θ(εT²)，而在学习器自身状态分布下度量为 \( O(\varepsilon T) \)。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup>

## 实施方式

实践者首先收集演示，通常通过遥操作或虚拟现实录制；[Robomimic](https://www.edgepedia.org/zh/robomimic)的PH划分是来自单个专家遥操作者的200条演示，而一项基于扩散的研究使用了566条VR采集的厨房轨迹。<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup><sup> • </sup><sup>[7](https://arxiv.org/pdf/2301.10677)</sup> 提取状态-动作对，选择模型类别，并通过监督似然最大化训练策略。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup>

评估采用闭环展开成功率，在Robomimic中对每个任务取50次展开的平均。<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup> 如果策略偏离演示分布，可以加入一轮交互式纠正：DAgger展开当前策略，请专家为访问到的状态打标签，把新标注的数据聚合进数据集，然后重新训练。<sup>[8](https://algorithmsbook.com/files/chapter-18.pdf)</sup>

## 起源

最早广为人知的系统是ALVINN，一个用于卡内基梅隆大学（CMU）的NAVLAB车辆道路跟随的三层反向传播网络。<sup>[9](https://proceedings.neurips.cc/paper_files/paper/1988/file/812b4ba287f5ee0bc9d43bbf5bbe87fb-Paper.pdf)</sup> 迪恩·A·波默洛（Dean A. Pomerleau）在1991年《神经计算》论文中描述了用于自主导航的神经网络高效训练。<sup>[10](https://doi.org/10.1162/neco.1991.3.1.88)</sup> 逆问题在控制理论中有更早的根源：P·莫伊兰（P. Moylan）和B·安德森（B. Anderson）1973年发表于《IEEE自动控制汇刊》的论文研究了非线性调节器理论和逆最优控制问题。<sup>[11](https://doi.org/10.1109/tac.1973.1100365)</sup> “逆强化学习”一词来自吴恩达（Andrew Y. Ng）和斯图尔特·罗素（Stuart Russell）2000年的论文《逆强化学习算法》（Algorithms for Inverse Reinforcement Learning），发表于ICML '00。<sup>[12](https://dl.acm.org/doi/10.1145/1015330.1015430)</sup> 后来的里程碑包括DAgger——由斯特凡·罗斯（Stephane Ross）、杰弗里·J·戈登（Geoffrey J. Gordon）和J·安德鲁·巴格内尔（J. Andrew Bagnell）于2010年在arXiv上报告，将模仿学习归约为无遗憾在线学习<sup>[13](https://doi.org/10.1184/r1/6550949)</sup>；以及生成对抗模仿学习——由乔纳森·何（Jonathan Ho）和[斯特凡诺·埃尔蒙](https://www.edgepedia.org/zh/stefano-ermon)（Stefano Ermon）于2016年在arXiv上报告。<sup>[14](https://doi.org/10.48550/arxiv.1606.03476)</sup>

## 变体

**交互式方法**在训练期间查询专家。DAgger迭代策略展开、专家重新标注和在聚合数据集上重新训练；更早的一类算法将学习器策略从专家策略缓慢混合到学习到的策略。<sup>[13](https://doi.org/10.1184/r1/6550949)</sup><sup> • </sup><sup>[15](https://proceedings.mlr.press/v9/ross10a.html)</sup>

**对抗式方法**用判别器匹配行为。GAIL交替进行判别器上的Adam步骤和TRPO策略步骤，判别器充当局部代价。<sup>[4](https://proceedings.neurips.cc/paper_files/paper/2016/file/cc7e2b878868cbae992d1fb743995d8f-Paper.pdf)</sup> 一个基于模型的变体使用前向模型使计算完全可微，从而能够获得精确的判别器梯度。<sup>[16](https://proceedings.mlr.press/v70/baram17a.html)</sup> 判别器-行动者-评价者（DAC）使用修改后的GAIL判别器来恢复对动力学鲁棒的奖励函数。<sup>[17](https://arxiv.org/pdf/1809.02925)</sup>

**奖励恢复与匹配方法**避免对抗训练。IQ-Learn学习单个Q函数，隐式表示奖励和策略。<sup>[18](https://proceedings.neurips.cc/paper/2021/file/210f760a89db30aa72ca258a3483cc7f-Paper.pdf)</sup> SQIL由西达尔特·雷迪（Siddharth Reddy）、安卡·D·德拉甘（Anca D. Dragan）和[谢尔盖·莱文](https://www.edgepedia.org/zh/sergey-levine)（Sergey Levine）于2019年在arXiv上提出，将模仿转化为带稀疏奖励的强化学习。<sup>[19](https://doi.org/10.48550/arxiv.1905.11108)</sup> 戈库尔·斯瓦米（Gokul Swamy）及其同事2021年的博弈论框架将算法分类为奖励匹配或动作价值匹配，并产生三个模板：AdVIL、AdRIL和DAeQuIL。<sup>[20](https://doi.org/10.48550/arxiv.2103.03236)</sup> 进一步扩展包括结合事后重标注的目标条件GAIL<sup>[21](https://proceedings.neurips.cc/paper/2019/file/c8d3a760ebab631565f8509d84b3b3f1-Paper.pdf)</sup>、在没有专家动作的情况下从观测中进行模仿<sup>[22](https://ar5iv.labs.arxiv.org/html/2309.02473)</sup>，以及乔纳森·张（Jonathan Chang）及其同事的基于模型的MILO框架——该框架使用来自次优行为策略的离线数据，且只需要覆盖专家的轨迹。<sup>[23](https://doi.org/10.48550/arxiv.2106.03207)</sup>

**扩散策略和Transformer策略**对完整的多模态动作分布建模，同时避免GAN不稳定性。<sup>[7](https://arxiv.org/pdf/2301.10677)</sup> 使用Transformer的动作分块在单次前向传播中预测未来动作块，以实现低延迟控制，其推理成本低于迭代扩散去噪。<sup>[24](https://www.tandfonline.com/doi/full/10.1080/01691864.2026.2726690)</sup>

## 应用

机器人操作是主要基准测试场：Robomimic的五个任务套件（Lift、Can、Square、Transport、ToolHang）在robosuite/MuJoCo中仿真。<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup> 自动驾驶是最初的应用，从ALVINN的道路跟随<sup>[9](https://proceedings.neurips.cc/paper_files/paper/1988/file/812b4ba287f5ee0bc9d43bbf5bbe87fb-Paper.pdf)</sup>到学徒学习驾驶仿真——其中来自单条1200样本轨迹的专家特征足以在25 m/s下模仿五种驾驶风格。<sup>[12](https://dl.acm.org/doi/10.1145/1015330.1015430)</sup> 游戏是DAgger的早期试验台，包括Super Tux Kart转向和Super Mario Bros<sup>[13](https://doi.org/10.1184/r1/6550949)</sup>；基于扩散的行为克隆已在《[反恐精英：全球攻势](https://www.edgepedia.org/zh/counter-strike-global-offensive)》中建模人类玩法。<sup>[7](https://arxiv.org/pdf/2301.10677)</sup> 在语言建模中，对精选回复进行监督微调就是应用于下一词元预测的行为克隆。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup>

## 局限与替代方案

**协变量偏移**是核心失败模式：学习器在专家状态上训练，却在其自身动作诱导的状态上测试；一旦漂移到分布外状态，就无法回到演示状态。<sup>[22](https://ar5iv.labs.arxiv.org/html/2309.02473)</sup> 一个FrozenLake实验使这一点具体化：在演示对上零误差的克隆策略仅达到专家成功率的大约四分之一。<sup>[2](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)</sup> 演示通常也是次优、含噪且多模态的，而单模态模型迫使研究人员转向小规模或经过大量整理的数据集；GAIL是模式寻求的，会遭受模式崩溃，只捕获行为的一个子集。<sup>[25](https://www.dfki.de/fileadmin/user_upload/import/16768_2408.04380v3.pdf)</sup><sup> • </sup><sup>[26](https://arxiv.org/pdf/1707.02747v2.pdf)</sup> 对抗奖励带有偏差：正奖励 \( -\log(1 - D(s,a)) \) 将智能体推向存活，负奖励 \( \log(D(s,a)) \) 推向提前终止。<sup>[27](https://proceedings.mlr.press/v222/arulkumaran24a/arulkumaran24a.pdf)</sup>

与替代方案相比，比较是经验性的，而非已有定论。在Robomimic上，PH数据上的BC-RNN在每个任务上匹配或击败所测试的每一种离线强化学习方法。<sup>[5](https://www.roboticscenter.ai/datasets/robomimic)</sup> 然而，在足够嘈杂的次优数据上，离线强化学习可以胜过给定专家数据的行为克隆，尤其是在长时域问题上；保守离线强化学习达到Õ(√H)次优性。<sup>[28](https://ar5iv.labs.arxiv.org/html/2204.05618)</sup> 常见的补救措施是先进行行为克隆阶段，然后进行强化学习微调。<sup>[25](https://www.dfki.de/fileadmin/user_upload/import/16768_2408.04380v3.pdf)</sup> [评估](https://www.edgepedia.org/zh/evaluation)本身缺乏标准化，使得不同方法之间的比较困难。<sup>[3](https://arxiv.org/pdf/2404.19456v2.pdf)</sup>

## References

1. [Imitation Learning: A Survey of Learning Methods](https://dl.acm.org/doi/10.1145/3054912)
2. [Learning from Demonstrations – Dive into Deep Learning](https://d2l.smola.org/chapter_reinforcement-learning/imitation.html)
3. [A Survey of Imitation Learning Methods, Environments and Metrics](https://arxiv.org/pdf/2404.19456v2.pdf)
4. [Generative Adversarial Imitation Learning (Ho & Ermon, NeurIPS 2016)](https://proceedings.neurips.cc/paper_files/paper/2016/file/cc7e2b878868cbae992d1fb743995d8f-Paper.pdf)
5. [Robomimic: Canonical Imitation Learning Benchmark](https://www.roboticscenter.ai/datasets/robomimic)
6. [Imitation Learning (Stanford CS237B lecture notes)](https://web.stanford.edu/class/cs237b/pdfs/lecture/cs237b_lecture_12.pdf)
7. [Diffusion models as observation-to-action models for behaviour cloning (arXiv 2301.10677, 'Diffusion BC')](https://arxiv.org/pdf/2301.10677)
8. [Imitation Learning (Algorithms for Decision Making, Ch. 18)](https://algorithmsbook.com/files/chapter-18.pdf)
9. [ALVINN: An Autonomous Land Vehicle in a Neural Network](https://proceedings.neurips.cc/paper_files/paper/1988/file/812b4ba287f5ee0bc9d43bbf5bbe87fb-Paper.pdf)
10. [Dean A. Pomerleau (1991). Efficient Training of Artificial Neural Networks for Autonomous Navigation. Neural Computation.](https://doi.org/10.1162/neco.1991.3.1.88)
11. [P. Moylan, B. Anderson (1973). Nonlinear regulator theory and an inverse optimal control problem. IEEE Transactions on Automatic Control.](https://doi.org/10.1109/tac.1973.1100365)
12. [Apprenticeship learning via inverse reinforcement learning](https://dl.acm.org/doi/10.1145/1015330.1015430)
13. [Ross, Stephane, Gordon, Geoffrey J., Bagnell, J. Andrew (2010). A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning. arXiv (Cornell University).](https://doi.org/10.1184/r1/6550949)
14. [Ho, Jonathan, Ermon, Stefano (2016). Generative Adversarial Imitation Learning. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1606.03476)
15. [Efficient Reductions for Imitation Learning](https://proceedings.mlr.press/v9/ross10a.html)
16. [End-to-End Differentiable Adversarial Imitation Learning (Baram, Anschel, Caspi, Mannor, ICML 2017)](https://proceedings.mlr.press/v70/baram17a.html)
17. [Discriminator-Actor-Critic (DAC) (arXiv 1809.02925)](https://arxiv.org/pdf/1809.02925)
18. [IQ-Learn: Inverse soft-Q Learning for Imitation (NeurIPS 2021)](https://proceedings.neurips.cc/paper/2021/file/210f760a89db30aa72ca258a3483cc7f-Paper.pdf)
19. [Reddy, Siddharth, Dragan, Anca D., Levine, Sergey (2019). SQIL: Imitation Learning via Reinforcement Learning with Sparse Rewards. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1905.11108)
20. [Swamy, Gokul and colleagues (2021). Of Moments and Matching: A Game-Theoretic Framework for Closing the Imitation Gap. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2103.03236)
21. [Goal-conditioned Imitation Learning / goalGAIL (NeurIPS 2019)](https://proceedings.neurips.cc/paper/2019/file/c8d3a760ebab631565f8509d84b3b3f1-Paper.pdf)
22. [A Survey of Imitation Learning: Algorithms, Recent Developments, and Challenges](https://ar5iv.labs.arxiv.org/html/2309.02473)
23. [Chang, Jonathan D. and colleagues (2021). Mitigating Covariate Shift in Imitation Learning via Offline Data Without Great Coverage. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.2106.03207)
24. [Hybrid-ACT: scaling robot imitation learning under few-demonstration settings with vector-quantized cross-attention](https://www.tandfonline.com/doi/full/10.1080/01691864.2026.2726690)
25. [A Survey on Learning from Multimodal Demonstrations with Deep Generative Models](https://www.dfki.de/fileadmin/user_upload/import/16768_2408.04380v3.pdf)
26. [Robust Imitation of Diverse Behaviors (arXiv 1707.02747)](https://arxiv.org/pdf/1707.02747v2.pdf)
27. [A Pragmatic Look at Deep Imitation Learning](https://proceedings.mlr.press/v222/arulkumaran24a/arulkumaran24a.pdf)
28. [When Should We Prefer Offline Reinforcement Learning Over Behavioral Cloning?](https://ar5iv.labs.arxiv.org/html/2204.05618)

---
*Initially written Sep 29, 2026 · Reviewed: Sep 30, 2026 · Edited: Sep 30, 2026; Oct 21, 2026 · Last review: Sep 30, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/imitation-learning

English original: https://www.edgepedia.org/imitation-learning
