Unit 3 of 11 · about 4 hours · explain
Inverse RL, the reward-learning boundary, GAIL and occupancy matching
Some tasks have demonstrations but no reward function. This unit draws the boundary: what reward learning can identify, and what occupancy matching settles for instead.
You'll be able to
- Explain why demonstrations underdetermine the reward and where maximum-entropy IRL pays for its answer.
- State GAIL as occupancy matching (Jensen-Shannon via the discriminator game) and what it recovers instead of a reward.
- Say what GAIL needs that behavior cloning does not, and read its discriminator signs correctly.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Inverse RL and GAILHands-on Modern RL - Offline RL and Imitation Concepts
Sections 1 and 2: the inverse-RL setting, the maximum-entropy distribution over trajectories, and why the partition function is intractable; Section 3: the discriminator-policy alternation and the occupancy-ratio optimum (page read 2026-10-14)
Use the page for the setting and the game structure. Take proposition numbers and the saddle objective from the paper below, not from this pre-reading.
- GAIL: occupancy matching and the discriminator gameGenerative Adversarial Imitation Learning
Sections 3-5 of arXiv:1606.03476v1: the occupancy measure with Propositions 3.1 and 3.2, the Jensen-Shannon matching objective with Equations 15-18, and Algorithm 1 with the TRPO policy step
- Comparing BC, DAgger, and GAILHands-on Modern RL - Offline RL and Imitation Concepts
Section 4: interaction, label, and reward requirements side by side (page read 2026-10-14)
Focus on
- Inverse RL is underspecified: many rewards, including zero, rationalize the same demonstrations. Maximum entropy selects the trajectory distribution proportional to exponentiated return, but its partition function sums over all trajectories and is intractable.
- GAIL stops asking for a reward and matches occupancy measures instead: the policy whose state-action visitation minimizes Jensen-Shannon divergence to the expert's. What it recovers is a policy, not a transferable reward.
- The paper's saddle (Equation 16) puts the log discriminator term on learner samples and the log one-minus term on expert samples, with policy cost equal to log discriminator output. Other sources flip this labeling, so check which expectation gets which term before reading any discriminator value.
- The 2016 TRPO policy step inside Algorithm 1 is dated machinery. Learn the objective and the alternation; a modern implementation would use a newer policy optimizer.
Common mistakes · 3
- Reading a discriminator output of 0.8 as expert-like without checking the labeling. Under the paper's Equation 16, the log term sits on learner samples, so a high value means looks-like-learner; flipped labelings mean the opposite.
- Calling GAIL an offline algorithm. It samples fresh learner trajectories every iteration (Algorithm 1, line 3), so it needs environment interaction that fixed-dataset methods do not have.
- Expecting the learned discriminator to serve as a reward for new tasks. It is a local cost tied to this expert and this training run, not an identified reward function.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Why can inverse RL never promise the true reward, even with infinite demonstrations?Answer
Demonstrations constrain behavior, not reward: many rewards produce the same optimal policy. Maximum entropy picks one by an entropy criterion, and its partition function is intractable, so approximations choose further.
2.In the paper's Equation 16, which samples does the log discriminator term average over, and what does a high discriminator value mean?Answer
Learner-policy samples average the log term; expert samples average the log one-minus term. High means the pair looks like the learner under this labeling, the reverse of pages that put the expert under the log term.
3.What does GAIL need that behavior cloning does not, and what does it recover instead of a reward?Answer
Environment interaction for fresh learner rollouts plus expert samples each iteration. It recovers an imitator policy whose occupancy matches the expert's, not a reward function.
4.Is the TRPO step load-bearing for the GAIL idea?Answer
No. The idea is the occupancy-matching objective and the discriminator game. TRPO is the 2016 optimizer; the objective survives a change of policy optimizer.
You're done when
You can write the occupancy definition and the saddle from memory with correct term labels, and state in one sentence each what IRL cannot identify and what interaction GAIL requires.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 12 more in the section
- Generative Adversarial Imitation LearningHo and Ermon (NeurIPS 2016) · support
Read the occupancy-measure view of imitation and the discriminator-as-reward construction. State what GAIL needs that behavior cloning does not (environment interaction) and what it recovers instead of a reward.
- Hands-on Modern RL - Offline RL and Imitation ConceptsWalking Labs · support
Use the offline data and distribution-shift page and the imitation chapter as pre-reading for BCQ, CQL, IQL, behavior cloning, DAgger and GAIL. They have no runnable offline or imitation scripts and no off-policy evaluation. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers.
Also in this section
- Stanford CS224R Spring 2026 - Imitation and Offline RLStanford University · primary
Study Lecture 02 (imitation: behavior cloning, covariate shift, DAgger) and Lecture 07 (offline RL). Homework 1 (behavior cloning, flow matching and DAgger on a small Flappy Bird environment) runs on CPU; Homework 3 (AWAC, IQL and a stitching study) runs on cloud GPUs, so read it for the losses. Follow the Stanford honor code for course materials.
- Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Imitation and Offline RLUC Berkeley · required
Slides are public at https://rail.eecs.berkeley.edu/deeprlcourse/static/slides/lec-N.pdf; current videos are not, and the public Fall 2023 playlist numbers lectures differently. Study Lectures 2 and 3 (behavioral cloning) and Lectures 17 and 18 (offline RL). Homework 1 (MSE and flow-matching action-chunk policies) runs on a laptop CPU; Homework 5 (SAC+BC, IQL and FQL on OGBench) needs a GPU, so debug on the smallest task and treat full 1M-step sweeps as optional.
- Offline Reinforcement Learning: Tutorial, Review and PerspectivesLevine et al. · required
Study the problem definition, distribution-shift failure, policy constraints, uncertainty and model-based/model-free taxonomy. Use it to state which offline assumptions each implementation relies on.
- Implicit Q-LearningKostrikov et al. · required
Derive the expectile value loss, Q target and advantage-weighted policy update. Implement fixed-batch loss tests and compare IQL with behavior cloning across dataset quality and coverage.
- Conservative Q-Learning for Offline Reinforcement LearningKumar et al. (NeurIPS 2020) · support
Read the conservative regularizer and the lower-bound argument. Implement the regularizer on a fixed batch and show how it lowers Q-values on actions the dataset does not contain.
- DAggerRoss, Gordon and Bagnell · support
Read the no-regret reduction and interactive data-aggregation loop. Demonstrate compounding error in a controlled imitation task, then show exactly what additional expert queries change.
- Cal-QL: Calibrated Offline RL Pre-Training for Efficient Online Fine-TuningNakamoto et al. (NeurIPS 2023) · support
Read why conservative values cause an initial dip when online fine-tuning starts and how calibration bounds the values. Measure the first online episodes after offline training with and without the fix.
- Doubly Robust Off-policy Value Evaluation for Reinforcement LearningJiang and Li (ICML 2016) · support
Read the per-decision importance-sampling estimator, the doubly robust form and its variance analysis. Implement ordinary, weighted and doubly robust estimates on logged trajectories from a small MDP whose true value you can compute.
- Batch Policy Learning under Constraints (Fitted Q Evaluation)Le, Voloshin and Yue (ICML 2019) · support
Read the Fitted Q Evaluation algorithm and its role inside the constrained learner. Implement FQE on your logged data and compare it with the importance-sampling estimates against the true value.
- Benchmarks for Deep Off-Policy EvaluationFu et al. (ICLR 2021) · support
Read the evaluation protocol and the metrics for estimator quality and offline model selection (rank correlation, regret of the selected policy). Use them to judge your estimators instead of one point error.
- Minari Offline DatasetsFarama Foundation · support
Use Minari as the dataset source for offline experiments: it serves Gymnasium-native datasets that download without login (start with a small MuJoCo set such as
mujoco/invertedpendulum/expert-v0). Record the dataset id and version with every result. - Reinforcement Learning Control Laboratory - Offline StretchRoadmap-Final · support
Add the project offline-data stretch only after online control passes. Calibrate importance or fitted-value estimates against simulator truth and expose one support-mismatch failure before hiding online access.