← Concept library

Foundations

The Exploration-Exploitation Trade-off

Choosing when to try something new versus repeating what already works is the central tension in reinforcement learning, and getting it wrong kills agent performance regardless of how well the rest of the system is designed.

intermediate · 6 min read

An agent trained purely to exploit its current best guess of the value function converges quickly - and permanently - to a suboptimal policy. A classic demonstration: an epsilon-greedy agent on a 10-armed bandit that sets epsilon to zero too early will commit to whichever arm happened to look best in its first handful of pulls, even if the true best arm was never tried. The gap between what the agent settles for and what it could have achieved is called regret, and it compounds over every subsequent timestep.

This is the exploration-exploitation trade-off. It is not a problem you solve once and move on. It lives at every decision point across the entire training lifetime of an agent.

What the Trade-off Formally Looks Like

Consider a stationary k-armed bandit. At each step t, the agent picks action a_t. Action a has a true expected value Q*(a). The agent maintains estimates Q_t(a). The greedy action is argmax_a Q_t(a).

Regret over T steps is:

L(T) = sum_{t=1}^{T} [ Q*(a*) - Q*(a_t) ]

where a* is the globally optimal arm. Any algorithm that never pulls a suboptimal arm will suffer zero regret - but only if it already knows which arm is optimal, which it does not at the start.

The tension: each exploratory pull wastes one opportunity to collect reward from the current best-known action, but it potentially shifts Q_t(a) toward Q*(a) for some underexplored arm, increasing long-run performance.

The same structure holds in full MDPs. The agent must balance gathering information about states it has rarely visited against maximising returns in regions it understands well.

The Classic Algorithms and Their Logic

Epsilon-greedy. With probability epsilon, pick a random action; otherwise pick greedy. Simple, robust, widely used in practice. The failure mode is uniform exploration: epsilon-greedy spends the same amount of time exploring clearly bad arms as promising ones.

Softmax / Boltzmann exploration. Sample actions proportional to exp(Q_t(a) / tau), where tau is a temperature parameter. Better-looking actions get more probability mass, so exploration is concentrated on plausible candidates. Requires tuning tau and is sensitive to the scale of Q estimates.

Upper Confidence Bound (UCB). Select the action that maximises:

UCB score(a) = Q_t(a) + c * sqrt( ln(t) / N_t(a) )

where N_t(a) is the number of times action a has been selected and c controls the confidence width. The bonus term is large when an arm is underexplored (N_t(a) small) and shrinks as it is tried more. UCB achieves logarithmic regret O(ln T) in the stationary bandit - provably optimal up to constants. It is optimistic in the face of uncertainty: the agent assumes an unexplored option might be good until shown otherwise.

Thompson Sampling. Maintain a posterior over Q*(a), sample once from each posterior, then act greedily on the samples. In the Bernoulli bandit, start with Beta(1,1) priors and update with each reward observation. Thompson Sampling often matches or outperforms UCB empirically and scales naturally to structured posteriors. Kuleshov and Precup (2014) ran extensive bandit benchmarks and found that simple heuristics like epsilon-greedy and Thompson Sampling outperform theoretically tighter algorithms on many practical settings.

Algorithm Regret bound Key tuning knob Uniform over bad arms?
Epsilon-greedy O(T) if epsilon fixed epsilon, decay schedule Yes
Softmax O(T) if tau fixed temperature tau No
UCB1 O(ln T) confidence constant c No
Thompson Sampling O(ln T) (posterior-dependent) prior choice No

From Bandits to Deep RL

The multi-armed bandit is stateless. In MDPs, exploration must also cover the state space. An agent that has never reached a high-value terminal state cannot have assigned it a positive Q-value, so greedy policy will never navigate toward it. Sparse-reward environments make this severe: if positive reward is reachable only through a long chain of specific actions, epsilon-greedy exploration will almost never stumble upon it by accident.

Two practical responses emerged in deep RL:

