TL;DR
Off-policy reinforcement learning is supposed to learn from data gathered by other policies, but this paper shows that standard deep methods fail when they must learn from a fixed batch of logged transitions with no further interaction. The cause is extrapolation error: the value estimates for state-action pairs missing from the batch are arbitrary, and the policy then chases them. The authors propose batch-constrained Q-learning and its deep form, BCQ, which restricts the policy to actions that look like the ones in the batch. BCQ learns from fixed data on continuous control tasks where the baselines do not.
Builds on: Offline Reinforcement Learning, DDPG, Double Q-Learning, Variational Autoencoder · Leads to: later batch methods such as CQL and IQL, which tackle the same failure in other ways.
Why it mattered
Many useful settings give reinforcement learning a fixed log and no way to try new things. A carefully monitored program or a human operator produces the data, and running an exploring agent on a real system is often costly, risky or slow. The paper argues that learning from such a batch has to be a first-class problem, because it is the setting where data collection is the bottleneck.
The authors claim BCQ is the first continuous control deep RL algorithm that learns effectively from arbitrary fixed batch data. The surprising experimental result is that an off-policy agent trained on exactly the same data as its behavioural agent does far worse than that agent, in every trial of the concurrent experiment. The paper names the cause extrapolation error. Plain imitation of the logged behaviour is the obvious shortcut, as in behavioural cloning, and it is strong when the data is expert. The paper argues that imitation methods struggle when the data is suboptimal.
The problem
In the batch setting the agent sees a set of transitions and cannot collect more. Deep Q-learning and actor-critic methods such as DDPG were designed for agents that gather their own data, and they were labelled off-policy because the update does not depend on which policy produced a transition. The paper's point is that this label hides a dependence on coverage.
When the agent updates a value estimate, it backs up the value of the next action it would choose. If that action is not in the batch, the value of that pair was never trained. The network's output there is an extrapolation from neighbouring data, and it can be arbitrarily wrong. The authors identify three ways this happens: absent data, a biased estimate of the dynamics from a finite batch, and a training mismatch, because transitions are sampled from the batch rather than from the policy's own distribution. Extrapolation error is not always positive, but the maximisation step in Q-learning turns it into a persistent overestimation bias, and nothing collects new data to correct it.
The experiments use the Hopper-v1 environment with three batches. In the final buffer batch, a DDPG agent is trained for a million steps with large exploration noise and its whole buffer is then used. In the concurrent batch, a behavioural agent and an off-policy agent learn from the same buffer. In the imitation batch, an expert policy supplies the data. The off-policy agent is far worse than its behavioural agent in every setting, even when the data is identical, and its value estimates are unstable or divergent. In the imitation batch, the agent quickly learns non-expert actions, which the paper attributes to optimistic extrapolation.
How it works
The input is a fixed batch of transitions from some behaviour policy. Nothing else is available. The output is a policy that stays close to the data and improves on it where the data supports improvement.
flowchart LR B["Fixed batch of transitions"] --> V["VAE learns actions the batch takes in each state"] V --> C["Sample candidate actions at the next state"] C --> P["Small perturbation of each candidate"] P --> T["Target: weighted min and max over two Q-networks"] T --> Q["Update Q-networks and perturbation"] Q --> A["Pick the best candidate by Q at each state"]
- Start from the batch alone. Check: every action the agent will ever take must be justified by a transition in , or it is an extrapolation.
- Learn which actions the data contains. A state-conditioned variational autoencoder is trained to reproduce the batch's actions given their states. Check: a sample from is an action similar to those the batch took in similar states.
- Sample candidates at the next state. For each sampled transition's next state , draw candidate actions from the generator. The paper uses during training. Check: the candidates come from the data's distribution, not from the whole action range.
- Perturb each candidate a little. A perturbation network adds an adjustment in the range . This reaches actions just outside the batch without sampling the generator a huge number of times. Check: no candidate moves by more than .
- Build a pessimistic target. A pair of Q-networks gives two values for each perturbed candidate. The target takes a weighted mix of the smaller and the larger value, with more weight on the smaller one, and then the maximum over candidates. Check: when the two networks disagree about a candidate, the target leans on the lower estimate.
- Update the networks. The Q-networks regress to the target. The perturbation network is trained by the deterministic policy gradient to raise , and the target networks follow the online networks slowly. Check: a candidate the Q-networks rate highly and the batch supports is favoured.
- Act. At a state, the policy draws candidates from the generator, perturbs them, and takes the one with the highest . Check: the chosen action is close to the data and has high estimated value.
The paper notes that the choice of and sets a trade-off. With and , the policy is simply behavioural cloning of the generator. As grows to the full action range and grows large, the policy becomes ordinary Q-learning, with all its extrapolation.
A tiny trace of step 5 uses three candidates for clarity, where the paper uses ten. Suppose the two target networks give and for candidates . With the per-candidate values are , and . The best is at 3.70. With reward and discount the target is . The lower estimate pulls the target down from what the larger network alone would give.
The math
The batch as an MDP
The Bellman operator for a policy is , and Q-learning updates from sampled transitions. In the batch setting the samples come from rather than from the true dynamics. The paper builds an alternative MDP with the same states and actions. Its transition probabilities are the empirical frequencies in the batch,
where counts how often the tuple occurs in . A pair that never occurs in the batch leads to a terminal state whose reward is the initial value of . Theorem 1 says that Q-learning on the batch converges to the optimal value of , not of the true MDP .
Extrapolation error, exactly
The error of a policy evaluated on the batch is the gap between its true value and its batch value,
Lemma 1 says that the weighted size of this error over the states and actions the policy actually visits, written , is zero exactly when the batch's transition probabilities match the true ones wherever and . For a deterministic MDP, one observed transition is enough to match the true dynamics. That gives the key definition. A policy is batch-constrained if every state-action pair it can visit, with positive probability, is in . Theorem 2 then says that for a deterministic MDP, the error is zero if and only if the policy is batch-constrained. A batch is coherent if every transition in it leads to a state that is also in the batch, unless that state is terminal. A coherent batch guarantees that such a policy exists when the start state is in the batch.
Batch-constrained Q-learning
The tabular algorithm restricts the maximum in the update to actions that are in the batch,
Theorem 4 states that, for a deterministic MDP and a coherent batch, this converges to the optimal batch-constrained policy. The paper's consequence is that such a policy is guaranteed to do at least as well as the behavioural policy from any state in the batch.
The deep version
The deep policy takes candidates from the generator and perturbs them,
The perturbation is limited to , which the paper implements with a tanh output scaled by . The value target for the Q-networks uses the pessimism weight , which the paper sets to 0.75,
where and , are target parameters. With this is the clipped double Q-learning target of Fujimoto and colleagues, which takes the minimum of two networks to reduce overestimation. Lowering below 1 blends in the larger estimate. The paper says controls how heavily uncertainty at future steps is penalised, and it uses 0.75 throughout.
The generator is a conditional variational autoencoder. Its encoder outputs a mean and standard deviation for a latent vector with , and its decoder reconstructs the action from the state and . The training loss is a reconstruction term plus a Kullback-Leibler term that keeps the latent distribution near a standard normal. The paper reuses the letter for the KL weight in the VAE loss, where and is the size of the latent vector. That is a different quantity from the target weighting above. The perturbation network is trained to maximise the first Q-network along sampled candidates,
Results
The paper reports its main comparison as learning curves rather than a table of scores, so this lesson states the claims and the experimental settings without quoting curve values.
Batch tasks. The paper compares BCQ with DDPG, DQN with a discretised action space, behavioural cloning, and a VAE-only cloning variant. It states that BCQ is the only algorithm that succeeds at all tasks, matching or outperforming the behavioural policy in each one. Behavioural cloning is best on the pure imitation task, which the paper says is expected because that task contains only expert data. Its value estimates for BCQ are stable, while the DDPG and DQN value estimates are unstable or divergent in the same tasks.
Imperfect demonstrations. A batch of 100,000 transitions from an expert with random actions on 30 percent of steps and extra Gaussian noise on the rest is a harder test. The paper reports that the deep RL and imitation baselines both perform poorly there, and that BCQ strongly outperforms the noisy demonstrator. It also reports that BCQ reaches high performance in far fewer iterations than deep RL methods typically need.
Ablation. Increasing the perturbation range lowers performance on the imitation task and makes the value function less stable, which fits the account of extrapolation error. The appendix also tries ensembles of 4 and 10 value networks as an uncertainty signal. The ensembles stabilise the value function but do not restrict the actions to the expert's, and they cost more computation.
Random data. On two small tasks, Pendulum and a two-joint Reacher, a batch of 5,000 steps from a random behavioural policy is enough for both BCQ and DDPG to learn. The paper notes that imitation methods need expert data, so they cannot use a batch like this one.
Limits.
- All the continuous control experiments are simulated, on OpenAI Gym tasks with MuJoCo physics (Hopper, HalfCheetah, Walker2d and others).
- Results are averaged over 5 random seeds for the behavioural policy, simulator and networks, so spread across seeds is not characterised in the text.
- The theory covers deterministic MDPs. For a stochastic MDP the paper notes that the batch may need infinitely many samples to match the true transitions.
- The paper says BCQ is only one way to approach batch-constrained learning in a deep setting, and it does not claim the method is the final answer.
Reading guide
Read the paper in this order. The right column names the lessons on this site that cover what each section assumes.
| Section | What it covers | Lessons to have in hand |
|---|---|---|
| 1 Introduction | Why batch learning matters, and why imitation and off-policy learning both fall short | Offline Reinforcement Learning, Behavior Cloning |
| 2 Background | MDPs, the return, the Bellman operator, DQN targets, DDPG and the deterministic policy gradient | Markov Decision Process, Bellman Equation, Deep Q-Network, Deterministic Policy Gradient |
| 3 Extrapolation error | The three causes, and DDPG on the Hopper batches | Target Network, Experience Replay, Overestimation Bias |
| 4.1 Finite MDPs | The batch MDP, Lemma 1, batch-constrained policies, BCQL | Temporal-Difference Learning, Q-Learning |
| 4.2 Deep BCQ | The generator, perturbation, pessimistic target and Algorithm 1 | Variational Autoencoder, Double Q-Learning, Actor-Critic Methods |
| 5 Experiments | Baselines, batch comparisons and imperfect demonstrations | Deep Deterministic Policy Gradient (DDPG) |
| 6 Related work | Batch RL, imitation, uncertainty, conservative updates | Offline Reinforcement Learning |
| Appendix A | Proofs for the finite MDP results | Bellman Equation |
| Appendices D to G | Ablations, the random behavioural study, and implementation details | Variational Autoencoder, Target Network |
Check yourself
QuestionWhat is extrapolation error, and why does a maximising Q-learning update make it harmful?Show answer
QuestionUsing the candidate values from the tiny trace, Q1 = (4.0, 2.5, 3.0) and Q2 = (3.6, 2.8, 3.4), with reward r = 1 and discount 0.99, what is the target if lambda is 0.5 instead of 0.75?Show answer
QuestionWhy does BCQ restrict the policy to actions the generator proposes near the batch, rather than letting the Q-network choose the best action over the full action range?Show answer
QuestionA logistics company has a year of logs from a human dispatcher, with no ability to run new experiments, and wants a policy that improves on the dispatcher. What would you check before using BCQ, and what would you expect to happen with a noisy dispatcher?Show answer
Sources
- Fujimoto, S., Meger, D. and Precup, D. (2018). Off-Policy Deep Reinforcement Learning without Exploration. arXiv:1812.02900. https://arxiv.org/abs/1812.02900
- Fujimoto, S., Meger, D. and Precup, D. (2018). DOI 10.48550/arXiv.1812.02900. https://doi.org/10.48550/arXiv.1812.02900
- Fujimoto, S., van Hoof, H. and Meger, D. (2018). Addressing Function Approximation Error in Actor-Critic Methods. arXiv:1802.09477. https://arxiv.org/abs/1802.09477