Concepts / Greedy and ε-Greedy Action Selection

Greedy and ε-Greedy Action Selection

The 10-armed testbed uses 2000 different ten-action bandit problems to compare learning behavior under averaged results.

  • Programming

The Immediate-Reward Trap

Suppose an agent has ten possible actions and must choose one. The natural strategy is to select the action with the highest estimated value. That strategy is called greedy action selection. It has an immediate advantage: the agent uses its current knowledge to pursue the best expected reward for the next step. However, an early reward can be misleading. If the agent treats an unlucky early observation as strong evidence, it may repeatedly choose the wrong action and stop collecting evidence about better actions.

current estimatesprobability 1 − εprobability εAction selectionExploration decisionprobability εGreedy actionhighest estimateRandom actionexploration
Given current estimated values and an exploration rate, how does the agent decide whether to exploit the best-known action or explore?

Greedy Actions and Current Estimates

A greedy action is an action with the greatest current estimated value. Selecting it is exploitation: the agent relies on what it currently believes and seeks the best expected one-step reward.

Finding the greedy action

An agent has current estimated values for several actions. Which action is greedy?

Compare estimates: The agent compares the current estimated value of each available action.

Find the greatest estimate: The action with the greatest estimate is the greedy action.

Choose by exploitation: Choosing that action uses current knowledge to seek the best expected reward for the next step.

The greedy action is whichever action currently has the greatest estimated value.

comparehighestcompareAction 1estimate 0.4Action 2greatest estimateAction 2estimate 1.1Action 3estimate 0.7
How are current action-value estimates compared to identify the greedy action?

The 10-Armed Testbed

The 10-armed testbed is not one single bandit problem. It is a collection of 2000 independently generated problems. Each problem has ten possible actions. Every action has a true action value, written as q∗(a). These true values are selected from a normal distribution with mean 0 and variance 1. When an action is chosen, its reward is random: the reward distribution has a mean equal to that action's true value and variance 1.

A method interacts with one problem for 1000 steps. The experiment is repeated across all 2000 problems, and the results are averaged. Averaging is important because one run can be strongly affected by chance rewards. The resulting curves describe average behavior across many different tasks rather than the outcome of one unusually lucky or unlucky problem.

each problem containstest selection methodcombine across problemsGenerate problems2000 independent problemsTen actionstrue action valuesRun method1000 interaction stepsAverage resultsaverage learning curve
How are independent ten-action problems combined into an average learning curve?

Updating Estimates by Sample Average

The compared methods estimate each action's value with the sample-average technique. For a particular action, the learner collects the rewards observed after selecting that action and averages those observations. That average becomes the current estimate used by the action-selection rule.

One action's estimate over repeated selections

Track the estimate for one action as the learner observes rewards from that action.

First observation: After the first reward for an action, the sample average is based on that one observed reward.

Second observation: After selecting the same action again, the estimate is the average of the first and second observed rewards.

Further observations: Each additional reward is included in the average for that action, so the estimate incorporates all observed rewards from that action.

Use the estimate: The current average is compared with estimates for other actions when the selection rule decides what to do next.

The sample average summarizes the rewards observed for an action and supplies the estimated value used for selection.

averageupdate averageupdate with observationsFirst rewardone observationAction estimatesample averageSecond rewardtwo observationsMore rewardsall observations
How do rewards observed for one action accumulate into its current estimated value?

Why Pure Greed Fails

The greedy method always selects the action with the highest current estimate. Its first results can therefore look promising because it immediately exploits what it currently believes is best. The problem is that an early sample may be disappointing even when the action is actually optimal, or unusually rewarding even when another action is better. Once a misleading estimate becomes the highest estimate, a purely greedy method may keep returning to that action and fail to revisit actions that received disappointing early samples.

In the reported comparison, the greedy method's average reward levels off at about 1 per step, while the best possible average reward on this testbed is about 1.55. The greedy method found the optimal action in only approximately one-third of the problems. These results show why fast initial improvement does not guarantee strong long-run behavior.

shapesselect highestfails to exploreEarly samplemisleading rewardHighest estimatewrong action appears bestRepeat actiongreedy selectionBetter actionnot revisited
How can an early inaccurate reward estimate cause a greedy agent to miss a better action later?

What do you think happens?

An optimal action receives a disappointing early sample, while another action receives a more attractive early sample. Which method is most likely to stop revisiting the optimal action?

  • The purely greedy method
  • The ε-greedy method with ε = 0.01
  • The ε-greedy method with ε = 0.1
Reveal answer

Answer: The purely greedy method

