Behavioral Cloning via Search in Video PreTraining Latent Space

Federico Malato, Florian Leopold, Amogh Raut, Ville Hautamaki, Andrew Melnik

TL;DR

Instead of training a policy to output actions from scratch, this paper reframes imitation learning in Minecraft as an online nearest-neighbor search over expert demonstrations. By mapping visual trajectories into the latent space of a pretrained Video PreTraining (VPT) model, the agent copies expert actions until its visual trajectory diverges from the demonstration, triggering a new search.

What Problem Does This Paper Address?

In complex open-world environments like Minecraft, standard deep reinforcement learning (DRL) often fails because tasks lack dense numerical reward signals. In the MineRL BASALT competition, agents are evaluated on open-ended tasks (such as building a house or catching a pet) judged purely on human-like execution without explicit reward functions.

While Behavioral Cloning (BC) can learn directly from human demonstrations, it notoriously suffers from compounding errors: minor deviations from the training distribution accumulate rapidly, stranding the agent in unfamiliar states where it fails catastrophically. The authors investigate how an agent can leverage a large library of expert trajectories on the fly without succumbing to this drift.

Methods

The authors cast control as a metric search problem over a latent space of "situations"—defined as short temporal sequences of consecutive observation-action pairs:

  1. Latent Encoding with VPT: The agent uses an existing Video PreTraining (VPT) model consisting of an IMPALA CNN image encoder followed by four transformer blocks (with an internal 128-step key-value memory). Individual video frames are converted into 1024-dimensional vectors capturing both spatial and temporal context.
  2. Trajectory Matching: The entire dataset of human demonstrations is pre-encoded into this latent space. During evaluation, the agent encodes its recent observation history and searches for the nearest situation vector in the demonstration library using $L_1$ distance.
  3. Action Replay and Drift Monitoring: The agent blindly copies the reference sequence of mouse and keyboard actions frame-by-frame. At each step, it monitors the $L_1$ distance between its current visual state and the reference trajectory.
  4. Search Triggers: A new nearest-neighbor search is launched if either:
  5. The $L_1$ distance exceeds a divergence threshold ($L_1 \ge 0.35$), indicating the agent has drifted off-course or hit an obstacle.
  6. The reference trajectory has been followed for more than 128 steps (a time-based window limit).
  7. Initial Warm-up: Because the transformer embedding relies on a temporal sequence, the agent remains stationary for the first second of an episode to accumulate a stable initial state before initiating its first search.
       Current Game State ---> [ VPT Encoder ] ---> Current Embedding
                                                         |
                                                    L1 Distance > 0.35
                                                    or > 128 steps?
                                                         |
                                           +-------------+-------------+
                                           | YES                       | NO
                                           v                           v
                           [ Search Nearest Neighbor ]      [ Step Forward in ]
                           [   in Expert Database    ]      [ Reference Track ]
                                           |                           |
                                           +------------>+<------------+
                                                         |
                                                         v
                                              Execute Copied Action

Datasets

The authors evaluate their approach on the official MineRL BASALT 2022 challenge dataset, which contains human gameplay trajectories across four distinct tasks:

  • FindCave
  • VillageAnimalPen (catch a pet)
  • MakeWaterfall
  • BuildVillageHouse

No new datasets or reward annotations were introduced.

Key Insights and Ideas

  • Physical Blockages Accelerate Latent Drift: When an agent gets stuck against a wall or obstacle while executing a copied action sequence, its observed visual embeddings rapidly decouple from the moving reference trajectory. Feature divergence naturally acts as an automatic, domain-agnostic failure detector.
  • Pretrained Representations as Metric Spaces: Without any task-specific fine-tuning or explicit policy gradients, the VPT latent space is structured enough that raw $L_1$ distances effectively capture semantically meaningful situational similarities.
  • Demonstration Replay over Direct Regression: Treating BC as continuous retrieval avoids the smoothing and mode-averaging problems common when training standard neural networks on multi-modal human action distributions.

Key Results

  • Competition Standing: The approach ranked 1st on the leaderboard at the end of Round 1 in the MineRL BASALT 2022 Challenge, generating visibly human-like behavior.
  • Quantitative Reset Verification: Across all four tasks, searching significantly reduced situational drift:
  • Deviation-based resets ("Spike"): Across tasks, average $L_1$ error right before a reset was approximately $0.37$, which dropped to $0.16\text{--}0.18$ immediately after matching a new trajectory (e.g., in FindCave, falling from $0.37 \pm 0.02$ to $0.17 \pm 0.02$).
  • Time-based resets ("Window"): The 128-step periodic resets corrected milder drift, lowering distance from $0.22\text{--}0.23$ down to $0.15\text{--}0.16$.

Limitations and Future Work

  • Coverage Bound: The agent cannot synthesize novel strategies; it is fundamentally bounded by the situations present in the offline demonstration dataset. If it enters an out-of-distribution state with no close match, it may struggle.
  • Initial Vulnerability: The 1-second stationary warm-up period is required to fill the transformer's temporal memory, leaving the agent vulnerable if it spawns in immediate hazards (such as next to lava).
  • Future Directions: The authors propose incorporating self-supervised segmentation of critical objects in first-person view, multi-modal feature fusion, modular control schemes, and dedicated working memory models to further improve stability.

Summary updated

BibTeX
@inproceedings{malato2023behavioral,
  author = {Federico Malato and Florian Leopold and Amogh Raut and Ville Hautamaki and Andrew Melnik},
  title = {{Behavioral Cloning via Search in Video PreTraining Latent Space}},
  booktitle = {Pretraining4Robotics @ ICRA},
  year = {2023},
  url = {https://openreview.net/forum?id=Gd1rXFG3SxN},
}
Figure