Search

Search papers and lessons

Overestimation Bias

Level 3 · 10 min read

Overestimation bias is the tendency of Q-learning to set its targets too high, because taking the maximum of noisy value estimates is biased upward even when each estimate is correct on average.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Reinforcement learning
  • Calculus
  • Linear algebra
  • Optimization
  • ReadReady to readNot yet

TL;DR

Q-learning updates each action's value toward a target that takes the best estimated value of the next state. When those estimates are noisy, the maximum of several noisy numbers tends to be too large. The result is a systematic overestimate, called overestimation bias, even when every individual estimate is right on average.

The effect is small in a toy problem and can be large in a real one with many actions and a function approximator. It matters because the errors feed into the next update and can compound.

Builds on: Q-Learning, Jensen's Inequality, Expected Value · Leads to: Double Q-Learning, Deep Q-Network

Where it's used

Game-playing agents with many moves. When a deep Q-network learns to play Atari games, it has to choose among a fixed set of controller actions and estimate each one's value from a neural network. Van Hasselt and colleagues (2016) showed that the standard DQN target overestimated action values in many games, with estimates above the returns the agent actually obtained later.

Trading and resource allocation. A learning agent that picks among many order sizes, or among many routes, and learns from noisy returns, will tend to believe its best-looking option is better than it is. The bias pushes the agent toward options whose estimates happened to be lucky.

Robot control with noisy sensors. A robot that estimates the value of many possible motions from noisy simulations inherits the same upward bias in the best motion. Any method that takes a maximum over noisy estimates faces this issue, which is why the fix is studied as a general statistical problem and not only a Q-learning one.

How it works

We follow one update of a tiny agent. The agent is in state ss, takes action aa, gets reward 0, and lands in state s′s'. In s′s' there are two actions, and both have true value 0.5. The agent's estimates are noisy: each estimate is the true value plus a random error of +0.2+0.2 or −0.2-0.2, each with probability one half, independently.

  1. Setup. Discount γ=0.9\gamma = 0.9, reward r=0r = 0. The true best value at s′s' is max⁡a′Q∗(s′,a′)=0.5\max_{a'} Q^*(s', a') = 0.5, so the correct target for the update is 0+0.9⋅0.5=0.450 + 0.9 \cdot 0.5 = 0.45.
  2. Noisy estimates. The agent holds two estimates for s′s'. Suppose they come out as (0.7,0.3)(0.7, 0.3). Check: each is the true 0.5 plus or minus 0.2.
  3. Max. Q-learning takes the larger estimate, max⁡(0.7,0.3)=0.7\max(0.7, 0.3) = 0.7, and forms the target 0+0.9⋅0.7=0.630 + 0.9 \cdot 0.7 = 0.63. Check: the target is above the true target of 0.45 even though neither estimate is systematically high.
  4. Repeat over all noise patterns. The four equally likely patterns give maxima 0.7,0.7,0.7,0.30.7, 0.7, 0.7, 0.3. Their average is 0.60.6, which is higher than the true best value 0.5.
  5. Result. The expected target is 0.9⋅0.6=0.540.9 \cdot 0.6 = 0.54, not 0.450.45. The gap of 0.090.09 is the overestimation bias that Q-learning would carry into the update.
flowchart LR
  T[True values 0.5, 0.5] --> N[Add noise plus or minus 0.2 to each]
  N --> M[Take the max over actions]
  M --> A[Average of the max is above 0.5]

The math

Step 2 in symbols: the noisy estimates

