Robust Offline Imitation Learning Through State-level Trajectory Stitching

Shuze Wang, Yunpeng Mei, Hongjie Cao, Yetian Yuan, Gang Wang, Jian Sun, Jie Chen

TL;DR

The authors propose State-based Behavior Retrieval (SBR), a framework that improves robot learning by "stitching" together useful fragments from low-quality, unlabeled datasets to augment scarce expert demonstrations. By using a simplified world model to identify transitions that lead back to expert states, the method significantly improves a robot's ability to recover from errors and generalize to new situations.

What Problem Does This Paper Address?

Imitation Learning (IL) is a powerful way to teach robots tasks by showing them expert demonstrations. However, it faces two major hurdles:

  1. Data Scarcity: High-quality expert data is expensive and time-consuming to collect.
  2. Covariate Shift: When a robot trained only on expert data makes a tiny mistake, it enters a state it has never seen before. Because it doesn't know how to recover, the error compounds, leading to total task failure.

While there is often plenty of "suboptimal" data available (failed attempts, random movements, or data from different tasks), simply training on it leads the robot to mimic bad habits. This paper tackles the challenge of how to "mine" these imperfect datasets for the specific transitions that help a robot stay on track or return to the expert's path.

Methods

The core of the paper is the State-based Behavior Retrieval (SBR) framework, which operates in three main phases:

  1. Representation Learning (The World Model): Instead of just looking at raw images, the authors train a simplified world model (encoder, dynamics predictor, and decoder) on the entire dataset (expert + suboptimal). This model learns a "latent space" that captures the underlying physics and rules of the environment.
  2. State-based Search and Extraction:
    • Similarity Metric: The system calculates how "similar" a state in the suboptimal data is to an expert state based on their distance in the latent space.
  3. Trajectory Stitching: This is the "secret sauce." The algorithm identifies states in the suboptimal data that are very close to expert states. It then traces backward through the suboptimal trajectories to find the actions that led to that "near-expert" state.
  4. By doing this, it creates "synthetic" trajectories that effectively teach the agent: "If you find yourself here (off-track), do this to get back to the expert path."
  5. Policy Training: The final robot policy is trained using standard Behavioral Cloning (BC) on a combined dataset of the original expert demos plus these newly "stitched" recovery segments.

Datasets

The authors evaluated their method on both simulated and physical platforms:

  • D4RL Benchmark: A standard suite for offline reinforcement learning, covering Navigation (Maze2D), Locomotion (Hopper, Walker2d, Ant, HalfCheetah), and Manipulation (Adroit tasks like Hammer, Door, Pen, and Relocate).
  • Real-world Robotic Tasks: Using a UR5 robotic arm, they tested three complex tasks:
  • Pour Tea: Grasping a teapot and pouring into a specific cup.
  • Clean Whiteboard: Using an eraser to remove marker stains.
  • Pick Pepper: Picking a pepper and placing it in a basket.
  • Note: For real-world tasks, they used only 20 expert demonstrations, a very small amount compared to typical deep learning requirements.

Key Insights and Ideas

  • Suboptimal Data is a Goldmine for Recovery: A failed demonstration isn't just "bad data." The early stages of a failure often look like an expert's actions, and the transitions out of a failure provide the exact "recovery" data that expert-only datasets lack.
  • State-level vs. Trajectory-level: Previous methods often filtered entire trajectories. SBR works at the state-action pair level, allowing for much more flexible "stitching." It can grab a 5-second window of a 30-second "failed" video if those 5 seconds contain a useful recovery maneuver.
  • World Models for Similarity: Using a dynamics-aware world model to define "similarity" is more robust than using simple image-based or VAE-based distances. It ensures that states are considered similar because they behave similarly in the environment, not just because they look similar.

Key Results

  • D4RL Performance: SBR outperformed state-of-the-art baselines (like DemoDICE, DWBC, and ILID) on 7 out of 11 tasks. It was particularly dominant in manipulation tasks (e.g., scoring 95.6 on pen-cloned-v1 vs. the next best baseline at 75.6).
  • Real-world Success: In physical robot experiments, SBR achieved success rate improvements of over 23% across downstream tasks compared to training on expert data alone.
  • Robustness to Scarcity: Ablation studies showed that even when expert trajectories were reduced from 50 down to 10, SBR maintained competitive performance, whereas standard Behavioral Cloning (BC-exp) collapsed.

Limitations and Future Work

  • Encoder Sensitivity: The method relies heavily on the state similarity metric. If the world model's encoder is not well-trained or is insensitive to small but task-critical features (like the state of a tiny latch), the retrieval process might select irrelevant data.
  • Computational Overhead: Training a world model and performing a state-based search across large offline datasets adds a layer of complexity and compute time compared to simple BC.
  • Future Directions: The authors suggest exploring more effective similarity metrics and investigating how this "stitching" approach could be applied to even more diverse, multi-task datasets.

Summary updated

BibTeX
@inproceedings{wang2025robust,
  author = {Shuze Wang and Yunpeng Mei and Hongjie Cao and Yetian Yuan and Gang Wang and Jian Sun and Jie Chen},
  title = {{Robust Offline Imitation Learning Through State-level Trajectory Stitching}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=Bo31mjrrQG},
}

Loading related content...

Figure