5.1.7 · D2Reinforcement Learning Foundations

Visual walkthrough — Exploration vs exploitation tradeoff

2,195 words10 min readBack to topic

This page rebuilds the central result of the parent topic from absolute zero: why pure exploiting and pure exploring both cost you the same (bad) way, and why balancing them wins. We do it entirely in pictures — one figure per step. Nothing is assumed. If you have never seen a single symbol below, you will still follow from line one.

Related vault stops if you want more: 5.2.03-Multi-Armed-Bandits, 5.1.06-Temporal-Difference-Learning, 5.1.08-Q-Learning, 5.3.05-Curiosity-Driven-Exploration.


Step 1 — The world: a row of slot machines

WHAT. We label the machines . The letter just names an action (which lever). is how many levers exist.

WHY. This is the simplest possible world where the tradeoff already appears. No walls, no maps, no time-travel — just "which lever?" If we can't explain the tradeoff here, we can't explain it anywhere.

PICTURE. Below, three machines. Each has a hidden true average payout (the Greek letter "mu", read "mew" — it just means "the long-run average reward of machine "). The tallest hidden bar is the best machine. You cannot see these bars yet — they are the secret.

Figure — Exploration vs exploitation tradeoff

Step 2 — The dream: if a genie told you the best machine

WHAT. Define the best average as

Reading it term by term:

  • ::: "take the largest value as ranges over all machines."
  • ::: the average of machine (from Step 1).
  • ::: the star marks the champion's average — the biggest of all the .

The genie's total haul over rounds (where is just "how many pulls we get") is means " rounds, each worth ."

WHY and not something fancier? We want a yardstick — the unbeatable score. The largest average is by definition the most reward-per-pull, so pulling it every time is optimal. We use because "the best" literally means "the maximum."

PICTURE. The green line is the genie's steadily climbing treasure, slope .

Figure — Exploration vs exploitation tradeoff

Step 3 — Reality: you must guess from noisy pulls

WHAT. Let be the reward you actually receive at round (the subscript = "at time step "). Your estimate of a machine's average is the ordinary average of its past rewards:

Term by term:

  • ::: the little hat means "my guess of ", not the truth.
  • ::: how many times I have pulled machine up to now.
  • ::: add up every reward I got on the rounds where I chose .
  • dividing by ::: turns that sum into an average.

WHY an average? Averaging is the cheapest honest summary of "how good has this machine felt so far." With few pulls it's a shaky guess; with many pulls it settles near the truth . That shakiness is the whole story of the next steps.

PICTURE. Two machines, each dotted rewards; the running average (a line) wobbles a lot early, then calms down as pulls pile up.

Figure — Exploration vs exploitation tradeoff

Step 4 — Regret: measuring the price of not knowing

WHAT.

Term by term:

  • ::: the dream total from Step 2.
  • ::: "expected" (average) reward you get at round ; the is just "on average." It equals because pulling machine pays on average.
  • ::: the per-round shortfall. Zero if you pulled the champion, positive otherwise.

WHY define regret at all? Because "how much reward did I get" depends on the machines' scale; "how much did I miss" is a clean, comparable number that is zero for the genie and grows only when you err. It turns "was my strategy good?" into "did my regret stay small?"

PICTURE. The green genie line and your lower orange line; the shaded gap between them is the regret, growing each round you pick a worse machine.

Figure — Exploration vs exploitation tradeoff

Step 5 — Pure exploitation fails: one bad sample, permanent damage

