The trade, stated exactly
- : the mean reward of the best action.
- : the mean reward of the action actually taken.
Regret is what exploration costs, measured against an oracle that knew the answer from the start.
An agent that only exploits stops at the first decent option and never discovers a better one. An agent that only explores learns everything and collects nothing.
The theory says the best achievable regret grows logarithmically, so some exploration forever is not a compromise but the optimum.
Epsilon-greedy
The simplest rule, and the one used in practice. It is also indiscriminate: when it explores, it is as likely to pick an action already known to be terrible as a promising one.
Decaying it from 1.0 to about 0.05 over training is standard, since early exploration is valuable and late exploration is mostly waste.
A fixed gives linear regret, which is why the decay matters rather than being a refinement.
UCB, which explores where it is uncertain
- : the observed mean reward of action .
- : how many times it has been tried.
The second term is a confidence width: large for actions tried rarely, shrinking as evidence accumulates.
Optimism in the face of uncertainty is the principle. An action is chosen either because it looks good or because nobody knows, and both are reasons worth acting on.
That is near the theoretical floor, and it is achieved with no randomness at all, since the rule is deterministic.
Thompson sampling
- Keep a posterior distribution over each action's reward.
- Draw one sample from each posterior.
- Take the action whose sample is highest.
- Observe the reward and update that action's posterior.
- Repeat.
Exploration falls out of the width of the posteriors rather than being added, so an uncertain action wins sometimes and a well-measured poor one essentially never does.
It matches UCB's guarantees, is usually better empirically, and is the standard choice for bandit problems in production such as content ranking.
Why deep reinforcement learning still mostly uses epsilon-greedy
UCB and Thompson sampling need visit counts or posteriors per state and action, and neither exists when states are continuous and never repeat.
The generalisation is an intrinsic reward for novelty, estimated by a density model or by the error of a network predicting a random fixed function of the state.
That is how agents explore environments where the external reward is zero for thousands of steps, and it is the only thing that solves such tasks at all.