The greedy method always selects the action with the highest current estimate. It has no deliberate random-selection step to return to an action that currently looks worse.

Adding ε-Greedy Exploration

An ε-greedy method separates action selection into two possibilities. With probability 1 − ε, it selects the action with the highest current estimated value. With probability ε, it selects a random action. The random choice is not intended to maximize the immediate reward. Its purpose is to give the learner opportunities to collect evidence about actions that may currently be undervalued.

Choosing the greedy action is exploitation. Choosing a nongreedy action is exploration. Exploitation uses current knowledge to pursue the best expected one-step reward. Exploration may produce a lower immediate reward, but it can reveal a better action and improve later choices when many future selections remain.

not usuallymore explorationmore exploitationε = 0always greedyEarlier discoveryusually ε = 0.1ε = 0.01less frequent explorationHigher eventualperformancereported for ε = 0.01ε = 0.1more frequent exploration
What changes in action choices, discovery speed, and long-run behavior as ε changes?

Comparing the Three Methods

MethodAction selectionEarly behaviorLong-run behavior in the reported comparison
GreedyAlways selects the action with the highest current estimateCan improve quickly through immediate exploitationAverage reward levels off at about 1 per step; finds the optimal action in approximately one-third of problems
ε = 0.01Usually selects the highest estimate, with occasional random selectionImproves more slowly than ε = 0.1Eventually outperforms ε = 0.1 on reward and optimal-action measures
ε = 0.1Selects the highest estimate most of the time, with more frequent random selectionUsually identifies the optimal action earlierContinued exploration means the optimal action is never selected more than 91% of the time in the reported comparison

The three methods use sample-average estimates; their main difference is how much they continue to explore.

The comparison demonstrates a timing trade-off rather than a universal winner at every moment. More exploration can help the learner discover the optimal action earlier. Less exploration leaves more selections available for exploiting current estimates and can produce better eventual performance in the reported comparison. The best interpretation of ε is therefore about the balance between learning speed and the cost of exploratory selections.

Mistakes in Reasoning

  • Assuming that the action with the highest estimate is always the true best action.

    Estimates are based on observed rewards, and early rewards can be misleading.

    Fix: Recognize that ε-greedy exploration creates opportunities to gather more evidence about actions that currently look worse.

  • Calling every random action a mistake.

    That random selection is the exploration part of the method, not an accidental failure.

    Fix: Distinguish immediate reward seeking from information gathering.

  • Assuming that ε = 0.1 must outperform ε = 0.01 at every stage.

    The source reports that ε = 0.01 eventually outperforms ε = 0.1 on both reward and optimal-action measures.

    Fix: Separate early learning speed from long-run performance.

  • Treating the testbed results as the behavior of one single bandit problem.

    The testbed contains 2000 independently generated problems, each with ten actions.

    Fix: Interpret the reported curves as averages across many tasks and many chance outcomes.

Reasoning Practice

MEDIUM

Explain what happens when an ε-greedy learner changes from ε = 0.1 to ε = 0.01. Address the frequency of random action selection, the likely speed of discovering the optimal action, and the reported long-run comparison of reward and optimal-action measures.

Hints
  • Start by comparing how often each method explores.
  • Then distinguish early discovery from later exploitation.
  • Use the reported comparison between ε = 0.1 and ε = 0.01.
MEDIUM

A greedy learner receives a disappointing early reward from the action that is actually optimal. Trace why the learner may stop selecting that action and explain how ε-greedy selection changes the situation.

Hints
  • Identify how the early reward changes the action's estimated value.
  • Recall what a purely greedy method does with the highest current estimate.
  • Then identify the role of occasional random selection.

Key Takeaways

  1. A greedy action has the greatest current estimated value, and selecting it is exploitation.
  2. Exploration selects a nongreedy action to gather evidence that may improve future decisions.
  3. The 10-armed testbed averages results from 2000 independent ten-action problems, each run for 1000 interaction steps.
  4. All three compared methods use sample averages to estimate action values; they differ mainly in whether and how often they explore.
  5. Greedy selection can look good early but become trapped by misleading rewards, while ε = 0.1 usually discovers the optimal action earlier and ε = 0.01 eventually performs better in the reported comparison.

Key Takeaways

  • Greedy selection always exploits the action with the greatest current estimated value.
  • ε-greedy selection explores with probability ε and exploits with probability 1 − ε.
  • The 10-armed testbed uses 2000 independent problems so that averaged results are less dependent on one lucky or unlucky run.
  • Sample averages update each action's estimated value from the rewards observed after selecting that action.
  • More exploration can improve early discovery, while less exploration can improve eventual performance in the reported comparison.