Episodic Novelty Through Temporal Distance

Yuhua Jiang, Qihan Liu, Yiqin Yang, Xiaoteng Ma, Dianyu Zhong, Hao Hu, Jun Yang, Bin Liang, Bo Xu, Chongjie Zhang, Qianchuan Zhao

TL;DR

Exploration in sparse-reward environments remains a major hurdle for reinforcement learning, especially in contextual settings where the environment changes every episode. This paper introduces Episodic Novelty Through Temporal Distance (ETD), a novel intrinsic motivation method that uses the expected number of steps between states as a robust similarity metric. By accurately estimating temporal distances via contrastive learning, ETD avoids the pitfalls of count-based and Euclidean-distance methods, achieving state-of-the-art exploration efficiency and robustness to noise.

What Problem Does This Paper Address?

In reinforcement learning (RL), agents struggle to learn when external rewards are sparse or absent. To fix this, researchers use intrinsic motivation—giving the agent a bonus reward for exploring "novel" states. However, in Contextual Markov Decision Processes (CMDPs), the environment changes from one episode to the next (e.g., procedurally generated mazes with different layouts). In these settings, global novelty metrics fail because what is new in episode A might be completely irrelevant or misleading in episode B.

To tackle this, recent methods use episodic bonuses based only on the current episode's history. These typically fall into two camps:

  1. Count-based methods: They track how often a state is visited within an episode. However, they fail in continuous or high-dimensional state spaces where every state is technically unique, and they are highly vulnerable to the "noisy-TV" problem (where random background noise tricks the agent into thinking it's constantly finding novel states).
  2. Similarity-based methods: They calculate how close a new state is to previous states using metrics like Euclidean distance or transition likelihood. Unfortunately, these metrics often fail to accurately capture true environmental topology or novelty, leading to poor exploration signals in complex environments.

Methods

The authors propose Episodic Novelty Through Temporal Distance (ETD). Instead of relying on pixel-level Euclidean distance or binary reachability classifiers, ETD uses temporal distance—the expected number of environment steps required to transition between two states—as its core metric for state similarity.

Key components include:

  • Quasimetric Temporal Distance Learning: ETD models temporal distance using successor distance, a mathematically sound quasimetric that satisfies the triangle inequality even in stochastic environments.
  • Contrastive Learning with Specialized Parameterization: To learn this distance without environment dynamics models, ETD trains an energy function $f_\theta(x,y)$ using a symmetrized InfoNCE loss on pairs of states sampled from the agent's rollout buffer. The energy function is parameterized as the difference between a potential network $c_\psi(y)$ and a quasimetric network $d_\phi(x,y)$. After training, the potential network is discarded, leaving an accurate predictor of temporal distance $d_\phi$.
  • Episodic Intrinsic Bonus: At each timestep $t$, the intrinsic reward $b_t$ is computed as the minimum temporal distance between the current state $s_t$ and all previously visited states in the current episode's memory: $$b_t = \min_{i \in [0, t)} d_\phi(s_i, s_t)$$

This aggressive formulation ensures that if the agent is close to any previously seen state in terms of time/steps, the bonus drops to zero, forcing it to seek genuinely out-of-reach areas.

Overview of the ETD framework, showing how contrastive learning estimates temporal distance to compute episodic intrinsic rewards.

Datasets

The authors evaluated ETD across several challenging, procedurally generated sparse-reward benchmarks:

  • MiniGrid: 2D grid-world environments including MultiRoom-N6, DoorKey-16x16, KeyCorridor-S6R3, and various configurations of ObstructedMaze (the most complex variant where keys are hidden in boxes and doors are blocked by balls).
  • Noisy MiniGrid: Modified versions of MiniGrid where Gaussian noise is added directly to the state inputs to simulate the "noisy-TV" problem.
  • Crafter: A high-dimensional, pixel-based 2D survival and achievement environment (64x64x3 observations) with 22 distinct achievements.
  • MiniWorld-Maze: A 3D procedurally generated maze environment requiring first-person navigation with a limited field of view.

Key Insights and Ideas

  • Why Temporal Distance Wins: Unlike Euclidean distance in latent spaces, temporal distance is inherently invariant to state representations. This makes it naturally immune to the "noisy-TV" problem because random noise doesn't change the number of steps needed to transition between actual environment states.
  • The Failure of Likelihood/Euclidean Metrics: As shown in a SpiralMaze experiment, standard inverse dynamics (Euclidean) struggles to provide smooth similarity estimates, and reachability likelihood classifiers only capture local proximity, failing to differentiate between varying levels of long-range distance. ETD provides a smooth, globally consistent gradient of distance.
Comparison of learned distances from a starting state (red square) in a SpiralMaze. ETD (right) accurately captures the true topological distance compared to inverse dynamics or likelihood methods.
  • The Power of the Minimum: Aggregating episodic history using the minimum distance consistently outperforms alternative functions like the 10% quantile or K-nearest neighbors. It provides the most aggressive exploration signal by completely zeroing out rewards for any state temporally close to the history.

Key Results

  • Superior Sample Efficiency: In the highly complex ObstructedMaze-Full environment, ETD reached near-optimal performance within 20 million steps, achieving double the sample efficiency of NovelD, the strongest baseline.
  • Robustness to Noise: When Gaussian noise was added to MiniGrid-DoorKey-16x16, count-based methods like NovelD completely failed (achieving 0 reward). ETD maintained its strong performance, showing virtually no degradation.
Figure 1: Training curves in Minigrid-DooKey-16x16 (w/w.o. noise).
  • High-Dimensional Scaling: ETD outperformed or matched state-of-the-art methods (DEIR, NovelD) on pixel-based benchmarks like Crafter and 3D MiniWorld mazes, proving its scalability to complex visual inputs.

Limitations and Future Work

  • POMDP Transformation: Introducing an episodic reward bonus that depends on the history implicitly transforms an MDP into a Partially Observable MDP (POMDP), which can introduce bias into the value function.
  • Ergodicity Assumption: The successor distance metric assumes an ergodic environment; in non-ergodic settings, the temporal distance between certain states could be infinite.
  • Purely Episodic: ETD currently focuses solely on intra-episode novelty. The authors note that combining ETD's temporal distance metric with a global cross-episode bonus (e.g., via maximum state entropy) is a promising direction for singleton MDPs where global exploration is essential.

Summary updated

BibTeX
@inproceedings{jiang2025episodic,
  author = {Yuhua Jiang and Qihan Liu and Yiqin Yang and Xiaoteng Ma and Dianyu Zhong and Hao Hu and Jun Yang and Bin Liang and Bo Xu and Chongjie Zhang and Qianchuan Zhao},
  title = {{Episodic Novelty Through Temporal Distance}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=I7DeajDEx7},
}
Figure