Regret · reinforcement learning

Also known as: cumulative regret

On this page 7

Regret in reinforcement learning is the difference between the reward an optimal policy would have collected and the reward the learning agent actually collected over a given number of steps or episodes. Also called cumulative regret, it is the standard measure of how efficiently an agent balances exploration and exploitation while it learns.

Regret matters because it scores the whole learning process, not only the final policy. An algorithm that eventually finds the best action but wastes thousands of trials on poor ones has high regret, while one that learns quickly and rarely errs has low regret. Theoretical guarantees in bandit problems and Markov decision processes are almost always stated as regret bounds.

How regret is defined and calculated

In the simplest setting, the multi-armed bandit, an agent repeatedly chooses one of K actions and receives a random reward. If the best action has expected reward μ*, the cumulative regret after T rounds is R(T) = T·μ* − Σ E[r_t], the expected shortfall compared with always playing the best arm.

An equivalent form sums over actions: regret equals the number of times each suboptimal arm is played multiplied by its gap Δ, the difference between its mean and the best mean. This decomposition shows that good algorithms must quickly stop pulling arms with large gaps while spending more trials only on arms that are hard to distinguish from the best.

In a Markov decision process, regret compares the value of the optimal policy with the value the agent achieves, summed over episodes or measured against the optimal average reward. The idea is identical: regret counts reward lost through imperfect decisions.

Several variants of regret are used, depending on what the analysis needs to capture.

VariantCompares the agent withTypical use
Cumulative regretOptimal action at every stepOnline learning and bandits
Pseudo-regretOptimal expected reward, ignoring noiseTheoretical analysis
Simple regretOptimal action, judged only at the endPure exploration and best-arm identification
Adversarial regretBest fixed action in hindsightAdversarial bandits and online games
Bayesian regretOptimal action averaged over a priorAnalysis of Thompson sampling
Common regret variants

Sublinear regret and what bounds mean

The central goal is sublinear regret: R(T) grows more slowly than T, so the average regret per step R(T)/T tends to zero. An algorithm with this property is called no-regret, because its long-run average behavior matches the optimum.

A linear regret means the agent keeps making mistakes at a constant rate forever. This happens, for example, with epsilon-greedy using a fixed epsilon, which continues to explore randomly even after the best action is known.

Known theoretical regret bounds give a benchmark for comparing algorithms. The table summarizes typical orders of growth, where K is the number of actions, Δ the smallest gap, S and A the numbers of states and actions, and T the horizon. Logarithmic factors are omitted in the MDP row.

SettingLower boundAchieved by
Stochastic bandit, instance-dependentOrder of log T per suboptimal armUCB, KL-UCB, Thompson sampling
Stochastic bandit, worst caseOrder of √(KT)MOSS and related UCB variants
Adversarial banditOrder of √(KT)EXP3, within a log K factor
Tabular MDPOrder of √(SAT) times a horizon or diameter factorUCRL2, UCBVI and related methods
Typical regret orders

The Lai–Robbins lower bound proves that no consistent algorithm can beat logarithmic regret on stochastic bandits, so methods that reach order log T are asymptotically optimal in that sense.

Regret and the exploration-exploitation tradeoff

Regret makes the exploration-exploitation tradeoff measurable. Exploring too little risks locking onto a suboptimal action and incurring linear regret; exploring too much wastes trials on actions already known to be poor. Low-regret algorithms explore in proportion to remaining uncertainty.

Different exploration strategies achieve very different regret, as the comparison shows.

StrategyExploration principleRegret behavior
GreedyNo explorationCan be linear when early estimates mislead
Fixed epsilon-greedyRandom action with constant probabilityLinear
Decaying epsilon-greedyRandom exploration that fades over timeLogarithmic with a well-tuned schedule
Upper confidence boundOptimism in the face of uncertaintyLogarithmic, with formal guarantees
Thompson samplingSampling from the posterior over rewardsLogarithmic and often best in practice
Exploration strategies and their regret

Where regret is used in practice

Regret is the natural objective whenever learning happens while the system is live and every poor decision has a real cost. Typical applications include online advertising, recommendation, adaptive clinical trials, dynamic pricing and A/B testing with contextual bandits.

In deep reinforcement learning on simulated environments, regret is reported less often, because training mistakes cost only compute. There, researchers focus on sample efficiency and final return. Regret becomes important again in online and safe reinforcement learning, where exploration happens in the real world.

Limitations and common misconceptions

Regret is a precise tool, but it is easy to misread. The most frequent issues are listed below.

  • Regret is relative: it measures loss against the best policy in a chosen class, not against perfection in an absolute sense.
  • Bounds hide constants: two algorithms with the same order of regret can differ greatly in practice.
  • Assumptions matter: guarantees for stochastic rewards may fail under nonstationary or adversarial conditions.
  • Low regret is not safety: an agent with good average regret can still take a rare catastrophic action.
  • Measurement needs the optimum: empirical regret can be computed only when the optimal reward is known, as in simulation.

In simple terms

Regret is a score for missed rewards. Imagine trying new restaurants in a city. Every time you eat somewhere worse than the best place, you lose a little enjoyment.

Add up all those small losses and you get your regret. A smart explorer finds the best place quickly and stops wasting meals on poor ones. In reinforcement learning, a good learning agent keeps total regret small, even while it is still learning.

A practical example

An online retailer tests five versions of a checkout page to find the one with the highest conversion rate. A classic A/B test would send equal traffic to every version for a fixed period, even after some versions clearly perform worse. Each visitor sent to a weak version is a lost sale, which is regret in the reinforcement learning sense.

The team instead runs Thompson sampling as a multi-armed bandit. After a few thousand visitors, the algorithm sends most traffic to the two leading versions and only occasional traffic to the others. Over 100,000 visitors, the simulation the team ran beforehand estimated that the bandit approach would lose far fewer conversions than the equal-split test, while still identifying the best page with high confidence. The outcome is a test that learns and earns at the same time.