CoDE: Collocation for Demonstration Encoding

Mandy Xie, Anqi Li, Karl Van Wyk, Frank Dellaert, Byron Boots, Nathan D. RatliffarXiv 2021

Abstract

Imitation learning (IL) is a frequently used approach for data-efficient policy learning. Many IL methods, such as Dataset Aggregation (DAgger), combat challenges like distributional shift by interacting with oracular experts. Unfortunately, assuming access to oracular experts is often unrealistic in practice; data used in IL frequently comes from offline processes such as lead-through or teleoperation. In this paper, we present a novel imitation learning technique called Collocation for Demonstration Encoding (CoDE) that operates on only a fixed set of trajectory demonstrations. We circumvent challenges with methods like back-propagation-through-time by introducing an auxiliary trajectory network, which takes inspiration from collocation techniques in optimal control. Our method generalizes well and more accurately reproduces the demonstrated behavior with fewer guiding trajectories when compared to standard behavioral cloning methods. We present simulation results on a 7-degree-of-freedom (DoF) robotic manipulator that learns to exhibit lifting, target-reaching, and obstacle avoidance behaviors.

Introduction

Imitation Learning (IL) is a powerful paradigm for teaching robots complex behaviors without the need for manual reward engineering. However, the most straightforward approach, Behavior Cloning (BC), suffers from a critical issue known as covariate shift. In BC, small errors in the robot's predicted actions accumulate over time, leading the robot into states that were not present in the training data. Once in these unfamiliar states, the policy's performance degrades rapidly, often leading to catastrophic failure.

While interactive methods like DAgger can mitigate this by querying an expert during training, such experts are rarely available in real-world offline settings. Furthermore, a fundamental mismatch often exists between the demonstration data (which may be noisy or jerky) and the desired policy (which should be smooth and stable). Standard BC attempts to average these inconsistencies, resulting in a "blurry" policy that fails to capture the underlying task dynamics.

Methodology: Collocation for Demonstration Encoding

To address these challenges, we introduce Collocation for Demonstration Encoding (CoDE). Inspired by collocation methods in optimal control, CoDE jointly optimizes the robot's policy alongside a set of "auxiliary trajectories." These auxiliary trajectories act as a parameterized bridge between the raw, potentially inconsistent demonstrations and the learned policy.

Conceptual comparison of Behavior Cloning (BC) and CoDE. CoDE uses auxiliary trajectories to bridge the gap between demonstrations and the learned policy.

The optimization process in CoDE balances two primary objectives:

  1. Alignment: Ensuring the auxiliary trajectories remain faithful to the original expert demonstrations.
  2. Consistency: Ensuring the learned policy can accurately reproduce these auxiliary trajectories with minimal one-step prediction error.

By allowing the auxiliary trajectories to be learnable variables, the system can effectively "smooth out" noise and dynamics mismatches. The auxiliary path absorbs the inconsistencies in the raw data, presenting the policy learner with a version of the task that is physically achievable within its constraints. This simultaneous optimization also avoids the numerical instabilities, such as vanishing gradients, often associated with backpropagation-through-time (BPTT).

Experimental Evaluation

We evaluated CoDE using a simulated 7-degree-of-freedom (DoF) Franka robotic manipulator on two distinct tasks:

  • Lifting & Reaching: The robot must lift its arm to reach a randomized 3D goal position.
  • Obstacle Avoidance: The robot must navigate to a goal while avoiding a randomly placed and oriented cylindrical obstacle.

Demonstrations were generated using a Riemannian Motion Policy (RMP) system. To assess sample efficiency, we trained models on datasets ranging from as few as 13 to as many as 300 trajectories.

Results and Discussion

CoDE demonstrated significant improvements over standard BC and BC with noise injection across all metrics. A key finding is CoDE's superior sample efficiency; the model trained on just 10 trajectories outperformed standard BC variants trained on over 150 trajectories.

Rollout RMSE vs. Horizon. CoDE maintains a nearly flat error rate over time, whereas standard BC errors compound quickly.

Quantitatively, CoDE's performance was markedly more stable:

  • Error Accrual: As shown in the figure above, while BC's error grows exponentially over the time horizon, CoDE’s rollout error remains nearly flat.
  • Accuracy and Safety: In the lifting task, CoDE achieved a mean target error of 0.01m, significantly lower than BC's 0.89m. In the obstacle avoidance task, CoDE reduced the collision rate from 49% (BC) to just 5.3%.
  • Robustness: CoDE exhibited much lower variance across different random seeds, indicating a more reliable training process for real-world deployment.

Conclusion and Future Work

CoDE provides a robust framework for offline imitation learning by treating the demonstration encoding as a joint optimization problem. By introducing auxiliary trajectories, it bridges the gap between messy real-world data and the requirements of a stable robot policy.

Currently, CoDE requires a known dynamics model to calculate prediction errors. Future work will explore extending the framework to scenarios where the dynamics model is learned simultaneously with the policy, further reducing the reliance on prior system knowledge.

Paper Citation: Mandy Xie, Anqi Li, Karl Van Wyk, Frank Dellaert, Byron Boots, Nathan Ratliff. "Imitation Learning via Simultaneous Optimization of Policies and Auxiliary Trajectories." arXiv:2105.03019v2 [cs.RO], 2021.

Summary updated

BibTeX
@misc{xie2021code,
  author = {Mandy Xie and Anqi Li and Karl Van Wyk and Frank Dellaert and Byron Boots and Nathan D. Ratliff},
  title = {{CoDE: Collocation for Demonstration Encoding}},
  year = {2021},
  eprint = {2105.03019},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.03019},
}
Figure