Count-based exploration. Add an intrinsic reward bonus inversely proportional to how often the agent has visited a state. In tabular settings this is straightforward. In high-dimensional spaces (pixels), you need a proxy for visit count. Bellemare et al. (2016) showed that pseudo-counts derived from a density model provide a principled generalisation: the intrinsic bonus is approximately (N(s) + 0.01)^(-0.5) where N(s) is the pseudo-count for state s. On Montezuma's Revenge - a notoriously hard-exploration Atari game - this approach dramatically improved over plain epsilon-greedy DQN.

Curiosity-driven exploration. Pathak et al. (2017) proposed using prediction error as an intrinsic reward. An agent learns a forward model that predicts the next state given the current state and action; states where the model is wrong are "surprising" and receive a bonus. This encourages the agent to seek out novel situations without needing explicit visit counts. The important subtlety: the forward model operates in a learned feature space rather than raw pixel space, so it does not reward changes that are irrelevant to the agent's own actions (e.g., a waving flag in the background).

In practice, most production deep RL systems use entropy bonuses in the policy rather than state-space exploration bonuses. The PPO implementation by Schulman et al. (2017) adds an entropy term to the policy objective:

L_total = L_CLIP - c1 * L_VF + c2 * H(pi(. | s_t))

where H is policy entropy. Maximising H discourages the policy from collapsing to a single deterministic action prematurely, keeping exploration alive throughout training. This is coarser than UCB or Thompson Sampling but scales to billions of parameters and is cheap to compute.

When It Falls Down

Non-stationary reward distributions. UCB and Thompson Sampling with standard Beta priors assume the bandit is stationary. In non-stationary problems (e.g., opponent behaviour changes, seasonal user preferences), old observations should be discounted. A sliding-window UCB or discounted Thompson Sampling is needed, and no single epsilon decay schedule works across all dynamics.

State aliasing in partial observability. In POMDPs the agent cannot distinguish states it has not seen from states it has seen but cannot remember. Count-based bonuses on observations can over-explore repeated observations that are actually distinct states, or under-explore because a familiar observation masks an unseen underlying state.

Curiosity addiction. Intrinsic reward based on prediction error can be dominated by regions that remain permanently unpredictable - a fire burning stochastically, a TV showing random noise. The agent spends all its time in front of the "noisy TV" collecting intrinsic reward while ignoring the actual task. This is a known failure mode labelled the "noisy TV problem". Restricting the prediction model to the agent-controllable aspects of the state is one mitigation; contrastive curiosity approaches are another.

Reward over-estimation in Q-learning. Epsilon-greedy in DQN relies on Q-values being reasonable guides to which actions are worth exploring less. But Q-learning is known to overestimate action values in early training, so the greedy action is often wrong. This means epsilon must remain non-trivially high for longer than theory suggests, or exploration stays biased toward already-overestimated actions.

Catastrophic over-exploration in safety-critical settings. In robotics or real-world deployment, exploration carries physical cost. Exploring by perturbing joint velocities on a real arm can cause hardware damage. Upper-bounding exploration to a safe action neighbourhood (constrained MDP approaches) sacrifices the theoretical guarantees of UCB-style methods.

Further Reading

  • Kuleshov, V. and Precup, D. (2014). "Algorithms for multi-armed bandit problems." arXiv:1402.6028. Empirical survey of bandit algorithms including epsilon-greedy, UCB, and Thompson Sampling across many settings.
  • Bellemare, M. G. et al. (2016). "Unifying Count-Based Exploration and Intrinsic Motivation." arXiv:1606.01868. Introduces pseudo-counts and applies them to hard-exploration Atari games.
  • Pathak, D. et al. (2017). "Curiosity-driven Exploration by Self-supervised Prediction." arXiv:1705.05363. ICML 2017. Self-supervised intrinsic reward from forward model prediction error.
  • Schulman, J. et al. (2017). "Proximal Policy Optimization Algorithms." arXiv:1707.06347. Section 3 explains the entropy bonus used to maintain exploration during PPO training.
Sign in to save and react.
Share Copied