Unit 4 of 11 · about 4 hours · measure
Offline datasets, behavior-policy identity, coverage and quality sweeps
Offline data cannot be repaired by interaction. Coverage and identity decide what any later algorithm is allowed to conclude, so this unit builds the dataset discipline first.
You'll be able to
- Record behavior-policy identity (dataset id, version, collection policy) with every offline result.
- Diagnose coverage and support gaps, including counterfactual queries the data cannot answer.
- Run quality, diversity, and coverage sweeps that compare cloning against an offline RL method with online truth reserved for audit.
Covers
Read
In this order, only the parts listed
0 of 4 done
- What offline RL is and why it is hardOffline Reinforcement Learning: Tutorial, Review and Perspectives
Sections 2.2 and 2.4 of arXiv:2005.01643v3: the offline problem statement with the behavior policy, then distributional shift named as the fundamental challenge
- Lecture 17: counterfactual queries and the SAC overestimation demoBerkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Imitation and Offline RL
PDF pp. 10-11: training data versus what the policy wants to do, with unseen actions as the counterfactual question; PDF p. 17: the soft actor-critic demo where predicted values exceed achieved returns on a log scale; PDF p. 18: why online sampling error becomes worse offline
- Minari dataset standards and one versioned datasetMinari Offline Datasets
Dataset Standards: episode and step data, spaces, and versioning; then open one hosted set such as https://minari.farama.org/datasets/mujoco/invertedpendulum/expert-v0/ and record its id, version, episode and step counts, and action bounds (pages read 2026-10-14)
- Lecture 07: the offline process and the behavior policyStanford CS224R Spring 2026 - Imitation and Offline RL
PDF pp. 7-9: training on a static dataset sampled from an unknown behavior policy that may mix human, scripted, and prior-RL sources
Read pp. 7-9 only here. Stitching and the method ideas belong to later units.
Focus on
- The behavior policy may be a mixture (human plus scripted plus prior runs) and is often unknown. Record the dataset id and version with every result; a result without them is not reproducible.
- A counterfactual query asks the value of an action never taken in that state. Online methods answer by trying it; offline methods must flag it, constrain around it, or admit they cannot answer.
- Expert data is narrow by construction. Medium or diverse data often trains better offline policies because coverage and stitching matter more than demonstration quality.
- Design sweeps as dataset variant by algorithm: at least two dataset types (for example expert versus medium) crossed with cloning versus one offline RL method, with online returns reserved for audit only.
Common mistakes · 3
- Equating more transitions with more coverage. Ten million steps from one deterministic policy cover one thin manifold; diversity of behavior is the coverage, not the row count.
- Downloading a dataset without its version and calling the experiment reproducible. Hosted sets are versioned because their contents change; the id alone does not pin the bytes.
- Tuning on online returns and calling the study offline. Online ground truth audits estimators after selection; the moment it guides a choice, the offline claim is void.
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.What four facts must accompany every offline result, and why?Answer
Dataset id, dataset version, behavior-policy description, and environment version. Without them nobody can tell what distribution the numbers came from or reproduce the bytes.
2.Why can medium-quality diverse data beat expert data for offline RL?Answer
Expert data concentrates on one narrow behavior, so new policies quickly leave its support. Diverse data covers more states and actions, which lets stitching and conservative methods compose better-than-demonstrator behavior.
3.What is a counterfactual query, and what did the Lecture 17 soft actor-critic demo show about it?Answer
Asking whether an unseen action is good without data to check. The demo showed predicted Q-values massively above achieved returns on a log scale: the policy asked, the data could not answer, and the values were wrong.
4.What belongs in the audit-only column of your sweep table?Answer
Online returns computed after all selection is finished, used only to judge estimators and methods. Nothing in that column may change a hyperparameter or a choice.
Practice
- Minari tutorial: behavioral cloning with PyTorch
Run the tutorial end to end on CPU: train the PPO expert, collect
cartpole/expert-v0withDataCollector, then clone it; keep the dataset id,algorithm_nameand Minari version with the trained policy and report them alongside the return (page read 2026-10-14)Small CartPole run on CPU; the expert step needs
rl_zoo3and Stable-Baselines3. As written, the loop hands(batch, time, action)logits toCrossEntropyLoss, which reads dimension 1, time, as the class axis: flatten logits to(-1, 2)with class-index targets before trusting the loss, and droprender_mode="human"on a headless machine. Treat the tutorial as the dataset-handling drill: collection, identity fields, episode iteration, baseline.
You're done when
You can state one dataset's full identity from memory of your run, point to its support gaps, and show a sweep table with the audit column untouched.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 10 more in the 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.
- 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.
Also in this section
- 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.
- 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.
- 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.
- 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. - 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.