Exploring Starts and Epsilon-Soft Policies
Imagine an agent learning to play blackjack purely by trial and error. It uses Monte Carlo Control to estimate action values from sampled episodes. If the agent always sticks on a hand of 14, it will never learn what happens when it hits. That action's value stays forever unknown, frozen at an arbitrary initial guess. Monte Carlo control improves a policy only for the state-action pairs it actually visits. So an unvisited pair is a blind spot the agent cannot reason its way out of. This is the exploration problem. It sits at the heart of every control algorithm that learns from its own experience. The fix has to guarantee, in some precise sense, that every state-action pair keeps getting sampled forever. This must hold no matter how greedy the policy becomes. Two classical solutions solve this: exploring starts, which forces every episode to begin at a random state-action pair, and epsilon-soft policies, which bake a small amount of randomness into the policy itself at every single step. Both techniques appear throughout the reinforcement learning literature. They show up in tabular Monte Carlo control, in Sarsa, and in Q-learning's behavior policy. They also appear conceptually inside the epsilon-greedy exploration used in deep RL systems like DQN. This distinction matters far beyond toy problems. Real systems — recommendation engines, robotic controllers, trading agents — face the exact same tension. They must balance exploiting what looks best right now against exploring to discover something better. An agent that never explores converges to a policy that is only locally consistent with its own biased experience. It is not one that is actually optimal. Getting exploration right is a prerequisite for any convergence guarantee in model-free control. This article gives a precise account of both techniques. It covers how exploring starts and epsilon-soft policies are defined. It explains why each guarantees infinite visitation of every state-action pair. It describes the algorithms that use them: Monte Carlo with Exploring Starts, and on-policy first-visit Monte Carlo control with an epsilon-soft policy. It also covers their complexity, and the subtle correctness arguments. This includes why the epsilon-soft approach converges to the best policy within its own soft policy class. It does not converge to the true optimal deterministic policy. This nuance sets up the on-policy/off-policy split covered next.
- Monte Carlo control needs every state-action pair visited infinitely often to guarantee convergence to an optimal policy.
- Exploring starts (ES) force each episode to begin at a uniformly random state-action pair, guaranteeing coverage.
- Exploring starts is often impractical: many real environments don't let you "start" wherever you like.
- Epsilon-soft policies fix this by making every policy, at every state, choose each action with probability at least ε/|A|.
- On-policy first-visit MC control with an epsilon-soft policy converges to the best policy among epsilon-soft policies, not the unconstrained optimum.
- These two exploration mechanisms foreshadow the deeper split between On-Policy vs Off-Policy Learning.
Without a mechanism that keeps every state-action pair reachable forever, greedy policy improvement can lock the agent out of the very experience it would need to correct its own mistakes.
The idea
Monte Carlo control estimates the action-value function from returns observed after visiting in sampled episodes, then improves the policy by acting greedily with respect to these estimates: . The generalized policy iteration (GPI) framework alternates evaluation and improvement and is known to converge to and provided every pair is evaluated infinitely often. This is not a minor technical footnote — it is the linchpin of the convergence proof. If a pair is visited only finitely many times (or not at all), its value estimate can remain arbitrarily wrong, and greedy improvement built on a wrong estimate can permanently avoid the action that was actually best.
Exploring starts (ES) is the assumption that every episode begins in a state-action pair drawn so that all pairs have nonzero probability of being the start — typically sampled uniformly over . After that random first step, the agent follows its current policy for the rest of the episode. Because the start distribution has full support and episodes repeat forever, every pair is visited infinitely often in the limit, which is exactly the condition GPI requires. Exploring starts is elegant in theory but demands a simulator (or environment) that lets you reset into any state-action pair on command — true in board games like blackjack or in Monte Carlo tree search, but false in most real interactive systems, where the agent cannot simply teleport into an arbitrary state.
Epsilon-soft policies solve the same problem without needing special resets. A policy is called -soft if
for some small . The most common instance is the epsilon-greedy policy: with probability it takes the greedy (currently best-estimated) action, and with probability it picks uniformly at random among all actions (including possibly the greedy one again). Because every action retains probability at least at every visited state, and every state is visited with positive probability under a reasonable environment, every pair is sampled infinitely often over an infinite stream of episodes — satisfying the same visitation requirement, but through the policy's own randomness rather than through artificial episode starts.
How it works
Monte Carlo Exploring Starts (MC-ES) modifies ordinary first-visit Monte Carlo control by randomizing the initial state-action pair of every episode, then following the current greedy policy thereafter, updating and improving after each episode. ``` Algorithm: Monte Carlo Control with Exploring Starts (first-visit) Initialize: Q(s, a) <- arbitrary, for all s in S, a in A(s) Returns(s, a) <- empty list, for all s, a pi(s) <- arbitrary action in A(s), for all s Repeat forever (for each episode): Choose S0 in S and A0 in A(S0) uniformly at random # exploring start Generate episode: S0, A0, R1, S1, A1, R2, ..., S_{T-1}, A_{T-1}, R_T following policy pi from step 1 onward (A_t = pi(S_t) for t >= 1) G <- 0 For t = T-1, T-2, ..., 0: G <- gamma * G + R_{t+1} Unless the pair (S_t, A_t) appears in S0,A0,...,S_{t-1},A_{t-1}: Append G to Returns(S_t, A_t) Q(S_t, A_t) <- average(Returns(S_t, A_t)) pi(S_t) <- argmax_a Q(S_t, a) # greedy improvement ```
On-policy first-visit Monte Carlo control with an epsilon-soft policy replaces the artificial random start with an epsilon-greedy policy followed from a (fixed or randomly chosen, but not necessarily exhaustive) initial state. ``` Algorithm: On-policy first-visit MC control (epsilon-soft) Input: small epsilon > 0 Initialize: Q(s, a) <- arbitrary, for all s, a Returns(s, a) <- empty list, for all s, a pi <- an arbitrary epsilon-soft policy (e.g., uniform random) Repeat forever (for each episode): Generate episode using pi: S0, A0, R1, S1, A1, ..., S_{T-1}, A_{T-1}, R_T G <- 0 For t = T-1, T-2, ..., 0: G <- gamma G + R_{t+1} Unless (S_t, A_t) appears earlier in the episode: Append G to Returns(S_t, A_t) Q(S_t, A_t) <- average(Returns(S_t, A_t)) A <- argmax_a Q(S_t, a) # break ties consistently For all a in A(S_t): if a == A: pi(a | S_t) <- 1 - epsilon + epsilon / |A(S_t)| else: pi(a | S_t) <- epsilon / |A(S_t)| ``` The only structural difference from ordinary MC control is the final block: instead of collapsing to a deterministic greedy action, the policy is updated to the epsilon-greedy distribution* around the current best action. This single change is what removes the need for exploring starts, since the policy itself keeps every action alive with probability at least at every state it visits, for as long as the algorithm runs.
Complexity & correctness
Time and space complexity. For a tabular MDP with states and actions per state, both algorithms store and `Returns` as tables of size ; maintaining running averages instead of full return lists keeps the space at rather than growing without bound. Per episode of length , generating the trajectory costs environment steps, and the backward return/update pass costs time (with a first-visit check implementable in amortized time per step using a `seen` hash set, or worst case with a naive scan), plus per visited state to redo the epsilon-greedy distribution update. So one episode costs time in the epsilon-soft variant and in the ES variant (policy update is , just overwrite the greedy action). Neither algorithm has a fixed iteration bound — convergence is asymptotic, driven by the law of large numbers on sample returns, so total time to reach a given accuracy scales with the number of episodes needed for the averages to concentrate, which is problem-dependent and not expressible as a closed-form function of , alone.
Correctness of Monte Carlo Exploring Starts. The proof sketch runs by analogy to classical policy iteration. Fix the current policy . Each episode's first-visit return is an unbiased sample of for the pair visited first in that episode (standard Monte Carlo estimation argument: the return is a sample path realization of the random variable whose expectation defines ). Because exploring starts guarantees every pair is the initial pair with positive probability at every episode, the strong law of large numbers implies
Once is (in the idealized limit) exactly , the greedy update is precisely the policy improvement step of policy iteration, and the policy improvement theorem guarantees for all , with strict improvement somewhere unless is already optimal. Iterating this argument, and noting the sequence of value functions is bounded above by , gives convergence to and an optimal — this is the argument given (with the appropriate technical care about interleaving evaluation and improvement per episode rather than waiting for full convergence at each step) in the classical treatment of MC-ES.
Correctness of on-policy epsilon-soft control. Here the target changes. Define as the set of all epsilon-soft policies. The claim is not that the algorithm converges to (which is deterministic and hence not epsilon-soft for ), but that it converges to the best policy within . The key step is a modified policy improvement lemma: for any epsilon-soft , define as the epsilon-greedy policy with respect to . Then
can be shown to be for every state , by writing 's expectation as a convex combination — worth of uniform exploration plus worth of the greedy action — and using the fact that a weighted average of values, when the weights match scaled appropriately, cannot exceed the maximum term. Concretely,
and since (a weighted average bounded by the max, using that these adjusted weights sum to 1 and are non-negative because is -soft), substituting back shows the right side collapses exactly to . Hence for all , by the standard policy improvement theorem applied within the constrained class. Iterating produces a monotonically improving sequence of epsilon-soft policies bounded above by the best epsilon-soft policy, which (by the same GPI convergence argument, now restricted to ) converges to that constrained optimum. The visitation guarantee is immediate: since for every reachable at every iteration, and episodes repeat forever, every pair is sampled infinitely often with probability 1, satisfying GPI's requirement without ever needing a special reset.
Honest tradeoffs. Exploring starts gives a cleaner asymptotic target ( itself) but an assumption that is often physically impossible to satisfy — you cannot reset a real robot or a live user session into an arbitrary state-action pair. Epsilon-soft control works with an ordinary environment interface but pays a permanent price: even the final, converged policy still acts randomly an fraction of the time, so the actual behavior is never truly optimal, only optimal-within-the-soft-class. Shrinking toward 0 over time (a GLIE — greedy in the limit with infinite exploration — schedule) can recover convergence to itself, but this reintroduces a scheduling hyperparameter and a slower, less clean convergence guarantee.
Worked example
Consider a tiny two-state MDP used to make the exploration argument concrete. States , two actions per state , deterministic transitions and rewards chosen so that the truly best action at is , but a poorly initialized greedy policy would never discover this without exploration:
| State | Action | Next state | Reward | True |
|---|---|---|---|---|
| 0 | 4.0 | |||
| terminal | 10 | 10.0 | ||
| terminal | 4 | 4.0 | ||
| terminal | -2 | -2.0 |
Suppose is initialized to zero everywhere, and the initial (arbitrary) policy happens to pick . Under plain greedy Monte Carlo control with no exploration mechanism, every episode starts at , takes (the only action the policy ever tries at ), transitions to , takes , and terminates. The pair is never sampled, so stays at its initial value of 0 forever, and the policy never switches to the truly optimal action, even though its value (10.0) is obviously better than 's (4.0) — the agent simply never gets the evidence. Now trace exploring starts. Over many episodes, the start pair is drawn uniformly from all four combinations. On episodes that start at :
| Episode start | Trajectory | Return (from , ) | Update |
|---|---|---|---|
| terminal, | |||
| terminal via | e.g. | ||
| terminal, | |||
| terminal, |
After just one sweep touching all four pairs, , so the greedy improvement step immediately sets — the optimal action — something plain greedy MC could never have discovered. Now trace epsilon-soft control with , , starting from the same bad policy bias. Every episode starts at (no artificial reset), but at the epsilon-greedy policy still assigns probability to even while looks greedy. So roughly 1 in 10 episodes samples purely from the policy's own randomness:
| Episode (schematic) | Action taken at | Probability | Outcome |
|---|---|---|---|
| ~90% of episodes | (greedy, prob ) | 0.9 | reinforces |
| ~10% of episodes | (exploratory, prob ) | 0.1 | reveals |
After enough episodes, converges to 10, overtakes , and the epsilon-greedy policy flips to assigning probability to and to — no reset to was ever needed, because the policy's own 10% exploration rate did the job. The final behavior is still not fully deterministic (it retains a 10% chance of the suboptimal action forever, unless is annealed), which is exactly the tradeoff discussed above.
Common pitfalls & traps
| Pitfall | Why it happens | Fix |
|---|---|---|
| Using pure greedy MC control with no exploration mechanism | Forgetting that Monte Carlo control's convergence proof requires infinite visitation; greedy-only policies can permanently starve some pairs | Add exploring starts or make the policy epsilon-soft |
| Assuming ES works in any environment | Exploring starts needs the ability to reset into an arbitrary state-action pair, which most real or even simulated environments don't expose | Use epsilon-soft policies (or off-policy methods) when resets are restricted to a fixed start distribution |
| Treating epsilon-soft convergence as convergence to | The modified policy improvement theorem proves improvement within , not against the unconstrained optimum | State the target correctly: best policy among -soft policies; anneal (GLIE) if true optimality is required |
| Keeping fixed forever in a deployed system | A permanently nonzero exploration rate means avoidable regret even after learning has converged | Decay on a schedule, or switch to a purely greedy policy for deployment after training |
| Confusing first-visit vs every-visit updates when checking "already appears in the episode" | Off-by-one/duplicate bugs when scanning trajectory history inside the backward loop | Track visited pairs with a set built incrementally, or use every-visit MC consistently and document which is used |
| Forgetting that ties in need a consistent rule | Random or inconsistent tie-breaking can destabilize policy improvement or violate the monotonic improvement argument | Break ties deterministically (e.g., lowest action index) or uniformly at random but fixed within an update step |
Pioneers & history
The exploration/exploitation tension long predates reinforcement learning as a field, tracing back to the multi-armed bandit problem studied in sequential statistics. Its formalization inside Monte Carlo control, and the epsilon-soft/epsilon-greedy machinery specifically, was consolidated in the modern reinforcement learning framework built by Richard Sutton and Andrew Barto, whose textbook treatment of Monte Carlo methods made exploring starts and epsilon-soft policies standard vocabulary for the field.
Origins · 1 minRichard S. Sutton and how this was discovered
Sutton co-developed the modern formalization of reinforcement learning, including temporal-difference learning, policy gradient methods, and the generalized policy iteration framework that underlies Monte Carlo control, Sarsa, and Q-learning.
Where this matters
Epsilon-greedy exploration, the direct descendant of epsilon-soft policies, is the default exploration mechanism in most practical value-based reinforcement learning systems, including DQN and its successors used for game-playing agents, resource allocation, and simulated robotic control. Exploring starts, while rarely usable in production systems, remains the cleanest theoretical device for teaching why Monte Carlo control converges, and it appears in practice inside self-play training pipelines and Monte Carlo tree search variants (such as in game engines), where random rollout starts or random opening moves are used deliberately to guarantee coverage of the game tree. Both mechanisms are direct ancestors of the exploration bonuses, optimistic initialization, and upper-confidence-bound strategies used in modern bandit algorithms and in exploration-heavy deep RL research. Understanding the ES-versus-epsilon-soft distinction is also the natural on-ramp to the broader question of On-Policy vs Off-Policy Learning: on-policy methods like Sarsa must keep the acting policy epsilon-soft to keep exploring, while off-policy methods like Q-learning can behave epsilon-greedily during data collection while learning about a separate, fully greedy target policy — decoupling exploration from the policy being optimized. This connects directly back to core ideas in Temporal-Difference Learning and to the general convergence theory of Generalized Policy Iteration.
Ask the tutor: How does the modified policy improvement theorem change if the epsilon-soft policy is replaced by a softmax (Boltzmann) exploration policy instead?
Why can't we just use a very small ε and call it "essentially optimal"?
A small reduces the frequency of suboptimal actions but never eliminates the gap: the converged policy still takes a wrong action with probability at least at every state, forever. In terms of expected return, this contributes a persistent, nonzero loss relative to , even after the value estimates have fully converged. For applications where behavior must eventually be as good as possible, the standard fix is annealing toward zero over time (a GLIE schedule — "greedy in the limit with infinite exploration") so that early episodes explore heavily while late episodes approach the deterministic optimum.
Does Q-learning need exploring starts or epsilon-soft policies?
Q-learning is off-policy: it learns the value of the greedy (target) policy while the actual actions can come from a different, more exploratory behavior policy — commonly epsilon-greedy. It does not need exploring starts because its convergence proof only requires that the behavior policy visits every state-action pair infinitely often, which epsilon-greedy behavior already guarantees, without constraining the target policy to be epsilon-soft. This decoupling is precisely what separates Q-learning's off-policy convergence guarantee from Sarsa's on-policy one, foreshadowing the broader on-policy/off-policy distinction.
Is exploring starts ever used in practice, given its unrealistic assumption?
Yes, in settings where the "environment" is actually a simulator the practitioner fully controls, such as self-play game engines or planning algorithms like Monte Carlo tree search variants, where resetting to an arbitrary board position or random opening move is trivial. It is far less usable in physical robotics, live recommendation systems, or any setting where the agent only experiences one continuous stream of interaction it cannot rewind or reposition arbitrarily. In those cases, epsilon-soft (or more sophisticated) exploration strategies are the practical default.
How does epsilon-soft interact with first-visit versus every-visit Monte Carlo?
The exploration mechanism and the visit-counting convention are independent design choices. Either first-visit (only the first occurrence of in an episode contributes a return sample) or every-visit (every occurrence contributes) can be paired with either exploring starts or epsilon-soft policies. First-visit is more common because its returns are more straightforwardly unbiased and independent across episodes, but every-visit is also consistent and is sometimes preferred for problems with revisitable states, since it uses more of the available data per episode.
What happens if ε is set too large?
An excessively large (close to 1) makes the policy behave close to uniformly random at every state, which does guarantee exhaustive exploration but severely dilutes the signal used for policy improvement — most episodes are dominated by exploratory noise rather than exploitation of what has been learned, slowing convergence and increasing the variance of the value estimates. There's a genuine bias-variance-style tradeoff: too small an risks insufficient exploration (slow or failed discovery of better actions), while too large an risks excessive exploration (slow exploitation of what is already known), and tuning it well is often problem-dependent.
Are exploring starts and epsilon-soft policies the only ways to guarantee exploration?
No — they are the two classical mechanisms presented alongside standard Monte Carlo control, but the broader RL literature has developed many alternatives: optimistic initialization of -values (encouraging early exploration of everything by making unvisited actions look artificially attractive), upper-confidence-bound (UCB) exploration bonuses that explicitly reward uncertainty, Boltzmann/softmax exploration, and modern intrinsic-motivation or curiosity-driven exploration bonuses used in deep reinforcement learning. Exploring starts and epsilon-soft policies remain the canonical starting point because their correctness arguments are the simplest to state and prove rigorously.