Modern Deep Reinforcement Learning/Offline RL: The Problem and Value-Based Fixes

Lesson 5.92,355 words

Offline RL: The Problem and Value-Based Fixes

Offline reinforcement learning learns a policy from a fixed logged dataset with no further environment interaction — off-policy learning pushed to the extreme, and it breaks for the extreme version of the same reason. Bootstrapping queries the value function at out-of-distribution actions the data never covers, those errors are optimistic, and with no online feedback to correct them they compound through the Bellman backup.

╌╌╌╌

Every method so far assumed a running environment. The agent acts, the environment returns a reward and a next state, and that fresh feedback keeps the estimates accurate — a value that drifts too high produces actions that get tried, fail, and get corrected. Offline reinforcement learning removes exactly that loop. You are handed a fixed dataset of transitions logged by some earlier policy, and you must return the best policy you can without collecting a single new transition. No exploration, no rollouts, no chance to test an optimistic guess against the environment.1

This is off-policy learning taken to its limit. Off-policy methods already learn about a target policy from data generated by a different behavior policy; offline RL is the special case where the behavior data is all there is and can never be run to gather more. The deadly triad — function approximation, bootstrapping, off-policy training — is present in full, and one of its stabilizers, the ability to visit the states your policy actually induces, is gone. The result is a failure mode sharp enough to have its own name, and a family of fixes that all reduce to a single instruction: be pessimistic about what the data cannot verify.

This lesson sets up the problem — the failure mode, and how you even score a policy from a log — then builds the two value-based families of fix: policy constraint (BCQ) and conservative value estimation (CQL). The implicit methods, model-based pessimism, and the sequence-modeling view of Decision Transformer continue in a companion lesson.

The setting and why it matters

Formally, offline RL fixes a static dataset

collected by a behavior policy (possibly a mixture of several policies, or logged human operators). The learner sees once, fits a policy , and is evaluated by deploying in the true environment. Between fitting and deployment there is no interaction. The empirical state-action distribution of the data,

is the only region of the world the learner has ground truth for. Anything outside its support is a guess.

The motivation is that in the domains where RL would help most, online interaction is expensive, slow, or dangerous, while logged data already exists in bulk.

DomainWhy online interaction is blockedWhat logged data exists
Medicinea bad treatment policy harms patientsyears of electronic health records, dosing logs
Autonomous driving / roboticsa bad action crashes hardwarefleet-scale driving logs, teleoperation traces
Recommendationlive experiments cost revenue and annoy usersbillions of impression-click histories
Industrial controlexploration can damage the plantsensor logs from existing controllers

In each case the promise is the same one supervised learning delivered on perception: turn a large static dataset into a decision-making system, with all the learning done offline and only the final policy deployed. The obstacle is that a policy is not a label. To evaluate a candidate action the value function must estimate outcomes for actions the dataset may never have taken, and estimation without feedback is where offline RL fails.

The core failure: distributional shift and extrapolation error

Run an ordinary off-policy algorithm — Q-learning, or an actor-critic like DDPG — on a fixed dataset and it typically diverges or returns a policy far worse than , even when is large and the network has ample capacity. The culprit is not optimization but the bootstrapping target.

Q-learning fits to the Bellman target

The maximization — or the actor chasing high value — deliberately seeks the action that maximizes the current . On a full environment that is fine: if the max lands on an overvalued action, the agent tries it, observes the true low reward, and the estimate is corrected. Offline, the transition for that chosen may simply not be in . The network's value there is pure extrapolation, and the argmax preferentially selects wherever the extrapolation happens to overshoot.

Two properties make this fatal offline rather than merely inconvenient.

The first is selection bias toward overestimation. Errors in are roughly symmetric — some out-of-distribution actions read too high, some too low — but the (or a greedy actor) is a systematic search for the highest value, so it lands on the positive errors by construction. This is the same overestimation that motivated Double Q-learning, but without any online experience to eventually reveal the truth.

The second is compounding with no corrective feedback. Bootstrapping feeds the inflated target back in: an overestimate at raises the target for , which raises , which raises the target for whatever transitions bootstrap off , and so on around the Bellman backup. Online, a rollout would eventually visit the offending action and puncture the bubble. Offline, nothing punctures it. The overestimation propagates and amplifies until the value function is dominated by fictitious high-value actions and the induced policy is garbage.

