Unit 8 of 11 · about 5 hours · derive, implement
Off-policy evaluation targets, importance sampling, weight clipping and effective sample size
Evaluation without interaction stands or falls on the weights. This unit makes every estimator earn its number against a known truth, with the diagnostics that expose a one-trajectory estimate.
You'll be able to
- Derive trajectory and per-decision importance-sampling estimators with their support assumptions.
- Implement ordinary, weighted, and per-decision estimates on logged trajectories with a known true value.
- Report weight diagnostics (distribution, clipping bias, effective sample size) instead of a bare point estimate.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Off-policy evaluation via importance samplingOffline Reinforcement Learning: Tutorial, Review and Perspectives
Section 3.1 of arXiv:2005.01643v3: the trajectory estimator with its weight product, the per-decision form that drops future weights per reward, and the weighted (self-normalized) variants with their bias-variance tradeoff
- DOPE: the behavior-agnostic protocol and step-wise ISBenchmarks for Deep Off-Policy Evaluation
Sections 2 and 3.2 of arXiv:2103.16596v1: evaluation without logged propensities (behavior policy estimated where required) and the split between point-error and ranking metrics; Section 5.1: the IS baseline, self-normalized step-wise importance sampling
- Importance-sampling families before the robust upgradeDoubly Robust Off-policy Value Evaluation for Reinforcement Learning
Section 3.2 of arXiv:1511.03722v3: the ordinary and weighted estimator review that the doubly robust form builds on
Read Section 3.2 only here. The doubly robust estimator itself belongs to the next unit.
Focus on
- The evaluation target is the return of a fixed target policy under logged trajectories from a behavior policy. Every estimator here reweights the same logged rewards; they differ only in which weights multiply which reward.
- Per-decision weights drop future ratios per reward because a reward cannot depend on later actions. Expectation is unchanged while per-trajectory values change, which is a variance reduction, not a bias fix.
- Self-normalized (weighted) estimators divide by the weight sum: lower variance, but biased at finite samples and only consistent. Ordinary estimators are unbiased but can ride on a handful of huge weights.
- Effective sample size compresses the weight vector into one number: squared weight sum over sum of squared weights. One dominant weight out of four trajectories gives about 1, and the estimate is then one trajectory wearing a disguise.
Common mistakes · 3
- Calling the weighted estimator unbiased because it matched truth once. It is biased at finite samples by construction; matching truth on one dataset is luck, and the bias points toward the behavior policy.
- Clipping weights and keeping the unbiasedness claim. Clipping caps variance by adding bias: the clipped weights undercount exactly the trajectories the target policy favors most. Report the clip level and the bias direction instead of hiding them.
- Estimating the behavior policy from the same logs and proceeding as if propensities were known. Estimation error enters every weight, and thinly logged actions hide the largest errors.
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.Which estimator is unbiased: ordinary or self-normalized? What does the other buy?Answer
Ordinary is unbiased under support. Self-normalized buys lower variance at the price of finite-sample bias toward the behavior policy; it is consistent, not unbiased.
2.In the four-trajectory reproduce case, ordinary and per-decision means agree at 2.0. What differs, and why keep both?Answer
Per-trajectory values differ (6 versus 8 on the best trajectory) while the mean matches. Per-decision removes future-weight noise per reward, so its variance across datasets is usually lower.
3.Weights are 4, 0, 0, 0. What are the ordinary estimate, the self-normalized estimate, and the effective sample size?Answer
Both estimates equal the first trajectory's return (ordinary mean 4 times return over 4; self-normalized return over weight sum 4). Effective sample size is 1 of 4: a single-trajectory estimate.
4.The logging system stored no propensities. What changes in the IS pipeline?Answer
Fit a behavior-policy model first and use estimated ratios, following the behavior-agnostic protocol. Every weight now carries model error, so support diagnostics matter more, not less.
You're done when
Your hand estimates match code on the four-trajectory case, and you refuse to report any IS number without its weight diagnostics attached.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 11 more in the section
- 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.
- 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.
- 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.
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.
- 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.
- 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.
- 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. - 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.