Optimistic initial values
Learning objective
Section titled “Learning objective”Be able to explain how an initial value can substitute for an exploration rule, predict how much exploration a given and buy, and say precisely why the technique stops working on a nonstationary problem.
Intuition
Section titled “Intuition”Every method so far has depended on where the estimates start, and that dependence has been a nuisance — a bias to be minimised or removed. Optimistic initial values turn it into the exploration mechanism itself.
Set every estimate higher than any reward the problem can plausibly deliver. On the standard 10-armed testbed, where , take:
Now run a purely greedy agent — , no randomness anywhere. It explores anyway.
The algorithm
Section titled “The algorithm”It is the simple bandit algorithm with two lines changed:
Optimistic greedy
Initialise, for to : (was 0)
Loop forever:
(breaking ties randomly) (no branch)
No exploration parameter appears in it. The exploration is a consequence of the initialisation.
Exploration by disappointment
Section titled “Exploration by disappointment”The agent is greedy, so it pulls whatever looks best. Every arm looks equally, absurdly good, so it picks one arbitrarily — and the reward comes back around 0, nowhere near the it expected. With :
That arm now ranks below the nine untried arms still sitting at 5. So the greedy choice is a different arm. Same disappointment, same demotion. The agent works through all ten arms in the first ten steps, then starts a second pass over arms now at 4.5, and a third, and so on.
The whole time it believes it is exploiting. It never chooses to explore; it is simply always disappointed by whatever it just tried, and the arm it has not tried recently always looks better. Reality underperforming expectations is what drives the search, and the search stops when the expectations become accurate.
Note which arms sink slowest: an arm returning higher rewards loses less on each update, so the genuinely good arms stay near the top of the ranking while the bad ones fall away. The sweeping is not blind — it is a sweep that gradually sorts.
The step size decides how much exploration you get
Section titled “The step size decides how much exploration you get”This is the part that is easy to miss, and it is why the technique is usually paired with a constant rather than the sample average.
With sample averages (): the first update is
The initial value is erased outright by a single pull. You get exactly one forced sweep through the arms and then the optimism is gone completely.
With constant : the estimate descends gradually — — so an arm must disappoint repeatedly before it drops below its rivals. The agent cycles through all the arms many times over. This is where the real exploration comes from.
The same fact read from the nonstationary page: plain constant retains a term forever. Ordinarily that lingering bias is the flaw. Here it is the entire feature. The unbiased step size from exercise 2.7 has by construction and wipes on the first pull — it is engineered to destroy exactly what this method runs on. The two techniques are incompatible, and that is not a coincidence.
How long the optimism lasts
Section titled “How long the optimism lasts”Since the excess decays as after pulls of an arm, the exploration lasts until that excess falls to roughly the spread of the true values:
For , , , : pulls per arm, so roughly 150 steps of near-uniform sweeping before the method starts behaving like an exploiter. That is the exploration budget, and it is fixed before the run begins by two numbers chosen in advance.
On the 10-armed testbed
Section titled “On the 10-armed testbed”Optimistic greedy (, ) against realistic -greedy (, ), both with , averaged over 3000 runs:
| Step | Optimistic, % optimal | -greedy, % optimal |
|---|---|---|
| 1 | 9.8 | 10.3 |
| 10 | 9.4 | 28.5 |
| 11 | 42.9 | 29.0 |
| 12 | 23.9 | 29.7 |
| 50 | 19.3 | 39.7 |
| 100 | 29.2 | 45.0 |
| 200 | 59.5 | 52.8 |
| 500 | 80.6 | 65.7 |
| 1000 | 84.6 | 75.8 |
Optimistic greedy is worse for the first 160 steps or so — it is busy being disappointed by all ten arms, roughly the predicted above — and takes a durable lead from about step 163 onward, finishing 9 points higher. The cost is paid entirely up front; the benefit is permanent, because after the sweep it wastes nothing on random actions the way a fixed does forever.
The spike at step 11
Section titled “The spike at step 11”The early part of that curve has a feature worth explaining, because it looks like a plotting error and is not (this is exercise 2.6). Averaging over thousands of runs removes noise, not structure — and optimistic greedy’s exploration is deterministic, so it does the same thing at the same step in every single run. Randomly-timed -greedy exploration averages smooth; time-locked sweeping does not.
Steps 1–10 sit at 10%. The forced sweep visits each arm once in an arbitrary order, so the optimal arm turns up at any given step with probability .
Step 11 spikes to 43%. After one sweep every arm holds , so the ranking of estimates is exactly the ranking of the first rewards observed. At step 11 the agent picks the winner of its first complete comparison, and the optimal arm wins that comparison far more often than chance. Simulating the underlying quantity directly:
against 42.9% observed at step 11. The spike height is that probability.
Step 12 collapses to 24%. Having pulled its favourite a second time, the agent knocks it down to ~4.05, below the nine arms still at ~4.5 — so it is forbidden from repeating and must move on. The optimal arm can only be picked at step 12 if it was not picked at step 11. Steps 13–17 sag to around 10%, because the best arm has usually already been consumed near the top of the ranking.
The ripples have period . Each completed sweep produces another re-ranking at steps 21, 31, and so on, better informed but blunter each time. They damp out as the sweeps desynchronise — arms stop being pulled equally often, and the time-locking that let the spike survive averaging breaks down.
What is wrong with it
Section titled “What is wrong with it”The exploration is transient. The drive to explore is spent once and does not return. Any method whose exploration is front-loaded is, as Sutton and Barto put it, focused on the beginning of time — and the beginning of time occurs only once.
So it is the wrong tool for nonstationary problems. If drifts at step 5000, the agent has no reason to go looking. The need for exploration recurs; the optimism does not. This is the sharpest limitation, and it rules the method out for most problems that matter.
You must know the reward scale. is only optimistic because we know . Without a bound on plausible rewards you cannot set — too low buys no exploration, too high wastes thousands of pulls sweeping.
It is not tunable. is a dial for how much exploration you are buying and when. Here the amount is an emergent consequence of and together, spent at the start, on a schedule you do not control.
Common mistakes
Section titled “Common mistakes”Pairing it with sample averages and expecting sustained exploration. gives in effect: one sweep, then nothing. Use a constant .
Reading the early curve as a bug. The spikes are the algorithm, not the plot. More runs will not smooth them.
Treating it as a general-purpose exploration method. It is a good trick on stationary problems with a known reward scale. Both conditions fail routinely.
Forgetting that ties still need random breaking. With every equal at
, an argmax that returns the lowest index makes the first sweep run in
index order — harmless here, but the same bug is fatal elsewhere.
Personal takeaways
Section titled “Personal takeaways”The appeal of this method is that it gets exploration for free, without an exploration parameter, from a quantity you had to choose anyway. The catch is that “free” means “unbudgeted”: you do not decide how much you are spending or when to stop, and there is no second helping.
The durable idea is bigger than the trick. Optimism in the face of uncertainty — prefer what you have not yet ruled out — is the principle behind UCB, R-max, and count-based exploration bonuses in deep RL. Optimistic initialisation is its crudest possible implementation: one optimistic prior, decaying on a fixed schedule, with no notion of which arms it is actually uncertain about. It treats an arm pulled 200 times and an arm pulled twice identically once their estimates match. Spending the exploration budget where the uncertainty really is, and continuing to spend it as uncertainty returns, is what every better method does.
Where next
Section titled “Where next”Optimism spent on a fixed schedule is the crude version of the idea. The next page makes the optimism proportional to the uncertainty that actually remains, arm by arm: upper-confidence-bound action selection.
References
Section titled “References”- Sutton, R. S. & Barto, A. G. Reinforcement Learning: An Introduction, 2nd ed., §2.6 and exercise 2.6.