Conservative Q-learning (CQL) is an offline reinforcement learning algorithm that learns a deliberately pessimistic Q-function from a fixed dataset by pushing down the values of actions the data does not support and pushing up the values of actions it does. The result is a value estimate that, under stated assumptions, lower-bounds the true value of the learned policy, which prevents the overestimation that breaks standard off-policy methods when no new data can be collected.
CQL was introduced in 2020 by Aviral Kumar, Aurick Zhou, George Tucker and Sergey Levine. It became one of the reference baselines for offline reinforcement learning because it is simple to add to existing actor-critic or Q-learning code and performs well on standard benchmarks such as D4RL.
Why offline Q-learning needs conservatism
In offline reinforcement learning, the agent learns only from a logged dataset collected by some behavior policy and cannot explore. Standard Q-learning computes Bellman targets with a maximum over actions, and that maximum often selects out-of-distribution actions whose Q-values were never trained against real outcomes.
Errors on those actions are not corrected, because the agent never tries them. The maximization then amplifies overestimation through bootstrapping, and the learned policy drifts toward actions that look excellent only because the critic is wrong. This distributional shift is the central failure mode that CQL targets.
| Setting | Can errors be corrected | Typical outcome without safeguards |
|---|---|---|
| Online Q-learning | Yes, through exploration | Overestimation is self-limiting |
| Off-policy with replay | Partly, as new data arrives | Moderate bias, usually manageable |
| Offline learning | No new data at all | Severe divergence of Q-values |
How the CQL objective works
CQL keeps the usual Bellman error term and adds a conservative regularizer weighted by a coefficient α. The regularizer minimizes Q-values under a distribution that favors high-value actions and maximizes Q-values on the actions actually present in the dataset.
In its most widely used form, CQL(H), the penalty is the difference between log Σ_a exp Q(s, a) and the dataset term E_(s,a)~D [Q(s, a)]. The log-sum-exp acts as a soft maximum over all actions, so the penalty grows whenever an unseen action is assigned a higher value than the logged ones. The full objective is the penalty multiplied by α plus the standard temporal difference loss.
| Component | Expression | Purpose |
|---|---|---|
| Push-down term | log Σ_a exp Q(s, a) | Lowers values of unsupported actions |
| Push-up term | E_D [Q(s, a)] | Preserves values of logged actions |
| Weight α | Fixed or tuned by Lagrange | Controls the degree of pessimism |
| Bellman error | (Q − target)² | Fits values to observed transitions |
| Threshold τ | Target penalty gap | Sets α automatically in CQL-Lagrange |
With a sufficiently large α, theory shows that the expected learned value is a lower bound on the true policy value. In practice the bound is approximate, but the gap between in-distribution and out-of-distribution values is what keeps the policy close to the data.
Variants and implementation choices
CQL is a regularizer rather than a complete architecture, so it is combined with different base learners. For continuous control, it is typically built on soft actor-critic, with the log-sum-exp approximated by sampling actions from a uniform distribution and from the current policy. For discrete actions, such as Atari games, it is added to DQN-style or QR-DQN critics, where the log-sum-exp is computed exactly.
- CQL(H) uses the entropy-regularized soft maximum and is the default variant.
- CQL(ρ) replaces it with a KL penalty toward a previous policy.
- CQL-Lagrange tunes α automatically so the penalty gap stays near a target τ.
- Cal-QL calibrates the conservative values for later online fine-tuning.
The most sensitive hyperparameter is α or its threshold τ. Values near 1 to 10 are common on locomotion tasks, while narrow expert datasets often need stronger conservatism than broad, noisy ones.
CQL compared with other offline methods
Offline algorithms differ mainly in where they apply pessimism: on the policy, on the value function or on the Bellman backup. CQL acts on the value function directly, which distinguishes it from methods that constrain the policy.
| Method | Main mechanism | Strength | Weakness |
|---|---|---|---|
| BCQ | Generative model limits candidate actions | Strong policy constraint | Needs a good behavior model |
| BEAR | Kernel divergence to behavior policy | Support-level matching | Sensitive kernel settings |
| TD3+BC | Behavior cloning term in actor loss | Very simple, fast | Limited on poor datasets |
| IQL | Expectile regression, no unseen actions queried | Stable and efficient | Less pessimism control |
| CQL | Penalizes unseen action values | Robust on mixed data | Slower, sensitive to α |
Limitations and practical pitfalls
Conservatism has a cost. An overly large α makes the policy behave almost like behavior cloning and prevents it from improving on the dataset. An overly small α reintroduces overestimation. Because offline training provides no reliable online signal, offline policy evaluation or a small validation budget is needed to choose settings.
Further pitfalls include the extra compute for action sampling in continuous spaces, poor performance when the dataset covers good behavior only sparsely, and slow progress during online fine-tuning, because the critic starts with values that are systematically too low.
The table below links the most common symptoms seen in CQL training runs to their usual causes and to practical remedies.
| Symptom | Likely cause | Remedy |
|---|---|---|
| Policy only imitates the data | α set too high | Lower α or raise threshold τ |
| Q-values grow without limit | α set too low | Increase α or use CQL-Lagrange |
| Slow online fine-tuning | Underestimated initial values | Use calibrated variants such as Cal-QL |
| Unstable continuous training | Too few sampled actions | Sample more actions per state |
| Poor results on narrow data | Sparse coverage of good actions | Collect broader or mixed datasets |
A common misconception is that CQL makes a policy safe in the broader sense of safe reinforcement learning. It reduces value overestimation from missing data, but it does not enforce explicit constraints, and it cannot correct errors in the dataset itself.
Explained without jargon
Imagine learning to drive only by watching recorded trips. You cannot test new moves yourself. Some untried moves might seem brilliant on paper. In reality they could be disasters.
Conservative Q-learning adds healthy skepticism. It assumes that anything not shown in the recordings is probably worse than it looks. The learner sticks mostly to proven behavior and improves it carefully. It does not gamble on guesses.
A typical use case
A logistics company wants a warehouse robot arm to pick mixed items faster, but trial-and-error learning on the live line would risk damaged goods. The team instead collects about 200,000 logged grasp attempts from earlier scripted controllers and human teleoperation, including both successes and failures.
Engineers train a soft actor-critic agent with the CQL regularizer and tune the Lagrange threshold on a held-out set of logged episodes. A plain off-policy critic trained on the same data predicts very high values for unusual grasp angles and fails most test picks. The CQL policy stays near grasps the data supports, and in a short supervised trial it achieves a higher success rate than the best scripted controller while producing no unsafe motions.