Source-linked AI summary
MOPO: Model-based Offline Policy Optimization
Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Zou, Sergey Levine, Chelsea Finn, Tengyu Ma
TL;DR
Offline RL must learn from static data despite distribution shift and limited support for unseen states. MOPO penalizes rewards using estimated dynamics uncertainty, theoretically optimizing a lower bound on true return, and substantially outperforms prior model-based and model-free methods across benchmark and generalization tasks. It nevertheless depends on reliable out-of-distribution uncertainty estimation and remains insufficiently robust for safety-critical deployment.
Problem
Offline RL faces distributional shift because prior model-free methods typically constrain policies to the dataset support, limiting generalization to unseen states.
Method
MOPO trains an MBPO policy in an uncertainty-penalized MDP, using predicted model variance to penalize rewards for estimated dynamics error.
Results
MOPO substantially outperforms standard model-based and prior state-of-the-art model-free offline RL methods on D4RL and tasks requiring out-of-distribution generalization.
Takeaways & Limitations
Uncertainty estimation is important for trading off return against model risk when offline policies generalize beyond the batch data support.
Takeaways & Limitations
Reliable out-of-distribution uncertainty estimation remains necessary, and offline RL requires substantial additional work before safety-critical deployment.
Abstract
from arXiv · showhide
Offline reinforcement learning (RL) refers to the problem of learning policies entirely from a large batch of previously collected data. This problem setting offers the promise of utilizing such datasets to acquire policies without any costly or dangerous active exploration. However, it is also challenging, due to the distributional shift between the offline training data and those states visited by the learned policy. Despite significant recent progress, the most successful prior methods are model-free and constrain the policy to the support of data, precluding generalization to unseen states. In this paper, we first observe that an existing model-based RL algorithm already produces significant gains in the offline setting compared to model-free approaches. However, standard model-based RL methods, designed for the online setting, do not provide an explicit mechanism to avoid the offline setting's distributional shift issue. Instead, we propose to modify the existing model-based RL methods by applying them with rewards artificially penalized by the uncertainty of the dynamics. We theoretically show that the algorithm maximizes a lower bound of the policy's return under the true MDP. We also characterize the trade-off between the gain and risk of leaving the support of the batch data. Our algorithm, Model-based Offline Policy Optimization (MOPO), outperforms standard model-based RL algorithms and prior state-of-the-art model-free offline RL algorithms on existing offline RL benchmarks and two challenging continuous control tasks that require generalizing from data collected for a different task. The code is available at https://github.com/tianheyu927/mopo.
1 Introduction
Offline RL aims to learn from static datasets without costly online interaction, but distribution shift makes out-of-distribution actions and states difficult to handle. MOPO builds on model-based RL by penalizing estimated dynamics uncertainty, enabling controlled generalization beyond the data support.
- Motivation: Static offline datasets could make RL more practical for real-world domains where online trial-and-error is costly or risky.The motivation includes autonomous driving, healthcare, and robot learning settings with large pre-recorded datasets.
- Challenge: Off-policy methods often fail offline because out-of-distribution action evaluation causes Q-function extrapolation errors, instability, and divergence.Existing offline methods therefore commonly constrain policies toward the dataset’s behavior distribution.
- Challenge: Offline policies need the ability to leave data support because batch datasets may be sub-optimal and may come from tasks different from the target task.These conditions motivate generalization to unseen states and actions.
- Approach: Model-based RL may support generalization through transition-level supervision, stable supervised gradients, and better-developed uncertainty estimation.The paper presents these properties as reasons to investigate model-based methods for offline RL.
- Approach: MOPO modifies MBPO by penalizing rewards according to model-dependent dynamics uncertainty over states and actions.The penalty is intended to trade off return against the risk of using inaccurate learned dynamics outside the data support.
- Results: MOPO substantially outperforms prior model-free offline RL methods on D4RL and tasks requiring generalization to out-of-distribution states.The comparison also evaluates MOPO against MBPO and addresses both benchmark and different-task data settings.
2 Related Work
Related work covers offline model-free methods that constrain policies or stabilize value estimates, model-based online RL methods underlying MOPO, and concurrent uncertainty-based offline model-based work. MOPO instead uses uncertainty as a soft reward penalty rather than terminating uncertain trajectories.
- Offline RL: Offline RL methods are motivated by the high sample complexity, limited generalization, and safety risks of online trial-and-error data collection.Many off-policy algorithms can be applied offline in principle but perform poorly in practice.
- Model-free Offline RL: Offline model-free RL commonly constrains the learned policy toward the behavioral distribution and uses uncertainty quantification to stabilize Q-functions.MOPO does not rely on behavioral-distribution constraints, allowing actions outside that distribution.
- Model-based Online RL: Model-based online RL has used diverse dynamics models and planning or Dyna-style policy optimization; MOPO builds specifically on MBPO’s Dyna-style approach.The approach is described as orthogonal to the choice of dynamics model.
- Concurrent Work: MOReL uses hard uncertainty thresholds to create terminating states, whereas MOPO incorporates uncertainty through a soft reward penalty.The soft penalty can permit a few risky actions before returning toward regions near the behavioral distribution.
3 Preliminaries
The paper formalizes offline RL as policy optimization in an MDP with known state, action, reward, transition, initial-state, and discount components. MBPO learns transition and reward models from the static dataset, performs model rollouts, and updates the policy with environment and model-generated data.
- MDP Formulation: An MDP is defined by state and action spaces, transition dynamics, rewards, an initial-state distribution, and a discount factor.The policy objective is expected discounted return under the MDP.
- Offline Setting: Offline RL provides only a static transition dataset collected by one or more behavior policies and prohibits further environment interaction.The sampling distribution of this dataset is called the behavioral distribution.
- Model MDP: The model-based approach estimates transition dynamics from the offline data and uses them to define a model MDP.The estimated dynamics induce state and state-action occupancy quantities under a policy.
- MBPO: MBPO learns transition and reward models by supervised learning on behavioral data, then performs k-step model rollouts for policy training.Generated data are stored separately and combined with environment data for policy updates.
- MBPO: In offline experiments, MBPO performs surprisingly well compared with model-free methods, motivating the derivation of MOPO.The method still uses model-generated data to update the policy despite the absence of new environment interaction.
4 MOPO: Model-Based Offline Policy Optimization
MOPO addresses offline model-based RL’s risk of exploiting inaccurate dynamics outside the behavioral data support by optimizing an uncertainty-penalized MDP. Its analysis links model uncertainty to conservative return guarantees and a tunable trade-off between performance gain and extrapolation risk.
- Motivation: Offline model-based RL can leave the behavioral distribution, but learned dynamics become increasingly inaccurate farther from that distribution.This creates a tension between finding better policies and overfitting to model errors.
- Theory: The theoretical analysis uses a telescoping relationship between true and learned dynamics to bound return estimation error through a function-class distance between transition distributions.The distance d_F is an integral probability metric, with total variation and Wasserstein distances arising under different function classes.
- Guarantees: Under assumptions on the uncertainty estimator, MOPO’s learned policy satisfies a performance guarantee relative to policies with bounded uncertainty and the behavior policy.The guarantee implies a lower-bound interpretation for the uncertainty-penalized objective and compares the learned policy with policies whose model-error measure is sufficiently small.
- Method: MOPO constructs an uncertainty-penalized MDP by subtracting λu(s, a) from the reward and optimizing the resulting objective with an RL algorithm.The practical framework uses a learned dynamics model, an admissible error estimator, and MBPO-style policy optimization.
- Risk-return trade-off: Increasing the allowed uncertainty δ expands the candidate policy set and can increase return, but it also increases the risk penalty 2λδ.The analysis selects the balance between gain from leaving the behavioral distribution and risk from dynamics-model error; δ is used for analysis rather than directly by the algorithm.
- Practical implementation: In practice, λ is user-chosen because the heuristic uncertainty estimator lacks the theory’s admissibility guarantee.The recommended direction depends on estimator bias: λ should increase when uncertainty underestimates true error and decrease when it overestimates it.
5 Experiments
The experiments evaluate MOPO on standard D4RL benchmarks and tasks requiring out-of-distribution generalization. MOPO is strongest on mixed and most medium-expert datasets, while substantially outperforming baselines on the constructed generalization tasks.
- 5.1 Evaluation on the D4RL benchmark: The evaluation covers D4RL datasets across halfcheetah, hopper, and walker2d, using random, medium, mixed, and medium-expert dataset types.The benchmark evaluation includes 12 problem settings, with additional non-MuJoCo experiments in the appendix.
- 5.1 Evaluation on the D4RL benchmark: The D4RL table reports normalized undiscounted returns, averaged over 6 random seeds, with scores roughly ranging from 0 for random policies to 100 for experts.Behavior cloning is included for comparison; model-free results are taken from prior work without reported standard deviations.
- 5.1 Evaluation on the D4RL benchmark: MOPO is strongest by a significant margin on all mixed datasets and most medium-expert datasets, while also performing strongly on random datasets.MOPO performs less well on medium datasets, where limited action diversity may hinder model generalization.
- 5.2 Evaluation on tasks requiring out-of-distribution generalization: The additional halfcheetah-jump and ant-angle tasks require policies to leave the support of datasets collected for different original tasks.Halfcheetah data contain running behavior while the test task requires jumping; ant data contain direct forward running while the test task rewards running at a 30 degree angle.
- 5.2 Evaluation on tasks requiring out-of-distribution generalization: MOPO outperforms all baselines by a large margin on halfcheetah-jump and ant-angle, with results averaged over 6 seeds for MOPO and 3 for other methods.Batch mean and maximum returns are lower than on-policy SAC, indicating that stronger performance requires going beyond the data support.
6 Conclusion
The paper concludes that model-based methods are more resilient than vanilla model-free methods to offline overestimation and overfitting, while MOPO explicitly penalizes uncertainty when leaving the behavioral distribution. It also identifies open questions about regularization, uncertainty estimation, and settings where learning a model is difficult.
- 6 Conclusion: Existing model-based methods outperform vanilla model-free methods offline, suggesting greater resilience to overestimation and overfitting issues.The conclusion connects this performance to model-based generalization beyond the data support.
- 6 Conclusion: MOPO optimizes an MDP that penalizes states with high model uncertainty, trading off the risk of mistakes against the benefit of escaping the behavioral distribution.The conclusion emphasizes that model error useful for online exploration can be harmful without offline interaction.
- 6 Conclusion: Future work includes combining policy regularization with reward penalties and explaining why model-based methods appear better suited to batch settings.The paper identifies greater state supervision, more stable supervised updates, and easier uncertainty estimation as possible factors.
- 6 Conclusion: For domains where learning a model is very difficult because of complex dynamics, better model-free offline RL methods may be desirable or imperative.The conclusion presents this as a scope boundary motivating further research.
Broader Impact
Offline RL may support applications such as autonomous driving, healthcare, and robotics where online data collection is costly or unsafe. The paper also stresses unresolved risks involving uncertainty estimation, reward design, adversarial vulnerability, robustness, and broader societal effects.
- Potential applications: Offline RL is potentially applicable to autonomous driving, healthcare, robotics, and other safety-critical settings where online data collection is costly.The motivation includes avoiding risks such as crashes during autonomous-driving interaction.
- Risks and challenges: Without reliable out-of-distribution uncertainty estimation, learned policies may behave unpredictably in scenarios they have not encountered.The paper presents uncertainty quantification as necessary for safer application in high-risk domains.
- Risks and challenges: Reward design can be difficult because specifying behavior aligned with human objectives is challenging even when engineers control the reward function.This is identified as a separate application challenge from uncertainty estimation.
- Risks and challenges: Parametric models may be susceptible to adversarial attacks, creating a vulnerability that bad actors could exploit.The paper points to robustness advances as part of improving deployment in safety-critical domains.
- Societal impact: Automating decision-making may reduce demand for workers in some industries, while the net effect on job availability remains unclear.The paper notes that technological advances have also historically created new occupations.
- Societal impact: Offline RL remains promising for impactful sequential decision-making, but substantial work is needed before it is sufficiently robust for safety-critical use.The paper specifically encourages further study of uncertainty estimation in sequential decision problems.
A Reminders about integral probability metrics
This section defines integral probability metrics through a function class and notes special cases that recover total variation, 1-Wasserstein, and maximum mean discrepancy distances. It also connects the framework to assumptions used later in the paper.
- Integral probability metrics: An integral probability metric measures the largest difference in expectations between two probability measures over a chosen class of measurable real-valued functions.The definition is given on a measurable space (X, Σ).
- Special cases: Choosing functions bounded by 1 yields the total variation distance.This is the special case F = {f : ∥f∥∞≤1}.
- Special cases: Choosing 1-Lipschitz functions yields the 1-Wasserstein distance under the same cost metric.The formulation uses couplings of the two probability measures.
- Special cases: Choosing the unit ball of a reproducing kernel Hilbert space yields maximum mean discrepancy.The relevant function class is F = {f : ∥f∥H ≤1}.
- Connection to the analysis: The section lists instantiations of the metric assumptions used in Section 4.1, including a 1-Lipschitz function class with cost c = Lv.These choices provide concrete forms for the abstract assumptions.
- Connection to the analysis: For a reproducing-kernel Hilbert-space function class, the paper identifies the corresponding cost as c = ν.This specializes the general metric framework to the stated Hilbert-space setting.
B Proofs
The paper supplies proof sketches for its theoretical results and outlines the practical MOPO algorithm. The proofs connect intermediate return bounds to the main theorem, while the algorithm outline describes implementation at a high level.
- The appendix provides a completeness proof for Lemma 4.1 based on an earlier lemma.
- The proof defines Wj as return under the learned policy for j steps followed by the true dynamics for the remainder.
- The proof decomposes return into the first j time steps evaluated under bT.
- The appendix then proceeds to prove Theorem 4.2 using a two-sided bound derived from Lemma 4.1.
- Algorithm 2 provides the practical MOPO procedure after the theoretical derivations.
D Ablation Study
The ablations examine how uncertainty penalties and model ensembles affect MOPO. Learned-variance penalties substantially improve performance over no penalty, with especially clear advantages in out-of-distribution domains.
- MOPO trains an ensemble of probabilistic dynamics models, rolls out model-generated transitions, penalizes rewards by maximum predicted variance, and updates the policy with SAC.
- The no-ensemble ablation measures disagreement among model mean predictions, while true-penalty uses the true model prediction error as an upper-bound reference.
- Reward penalties based on learned variance perform comparably to ensemble-disagreement penalties in D4RL and better in out-of-distribution domains.
- Both uncertainty-based penalties substantially outperform using no reward penalty, demonstrating the importance of modeling uncertainty.
- Oracle uncertainty performs slightly better than most practical methods, while MOPO achieves the best result on halfcheetah-jump.
- Performance differences are larger on halfcheetah-jump and ant-angle, where greater generalization demands place more pressure on model and uncertainty-estimate accuracy.
- 4140.6±88 average return for MOPO versus 4166.3±228.8 for MOPO, avg. var. in halfcheetah-jump indicates similar performance across max and mean variance penalties.
E Empirical results on generalization capabilities
MOPO’s generalization is strongest when target tasks remain sufficiently connected to the dataset’s supported states. Its ablation results show learned-variance penalties are particularly useful for out-of-distribution tasks.
- MOPO generalizes to Ant running at a 45° angle, achieving almost buffer max score.
- MOPO fails to generalize to 60° and 90° angles when the target requires states completely outside the data support.
- Different reward penalties substantially improve performance, while learned-variance penalties outperform ensemble-disagreement penalties in out-of-distribution cases.
- Oracle-uncertainty methods achieve marginally better performance than MOPO, suggesting that MOPO estimates uncertainty effectively.
F Experiments on HIV domains
The HIV experiment evaluates MOPO on offline treatment data generated from an online SAC agent. MOPO outperforms BEAR and nearly reaches the dataset’s buffer maximum under the reported setup.
- The HIV simulator models sequential treatment decisions involving two anti-HIV drugs, with objectives of maximizing immune response and minimizing virus.
- MOPO is evaluated on data from the first 200k steps of training an online SAC agent in the HIV environment.
- MOPO outperforms BEAR and achieves almost the buffer max score on the HIV treatment task.
- The HIV results are reported in Table 5 as averages over 3 random seeds.
- The experiments use model rollouts, uncertainty penalties, and SAC updates with real and model-generated replay data.