Let Q∗(s′,a)Q^*(s', a) be the true action value and Q^(s′,a)=Q∗(s′,a)+εa\hat{Q}(s', a) = Q^*(s', a) + \varepsilon_a the estimate, where εa\varepsilon_a is noise with mean zero. Here εa∈{−0.2,+0.2}\varepsilon_a \in \{-0.2, +0.2\}, each with probability one half.

Step 3 in symbols: the target

The Q-learning target for a transition with reward rr is

y=r+γmax⁡a′Q^(s′,a′).y = r + \gamma \max_{a'} \hat{Q}(s', a').

The update moves Q^(s,a)\hat{Q}(s, a) toward yy. The correct target would use Q∗Q^* in place of Q^\hat{Q}.

Step 4 in symbols: the expected maximum

Take the case of nn actions, with the same true value vv and independent noise εa\varepsilon_a. The expected maximum estimate is

E ⁣[max⁡aQ^(s′,a)]=v+E ⁣[max⁡aεa].\mathbb{E}\!\left[\max_a \hat{Q}(s', a)\right] = v + \mathbb{E}\!\left[\max_a \varepsilon_a\right].

Since every εa\varepsilon_a has mean zero, each individual estimate is unbiased, so E[Q^(s′,a)]=v\mathbb{E}[\hat{Q}(s', a)] = v for each aa. But the maximum is not unbiased. For εa=±δ\varepsilon_a = \pm \delta with equal probability, the maximum is −δ-\delta only if every action draws −δ-\delta, which has probability (1/2)n(1/2)^n. So

E ⁣[max⁡aεa]=δ(1−21−n).\mathbb{E}\!\left[\max_a \varepsilon_a\right] = \delta\left(1 - 2^{1-n}\right).

Check with n=2n = 2 and δ=0.2\delta = 0.2: the formula gives 0.2⋅(1−1/2)=0.10.2 \cdot (1 - 1/2) = 0.1, which matches Step 4 of the walkthrough, where the average maximum was 0.6 against a true value of 0.5.

Why it is Jensen's inequality

The maximum function is convex: for any two numbers, max⁡(a,b)≥a+b2\max(a, b) \ge \frac{a+b}{2}, and the gap grows with the spread. Jensen's inequality says that for a convex function gg, g(E[X])≤E[g(X)]g(\mathbb{E}[X]) \le \mathbb{E}[g(X)]. Here gg is the maximum over a vector of random estimates, so max⁡aE[Q^]≤E[max⁡aQ^]\max_a \mathbb{E}[\hat{Q}] \le \mathbb{E}[\max_a \hat{Q}]. The left side is the true best value, and the right side is what Q-learning uses.

Worked examples

Example
Example 1: two actions, noise of plus or minus 1 (hand-computable)

Two actions with true values 0 and 0. Each estimate is ±1\pm 1 with probability one half, independently.

  1. The four equally likely noise patterns are (+1,+1)(+1,+1), (+1,−1)(+1,-1), (−1,+1)(-1,+1), (−1,−1)(-1,-1).
  2. Their maxima are 1,1,1,−11, 1, 1, -1.
  3. Average maximum: 1+1+1−14=0.5\frac{1 + 1 + 1 - 1}{4} = 0.5.
  4. The true best value is 0, so the bias is 0.50.5.
  5. Check with the formula: δ(1−21−n)=1⋅(1−1/2)=0.5\delta(1 - 2^{1-n}) = 1 \cdot (1 - 1/2) = 0.5.

Interpretation: each estimate is unbiased, yet the best of two is too high by half a unit on average.

Example
Example 2: the walkthrough with a Q-learning target (the standard case)

State s′s' has two actions, both with true value 0.50.5. The estimates are the true value plus noise of ±0.2\pm 0.2. Reward r=1r = 1 and discount γ=0.9\gamma = 0.9 for the transition into s′s'.

  1. Correct target: r+γ⋅0.5=1+0.45=1.45r + \gamma \cdot 0.5 = 1 + 0.45 = 1.45.
  2. Equally likely estimate pairs: (0.7,0.7)(0.7, 0.7), (0.7,0.3)(0.7, 0.3), (0.3,0.7)(0.3, 0.7), (0.3,0.3)(0.3, 0.3).
  3. Maxima: 0.7,0.7,0.7,0.30.7, 0.7, 0.7, 0.3. Average: 2.44=0.6\frac{2.4}{4} = 0.6.
  4. Expected Q-learning target: 1+0.9⋅0.6=1.541 + 0.9 \cdot 0.6 = 1.54.
  5. Check with the formula: δ(1−21−n)\delta(1 - 2^{1-n}) with δ=0.2\delta = 0.2 and n=2n = 2 is 0.10.1, so the average maximum is 0.5+0.1=0.60.5 + 0.1 = 0.6, as in step 3.
  6. The target is inflated by 1.54−1.45=0.091.54 - 1.45 = 0.09. Every update that passes through this state carries that error.

Interpretation: the reward is correct, the discount is correct, and the value estimates are unbiased. The bias comes entirely from taking the maximum.

Example
Example 3: many actions, realistic noise (realistic)

A pricing agent chooses among n=10n = 10 prices. Suppose its estimates for all prices are unbiased, with noise ±0.2\pm 0.2 as before, and all prices truly have the same value vv at the next state. Take γ=0.9\gamma = 0.9.

  1. Expected maximum noise with n=10n = 10: δ(1−21−10)=0.2⋅(1−2−9)=0.2⋅(1−0.00195)≈0.1996\delta(1 - 2^{1-10}) = 0.2 \cdot (1 - 2^{-9}) = 0.2 \cdot (1 - 0.00195) \approx 0.1996.
  2. Bias of the max: about 0.20.2, close to the full noise size, because with ten actions the best draw almost always contains at least one positive error.
  3. Inflation of the target: γ⋅0.1996=0.9⋅0.1996≈0.180\gamma \cdot 0.1996 = 0.9 \cdot 0.1996 \approx 0.180.
  4. Compare with the walkthrough: with two actions the inflation was 0.9⋅0.1=0.090.9 \cdot 0.1 = 0.09. The noise is the same as before, so multiplying the number of actions by five has nearly doubled the bias, from 0.1 to 0.2.
  5. The lesson: the bias grows with the number of actions and with the noise, and a large action set is where it hurts most.

Try it: with n=3n = 3 actions and noise ±0.2\pm 0.2, what is the inflation of the Q-learning target when γ=0.9\gamma = 0.9? Answer: δ(1−21−3)=0.2⋅0.75=0.15\delta(1 - 2^{1-3}) = 0.2 \cdot 0.75 = 0.15 for the maximum's bias, so the target is inflated by 0.9⋅0.15=0.1350.9 \cdot 0.15 = 0.135.

Common mistakes and tradeoffs

It is tempting to think that an unbiased estimate of each action's value gives an unbiased estimate of the best value. In fact the maximum of unbiased estimates is biased upward, because the maximum rewards positive noise and discards negative noise. The estimates can each be exact on average and the maximum still be too high.

It is tempting to think that overestimation bias only happens with bad estimators. In fact it happens with perfectly good ones, and it is a consequence of choosing and evaluating with the same noisy numbers. Better estimators reduce the noise, but the maximum still inherits whatever noise remains.

It is tempting to think that the bias is harmless because the agent will correct it later. In fact the inflated target is fed back into later updates, so the error can persist and grow when values bootstrap from each other, which is what happens in deep Q-learning with function approximation.

When to worry: many actions, noisy returns, and function approximation. The bias is small in tabular problems with few actions and many visits.

When not to worry: a small problem where each action is tried often and the estimates are accurate, so the noise is small.

Fixes and alternatives: Double Q-Learning uses two estimators, one to pick the best action and the other to evaluate it, which breaks the link between the noise in the choice and the noise in the value. Deep versions use a Target Network to slow the change of the target, which reduces but does not remove the bias. Averaging several estimates is also an option, at the cost of more samples.

History

The problem was noticed in the early days of reinforcement learning with function approximation. Thrun and Schwartz (1993) analysed the effect of the maximum over noisy action values and showed that it can systematically inflate estimates. Q-learning itself, from Watkins in 1989 with the convergence analysis by Watkins and Dayan in 1992, was proved to converge in the tabular case, where the bias is small and vanishes with enough visits.

Van Hasselt (2010) proposed double Q-learning, which decouples action selection from evaluation. When deep Q-networks became practical in 2015, the same problem was found to be severe with neural function approximators. Van Hasselt, Guez and Silver (2015, published 2016) showed that the standard DQN target overestimated values, and that a double-estimator target reduced both the bias and the error in performance on many Atari games.

Recap

  • Q-learning's target uses the maximum over estimated action values in the next state.
  • Each estimate may be unbiased, but the maximum of noisy estimates is biased upward, by an amount that grows with the noise and with the number of actions.
  • Jensen's inequality explains why: the maximum is convex, so the maximum of an average is no larger than the average of the maximum.
  • The inflated target propagates through bootstrapped updates, so the bias can compound.
  • Double Q-learning and related methods separate action selection from evaluation to reduce it.

Read next: Double Q-Learning for the standard fix, and Deep Q-Network for where the bias matters most.

Check yourself

QuestionRecall: why can each action's estimate be correct on average while the maximum over actions is still too high?Show answer

The maximum is a convex function of the estimates. It takes the largest draw, so positive noise is kept and negative noise is discarded. Averaged over noise patterns, the largest value sits above the true best value, by Jensen's inequality.

QuestionCompute: two actions with true value 0 and noise of plus or minus 0.5, each sign equally likely and independent. What is the expected maximum estimate?Show answer

Four equally likely patterns give maxima 0.5,0.5,0.5,−0.50.5, 0.5, 0.5, -0.5. Their average is 0.5+0.5+0.5−0.54=0.25\frac{0.5 + 0.5 + 0.5 - 0.5}{4} = 0.25. The formula δ(1−21−n)=0.5⋅0.5=0.25\delta(1 - 2^{1-n}) = 0.5 \cdot 0.5 = 0.25 agrees.

QuestionWhy does the bias grow as the number of actions grows, even when each action's noise is the same?Show answer

With more actions there are more chances that at least one estimate draws a large positive error. The probability that every estimate draws a negative error falls as (1/2)n(1/2)^n, so the expected maximum rises toward the full noise size δ\delta.

QuestionApplied: a team sees a Q-learning agent with 50 actions whose values keep climbing above what its test episodes earn. What is the likely cause, and what is one change to try?Show answer

The likely cause is overestimation bias: the target takes the maximum over 50 noisy estimates, and that maximum is inflated. One change to try is double Q-learning, which chooses the action with one set of estimates and evaluates it with another, so the choice's noise does not inflate the value.

Sources