WHAT. Concretely (parent's Example 1): true , , so and is best. Early samples give , (one unlucky loss). Greedy sees , locks onto forever. Each round it loses so after rounds: The symbol ("big-O of ") means "grows in proportion to " — a straight, ever-rising line. That's the worst kind: it never stops bleeding.

WHY it fails. Greedy trusts as if it were . With , that trust is unearned. No mechanism ever forces a re-pull of , so the false low estimate is frozen in.

PICTURE. 's single unlucky pull, greedy's decision to quit , and the resulting straight-line regret climbing forever.

Figure — Exploration vs exploitation tradeoff

Step 6 — Pure exploration also fails: knowledge you never use

WHAT. With machines chosen uniformly, your average per-round reward is the plain average of all the , call it . The per-round shortfall is the fixed positive number , so Again a straight rising line — same failure mode as greedy, opposite cause.

WHY it fails. Good estimates are worthless if the policy ignores them. Exploration answers "which is best?" but never cashes in the answer.

PICTURE. Accurate estimates (bars matching the true hidden bars) sitting next to a regret line that still climbs linearly — the tragedy of unused knowledge.

Figure — Exploration vs exploitation tradeoff
Recall

Why do both extremes give regret? ::: Greedy commits before it knows (may commit to a loser); random knows but never commits. Either way a fixed positive shortfall repeats every round → straight line.


Step 7 — The balance: explore early, exploit later → sublinear regret

WHAT. Good strategies (like UCB and Thompson sampling from the parent) achieve Here (natural logarithm of ) grows far slower than : doubling adds only a constant to . So regret per round . That is the technical meaning of "the tradeoff, solved well."

WHY appears. Statistically, ruling out a wrong machine with confidence takes about mistaken pulls (you need your confidence bound to shrink like — the exploration bonus in the parent's UCB rule). After that, you exploit. Sum the finitely-many exploratory errors and you get , not .

PICTURE. Three curves on one plot: greedy (straight, steep), random (straight), balanced (bends flat like ). The balanced curve is the whole point of the chapter.

Figure — Exploration vs exploitation tradeoff

Step 8 — Edge & degenerate cases (so you never hit a surprise)

Case A — Two machines are tied (). Then picking either costs zero regret. There is nothing to lose by exploring between them; the tradeoff dissolves. Regret can be .

Case B — Only one machine (). No choice, no exploration needed, always ⇒ . The tradeoff needs at least two competing options to exist.

Case C — All zero rewards. Every , so and regret is no matter what you do — but you also learn nothing useful. (This is the sparse-reward wall from the parent's Montezuma example; see 5.3.05-Curiosity-Driven-Exploration.)

Case D — vs . is the exploration probability in -greedy. is pure greedy (Step 5, ). is pure random (Step 6, ). Both endpoints of the dial are bad; the sweet spot is a small, decaying so exploration fades as confidence grows (mirrors Step 7).

PICTURE. Regret as sweeps from to : a U-shape (or bowl) — high at both ends, low in the middle — with the decaying- strategy sitting at the bottom.

Figure — Exploration vs exploitation tradeoff

The one-picture summary

Everything above, compressed: the genie's line, greedy's linear bleed, random's linear bleed, and the balanced curve that bends flat — with the shaded regret gaps labelled.

Figure — Exploration vs exploitation tradeoff
Recall Feynman retelling — say it back in plain words

There's a row of slot machines and one of them pays best on average, but you don't know which. A make-believe genie who knew the best machine would just pull it every time and rack up the highest possible score. Regret is simply how far behind that genie you fall — it's zero for the genie and grows every time you pull a worse machine. If you're stubborn and always pull whatever looks best from your tiny handful of tries, one unlucky early pull can make you quit the actually-best machine forever — your regret climbs in a straight line. If instead you pull totally at random, you learn which machine is best but never bother to use that knowledge — your regret also climbs in a straight line. The clever move is to explore a lot early (when you're unsure), then, as your confidence grows, gradually shift to almost always pulling the champion. Because the exploring you still need shrinks over time, your extra losses shrink too, and your regret curve bends flat — it grows like , which is much, much slower than . Corner cases: with one machine or tied machines there's nothing to lose; with all-zero rewards there's nothing to learn; and the exploration dial is bad at both extremes, best in a decaying middle.

Recall

One-line takeaway ::: Pure exploit and pure explore both give regret; balancing them (explore early, exploit later) gives sublinear regret.

Next: see how these ideas power learned value estimates in 5.1.08-Q-Learning and policy-based methods in 5.1.11-Policy-Gradient-Methods; and note the kinship with over-committing to noisy data in 4.5.07-Overfitting-and-Regularization.