Lesson 1 of 14 in this unit
Explore before you decide.
Choose between uncertain rewards and discover why trying a new option can improve later decisions.
By the end: Explain exploration and exploitation, read an action-value estimate, and calculate a policy’s expected reward.
Prerequisites and path options
Why learn this? Understand why trying an uncertain option can improve later decisions, even when it costs something now.
Start with something concrete.
Three unfamiliar snack machines sometimes give you a free snack. Each has a different chance of success, but you do not know those chances. Should you keep using the first machine that worked, or spend some turns investigating the others?
Try the interactive modelAn arm gave reward 1 on its first pull. What can you conclude?
Change one thing. Watch what follows.
Loading this browser experiment…
Understand what changed.
A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.
The idea in everyday terms
An agent chooses an option and receives a reward. Trying only the option that currently looks best can hide a better alternative. Exploration means sometimes trying something else to improve the evidence for future choices.
What to watch in the experiment
The bandit records rewards for each option and updates its average estimate. The epsilon setting controls how often it explores rather than taking the current favorite. Compare the reward earned now with what the agent learns about less-tested options.
What this does not establish
The lab uses a small table and a programmed choice rule. It is not a neural actor–critic system, and success on these fixed options does not establish good decisions in changing environments.
Open the full worked examples, calculations and limitations
This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.
Learn from consequences
In supervised learning, we supplied a desired answer for each input. In reinforcement learning, an agent chooses an action, receives a reward, and may enter a new state. Its choices affect what experience it collects. The objective is usually to increase expected accumulated reward, not to copy a labeled action on every turn.
The three-arm experiment is a bandit: each choice gives an immediate reward without changing a useful future state. Its hidden reward probabilities are 0.2, 0.5, and 0.8, matching the source example. Each outcome is either 0 or 1. A probability of 0.8 means an average of about eight successes per ten pulls over many repetitions, not a guarantee about the next ten.
Explore or exploit?
Exploitation chooses the action with the largest current estimate. Exploration tries alternatives to collect evidence. Our ε-greedy policy explores with probability ε and otherwise exploits. Exploration chooses uniformly among all three arms, including the current favorite.
With ε = 0.3, each arm receives 0.3 / 3 = 0.1 probability from exploration. The current favorite also receives the remaining 0.7, for a total probability of 0.8. ε is a design choice: too little exploration can miss a better option; continued random choices can reduce reward once good estimates are available. This lab keeps ε fixed until you change it.
At the start all estimates are zero. The tie rule chooses A. With ε = 0, the learner never discovers B or C: A’s estimate cannot fall below their initial zero. That is a property of this initialization and tie rule, not a theorem that every greedy learner always fails.
Three different value questions
An action value Q asks: “How much return do I expect if I take this action?” For this one-step bandit, we estimate it using the observed average reward for that arm. An untried arm is initialized to zero, which is a starting guess rather than an observation.
Here n counts this arm’s pulls, including the latest. If an arm has produced rewards 1, 0, 1, its estimate is 2/3. A fourth reward of 0 changes it to 2/3 + (0 − 2/3)/4 = 1/2.
A state value V asks: “How good is this situation under my policy?” In this bandit, the situation is always the same. Multiply each action estimate by the probability of choosing that action, then add.
The advantage A compares an action with the policy’s baseline. A positive advantage means better than that estimated baseline, not certain success. In a multi-step task, Q and V refer to future accumulated rewards under specified behavior, not merely the next reward.
From a table to actor–critic learning
An actor selects actions using a policy. A critic estimates value and supplies feedback that can help improve the policy. Advantage estimates can guide the actor toward actions that did better than expected. Larger systems can represent the policy and critic with neural networks and update their weights using gradients.
Our bandit instead uses a small table and a programmed ε-greedy policy. Its Q, V, and A values make those ideas visible, but it does not implement a neural actor–critic optimizer. The next lesson introduces changing states and delayed consequences.
After many pulls, Q estimates are 0.2, 0.5, and 0.8. With ε = 0.3, random exploration chooses each arm equally. What is the next policy’s estimated reward?
Take this idea with you.
A learner needs evidence about alternatives. Exploration trades some immediate reward for information; value estimates and observed success rates remain uncertain.
Explore related topics and the topic map
How this topic connects
Explore this topic on the interactive mapUse these connections to review a foundation or choose where to go next. You can open any topic without completing the others.
What it builds on
- Averages and probability
Combine outcomes with their frequencies or probabilities, keeping the denominator explicit when interpreting this lesson’s evidence.
- Training and testing
Avoid choosing a model that memorizes examples but fails on new ones.
Choose between uncertain rewards and discover why trying a new option can improve later decisions.
What it enables
- Learn from delayed rewards
Connect an action to later consequences so you can design rewards that encourage the intended behavior.
- Call a tool, then check the evidence
Build assistants that inspect tool results and recover from failures instead of treating every returned value as trustworthy.
- Decide whether another computation is worth it
Decide whether another lookup or calculation is likely to be worth its time and cost.
Show 3 more connections
- Learn from routing evidence without fooling yourself
Compare routing choices fairly when the available evidence depends on which options were tried.
- Build an architecture that earns its complexity
Test whether a more complex agent actually improves outcomes enough to justify its extra parts.
- Learn reusable temporally extended skills
Test learned option actions and stopping decisions separately from a fixed hierarchy before claiming reusable learned skills.