The out-of-distribution overestimation blowup. Within the data support (shaded) the fitted tracks the true ; outside it, the Bellman selects wherever the extrapolation overshoots, and bootstrapping feeds that inflated value back as a target, so the error compounds with no online return to correct it.

The diagnosis determines the fix. The value function is trustworthy inside the data support and unreliable outside it, and the standard Bellman backup does the one thing guaranteed to exploit the unreliable region. Every offline method below enforces the same rule a different way: do not trust, or do not query, values off the data.

A worked example: how the bubble inflates

Take a two-state chain: states and , with two actions , discount , and a tiny logged dataset that only ever took :

Action is never logged from either state. Suppose the true environment is dull: from anywhere gives reward and self-loops, so , while earns the returns and . A well-behaved learner should recover exactly these.

Now initialize a network whose generalization happens to read the unseen action optimistically: say it predicts before any training (a pure extrapolation, off-support, positive by bad luck). Run one Bellman backup on the logged transition with a greedy max target:

The max reached off the data and pulled the fictitious into the target for a logged transition. is now dragged toward — a target the logged data never justifies — and the inflation does not stop. The next backup on reads (or higher, if still reads higher), so , and if the network's extrapolation of is also optimistic the same overshoot re-enters at . Each sweep the phantom value at feeds a higher target, the higher target raises the logged , and with no rollout ever executing to observe its true reward, nothing pushes the estimate back down. Online, one visit to would return reward and collapse the bubble in a single update; offline, the -value is never corrected and the whole chain drifts up unboundedly. The induced greedy policy then prefers — an action the data shows nothing about and the environment rewards not at all.

The overestimation bubble on the two-state chain. A single optimistic off-support value at the unseen action (dashed) is pulled into the Bellman max, inflating the target for a logged transition; the inflated logged value feeds the next backup, and with no rollout to execute the estimate climbs each sweep while the true value (flat, low) is never queried.

The failure is averted by one change: a value at that the learner does not trust. Each family below installs precisely that.

Off-policy evaluation: scoring a policy from the log

Before improving a policy offline you often want to score one: given a candidate and only the log from , estimate without ever running . This is off-policy evaluation (OPE), and it is both a subproblem inside offline RL and the way a practitioner decides whether a learned policy is safe to deploy. It inherits the same distributional-shift problem in a purer form.

The unbiased classical estimator is importance sampling. A trajectory logged under is reweighted by the ratio of the probability would have produced it to the probability did:

It is unbiased, but the product of per-step ratios is its undoing: over a horizon of steps the weight is a product of factors, and its variance grows exponentially in . A single trajectory whose actions strongly prefers but rarely took gets an astronomically large weight and dominates the average, so the estimate is unbiased but so noisy as to be useless past short horizons — the curse of horizon.

Importance-sampling weights for off-policy evaluation. Each logged trajectory is reweighted by the product of per-step ratios pi over pi-beta. Most weights are near zero (the target policy would rarely take those actions) while a few are enormous, so a handful of trajectories dominate the estimate and its variance explodes with the horizon.

Two standard repairs reduce the variance. Weighted importance sampling (WIS) self-normalizes by dividing by instead of ; this introduces a small bias but is consistent and dramatically lower-variance in practice. Doubly-robust estimators combine importance sampling with a learned value-function model: the model supplies a low-variance baseline, and importance sampling corrects only its residual, so the estimator is unbiased if either the model or the ratios are right, and low-variance when the model is even roughly accurate. A third route abandons per-step ratios entirely and estimates the ratio of state-action occupancies directly, sidestepping the horizon product (marginalized OPE). None escapes the basic limit: a policy far from cannot be evaluated reliably from 's data — the same support limit that constrains offline learning constrains offline evaluation.

Fix family 1 — policy constraint (BCQ)

The most direct reading of the diagnosis is: never let the target action stray far from actions the behavior policy would take. If only ever proposes actions with support in , then is only ever queried where it is constrained by data, and extrapolation error never enters the backup.

Batch-Constrained deep Q-learning (BCQ)2 implements this with a learned generative model of the behavior policy. A conditional variational autoencoder is trained on to reproduce the actions took at each state — it is a density model of actions that plausibly appear in the data. At decision time BCQ samples a handful of candidate actions from , allows each a small learned perturbation bounded by a radius , and picks the candidate with the highest :

