Exploration & Exploitation – Game AI (Multi-Armed Bandits)

One-Armed Bandit Problem

  • Simplest possible slot-machine scenario: a single lever that returns either a jackpot (reward =1=1) or a loss (reward =0=0).
  • Unknown but fixed “true” probability of winning is denoted pp_*.
  • Learner repeatedly “pulls” and forms a belief p^t\hat p_t after each trial.
    • Example belief trajectory given in the slides:
    • Pull 1 → WIN → p^1=1.0\hat p_1 = 1.0 (optimistic – based on only one sample)
    • Pull 2 → LOSS → p^2=0.5\hat p_2 = 0.5
    • Pull 3 → LOSS → p^30.33\hat p_3 \approx 0.33
    • Pull 4 → LOSS → p^4=0.25\hat p_4 = 0.25
    • Pull N → LOSS → p^N=1N\hat p_N = \tfrac{1}{N}
  • Highlights the tension: with limited data, our estimate wanders and confidence is poor.

Multi-Armed Bandit (MAB) Problem

  • Generalisation: KK different machines, each with unknown win probability p<em>1,p</em>2,,pKp<em>1,\,p</em>2,\,\dots,\,p_K.
  • Objective: maximise total expected reward (e.g.
    max<em>policy  E[</em>t=1Trt]\max<em>{\text{policy}} \; \mathbb E\big[\sum</em>{t=1}^{T} r_t\big])
    which is equivalent to minimising regret (defined later).
  • Games shown as examples: Borderlands, GTA 5, Yakuza 5, Super Mario slot mini-game, etc.

Exploration vs. Exploitation Trade-off

  • If we exploit only the current best-looking machine, we might be wrong forever.
  • If we explore forever, we waste pulls on sub-optimal options.
  • Goal: find a principled way to balance making money now with learning for the future.

Pure Exploration Policy (Random)

  • Always choose a random arm; no memory of statistics.
  • Guarantees maximal information gathering but terrible short-term reward.
  • Example from slide: randomly visit Mario-themed slots → illustrated outcome distribution (50 % blue, 25 % red, 10 % green, etc.).
  1. No stats – pick a favourite and stick with it.
  2. Initialise p^=0\hat p=0 for all machines and always pick the highest belief (ties → fewest losses).
    • First positive reward locks agent onto that arm forever (can be catastrophically wrong).
  3. “Optimistic prior” – start every arm at p^=1.0\hat p=1.0 with fictitious count N0N_0.
    • Large N0N_0 lowers risk of a good arm falling behind due to early bad luck.
  4. “Switch-on-loss” – move to next-best arm after every failure.
    • Never settles; oscillates; incurs perpetual exploration cost.
  5. “Epsilon-First / Round-Robin” – visit every arm exactly NN times, then stick with the currently best.
    • Works only if chosen NN is large enough for statistical significance.

ϵ\epsilon-Greedy Strategy

  • Parameters: ϵ[0,1]\epsilon \in [0,1] (e.g. ϵ=0.1\epsilon=0.1).
  • Policy:
    • With probability 1ϵ1-\epsilon → exploit: pull arm with highest current belief p^\hat p.
    • With probability ϵ\epsilon → explore: pick a random arm.
  • Benefits:
    • Simple; computationally cheap.
    • Can “escape” early greedy traps because of the forced randomness.
  • Numbers from slide: 90 % best-believed, 10 % random when ϵ=0.1\epsilon=0.1.

Decaying ϵ\epsilon-Greedy

  • Schedule ϵ<em>t0\epsilon<em>t \downarrow 0 over time, e.g. ϵ</em>t=1log(t+1)\epsilon</em>t = \frac{1}{\log(t+1)}.
  • Yields logarithmic asymptotic regret: RT=O(logT)R_T = \mathcal O(\log T).
  • Downside: requires domain knowledge to pick a good decay schedule.

Regret – Formal Performance Measure

  • At each step tt the optimal arm’s expected reward is rtr_t^*.
  • Agent receives rtr_t.
  • Instantaneous regret: Δ<em>t=r</em>trt\Delta<em>t = r</em>t^* - r_t.
  • Cumulative regret after TT pulls:
    R<em>T=</em>t=1T(r<em>tr</em>t).R<em>T = \sum</em>{t=1}^{T} \big(r<em>t^* - r</em>t\big).
  • Minimising RTR_T ⇔ maximising total reward.
  • Plot shown in slides compares regret growth for:
    • Pure greedy (sky-rockets).
    • Fixed ϵ\epsilon-greedy (sub-linear).
    • Decaying ϵ\epsilon-greedy (logarithmic, best of those displayed).

Reinforcement Learning Connection

  • Bandit = single-state reinforcement-learning problem (no state transitions).
  • Core RL concepts illustrated:
    • Policy (mapping from observations → actions).
    • Reward signal.
    • Exploration/exploitation dilemma.
  • Games/visual metaphors: DuckTales remastered (Scrooge swimming in coins) emphasises maximising long-term return.

Practical / Philosophical Takeaways

  • Early optimism (strategy 2) is a simple yet powerful fix to “premature convergence.”
  • Regret gives us a yard-stick independent of reward scale; critical for algorithm comparison.
  • Real-world applicability: ad selection, A/B testing, recommendation engines — anywhere we repeatedly choose among alternatives with uncertain payoffs.
  • Ethical caution: aggressive exploration on real users can lower their experience (e.g. showing many bad ads) → need to tune ϵ\epsilon responsibly.

Numerical & Statistical References Recap

  • Win probabilities in example table: 1.00.50.330.251N1.0 \to 0.5 \to 0.33 \to 0.25 \to \dots\, \tfrac{1}{N}.
  • Super-Mario mini-game pictogram probabilities: 50 %, 25 %, 10 % (illustrative, not exact).
  • ϵ=0.1\epsilon=0.1 ⇒ 90 % exploitation, 10 % exploration.
  • Logarithmic regret bound for decaying ϵ\epsilon-greedy: RTClogTR_T \le C\log T for some constant CC.