PAC-MDP Framework
PAC-MDP is a promise about efficient exploration: except for a limited number of learning steps, the agent acts nearly as well as if it already knew the environment.
Why Does This Exist?
You can run epsilon-greedy for a million steps and still have no answer to the only question that matters: how many bad steps did learning cost? Random dithering keeps paying for the same lesson. That is fine in a bandit demo. It is not a guarantee.
PAC-MDP gives you a mistake budget. It says an agent is efficient when the number of steps where it acts more than away from optimal stays bounded by a polynomial in the problem size, with high probability. Small budget, clean claim. You can compare algorithms by their budgets instead of their vibes.
This page defines that budget and shows one mechanism that meets it: RMAX with known states and optimistic unknowns. For the model itself, start with the Markov Decision Process. For the broader tension between trying new things and cashing in, read exploration vs exploitation. Here you get the guarantee plus the counting trick behind it.
Quick grounding, since search readers land here first. An MDP is : is the set of states, is the set of actions, gives next-state probabilities, gives rewards, and in discounts the future. is the expected discounted return from under policy , and is the best achievable value. A policy is -optimal at when , with a small accuracy you pick.
Think of It Like This
The new courier with a cautious map
You run a courier depot in a town you have never mapped. Your rule is simple. A street becomes known after your riders have driven it 369 times. Fewer trips than that, and the street stays unknown.
Each morning you plan the fastest route on this map. Known streets carry their measured average time. Unknown streets are penciled in as empty, the fastest a street could ever be. So the planner loves unknown shortcuts. Two things happen next.
If the chosen route uses only known streets, the estimate is honest and the delivery lands on time. You exploited. If the route uses an unknown shortcut, your rider drives it and reports back. Either the shortcut really is fast and you keep using it, or it was slow and the map gets one entry closer to complete. You explored, and the unknown set shrank.
Your late-delivery budget is the number of rides before every useful street turns known. After that, the optimism has nothing left to chase.
Where the analogy stops: real streets are never empty by default. The maximum value is a math trick that forces visits, not a belief about the world. And RMAX assumes the town does not change under you, which real traffic does.
How It Actually Works
What counts as a mistake?
Fix accuracy and failure probability in . Write for the agent's policy at time and for the state it sits in. Step is a mistake when:
The sample complexity of exploration, often shortened to sample complexity, is the count of such steps along one infinite run. An algorithm is PAC-MDP when that count is bounded by some polynomial in , , , , and , with probability at least . Here and are the numbers of states and actions, and is the effective horizon: the smaller the discounting, the further errors propagate.
This framing comes from the PAC analysis of Strehl, Li, and Littman, building on Kakade's thesis work and on the RMAX algorithm of Brafman and Tennenholtz. The point is deliberately narrow. It does not bound total lost reward. It bounds how often you are far from optimal. That is why a few costly exploration steps are allowed, but endless dithering is not.
How RMAX turns unknowns into exploration
RMAX keeps counts. Let be visits to the pair, the transitions seen, and likewise the reward total. Pick a threshold . The pair is known when and unknown otherwise.
For known pairs, RMAX uses the empirical model and straight from the counts. For unknown pairs, it substitutes the rosiest possible model: reward on every step plus a self loop, which gives value . It then runs value iteration on this optimistic model, acts greedily, updates counts after each real transition, and replans whenever a pair flips from unknown to known.
Now the neat either-or. If the optimistic plan stays inside known states, the simulation idea applies: an accurate model gives near-accurate values, with error growing as the horizon compounds. So the greedy act is near optimal and you exploited. If the optimistic plan reaches through an unknown, the agent walks there and collects the visits that make it known. You explored, and unknowns strictly shrink. Since there are only pairs and each needs at most visits, unknown visits run out. The rest is bounding the small leaks, like acting on a known model that is still slightly off.
The trade is explicit. You pay up to exploratory visits for a guarantee that the remaining behavior is near optimal. The assumption is finite states and actions with bounded rewards and a fixed model. When states are huge or continuous, raw counts stop working and you need structure plus a different analysis. Then reach for function approximation tools, not a bigger .
Worked example: how many visits make a pair known?
Take a toy with states and actions, so pairs. Ask for reward accuracy per pair with overall confidence . Rewards sit in . This is the counting idea inside RMAX, simplified to one reward mean so you can check every digit. The full algorithm uses a larger because transition errors across outcomes compound through the horizon. Treat 369 as the illustration, not the deploy constant.
Split the failure budget evenly. Per-pair budget . Hoeffding for a bounded mean says:
Set the right side to and solve:
Plug in. . . Denominator . Ratio . Round up, because visits are whole:
After 369 visits to a pair, its reward estimate sits within 0.1 except with probability at most 0.05 spread across all 40 pairs. Pigeonhole next: at most visits can land on unknowns before every pair turns known.
Now optimism picks the action. Set and , so . Suppose the best known pair offers while an unknown offers the optimistic . Ten beats seven point two, so the planner sends the agent to the unknown. Either the unknown delivers and you found something better, or its estimate falls after a few visits. Both outcomes are progress. The diagram draws exactly this split, and the code below recomputes both numbers.
How is this different from regret?
Regret adds up gaps: over steps. PAC-MDP counts bad steps: how many satisfy . Same run, different question. How much did you lose versus how often were you far off.
They connect through one safe split. Mistake steps lose at most each, the rest lose at most each, so total regret is at most where is the mistake count. But the two bars reward different behavior. Many tiny errors look bad to PAC with small yet cost little regret. A few huge exploration losses look fine to PAC yet hurt regret. Keep them apart. If you want the regret-flavored view of dithering versus bonuses, the exploration vs exploitation page centers it. If you want the model-free counterpart that later earned its own PAC result through delayed updates, read Q-learning.
Code
The snippet recomputes the threshold and the optimistic pick. It is deliberately small so you can rerun it.
import math
def known_threshold(num_pairs: int, alpha: float, delta: float) -> int: per_pair: float = delta / num_pairs return math.ceil(math.log(2.0 / per_pair) / (2.0 * alpha * alpha))
def optimistic_value(r_max: float, gamma: float) -> float: return r_max / (1.0 - gamma)
m = known_threshold(40, 0.1, 0.05)v_max = optimistic_value(1.0, 0.9)q_known = 7.2choice = "unknown" if v_max > q_known else "known"print(f"m = {m}")print(f"Vmax = {v_max:.1f}")print(f"Q_known = {q_known:.1f} -> pick {choice}")assert m == 369assert math.isclose(v_max, 10.0)print("checks passed")# -> expected output:m = 369Vmax = 10.0Q_known = 7.2 -> pick unknownchecks passedWatch Out For
PAC does not mean zero mistakes
Newcomers ship an optimistic learner and file a bug when early returns dip. That dip is the mechanism working. PAC allows a polynomial batch of -bad steps while the model fills in. In the toy above, up to 14,760 visits can hit unknowns before the partition closes, and those steps may look bad one by one.
The fix: test the right thing. Count -bad steps over long runs instead of demanding a clean first episode. If the count keeps growing past your budget as you scale or shrink , your or your planner is wrong, not the definition.
Delta is confidence, not accuracy
Readers see and hear within five percent of optimal. No. Epsilon is accuracy, how close the values must be. Delta is confidence over random runs, how often the bound holds. They move differently too. Halving in the Hoeffding slice roughly quadruples because sits in the denominator, while shrinking only grows logarithmically through .
The fix: recompute when the setting changes. The 369 above belongs to , , , . New sizes, new accuracy, or a transition-aware analysis all need their own arithmetic. Never paste 369 as a universal constant.
The Quick Version
- PAC-MDP counts steps where the agent trails the optimum by more than epsilon, and calls learning efficient when that count stays polynomial in states, actions, accuracy, confidence, and horizon.
- RMAX marks a state-action pair known after m visits, fits an empirical model there, and assigns maximum value to everything still unknown.
- Unknown values of Vmax pull the planner toward novelty, so each plan either exploits an accurate known region or visits an unknown and shrinks that region.
- Regret totals lost value across steps while PAC-MDP counts far-from-optimal steps, so one view prices exploration and the other rations it.
- The toy threshold m equals 369 visits for 10 states, 4 actions, accuracy 0.1, and confidence 0.05, with Vmax 10 beating a known 7.2 to force one useful visit.