The generative model keeps the argmax on-support; the bounded perturbation lets improve on locally without leaping to unseen actions. Setting and one sample recovers behavior cloning; larger and more samples recover something closer to Q-learning. BCQ was the paper that named extrapolation error and showed standard off-policy deep RL fails on data its own earlier version generated.

BCQ's constrained argmax. A generative model of the behavior policy proposes candidate actions clustered on the data support (blue); each is allowed a small bounded perturbation (arrows); the argmax picks the best perturbed candidate. Because every candidate stays near the data, the value function is never queried at the far-off-support actions where it overshoots (red region).

The tension in policy-constraint methods is the choice of (or the divergence weight): too tight and can never improve on the logged behavior; too loose and out-of-distribution actions leak back in. That tuning knob is the recurring cost of constraining the policy rather than the value, which is what the next family attacks instead.

Fix family 2 — conservative value estimation (CQL)

Instead of constraining which actions the policy may take, constrain the value function itself: deliberately push down the Q-values of out-of-distribution actions so the argmax has no incentive to pick them. If unseen actions look bad, the greedy policy stays on the data on its own, no generative model required.

Conservative Q-Learning (CQL)3 adds one term to the standard Bellman error. The term maximizes on state-action pairs from the data and minimizes it on actions sampled from the current policy (the ones at risk of being out-of-distribution overestimates). In its practical form, at each state the penalty pushes down a log-sum-exp over all actions and pulls up the value of the logged action:

where is the empirical Bellman operator and trades off conservatism against fitting the data. The log-sum-exp is high wherever any action's value is high, so minimizing it flattens the optimistic peaks; the second expectation protects the values of actions actually in the data. Kumar et al. prove this learns a that lower-bounds the true (for large enough ) — the value function is provably pessimistic, so its greedy policy cannot be fooled by a fictitious high-value action.

Conservative versus naive value landscapes at a fixed state. The naive (dashed) fits the data in-support but extrapolates upward off it, handing the argmax a fictitious peak. CQL adds a penalty that pushes down out-of-distribution values, so the conservative (solid) lower-bounds the true value and its argmax stays on the data.

CQL's advantage over policy constraint is that it needs no generative model of and degrades gracefully: even a loosely tuned still yields a value function biased toward pessimism, which is the safe direction offline.

Where this leaves us

The setup is now in place. Offline RL fails because bootstrapping queries the value function at out-of-distribution actions the log never covers; those queries come back optimistic, and with no online audit the errors compound through the Bellman backup into a value function detached from reality. Off-policy evaluation lets you score a candidate policy from the log without deploying it, but it inherits the same shift.

Two families of fixes are now in hand, both enforcing the one rule — trust only what the data confirms:

  • Policy constraint (BCQ) keeps the learned policy close to the behavior policy, so the value function is never asked about far-off actions in the first place.
  • Conservative value estimation (CQL) lets the policy roam but pushes down the -values of out-of-distribution actions, provably lower-bounding the true value.

A third, subtler family never queries the value function off the data at all; a model-based branch builds pessimism into a learned MDP; and a sequence-modeling view sidesteps bootstrapping entirely. Those — IQL, MOPO/COMBO, and Decision Transformer, plus the modern fine-tuning and generative-planning lines — continue in Offline RL: Implicit Methods, Sequence Models, and Beyond.

Footnotes

  1. Levine, Kumar, Tucker, Fu (2020), Offline Reinforcement Learning: Tutorial, Review, and Perspectives on Open Problems, arXiv:2005.01643 — the survey that frames distributional shift as the central offline challenge and organizes the method families.
  2. Fujimoto, Meger, Precup (2019), Off-Policy Deep Reinforcement Learning without Exploration, ICML — introduces batch-constrained Q-learning (BCQ) and names extrapolation error; shows standard off-policy deep RL fails on fixed datasets.
  3. Kumar, Zhou, Tucker, Levine (2020), Conservative Q-Learning for Offline Reinforcement Learning, NeurIPS — the conservative penalty that pushes down out-of-distribution Q-values and provably lower-bounds the true value.

╌╌ END ╌╌