AI Exploration vs Exploitation
Exploration versus exploitation is the ongoing tradeoff between trying unfamiliar actions to learn more and choosing the best action already known to work.
The Dilemma
Imagine an agent that has already found an action that earns a decent reward. Should it keep repeating that action, since it's proven, or should it try something different in case that alternative turns out to be even better? Exploitation means picking the action the agent currently believes is best, based on everything it has learned so far, to gather reward right now. Exploration means deliberately picking a less certain or less tried action, purely to learn more about it, even though it might turn out worse in the short term.
A simple everyday parallel: you have a favorite restaurant you already know is good. Going back to it is exploitation -- a reliably enjoyable meal. Trying the new restaurant that opened down the street is exploration -- it might be disappointing, or it might become your new favorite, but you can't find out without trying it at least once.
Why You Can't Just Pick One
Common Strategies to Balance the Two
- Epsilon-greedy: most of the time take the best-known action, but with a small probability (epsilon) take a random action instead.
- Decaying epsilon: start with a high chance of exploring early on when little is known, and gradually shrink that chance as the agent gathers more experience.
- Softmax (Boltzmann) exploration: instead of an all-or-nothing random choice, pick actions with probability roughly proportional to how promising each one currently looks.
- Upper confidence bound (UCB): favor actions that are either high-reward or under-tried, giving actions with little data a temporary boost so they get a fair chance to prove themselves.
Example
import random
def epsilon_greedy(action_values, epsilon=0.1):
if random.random() < epsilon:
return random.choice(list(action_values.keys())) # explore
return max(action_values, key=action_values.get) # exploitBeyond Reinforcement Learning
This same tradeoff shows up well beyond formal reinforcement learning. A company running an A/B test on a website is exploring: showing a fraction of visitors an untested design to learn whether it performs better, at the cost of some visitors seeing the (possibly worse) new version. The classic version of this problem -- deciding which of several slot machines to keep pulling when you don't know their payout rates in advance -- is called the multi-armed bandit problem, and it's the simplest setting where exploration versus exploitation appears in its purest form.
Exercise: AI Reinforcement Learning
What is the core learning signal that guides a reinforcement learning agent?