Sample-efficient Real-time Planning with Curiosity Cross-Entropy Method and Contrastive Learning

Mostafa Kotb, Cornelius Weber, Stefan Wermter

Abstract

Model-based reinforcement learning (MBRL) with real-time planning has shown great potential in locomotion and manipulation control tasks. However, the existing planning methods, such as the Cross-Entropy Method (CEM), do not scale well to complex high-dimensional environments. One of the key reasons for underperformance is the lack of exploration, as these planning methods only aim to maximize the cumulative extrinsic reward over the planning horizon. Furthermore, planning inside the compact latent space in the absence of observations makes it challenging to use curiosity-based intrinsic motivation. We propose Curiosity CEM (CCEM), an improved version of the CEM algorithm for encouraging exploration via curiosity. Our proposed method maximizes the sum of state-action Q values over the planning horizon, in which these Q values estimate the future extrinsic and intrinsic reward, hence encouraging reaching novel observations. In addition, our model uses contrastive representation learning to efficiently learn latent representations. Experiments on image-based continuous control tasks from the DeepMind Control suite show that CCEM is by a large margin more sample-efficient than previous MBRL algorithms and compares favorably with the best model-free RL methods.

Introduction

Model-based Reinforcement Learning (MBRL) is highly valued for its sample efficiency, achieved by learning a "world model" to simulate the consequences of actions. However, standard planning algorithms like the Cross-Entropy Method (CEM) often struggle in complex environments because they are inherently "greedy," focusing solely on maximizing known extrinsic rewards. This leads to poor exploration, particularly in sparse-reward settings where feedback is infrequent.

While model-free RL often employs curiosity-driven exploration—where agents receive intrinsic rewards for reaching novel states—applying this to MBRL is non-trivial. Real-time planning typically occurs in a compact latent space where future observations are unavailable, making it impossible to calculate prediction errors (the standard metric for curiosity) during the planning phase.

The challenge of planning in latent space: future observations are unavailable, making standard curiosity metrics difficult to apply.

Methodology: Curiosity CEM (CCEM)

The proposed framework, TD-MPC with CCEM, addresses these challenges through three integrated components:

1. Curiosity CEM (CCEM)

Standard planners sum predicted rewards, which are "blind" to curiosity during the imagination phase. CCEM instead maximizes a discounted sum of state-action $Q$-values. These $Q$-values are trained to estimate the sum of both extrinsic and intrinsic rewards. This allows the real-time planner to "foresee" the curiosity value of future latent trajectories without needing the actual future observations.

2. Intrinsic Curiosity Module (ICM)

To generate intrinsic rewards during training, the model utilizes an Intrinsic Curiosity Module. It consists of an inverse dynamics model (predicting the action between two states) and a forward dynamics model. The intrinsic reward is defined as the prediction error of the forward model in the latent space.

The TD-MPC with CCEM architecture, highlighting the Intrinsic Curiosity Module (ICM) and latent space planning.

3. Contrastive Representation Learning

To ensure the latent space is informative and robust to noise, the authors employ a temporal contrastive loss (InfoNCE). This maximizes the mutual information between the current state-action pair and the resulting next state, facilitating the learning of features that are truly predictive of environment dynamics.

Experimental Evaluation

The method was evaluated on six image-based continuous control tasks from the DeepMind Control (DMC) Suite: Finger Spin, Cartpole Swingup, Reacher Easy, Cheetah Run, Walker Walk, and Ball-in-cup Catch. These tasks represent a variety of challenges, including sparse rewards and high-dimensional action spaces.

Key Results

  • Superior Sample Efficiency: At the 100k environment step benchmark, TD-MPC with CCEM significantly outperformed model-based baselines like PlaNet and Dreamer.
  • Competitive Performance: The method performed comparably to, and often better than, state-of-the-art model-free algorithms such as DrQ and CURL, which typically require more samples.
  • Ablation Studies: Removing the curiosity component (Non-CCEM) led to a marked decrease in performance across nearly all tasks, confirming that curiosity-driven exploration is a critical driver of success in these environments.

Conclusion

CCEM successfully bridges the gap between real-time model-based planning and curiosity-driven exploration. By baking the expectation of curiosity into a $Q$-function, the agent can effectively navigate toward novel states during latent-space planning. This approach, combined with contrastive learning, sets a new standard for sample efficiency in image-based continuous control.

Summary updated

BibTeX
@inproceedings{kotb2023sample,
  author = {Mostafa Kotb and Cornelius Weber and Stefan Wermter},
  title = {{Sample-efficient Real-time Planning with Curiosity Cross-Entropy Method and Contrastive Learning}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2023},
  doi = {10.1109/iros55552.2023.10342018},
}
Figure