Reward-Consistent Dynamics Models are Strongly Generalizable for Offline Reinforcement Learning

Fan-Ming Luo, Tian Xu, Xingchen Cao, Yang Yu

In the world of Reinforcement Learning (RL), "offline" learning is the ultimate challenge. Instead of letting an agent actively explore an environment to learn the rules, we hand it a static log of past experiences and ask it to figure out an optimal policy. Model-based offline RL (MBRL) attempts to solve this by building a mental simulator—a dynamics model—of the environment from that historical data.

The primary problem? These simulators are notoriously prone to "hallucinations." When an agent tries a strategy not present in the original data, the model often predicts impossible transitions, leading the agent down a rabbit hole of failure. At ICLR 2024, researchers presented MOREC (Model-based Offline reinforcement learning with Reward Consistency), a method that uses "dynamics rewards" to keep these simulators grounded in reality.

The Achilles' Heel: Generalization Error

The core weakness of offline MBRL is generalization error. Standard dynamics models are trained via supervised learning to minimize the difference between predicted and actual next states. However, when the agent encounters an Out-of-Distribution (OOD) state-action pair, the model's predictions become unreliable.

Because RL involves sequential decision-making, a tiny error in step one compounds into a massive error in step two. Eventually, the agent optimizes its policy in a completely imaginary environment that bears no resemblance to the real world. Previous solutions tried to be "pessimistic"—penalizing the agent for visiting states where the model is uncertain—but this often makes the agent too timid to learn anything useful.

The MOREC Approach: Laws of Physics as a Reward

The authors introduce a clever shift in perspective: What if we treat the environment's physics as an agent?

Just as a human agent acts to maximize a task reward, the environment "acts" to produce transitions that follow consistent physical laws. The authors call this hidden consistency the dynamics reward.

The MOREC framework integrates a learned dynamics reward to filter transitions during model simulation.

1. Learning the "Laws of Physics" via IRL

Instead of just fitting a curve to the data, MOREC uses Inverse Reinforcement Learning (IRL). It trains a discriminator to distinguish between real transitions from the dataset and "fake" transitions generated by the learned model. This discriminator effectively becomes a dynamics reward function: it assigns a high score to transitions that look physically plausible and a low score to model hallucinations.

2. Transition Filtering

Once this reward function is learned, it acts as a filter during the agent's training. When the dynamics model needs to predict the next state, it doesn't just provide one answer. Instead:

  1. The model generates a batch of candidate next states.
  2. The dynamics reward function evaluates each candidate.
  3. The system selects the candidate with the highest reward.

This ensures that even if the underlying dynamics model is slightly inaccurate, the filtering process steers the simulation back toward physically consistent states.

Key Insights: Recovering Unseen Transitions

A surprising finding from the study was that the learned dynamics reward generalizes much better than the dynamics model itself. It can accurately "score" transitions in regions of the state space the model has never seen.

Heatmaps from a synthetic task demonstrate that the dynamics reward (d, e) captures the true underlying physics much better than the raw model predictions (b, c), allowing MOREC to recover unseen transitions.

In synthetic tests (like a refrigerator temperature-control simulation), MOREC was able to "recover" distant unseen transitions. By picking the most reward-consistent candidates, the model effectively guessed the correct physics even when its raw supervised prediction was wrong. Furthermore, MOREC is designed as a plug-and-play framework. It can be integrated into existing state-of-the-art methods like MOPO and MOBILE to immediately boost their performance.

Remarkable Benchmark Results

The researchers evaluated MOREC across standard D4RL (locomotion) tasks and the much harder NeoRL benchmark, which features narrower data distributions that make generalization exceedingly difficult. The quantitative results are striking:

  • NeoRL: MOREC improved the state-of-the-art (SOTA) by an average of 25.9%.
  • D4RL: It improved SOTA by 4.6%.
  • The 95% Club: MOREC is the first method to achieve over 95% of the performance of online RL (where the agent can actually practice in the environment) in 6 out of 12 D4RL tasks and 3 out of 9 NeoRL tasks.
  • Compounding Error Reduction: Visualizations showed that MOREC significantly reduced compounding errors over long rollout horizons (up to 100+ steps), whereas standard models saw their errors blow up exponentially.

Limitations and Future Work

While powerful, MOREC does come with a few practical trade-offs. Training an ensemble of discriminators and generating batches of candidate transitions increases memory usage and adds about 12.4% to the training time. In tasks with extremely large state and action dimensions, the discriminator ensemble might become heavily memory-intensive. Future work may explore "last-iterate convergence" methods to maintain performance while using fewer discriminators, potentially making the method lighter and faster.

Based on the ICLR 2024 paper: "Reward-Consistent Dynamics Models are Strongly Generalizable for Offline Reinforcement Learning" by Fan-Ming Luo, Tian Xu, Xingchen Cao & Yang Yu.

Summary updated

BibTeX
@inproceedings{luo2024reward,
  author = {Fan-Ming Luo and Tian Xu and Xingchen Cao and Yang Yu},
  title = {{Reward-Consistent Dynamics Models are Strongly Generalizable for Offline Reinforcement Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=GSBHKiw19c},
}
Figure