Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed
Deep Reinforcement Learning · Lecture 69 of 99 · 18:16
Lecture 16, Part 3: Model-Based Offline RL
Study guide
What this lecture covers
This part of the lecture turns to model-based approaches to offline RL, arguing they are a natural fit because a learned dynamics model can be trained once on a fixed data set and then reused to generate a policy. It explains why the same out-of-distribution problem seen with Q-functions also affects models: a policy can exploit inaccuracies in the model to reach states the model erroneously predicts as high-reward.
The lecture walks through two Dyna-style fixes that penalize the reward according to model uncertainty (MOPO) or directly penalize the critic on model-generated data (COMBO), each with some accompanying theory about how close the learned policy can be guaranteed to get to the true optimum. It closes with a non-Dyna alternative, the trajectory transformer, which plans directly using a large sequence model trained on entire trajectories.
Key ideas
- Out-of-distribution states problem: unlike the out-of-distribution action problem for Q-functions, model-based offline RL faces an additional risk where the policy can exploit the model to reach out-of-distribution states that the model incorrectly predicts as high-reward.
- Uncertainty penalty (MOPO): add a penalty term
u, an estimate of model error (for example, disagreement across an ensemble of models), to the reward so that exploiting model inaccuracy is not worth it once the penalty outweighs the fabricated gain. - Theoretical guarantee: under the assumption that
uupper-bounds the true model error, the learned policy's true return is guaranteed to be at least as good as the best policy whose expected model error is bounded, which implies the method should at least match the behavior policy and can approach the optimal policy if the model is accurate where it matters. - COMBO: applies a CQL-like idea to the model-based setting by pushing down Q-values for model-generated state-action pairs while pushing up Q-values for real data, so if the model produces realistic transitions indistinguishable from real data, the two terms cancel and the model's contribution is trusted.
- Trajectory transformer: a non-Dyna alternative that trains a large sequence model (for example, a causally masked transformer) to estimate the joint probability of entire state-action trajectories, discretized per dimension, and then plans by searching for action sequences with high probability under this model and high reward, using a reward-guided variant of beam search.
Walkthrough
Why the out-of-distribution problem is worse for models (0:02)
The lecture explains that Dyna-style model-based methods, which use real states and actions as starting points for short simulated rollouts, face an analogous but compounded problem to Q-function overestimation: a policy can learn to trick the model into predicting unrealistically high-reward outcomes by driving it into out-of-distribution states, and errors can then compound as the model continues rolling out from those bad states.
MOPO: penalizing uncertainty in the reward (2:02)
The lecture introduces MOPO (model-based offline policy optimization), which adds an uncertainty penalty u to the reward, typically estimated from disagreement across an ensemble of learned dynamics models, so that exploiting the model's inaccuracies becomes less rewarding than staying close to well-understood transitions. It walks through the accompanying theoretical result: if u reliably upper-bounds the true model error, the learned policy's true return is bounded below by the best policy whose expected model error is small, implying the method should be at least as good as the behavior policy and can approach optimal if the model is accurate on the states the optimal policy would visit.
COMBO: applying CQL-style penalties to model data (10:07)
The lecture presents COMBO, which adapts the CQL idea to model-based RL by pushing down Q-values on state-action pairs sampled from the model while pushing up Q-values on real data-set pairs. It explains that if the model produces transitions indistinguishable from real data, these two effects roughly cancel and the model is effectively trusted, while transitions that look clearly synthetic get penalized, without needing to modify the reward function directly.
Planning with the trajectory transformer (12:08)
The lecture describes a non-Dyna approach: train a large sequence model, such as a causally masked transformer, over entire trajectories discretized per state and action dimension, so the model captures the joint probability of state-action sequences under the behavior policy. Because offline training doesn't require active data collection, it becomes practical to use very large, expressive models like transformers. Planning is then done with a reward-guided variant of beam search that samples candidate next tokens from the model (keeping the plan close to what the data supports) and keeps the highest-reward prefixes, illustrated with an animation of long-horizon humanoid predictions.
Before you watch
- Watch Lecture 16, Parts 1 and 2 first for the actor-constraint and CQL solutions to distributional shift in model-free offline RL, which this lecture parallels in the model-based setting.
- Review the model-based RL and Dyna-style methods lecture from earlier in the course, since this lecture assumes familiarity with that framework and terminology.
- Basic familiarity with ensembles for uncertainty estimation, covered in the model-based RL unit, is helpful for understanding the uncertainty penalty.
Check your understanding
- Why does model-based offline RL face an out-of-distribution states problem in addition to the out-of-distribution actions problem seen in Q-learning methods?
- What role does the uncertainty penalty
uplay in MOPO, and what does the accompanying theory guarantee ifuupper-bounds the true model error? - How does COMBO adapt the CQL idea to model-generated data, and why does this let it trust an accurate model automatically?
- How does the trajectory transformer's planning approach ensure that generated plans stay close to what the data supports?
Vocabulary
- model-based (adjective)
- Using a learned model of how the environment works to plan or train.
Model-based offline RL learns a dynamics model from the fixed data set. - offline RL (noun)
- Training a policy only from a fixed, already-collected data set, with no new interaction.
Offline RL must avoid trusting actions the data never showed. - dynamics model (noun)
- A model that predicts the next state given the current state and action.
The dynamics model is trained once on the fixed data set. - policy (noun)
- A rule that chooses which action to take in each state.
The policy can exploit small errors in the learned model. - out-of-distribution (adjective)
- Different from anything seen in the training data.
The policy drives the model into out-of-distribution states. - exploit (verb)
- To take unfair advantage of a weakness for benefit.
A policy can exploit inaccuracies in the model to earn fake reward. - Dyna-style (adjective)
- Describes methods that use real data as starting points for short simulated rollouts.
MOPO is a Dyna-style method that fixes the reward with a penalty. - rollout (noun)
- A simulated sequence of states and actions generated by running a policy or model forward.
The model generates rollouts starting from real states. - compound (verb)
- To build up and get worse over repeated steps.
Model errors compound as the rollout continues. - penalize (verb)
- To reduce a score or reward as a punishment.
MOPO penalizes the reward based on model uncertainty. - ensemble (noun)
- A group of several models trained together to give more reliable estimates.
Model uncertainty is estimated from disagreement across an ensemble. - disagreement (noun)
- The amount by which several models give different answers for the same input.
High disagreement among the ensemble signals high uncertainty. - upper-bound (verb)
- To set a limit that a quantity cannot go above.
The penalty term is designed to upper-bound the true model error. - theoretical guarantee (noun)
- A mathematical proof that a method will behave in a certain way under stated assumptions.
The theoretical guarantee says the policy is at least as good as the data. - behavior policy (noun)
- The policy that originally generated the training data.
The learned policy should do at least as well as the behavior policy. - Q-value (noun)
- A number estimating how good it is to take a specific action in a specific state.
COMBO pushes down Q-values for made-up state-action pairs. - critic (noun)
- The part of an RL system that estimates how good states or actions are.
COMBO directly penalizes the critic on model-generated data. - cancel out (phrasal verb)
- To combine two opposite effects so they balance and leave no net effect.
The two terms cancel out when the model looks realistic. - indistinguishable (adjective)
- So similar that you cannot tell two things apart.
The model's fake data is indistinguishable from real data. - sequence model (noun)
- A model trained to predict or generate ordered sequences of data.
The trajectory transformer is a large sequence model. - transformer (noun)
- A type of neural network good at processing sequences using attention.
A causally masked transformer predicts the next token in the trajectory. - joint probability (noun)
- The probability that several events all happen together.
The transformer estimates the joint probability of a full trajectory. - discretize (verb)
- To convert a continuous value into a fixed set of separate categories.
Each dimension of the trajectory is discretized before training. - beam search (noun)
- A search method that keeps only the best few candidate sequences at each step.
Planning uses a reward-guided variant of beam search. - prefix (noun)
- The first part of a sequence, before it is completed.
Beam search keeps the highest-reward prefixes. - trust (verb)
- To treat something as reliable enough to rely on.
If the model is accurate, its contribution is trusted. - long-horizon (adjective)
- Covering many steps into the future.
The transformer produces long-horizon humanoid predictions.
Chapters
- 0:00 <Untitled Chapter 1>
- 0:06 Model Based Offline Rl Methods
- 0:28 How Does Model Based Rl Work
- 1:53 Out-of-Distribution States Problem
- 2:48 Mobile Model Based Offline Policy Optimization
- 3:50 Choice of Uncertainty Penalty
- 4:15 Uncertainty Penalty
- 9:21 Optimality Gap
- 12:28 The Trajectory Transformer
- 14:06 Transformer Model
- 15:15 Auto Regressive Sequence Model
← Lecture 16, Part 2: Conservative Q-Learning (CQL) · Lecture 16, Part 4: Offline RL in Practice, Applications, and Open Problems →
