Deep RL IV: Imitation, Offline RL and Off-Policy Evaluation

Offline data removes the ability to repair coverage mistakes through interaction. This stage exposes covariate shift, support mismatch and estimator variance, establishes behavior cloning as a strong baseline and limits claims to what the logged policy and data can identify.

Section 6 of 12 · 11 units · about 45 hours

0/11

By the end you can Build behavior-cloning and IQL-style baselines on a versioned dataset, expose a coverage failure, and show what an off-policy estimate can and cannot establish using weight, support and effective-sample-size diagnostics.

Units

Build it

Mini project · about 10 to 14 hours

Offline imitation and calibrated off-policy evaluation

Extend policylab with an offline/ laboratory over versioned logged datasets: cloning baselines, conservative values and a full off-policy evaluation suite. Calibrate every estimator against simulator truth and seal online returns until the audit. Support gaps become explicit abstention rules, not silent extrapolation.

  1. 1Log expert and learner trajectories from a small MDP with exact values in oracles/ into versioned offline/ datasets with behavior-policy identity and coverage counts, and fit a behavior-cloning baseline that every later estimator and policy is compared against.
  2. 2Train an expert-versus-learner classifier on the logged pairs, check its optimum under the stated labeling against the occupancy ratio, and name the online rollouts GAIL would still need.
  3. 3Add a fixed-batch CQL regularizer test that lowers values on actions missing from the data while holding in-data values, then sweep the conservatism weight and write down the performance tradeoff.
  4. 4Compute ordinary, weighted and per-decision estimates on logged trajectories with a known true value, keeping weight-distribution plots, clipping comparisons and effective-sample-size diagnostics calibrated against simulator truth.
  5. 5Run FQE on the same logs beside importance-sampling estimates, add a doubly robust estimate, and judge all three by absolute error, rank correlation and selection regret against simulator truth.
  6. 6Expose one support-mismatch failure with its undefined weight written out, select candidates by rank correlation and regret with online returns sealed, then audit on held-out policies with frozen normalization, fallback and trigger logs.
What you hand in
  • offline/ datasets with behavior identity, coverage diagnostics and the discriminator-versus-occupancy check.
  • CQL, importance-sampling, FQE and doubly robust estimates with sweeps and diagnostics against simulator truth.
  • Sealed selection with rank and regret metrics, the audit table, and the abstention rule with fallback.
How to check it
  • Self-grade with the rubric below
How it's graded

Pessimism tests

Pass: The fixed-batch CQL test lowers unseen-action values while in-data values hold, and the weight sweep records the tradeoff.

Great: A matched cloning baseline shows where conservatism wins and where coverage alone decides.

Weight honesty

Pass: All three importance-sampling estimates carry weight plots, clipping comparisons and sample-size diagnostics against truth.

Great: A clipped-versus-unclipped pair shows the bias direction, and one dominant weight is called out as a single-trajectory estimate.

Estimator ranking

Pass: FQE, importance-sampling and doubly robust estimates report error, rank correlation and regret on the same logs.

Great: A ranking flip between error and regret is kept as evidence that selection needs ordering, not accuracy.

Sealed selection

Pass: The undefined-weight exhibit is written out, selection uses sealed returns, and the audit covers held-out policies.

Great: The abstention rule routes unsupported pairs to fallback with trigger logs, and normalization stays frozen throughout.

Resources

  • Stanford CS224R Spring 2026 - Imitation and Offline RLStanford University

    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

    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.

    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.

    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)

    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

    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.

  • Generative Adversarial Imitation LearningHo and Ermon (NeurIPS 2016)

    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.

  • Cal-QL: Calibrated Offline RL Pre-Training for Efficient Online Fine-TuningNakamoto et al. (NeurIPS 2023)

    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)

    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)

    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)

    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

    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.

  • Hands-on Modern RL - Offline RL and Imitation ConceptsWalking Labs

    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/chapterNN folders do not follow the site chapter numbers.

  • Reinforcement Learning Control Laboratory - Offline StretchRoadmap-Final

    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.