Unit 6 of 11 · about 4 hours · derive, implement

Implicit Q-Learning expectiles and advantage-weighted actor updates

IQL learns multi-step values without ever asking the Q-function about unseen actions. It is the method that makes the no-OOD-query idea concrete and testable on a fixed batch.

You'll be able to

  • Derive the expectile value loss, the Q target, and the advantage-weighted policy update from the IQL paper.
  • Explain why the separate value function avoids both out-of-data queries and lucky-transition bias.
  • Compare IQL with cloning across dataset quality and coverage, sweeping the expectile.

Covers

Implicit Q-Learning expectile and advantage weightingAdvantage-weighted actor update vocabulary
1

Read

In this order, only the parts listed

0 of 4 done

  1. IQL: expectiles, the Q backup, and policy extractionImplicit Q-Learning

    Sections 4.1-4.3 of arXiv:2110.06169v1: expectile regression with Figure 1, the value loss and Q loss, the advantage-weighted extraction with Algorithm 1; Section 5.1: one-step improvement versus multi-step IQL

  2. Lecture 07: advantage weighting to expectile IQLStanford CS224R Spring 2026 - Imitation and Offline RL

    PDF pp. 20-21: full advantage-weighted regression; PDF p. 25: the expectile loss with its worked plot; PDF p. 26: the three IQL losses with the Homework 3 pointer

    Watch the notation: the slides write the expectile weight as a small value below 0.5 where the paper and the homework write it above 0.5. They are complements of each other; the traps below pin this down.

  3. Lecture 18: implicit constraints to IQLBerkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - Imitation and Offline RL

    PDF pp. 9-10: advantage-weighted regression and the AWAC update; PDF pp. 11-15: avoiding all out-of-distribution actions in the Q update with the expectile value function

  4. IQL and how it differs from AWACHands-on Modern RL - Offline RL and Imitation Concepts

    Sections 2.3, 3.2, and 3.3: the expectile backup through next-state values instead of maximized Q, and the AWAC-versus-IQL advantage comparison (page read 2026-10-14)

2

Focus on

  • The three losses use dataset actions only: an expectile value loss that estimates an upper envelope over in-support actions, a mean-squared Q loss backed up through next-state values, and an advantage-weighted cloning loss for the policy.
  • The separate value function does two jobs at once: it never queries unseen actions, and it averages out transition luck, because a high target from a lucky next state does not move the action-envelope estimate the way a directly fitted maximum would.
  • The expectile parameter is a sweep, not a constant: 0.5 recovers the mean and higher values reach further toward the in-support maximum. The homework compares 0.2 against 0.9 on the U-maze for exactly this reason.
  • AWAC and IQL share the weighted-cloning policy form but estimate advantage differently: AWAC backs advantages through a standard Q backup that still queries next actions sampled from the current policy, while IQL backs them through the expectile value with no out-of-data query.
Common mistakes · 3
  • Mixing up the expectile conventions. The paper and both homeworks write the upper expectile above 0.5 (0.9 beats 0.2 for reaching good values); the Stanford slides write the same loss with the complement below 0.5. Convert before comparing numbers across sources.
  • Treating the expectile as a maximum. It approaches the in-support maximum as the parameter tends to 1 but stays an expectile of dataset values at any fixed setting; it never invents out-of-support actions.
  • Reading small inverse temperature as aggressive. In the extraction loss, small temperature behaves like plain cloning and large temperature reaches for the Q maximum; the direction is the reverse of a penalty weight.
3

Try it yourself

Closed-book, before checking anything

Closed-book, write all three IQL losses, compute the 0.9 expectile of the values 0, 0, and 10 (8.18, above the mean 3.33), and show on a fixed batch that no loss term evaluates an action outside the dataset.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Compute the 0.9 expectile of values 0, 0, and 10, and compare with the mean.Answer

    8.18, above the mean 3.33. The minimizer weights the above-estimate squared error at 0.9 and the below-estimate part at 0.1, pulling the estimate toward the high in-support value.

  2. 2.Why does IQL fit a separate value function instead of taking expectiles of Q targets directly?Answer

    A high Q target can come from a lucky transition into a good state rather than a good action. The separate value function takes the expectile over actions only, while the Q backup averages over transition stochasticity.

  3. 3.Where does AWAC still query out-of-distribution actions while IQL does not?Answer

    AWAC's advantage comes from a standard Bellman backup that samples next actions from the current policy, which may be unseen. IQL's backup goes through the expectile of dataset values at the next state, using dataset actions only.

  4. 4.What does the extraction loss become as the inverse temperature goes to zero?Answer

    Plain behavior cloning: all advantage weights tend to 1, so every dataset action is imitated equally regardless of value.

  5. 5.A run with expectile 0.2 underperforms 0.9 on the U-maze. What does that tell you, in one sentence?Answer

    The task needs multi-step improvement toward good in-support values, which the near-mean estimate cannot provide; the higher expectile reaches further up the dataset's value envelope.

5

Practice

  • Stanford CS224R Homework 3, Questions 1-2: AWAC and IQL on AntMaze

    Question 1: AWAC implementation and comparison; Question 2: cs224r/critics/iql_critic.py and cs224r/agents/iql_agent.py with the expectile sweep over 0.2 and 0.9 on antmaze-umaze-v0, then the better setting on antmaze-medium-diverse-v0

    Full runs need Modal GPUs (about 1 hour per U-maze run, 1.5 hours for medium). Implement the three losses locally first with fixed-batch tests that assert no out-of-data query, and treat full sweeps as optional.

You're done when

Your hand expectile matches code, your fixed-batch losses never touch an unseen action, and you can predict which expectile wins on a new maze and why.

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.

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

  • 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

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

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