Unit 5 of 11 · about 5 hours · derive, implement

Extrapolation error, pessimism and Conservative Q-Learning

Standard backups query actions the data never saw and believe the answer. Pessimism is the fix that keeps offline values honest, and CQL is its cleanest expression.

You'll be able to

  • Locate where extrapolation error enters a Bellman backup and demonstrate it with a fixed-batch query.
  • Derive the Conservative Q-Learning regularizer and the lower-bound claims behind it.
  • Sweep the conservatism weight and show lowered out-of-data values with in-data values held.

Covers

Offline distribution shift and extrapolation errorPessimism and conservative value estimationConservative Q-Learning vocabulary
1

Read

In this order, only the parts listed

0 of 4 done

  1. Shift in dynamic programming, uncertainty, and CQLOffline Reinforcement Learning: Tutorial, Review and Perspectives

    Sections 4.2 through 4.5 of arXiv:2005.01643v3: distributional shift inside Bellman backups, policy constraints, uncertainty-based conservative estimates, and the CQL penalty as conservatism without explicit uncertainty

  2. CQL: the regularizer and the lower boundsConservative Q-Learning for Offline Reinforcement Learning

    Sections 1-3 of arXiv:2006.04779v3: Equations 1 and 2 with Theorems 3.1 (pointwise lower bound under support conditions) and 3.2 (tighter expected-value bound that is not pointwise); Section 3.2: the CQL(H) log-sum-exp variant (Equation 4), with Section 4 for the practical algorithm

  3. Lecture 18: Conservative Q-Learning slidesBerkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Imitation and Offline RL

    PDF pp. 17-21: pushing down large Q-values while pushing up in-data pairs, with the policy-constraint versus pessimism framing from PDF p. 2

    Use pp. 17-21 only here. IQL (pp. 11-15) and offline-to-online (pp. 22-24) belong to other units.

  4. CQL against BCQ and IQLHands-on Modern RL - Offline RL and Imitation Concepts

    Sections 2.2 and 2.4: the log-sum-exp soft maximum over all actions, the in-data restoration term, the penalty gap, and the method comparison table (page read 2026-10-14)

2

Focus on

  • Extrapolation error enters at the max: a Q-learning backup queries values at actions the dataset never paired with that state, and the maximizer seeks out exactly the overestimated ones.
  • CQL adds a penalty with two opposing terms: push down a soft maximum over all actions and push up the pairs actually observed. The gap between them is the conservatism; the paper's theory turns it into a lower bound.
  • A concrete gap: in-data value with one unseen action at gives a soft maximum of and a pre-weight gap of . Recompute both numbers; the weight in front sets the strength.
  • The two theorems differ in scope: Equation 1 gives a pointwise lower bound when the pushed-down distribution stays inside behavior support; Equation 2 gives a tighter bound on expected policy value that does not hold pointwise.
Common mistakes · 3
  • Quoting the lower bound for arbitrary actions. The pointwise claim needs the support condition of Theorem 3.1; the Equation 2 form bounds expected value only, and neither survives truly unsupported queries.
  • Setting the conservatism weight once and forgetting it. The paper trades performance against conservatism through this weight and notes that the weight needed for the lower bound falls as data grows; sweep it, do not copy it.
  • Assuming conservatism is free at deployment time. Pushed-down values cause the initial unlearning dip when online fine-tuning starts; that measurement belongs to the sequence-models unit.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write the CQL(H) objective (Bellman error plus the weighted soft-maximum minus in-data term), compute the 8.05 and 3.05 values above, and implement the fixed-batch regularizer showing out-of-data values falling while in-data values hold.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Where exactly does extrapolation error enter a Q-learning backup?Answer

    At the maximization (or argmax-action query) over next actions: it evaluates the Q-function at actions the dataset never paired with that state, and maximization selects the most overestimated one.

  2. 2.In-data value 5, one unseen action valued 8. What are the soft maximum and the penalty gap?Answer

    Soft maximum 8.05, gap 3.05 before the weight. The soft maximum is dominated by the unseen 8, which is exactly the overestimation the penalty must suppress.

  3. 3.Contrast the two CQL theorems in one sentence each.Answer

    Theorem 3.1: iterating the Equation 1 update lower-bounds the true Q pointwise when the penalty distribution stays in behavior support. Theorem 3.2: the Equation 2 form gives a tighter bound on expected policy value but not a pointwise bound.

  4. 4.What should happen to the conservatism weight as the dataset grows toward infinite coverage?Answer

    The weight needed for the lower bound shrinks: the paper notes that as grows the required weight decreases, so in the limit of infinite data an extremely small weight suffices.

You're done when

You derive the regularizer from memory, reproduce the 8.05 gap on paper, and can state which theorem covers which claim without hedging.

Only when you can do this without notes.

Leads to

Notes

Resources · 4 for this unit, 10 more in the section
  • 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.

  • 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.

  • 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/chapterNN folders 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.

  • 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.

  • 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.

  • 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.