Exploration vs. Exploitation

A Q-table starts with guesses. If the agent always chooses the action with the highest current Q-value, an early lucky or unlucky sample can lock behavior into a bad pattern. The agent may never try the action that would have been better.

Exploitation uses what the agent currently believes is best. Exploration tries actions to gather information. RL agents need both: exploiting too early can trap learning, but exploring forever ignores useful evidence.

Exploration vs exploitation

How epsilon changes behavior

A lunch robot has learned that sandwiches look safest. Soup is under-tested, but it is actually the best option. Choose epsilon to see what the next 20 decisions look like.

🥪

Q = 0.8

best current Q

🍲

Q = 0.0

under-tested

🥗

Q = 0.2

okay

🥤

Q = -0.1

usually bad

explore

4/20

exploit

16/20

🍲 tries

1

sample return

11.2

random

r +1.0

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

random

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

random

r -0.2

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

greedy

r +0.6

random

r +0.2

greedy

r +0.6

greedy

r +0.6

The robot mostly gets sandwiches, but a few random choices create chances to discover the under-tested soup counter.
With probability epsilon, the robot explores by choosing randomly. With probability 1 - epsilon, it exploits by choosing the action with the highest current Q-value.

A common compromise is an ϵ\epsilon-greedy policy:

at={random action,with probability ϵargmaxaQ(st,a),with probability 1ϵ.a_t=\begin{cases}\text{random action}, & \text{with probability } \epsilon \\ \arg\max_a Q(s_t,a), & \text{with probability } 1-\epsilon.\end{cases}

When ϵ=0\epsilon=0, the agent is fully greedy. When ϵ=1\epsilon=1, every action is random. Most practical settings use something in between, often with ϵ\epsilon changing over training.

The Best-Looking Action Can Be A Trap

A high current Q-value means "best according to current evidence." Exploration exists because the table may be wrong early in training.

Checkpoint

In an ϵ\epsilon-greedy policy, what happens with probability 1ϵ1-\epsilon?