Advanced techniques
Offline Reinforcement Learning and Imitation Learning
Understand behavior cloning, distribution shift, pessimistic value learning, and the limits of evaluating new policies from fixed logs.
By the end you can
- Distinguish behavior cloning, imitation learning, and offline reinforcement learning
- Explain why out-of-distribution actions make offline value estimation unreliable
- Interpret conservative and behavior-regularized methods as responses to support mismatch
- Design a deployment gate that combines offline evaluation, simulation, and guarded online tests
The agent cannot ask the environment a follow-up question
Online reinforcement learning can try an action, observe the consequence, and collect new data. Offline RL receives a fixed dataset of logged transitions and must learn without further interaction. That is attractive in healthcare, robotics, operations, and recommendation, where exploration may be costly or unsafe. The fixed dataset creates a central problem. A learned policy may choose actions rarely or never taken by the behavior policy that generated the logs. Value estimates for those actions rely on extrapolation. Small errors compound through Bellman backups, and unsupported actions start to look unrealistically valuable.
Imitation learning avoids some of this by copying observed behavior. But it may inherit suboptimal decisions, and it can drift into unfamiliar states when small mistakes accumulate. Offline RL tries to improve beyond the behavior while staying inside the dataset's support.
Two standard algorithms broke on a fixed batch in 2019, and Fujimoto and colleagues named the cause in the first line of their abstract: “In this paper, we demonstrate that due to errors introduced by extrapolation, standard off-policy deep reinforcement learning algorithms, such as DQN and DDPG, are incapable of learning with data uncorrelated to the distribution under the current policy, making them ineffective for this fixed batch setting.” Two named algorithms, one named cause. The critic is asked about actions the log never tried, and it answers anyway.
That sentence is often quoted as if it were a law of offline learning. It is not. A year later a team at Google Brain reached the opposite result. They assembled the DQN Replay Dataset: 50 million (observation, action, reward, next observation) tuples per game across 60 Atari 2600 games, split into 5 replay datasets per game, 300 datasets in all. Offline QR-DQN and offline REM, trained with no environment interaction at all, outperformed the fully trained online DQN agent. The difference between the two results is not the algorithm family. It is the log. Extrapolation error is what a narrow dataset does to a critic, not a fixed property of learning without exploration.
The core offline-RL question is not only “what has high estimated value?” but “what does the dataset support us in believing?”
Visual
Why support mismatch compounds
One unsupported choice can move the agent into states that are also absent from the dataset. That is the chain behind extrapolation error. The critic is questioned about an action the log never tried. It answers from whatever the network extends into that gap. The policy is then pulled toward the states where that answer applies.
- 1
Logged state
The dataset contains a familiar state under the behavior policy.
- 2
Novel action
The learned policy selects an action rarely observed there.
- 3
Unfamiliar next state
The transition leads outside dense data support.
- 4
Extrapolated value
The critic estimates consequences from weak evidence.
- 5
Compounding optimism
The policy is attracted toward a chain of unsupported estimates.
Offline errors are sequential: unsupported actions alter the future state distribution as well as the immediate prediction.
Comparison
Three levels of ambition from fixed logs
The methods differ in how far they try to move beyond recorded behavior.
The first column is not a toy. On 13 October 2023 a collaboration of robotics labs released a pooled behavior-cloning corpus and described it plainly: “The Open X-Embodiment Dataset contains 1M+ real robot trajectories spanning 22 robot embodiments, from single robot arms to bi-manual robots and quadrupeds. The dataset was constructed by pooling 60 existing robot datasets from 34 robotic research labs around the world and converting them into a consistent data format for easy download and usage.” Across 21 institutions the corpus covers 527 skills and 160,266 tasks. RT-1-X, the policy trained on it, had a 50% higher success rate than the original state-of-the-art methods each institution had contributed.
The honest half of the result sits in the same paper. In the large-dataset domains RT-1-X did not outperform the single-dataset RT-1 baseline. Pooling bought improvement where a lab's own log was thin and bought nothing where it was already thick. That is the support argument the other two columns make as well, with reward optimization attached. The question is never how much data there is. It is whether the data covers the decisions the policy wants to make.
Behavior cloning
Supervised learning from states to logged actions.
- Simple and stable
- No explicit reward optimization
- Copies demonstrator bias and mistakes
- Suffers compounding error off the demonstrated path
Behavior-regularized offline RL
Optimize reward while penalizing departure from the behavior distribution.
- Balances improvement and support
- Requires a notion of behavior similarity
- Can be conservative when logs are broad
- Useful with mixed-quality demonstrations
Conservative value learning
Penalize high values for unsupported actions or policies.
- Targets overestimation directly
- Can provide pessimistic action values
- Hyperparameters control conservatism
- Example: CQL-style objectives
Example
What to learn about the logging policy before training
The dataset is a record of decisions. It is not a neutral sample of the environment. Most healthcare offline-RL work runs on a single log, MIMIC-III, and the 2016 paper describing it is exact about what it holds: “MIMIC-III contains data associated with 53,423 distinct hospital admissions for adult patients (aged 16 years or above) admitted to critical care units between 2001 and 2012.” Those admissions cover 38,597 distinct adult patients. A further 7,870 neonates were admitted between 2001 and 2008. All of it comes from one hospital, Beth Israel Deaconess Medical Center in Boston. A policy learned from it has been shown one hospital's practice inside the window that sentence names. That is the object the checklist audits.
- Coverage: which states and actions occur often, rarely, or never? Coverage is a property of the representation as much as of the data. The AI Clinician reduced its ICU logs to 750 discrete patient states and 25 dose actions, 5 fluid levels crossed with 5 vasopressor levels, and every coverage question is asked about that grid rather than about medicine.
- Policy mixture: were the logs produced by one policy, several experts, or changing business rules? Open X-Embodiment is the extreme case — 60 existing robot datasets from 34 labs, 22 embodiments, 527 skills and 160,266 tasks pooled into one corpus — where the mixture is the dataset rather than a defect in it.
- Propensity information: are action probabilities or decision scores recorded, or only the action that was taken? A record of what was administered is not a record of the distribution it was drawn from, and importance-weighted estimators need the second.
- Reward completeness: are delayed outcomes, censoring, and missing rewards handled correctly? MIMIC-III's adult window closes in 2012 and its neonatal window in 2008. Whatever happened to a patient after their record ends is not in any reward computed from it.
- Confounding: did hidden information influence both the logged actions and the outcomes? Jeter and colleagues traced the AI Clinician's headline result partly to a state space biased toward healthier patients rather than to better treatment.
- Safety constraints: which actions were prohibited, and are those constraints represented explicitly? Waymo's answer for ChauffeurNet is instructive. Collisions and off-road departures are absent from expert driving logs, so the team had to synthesize them.
Key idea
Logged outcomes do not reveal every counterfactual
A flagship result shows what a fixed log cannot settle. The AI Clinician learned a sepsis treatment policy from retrospective ICU logs, compressed into 750 discrete patient states and 25 dose actions, 5 fluid levels by 5 vasopressor levels. It reported that mortality was lowest where clinicians' real doses matched its recommendations. That appeared in Nature Medicine on 22 October 2018.
An independent team at Emory and Georgia Tech reimplemented the method in 2019. They ran it on 5,366 MIMIC-III septic patients who had received both vasopressors and fluids, and found that a zero-drug policy outperformed the clinician policy in most realizations. That is a result about the estimator, not about sepsis. Their paper names the mechanism: “In the final policy evaluation, almost no value (positive or negative) is given to trajectories for which the AI Clinician tries something significantly different than the real clinician, regardless of if it would have harmed or improved a patient’s outcome.” The evaluation went quiet exactly where the policy was most novel. That is where the evidence was needed.
The same silence appears outside medicine. If a recommender only ever displayed items chosen by an older system, clicks do not reveal how users would have responded to the items it never showed. Offline RL does not automatically solve confounding or missing counterfactuals. Causal assumptions, randomized data, propensity logging, simulators, or targeted online experiments may be necessary. A high offline estimated return is not sufficient evidence for deployment.
Fixed logs constrain both statistical support and causal identification.
Steps
A staged deployment gate for an offline policy
No single offline score should authorize a high-impact policy change. Step 2 is the one that gets treated as a formality, and it is the one with a measured warning attached. An independent group at Nanjing University and Polixir built NeoRL, a benchmark with controlled dataset sizes and low-exploration logging, and evaluated BCQ, CQL, PLAS and MOPO on it. The algorithms were often no better than the deterministic version of the behavior policy, and offline policy evaluation gave little help in choosing between them. If the offline estimator cannot rank the candidates, the policy already in production is the only ranking available. Step 4 is then a source of evidence, not a verdict.
1. Validate the dataset
Audit coverage, logging changes, rewards, censoring, and confounding.
2. Establish imitation baselines
Compare behavior cloning and the logged policy itself.
3. Train conservative candidates
Sweep support and pessimism controls.
4. Use multiple offline estimators
Compare importance-based, model-based, and fitted-value evidence when assumptions permit.
5. Stress in simulation or replay
Test rare states, constraint violations, and policy drift.
6. Deploy behind safeguards
Use shadow mode, small traffic, human review, or hard action constraints.
Analogy
Learning to drive from dashboard recordings
Dashboard recordings of another driver are a complete record of what that driver did and a silent one about everything else. You can imitate familiar maneuvers. You cannot ask what would have happened under an unrecorded turn. If the learned policy drifts onto a road the demonstrator rarely visited, every later decision rests on weaker evidence.
Waymo ran this experiment at a scale that settles the question. Bansal, Krizhevsky and Ogale presented ChauffeurNet in 2019, and the abstract opens with the negative result: “We find that standard behavior cloning is insufficient for handling complex driving scenarios, even when we leverage a perception system for preprocessing the input and a controller for executing the output on the car: 30 million examples are still not enough.” Waymo's own blog renders that volume as “the equivalent of about 60 days of expert driving data”. Sixty days of a good driver, and the cloned policy still could not be trusted with the road.
The fix was not more of the same data. The team synthesized perturbed trajectories, including collisions and going off the road, that the expert logs never contained. A driver who stays in the lane never demonstrates the recovery. So a conservative learner stays close to demonstrated behavior unless the logs give strong evidence that something else does better. A simulator can add the counterfactual experience the logs lack. Its fidelity then becomes the critical assumption.
Offline policies should be ambitious only where the data provides credible support.
Case
Why a small imitation error grows quadratically with the episode
Imitation error compounds once a policy leaves the states its expert visited. Ross and colleagues gave the mechanism one sentence in 2011: “Intuitively this is because as soon as the learner makes a mistake, it may encounter completely different observations than those under expert demonstration, leading to a compounding of errors.” Their bound gives the size of it. A policy that errs with probability ε on the expert's own state distribution satisfies J(π) ≤ J(π*) + T²ε over a T-step episode. That is an extra cost which “grows quadratically in T”, and they state that the bound is tight.
The experiments are as blunt as the algebra. On Super Tux Kart the supervised baseline did not improve as more expert laps were collected. DAgger, built to pull that growth back toward linear, reached a policy that never fell off the track after 15 iterations. On Super Mario Bros. DAgger reached an average distance of 3030 per stage.
It would be comfortable to read all this as a weakness of one algorithm on two video games. A 2020 result closed that exit. Rajaraman and colleagues proved that behavior cloning has suboptimality of order |S|H²log(N)/N, with a matching lower bound of order |S|H²/N when no interaction is allowed. The quadratic dependence on the horizon is a property of learning from a fixed set of demonstrations, not an artefact of a particular loss.
Key idea
Draw the deployment boundary around logged support
An offline policy is most fragile where it chooses actions rarely represented in the data. A high estimated value in those regions may reflect extrapolation error rather than genuine improvement.
Conservative objectives were built for exactly this. Conservative Q-learning, presented by Kumar and colleagues at NeurIPS 2020, lowers the estimated value of actions the dataset does not support. Its abstract reports methods “often learning policies that attain 2-5 times higher final return” than prior offline methods, with the widest margins on mixed and multi-modal data.
That figure is a statement about the datasets it was measured on. An independent group at Nanjing University and Polixir built NeoRL, a benchmark with controlled dataset sizes and low-exploration logging, closer to the way industrial logs are actually produced. They put the same family of algorithms through it. Their abstract gives the verdict: “The empirical results demonstrate that the tested offline RL algorithms become less competitive to the deterministic policy on many datasets, and the offline policy evaluation hardly helps.” The 2-5 times figure and this sentence are not in conflict. Broad exploratory logs earn the first. Narrow operational logs produce the second.
Two things follow for practice. Map state–action coverage, logging-policy variation, and outcome delay before training, and use conservative objectives, behavior constraints, simulation, or human review where the evidence is weak. Then measure every candidate against the deterministic behavior policy rather than against the offline estimator's ranking, because on low-exploration logs that ranking is the thing NeoRL found unhelpful. If the proposed policy depends on unsupported actions, the correct result may be to collect new data rather than deploy.
Offline optimization cannot identify the consequences of actions that the logs do not support.
Key takeaways
- Offline RL learns a policy from fixed logged interactions without new exploration, and whether that works is a property of the log. DQN and DDPG failed on a fixed batch in 2019; on the DQN Replay Dataset — 50 million tuples per game across 60 Atari 2600 games — offline QR-DQN and REM beat the fully trained online DQN agent.
- Behavior cloning copies actions but compounds error off the demonstrated path: the tight J(π) ≤ J(π*) + T²ε bound, DAgger's 3030 average distance per stage on Super Mario Bros., and a matching |S|H²/N lower bound when no interaction is allowed.
- Unsupported actions and states make offline value estimates extrapolations rather than measurements. ChauffeurNet's 30 million driving examples were still not enough until Waymo synthesized the collisions and off-road departures the expert logs never contained.
- Behavior regularization and conservative value learning limit unsupported improvement — conservative Q-learning reported 2-5 times higher final return — but NeoRL found the same family often no better than the deterministic behavior policy on low-exploration logs.
- Audit the log before training. MIMIC-III is 53,423 adult critical-care admissions from a single hospital between 2001 and 2012, and the AI Clinician compressed logs of that kind into 750 patient states and 25 dose actions.
- Deployment should combine offline evidence with simulation, constraints, human review, or limited online tests. The AI Clinician's own evaluation gave almost no value to trajectories that departed from the clinicians, and a zero-drug policy beat the clinician policy in most realizations.