Deep Demonstration Tracing: Learning Generalizable Imitator Policy for Runtime Imitation from a Single Demonstration

Xiong-Hui Chen, Junyin Ye, Hang Zhao, Yi-Chen Li, Xu-Hui Liu, Haoran Shi, Yu-Yan Xu, Zhihao Ye, Si-Hang Yang, Yang Yu, Anqi Huang, Kai Xu, Zongzhang ZhangICML 2024

TL;DR

Deep Demonstration Tracing (DDT) is a new framework for one-shot imitation learning that enables agents to follow a single demonstration even in dynamic environments with unforeseen obstacles. By combining a novel "demonstration transformer" architecture with meta-reinforcement learning, DDT allows agents to adaptively "trace" an expert's path and recover gracefully when environmental changes force them off-track.

What Problem Does This Paper Address?

One-shot imitation learning (OSIL) aims to teach an agent a new task using only a single expert demonstration. While existing methods work well in static settings, they often crumble in the real world where environments are dynamic.

Navigating around unexpected obstacles

Imagine a valet-parking robot following a recorded human path. If a new truck is suddenly parked in the middle of that path, a traditional OSIL agent—which usually relies on simple behavior cloning—might collide with the truck or get "lost" once it deviates from the expert's exact coordinates. The challenge is creating an imitator that doesn't just blindly mimic actions but understands how to "trace" the demonstration: navigating around unexpected changes and then finding its way back to the original plan.

Methods

The authors introduce Deep Demonstration Tracing (DDT), which moves away from simple mimicry toward a three-stage decision-making paradigm:

The Identify-Analyze-Trace architecture of DDT
  1. Identify: Determine which states in the demonstration are most relevant to the agent's current situation.
  2. Analyze: Examine how the expert behaved in those specific states.
  3. Trace: Combine the agent's current observations with the expert's patterns to take an optimal action that progresses the task.

To implement this, they designed a Demonstration Transformer architecture. Unlike standard transformers, this model uses a specialized attention mechanism to query the demonstration for "expert behavior patterns" and fuses them with the agent's current state.

Crucially, DDT is trained using Context-based Meta-Reinforcement Learning (meta-RL) rather than just supervised learning. By using a custom "imitation reward," the agent is encouraged to explore and learn "common sense" behaviors—like obstacle avoidance—that aren't explicitly shown in the demonstration. This allows the agent to learn how to recover and return to the demonstrated path if it gets pushed away by a disturbance.

Key Insights and Ideas

  • Architecture as Inductive Bias: Instead of relying solely on complex loss functions, the authors built the "Identify-Analyze-Trace" logic directly into the neural network's structure. This encourages the model to naturally look for correspondences in the demo.
  • The Power of "Recoverability": The paper introduces the concept of "recoverable MDP sets." Theoretically, they show that if an environment allows an agent to return to the expert's path after a deviation, a single demonstration is mathematically sufficient for success.
  • Beyond Behavior Cloning: The "aha moment" is that imitation learning in dynamic worlds is actually a meta-RL problem. The demonstration provides the context for the task, but RL provides the robustness needed to handle the "what-ifs" that the expert never encountered.

Datasets and Key Results

The researchers evaluated DDT across several challenging domains, including a new VPAM (Valet Parking Assist in Maze) benchmark, Meta-World robotics tasks with self-built disturbances (e.g., accidentally dropping a grasped block), and standard Gymnasium control tasks.

DDT significantly outperformed state-of-the-art baselines (like DCRL and Trans4OSIL) across all tasks:

  • Robustness to Change: In Meta-World tasks with disturbances, DDT maintained a success rate of 0.61, while the best baseline dropped to 0.12.
  • Generalization: In the VPAM maze, when moving from training to environments with unforeseen obstacles, DDT's performance only degraded by 15%, compared to a 20% to 52% drop for other methods.
  • Scaling Potential: The authors found that DDT's performance increases log-linearly with both the amount of demonstration data and the number of model parameters, suggesting it could serve as a foundation for larger "generalist" imitator agents.

Limitations and Future Work

The primary limitation involves "Faraway States." If an unforeseen change (like a new wall) pushes the agent so far from the expert's path that it cannot "see" any relevant demo states with its local sensors, it may fail to recover. The authors note that without global map information or prior knowledge, a perfect recovery in these extreme cases is currently impossible.

Future work includes extending DDT to handle visual inputs (pixels) directly and exploring how this "tracing" mechanism can be integrated into large-scale generalist agents capable of handling hundreds of diverse robotic tasks.

Summary updated

BibTeX
@inproceedings{chen2024deep,
  author = {Xiong-Hui Chen and Junyin Ye and Hang Zhao and Yi-Chen Li and Xu-Hui Liu and Haoran Shi and Yu-Yan Xu and Zhihao Ye and Si-Hang Yang and Yang Yu and Anqi Huang and Kai Xu and Zongzhang Zhang},
  title = {{Deep Demonstration Tracing: Learning Generalizable Imitator Policy for Runtime Imitation from a Single Demonstration}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=DJdVzxemdA},
}
Figure