It reproduces the dataset's average behavior. This is sensible when the data are consistently expert, but a fixed dataset may contain failed trajectories, policies of different quality, and locally useful fragments that never occur together.
Offline RL tries to select and stitch the useful parts. If one trajectory reliably reaches an intermediate state and another continues from there to the goal, Bellman backups can combine them even when no demonstration contains the complete solution.
This ambition requires counterfactual reasoning: the learned policy must compare actions and sequences that were not executed together. That is also where offline RL becomes dangerous.
The Counterfactual Problem
The dataset supports estimates near its own state-action distribution:
dβ(s,a)=dβ(s)πβ(a∣s).
The learned policy induces another distribution:
dπ(s,a)=dπ(s)π(a∣s).
A small regression error under dβ says little about error under dπ:
Edβ[ℓ(s,a)] small\centernot⟹Edπ[ℓ(s,a)] small.
Ordinary distribution shift is already difficult. Offline RL adds optimization:
a∗=argamaxQ(s,a).
The policy actively searches for actions with the largest predicted value, so it tends to select positive approximation errors.
Unsupported Bellman targets
A standard value-based target is
y=r+γa′maxQϕˉ(s′,a′).
In actor-critic form,
y=r+γEa′∼πθ(⋅∣s′)[Qϕˉ(s′,a′)].
The transition (s,a,r,s′) came from the dataset. The target action a′ may not have. The critic then copies an unsupported prediction into the value of an observed action:
LQ(ϕ)=ED[(Qϕ(s,a)−y)2].
That error can propagate backward through every later Bellman backup.
Write
Q(s,a)=Q(s,a)+ε(s,a).
Even when a randomly selected error has zero mean, maximization preferentially chooses positive errors:
E[ε(s,argamaxQ(s,a))]>0.
The actor creates the same failure directly:
θmaxEs∼D,a∼πθ(⋅∣s)[Qϕ(s,a)].
It is an optimizer over critic extrapolation errors.
Model-based RL suffers the analogous problem when a planner finds actions for which learned dynamics are optimistic. Importance-sampled policy gradients suffer when
πβ(a∣s)πθ(a∣s)
becomes enormous because behavior probability is tiny.
Online RL can execute the suspicious action, observe its consequence, and correct the estimate. Offline RL cannot. Errors that would be temporary online can remain self-reinforcing offline.
Most offline algorithms use one or more of three ideas:
constrain the policymake values pessimisticuse in-sample backups⇒π stays near behavior support,⇒unsupported actions look unattractive,⇒the critic never queries actor actions..
These are different ways to refuse unsupported counterfactuals.
Constraining Policy Improvement
The unconstrained actor seeks
πmaxEs∼D,a∼π[Q(s,a)].
A behavior-regularized version solves
πmaxEs∼D,a∼π[Q(s,a)]s.t.D(π(⋅∣s),πβ(⋅∣s))≤ϵ.
The Lagrangian form is
πmaxEs∼D[Ea∼π[Q(s,a)]−αD(π,πβ)].
Small α permits aggressive improvement and more extrapolation. Large α approaches imitation.
The ideal constraint would only require
suppπ(⋅∣s)⊆suppπβ(⋅∣s).
It would allow any supported action without preserving bad behavior frequencies. Exact support is difficult to estimate in continuous high-dimensional spaces, so practical methods use smooth divergences or learned behavior models.
Forward and reverse KL behave differently
Forward KL is
DKL(πβ∥πθ)=Ea∼πβ[logπθ(a∣s)πβ(a∣s)].
Up to a constant in θ,
DKL(πβ∥πθ)=−Ea∼πβ[logπθ(a∣s)]+const.
It is directly estimated from dataset actions and pressures the policy to cover all behavior modes—including poor ones.
Reverse KL is
DKL(πθ∥πβ)=Ea∼πθ[logπβ(a∣s)πθ(a∣s)].
Using policy entropy,
DKL(πθ∥πβ)=−Ea∼πθ[logπβ(a∣s)]−H(πθ(⋅∣s)).
Reverse KL can focus on one good behavior mode, but it requires evaluating the unknown behavior density.
Actor-critic plus behavioral cloning
Using forward KL gives a particularly simple actor objective:
Dropping that constant leaves the cloning term estimated from D.
For a deterministic Gaussian actor, cloning becomes
−∥πθ(s)−a∥22.
AC+BC is easy to add to an existing actor-critic. Its weakness is the coefficient: one global α must balance reward scale, critic scale, support quality, and the value of deviating in every state. The critic target may also still evaluate unsupported actor actions.
A BRAC-style method places an explicit behavior divergence in both policy improvement and critic evaluation:
y=r+γEa′∼πθ[Qϕˉ(s′,a′)−λD(πθ,πβ)].
The critic then estimates behavior-regularized return rather than unconstrained return.
Advantage-Weighted Regression
Advantage-weighted methods never optimize arbitrary actor actions. They fit only dataset actions, giving better actions larger weights.
For one state, consider the reverse-KL constrained improvement problem
Z(s) changes state weighting but not the preferred action distribution at a fixed state.
Dataset samples now estimate the remaining expectation.
The exponential is the exact KL-constrained solution, not an arbitrary heuristic. It also keeps weights positive:
w(s,a)=exp(A(s,a)/λ)>0.
In practice,
w(s,a)=min(wmax,eA(s,a)/λ)
limits variance. Large λ approaches ordinary cloning; small λ concentrates on the highest-advantage samples.
AWAC combines this supervised actor update with an actor-critic value estimate. Its actor remains in-sample, though its conventional critic target may still query current-policy actions.
Implicit Q-Learning
Implicit Q-learning, or IQL, removes actor actions from critic training altogether. It separates
Q(s,a)←r+γV(s′)
from an in-sample estimate of the best supported value:
In continuous state spaces, the exact same state rarely appears with many recorded actions. A literal sample maximum is therefore unusable. IQL approximates an upper supported value with expectile regression.
Define
ℓ2τ(x)={(1−τ)x2,τx2,x>0,x≤0,τ∈[0.5,1).
Then fit
LV(ψ)=E(s,a)∼D[ℓ2τ(Vψ(s)−Qϕˉ(s,a))].
When V<Q, the residual receives weight τ. For τ>0.5, underestimating high Q-values is penalized more than overestimating low ones, pulling V toward the upper tail of supported actions.
What the expectile solves
Let X=Q(s,A) for A∼πβ(⋅∣s). The expectile v satisfies
(1−τ)E[(v−X)+]=τE[(X−v)+].›See derivation
For fixed s, minimize
L(v)=E[ℓ2τ(v−X)].
Differentiating the two regions and setting the result to zero gives
E[(1−τ)(v−X)1{v>X}+τ(v−X)1{v≤X}]=0.
Move the negative-residual term to the other side:
(1−τ)E[(v−X)+]=τE[(X−v)+].
At τ=0.5, v is the mean. As τ approaches one, high supported Q-values exert more influence and v approaches a soft in-support maximum.
For two equally likely values −10 and 10, with −10<v<10,
L(v)=21(1−τ)(v+10)2+21τ(v−10)2.
The stationary point is
v=10(2τ−1).
Thus τ=0.985 gives v=9.7: close to the best supported value without ever maximizing over a policy-sampled action.
After learning Q and V, extract the policy with weighted cloning:
No expectation under πθ appears in critic learning. The actor is a final extraction step, which is why the Q-learning is implicit rather than a conventional actor-critic loop.
Conservative Q-Learning
IQL avoids evaluating unsupported actions. Conservative Q-learning, or CQL, evaluates broader actions but deliberately lowers their values.
Let μ(a∣s) be a broad proposal, such as a mixture of uniform, behavior, and current-policy actions. CQL augments Bellman regression with
Minimization pushes down values on broad or policy-generated actions and restores values on observed actions. Bellman regression preserves temporal consistency.
The broad proposal can itself seek high Q-values. For discrete actions, consider
The common discrete-action regularizer is therefore
αEs∼D[loga∑eQ(s,a)−Ea∼πβ(⋅∣s)Q(s,a)].
The log-sum-exp emphasizes whichever actions currently have suspiciously large values. In continuous spaces, it is approximated with importance-weighted samples from several proposals.
After pessimistic critic learning, a discrete policy can take
π(s)=argamaxQ(s,a),
while a continuous actor maximizes Q in the usual way. Unsupported actions are now less attractive because the critic was trained to undervalue them.
CQL directly attacks overestimation and can support ordinary policy optimization. Too much conservatism, however, suppresses genuinely good actions, increases sensitivity to α, and can slow later online adaptation.
Expressive Policies Preserve Behavior Modes
A unimodal Gaussian actor fitted to multimodal behavior may average between separated modes. The mean can lie in a region where the dataset contains no action at all.
Diffusion and flow policies can represent a richer behavior distribution:
πgen(a∣s)≈πβ(a∣s).
Their main offline-RL role is support modeling: generate plausible candidates, then use values to choose among them.
Sample and rank
IDQL first trains an IQL critic, then fits a diffusion or flow policy with behavioral cloning. At deployment it samples
a1,…,aK∼πgen(⋅∣s)
and selects
a∗=argakmaxQϕ(s,ak).
Candidate actions remain near the learned behavior manifold, while Q-ranking improves over average behavior. More candidates improve the chance of finding a good supported mode but increase generative sampling and critic-evaluation cost.
Distilling a flow into a fast actor
Flow Q-learning trains a latent-conditioned behavior generator
aflow∼πflow(⋅∣s,z),z∼p(z),
then learns an ordinary actor with a Q objective and a same-latent cloning term:
Conditioning both models on the same z preserves the mapping from latent regions to behavior modes. Without it, cloning may collapse distinct modes into their average.
Another option performs online exploration in the generator's latent space:
w∼πw(⋅∣s),a=πgen(s,w).
Every latent action passes through the pretrained decoder, relocating exploration from raw action space to a structured action manifold.
Model-Based Offline RL
A learned dynamics model faces the same counterfactual problem. It is fitted on
(s,a)∼dβ,
then queried under a new policy:
at∼π(⋅∣st),st+1∼pη(⋅∣st,at).
Unsupported action errors compound into unsupported imagined states. Offline model-based methods therefore make synthetic experience pessimistic.
MOPO penalizes uncertain rewards
Model-Based Offline Policy Optimization uses
r(s,a)=r(s,a)−λu(s,a),
where u(s,a) estimates epistemic uncertainty, often through dynamics-ensemble disagreement. The policy optimizes
J(π)=Ep,π[t∑γt(r(st,at)−λu(st,at))].
An imagined trajectory must offer enough reward to compensate for entering uncertain regions.
COMBO penalizes synthetic values
COMBO combines model rollouts with a CQL-like contrast:
The first line lowers model-generated tuples relative to real tuples. The second performs Bellman regression on a real-synthetic mixture. MOPO inserts pessimism through explicit uncertainty; COMBO inserts it through conservative value learning.
Both methods use extra synthetic data without treating the learned simulator as uniformly trustworthy.
From Offline Pretraining to Deployment
Offline safety and online exploration prefer different biases:
offline:online:pessimism, support constraints, in-sample evaluation,exploration, rapid support expansion, fast recalibration.
A conservative critic may initially stagnate when online fine-tuning begins because it must undo deliberate pessimism before exploiting new evidence.
A simple alternative initializes an ordinary online learner from scratch but mixes old and new replay:
pbatch=21poff+21pon.
Then
∇L=21EDoff[∇ℓ]+21EDon[∇ℓ].
This retains the coverage benefit of prior data without inheriting a badly calibrated offline critic.
Selecting an offline policy is difficult because its real return cannot be measured without violating the setting. Low training Bellman error is insufficient: the critic may fit data actions while remaining wrong on policy actions.
Useful but imperfect checks include held-out Bellman error, behavior divergence, conservative value estimates, stability across seeds, and off-policy evaluation when its coverage assumptions are credible. Limited safe deployment data is stronger evidence when it is available.
Method choice should begin with the dataset:
Narrow expert data often favors behavioral cloning or strong constraints.
Mixed-quality data with useful fragments favors AWR, AWAC, or IQL.
Severe critic overestimation motivates CQL.
Multimodal actions favor diffusion or flow behavior models.
Predictable dynamics with measurable uncertainty can justify MOPO or COMBO.
No objective can recover arbitrary behavior absent from the data. Offline RL can reweight, generalize, and stitch supported evidence, but it cannot make unsupported counterfactuals reliable.
The core design rule is therefore
improve where the dataset supports comparisonand remain conservative everywhere else.