TL;DR
Standard imitation learning requires extensive demonstrations or test-time fine-tuning, struggling when an agent encounters unexpected obstacles. This paper introduces Imitator Learning (ItorL) and a method called Demo-Attention Actor-Critic (DAAC), which enables an agent to execute novel tasks out of the box from just one demonstration while dynamically dodging disturbances and recovering back to the demonstration path.
What Problem Does This Paper Address?
Traditional Imitation Learning (IL) trains policies to copy expert demonstrations. However, existing methods fall short in real-world deployment:
- Behavior Cloning (BC) suffers from compounding errors and fails abruptly when forced into unvisited states.
- Meta-IL (e.g., MAML-based) requires online gradient descent and interaction rounds to adapt to new tasks.
- One-Shot Transformer IL treats demonstrations as static context vectors and often fails to adapt when environments introduce unexpected, dynamic changes (such as a pedestrian appearing in a previously clear parking lot).
The authors define Imitator Learning (ItorL): training a generalized imitator module that can reconstruct an effective policy on-the-fly for unseen tasks from only a single demonstration, without any test-time fine-tuning, even when unexpected changes occur during execution.
Methods
To make one-shot imitator learning theoretically tractable, the paper formalizes the $\tau_\Omega$-tracebackable MDP set: environments where a goal-conditioned policy can safely guide the agent back to a successor state on the demonstration trajectory after deviations.
Building on this, the authors propose Demo-Attention Actor-Critic (DAAC), combining context-based Meta-RL with two key innovations:
[Current State s_j] ──(Query)──┐
├──> [Cross-Attention] ──> [Action Output a_j]
[Demo States s^e_i] ──(Keys)───┤ (Weights)
[Demo Actions a^e_i] ──(Values)─┘
- Demonstration-based Attention (DA) Architecture: Instead of squashing the demonstration into a single latent vector, DA explicitly breaks decision-making into two intuitive phases via cross-attention:
- Phase 1 (Which state to follow?): Matches the agent's current state (query) against demonstration states (keys) via attention dot-products.
- Phase 2 (Which action to take?): Uses the resulting attention weights over demonstration actions (values) to guide the agent's next action.
- Heuristic Stationary Imitator Reward ($R_{\text{Itor}}$): To avoid learning solely from sparse terminal rewards, the authors craft a dense reward: $$R_{\text{Itor}}(s, a) = 1 - \min\left(d(\bar{s}, s)^2 + \frac{d(\bar{a}, a)^2}{\exp(d(\bar{s}, s)^2)},\, \eta\right) + \alpha R_\omega(s, a)$$
- $\eta$ clips penalties when the agent is far away (preventing misleading gradients through impassable obstacles).
- $\exp(d(\bar{s}, s)^2)$ adaptively scales down action penalties when deviating, allowing the agent to take evasive actions without being penalized for not strictly matching expert actions.
The agent and critic are trained in simulation across tasks using Soft Actor-Critic (SAC).
Datasets
The authors evaluated DAAC on newly designed benchmarks and standard continuous control environments:
- Demo-Navigation (DN): A custom 2D continuous maze navigation benchmark ($24 \times 24$). The agent only receives 8-ray local distance observations (coordinates optionally provided). Random obstacles appear during deployment that were absent during demonstration collection. Evaluated across single-map, multi-map, and unseen map scenarios.
- Demo-Manipulation: A 3D robotic manipulation suite comprising object grasping, stacking, and collecting tasks with cluttered obstacles.
- Gymnasium Pusher and Reacher: Continuous robotic control environments with high-dimensional state spaces (joint angles, velocities, end-effector coordinates).
Key Insights and Ideas
- Demonstrations are more than context: Standard meta-RL treats demonstrations as an implicit task ID vector. DAAC treats the demonstration as a step-by-step structural reference, aligning current states to demonstration states along the diagonal of the attention map.
- Action matching must be distance-aware: Blindly enforcing behavior cloning when the agent is off-trajectory causes catastrophic collisions. Down-weighting action matching when far from the path allows the RL policy to maneuver around obstacles and rejoin the demonstration downstream.
- Zero-shot execution beats test-time adaptation: Because the agent practices returning to expert paths during training, it exhibits out-of-the-box robustness without needing expensive test-time fine-tuning.
Key Results
- Navigation in Unseen Mazes with Obstacles: On multi-map navigation with obstacles, DAAC achieved a 0.73 success rate on entirely new maps, outperforming DCRL (0.46), Transformer-BC (0.21), and Context-based Meta-RL (0.33).
- Robotic Manipulation: In multi-task manipulation, DAAC reached 0.89 (seen demos) and 0.45 (unseen demos), whereas baseline methods (DCRL, TRANS-BC, CbMRL) struggled to exceed 0.10. On Reacher and Pusher, DAAC achieved 0.95 and 0.94 success rates on new demonstrations.
- Log-Linear Scaling: Scaling up the demonstration dataset size and model parameters (up to 19.4M parameters) showed consistent log-linear performance gains, especially in challenging coordinate-free settings.
Limitations and Future Work
- Partially Observable Settings (No Coordinates): In maze navigation without global coordinates, performance drops noticeably (success rates around 40–58%), as identical local observations across different maze corridors create severe aliasing (a POMDP challenge).
- Inference Complexity: The cross-attention mechanism scales quadratically with demonstration length, requiring compression or windowing for long trajectories.
- Faraway States: When perturbations place the agent too far from the demonstration (violating tracebackability, e.g., initial state offset $> 2.4$ units in mazes), attention matching degenerates and success rates drop linearly.
Summary updated