Compounding Errors & Interactive Imitation
Why cloning errors can grow quadratically with the horizon, and how DAgger makes them linear.
How can a policy that is right 99.9% of the time on the expert's data still fail, and how much can asking the expert help? This lesson proves behavior cloning's quadratic bound by coupling the learner with the expert and shows that it is tight, defines recoverability through the expert's cost-to-go, analyzes DAgger as a reduction to no-regret online learning (mixing terms included), and ends with the lower bounds that say when no amount of interaction can help.
What you’ll learn
- Prove by coupling the learner with the expert, and construct a task that attains it.
- Define the recoverability constant through the expert's cost-to-go, and derive in terms of the learner's error on its own distribution.
- Analyze DAgger with expert mixing as a reduction to no-regret online learning, and state the guarantees of forward training and SMILe.
- Summarize the lower bounds and taxonomies of Rajaraman et al. (2020), Swamy et al. (2021) and Foster, Block & Misra (2024), and what they imply about when interaction helps.
The quadratic bound, by coupling
Write the dynamics as with independent noise (every transition kernel can be written so), and the learner's choice as with independent uniform . Run the learner and the expert from the same with the same . Let be the event that the learner's actions agreed with the expert's at steps . On both trajectories coincide up to .
On the pairs coincide, so the two step- costs are equal; otherwise they differ by at most 1:
Split by the first disagreement. Given the past, the learner disagrees at step with probability , and on its state is the expert's , whose law is :
Sum over . Each is counted once for every step from to :
Spread the error evenly instead: the learner errs with probability at every step while it still follows the expert, the first error traps it with cost 1 per step (that step included), and the expert's cost is 0. For , what is the learner's expected extra cost? (The bound gives .)
Show the answer
4.2
The learner is trapped at step with probability , so the extra cost is . That is close to , about half the worst case: uniform errors give the same quadratic order with constant , while front-loaded errors attain the bound.
Recoverability: errors on the learner’s own states
The quadratic bound charges every disagreement with the whole rest of the episode. A sharper accounting asks what one wrong action really costs if the expert takes over afterwards. Let be the expected cost of taking in and then following for the remaining steps, , and .
Let follow for the first steps and afterwards, so and , and telescope:
The two hybrid policies coincide for the first steps, so under both; they differ only in the action at step , after which the expert has steps to go:
The bracket vanishes where picks the expert's action and is at most where it does not, so it is at most . Summing over turns into :
The theorem trades the expert's distribution for the learner's own, which is the distribution that matters, at the price of the constant . Three regimes:
- The cost is the imitation loss, . The expert's cost-to-go is 0 from every state, so .
- The expert recovers quickly. If one wrong action raises the expert's cost-to-go by at most (a car that swerves is back in its lane within a few steps), then and the bound is linear in . Ross, Gordon and Bagnell note that if the Markov chain of the expert's behavior mixes at an exponential rate , then .
- One mistake is fatal. If a wrong action leads to a trap, can be as large as , so and the bound is quadratic again.
DAgger as a reduction to no-regret learning
DAgger turns the chicken-and-egg problem into online learning. Round collects data with , which follows the expert with probability at each step, and charges the online learner the loss , where is a surrogate that upper-bounds the 0–1 error . A sequence has average regret if
Training on the aggregate of all rounds is follow-the-leader, which achieves for strongly convex losses; any other no-regret algorithm would do. One wrinkle remains: is measured on the states of the mixture , while the performance-difference bound needs the error of on its own states.
With probability the mixture uses at all steps, and given that event its trajectories are distributed exactly as those of , because the coin flips are independent of everything else. So for some distribution ,
Subtract , use , and Bernoulli's inequality :
The lemma moves each round's loss from the mixture's states to the learner's own, at a cost of at most :
The best iterate is no worse than the average, and the average of is within of the best fixed policy in hindsight:
Finally, the first terms of the last sum are at most 1 each, and the rest are . Feeding the result into gives the bound on .
Two assumptions hide in this result. First, is a best-in-class error on distributions the learner itself generates. If no policy in imitates the expert well on those states, for example because the learner's observations miss something the expert sees, DAgger converges to a poor policy and the bound is honest about it. Second, the reduction needs no regret against the sequence of losses. Follow-the-leader on a strongly convex loss provides it; a learner that refits only to the newest round does not.
What does DAgger's analysis require of the supervised learner that behavior cloning's analysis does not?
- That the expert's policy belongs to the policy class
- A no-regret guarantee against the sequence of per-round losses, such as follow-the-leader on a strongly convex loss
- Access to the task's cost function
- A model of the environment's dynamics
Show the answer
B. A no-regret guarantee against the sequence of per-round losses, such as follow-the-leader on a strongly convex loss
The whole argument passes through the regret bound: the iterates' average loss on their own data is within of the best fixed policy on all rounds. Cloning's analysis needs only a small error on one fixed distribution.
Lower bounds and a taxonomy
Rajaraman, Yang, Jiao and Ramchandran (2020) asked for minimax rates in tabular episodic MDPs with expert trajectories and per-step rewards in . The policy that mimics the expert wherever the expert was observed is suboptimal by in expectation, even for a stochastic expert. Conversely, every algorithm is suboptimal on some instance, even with a deterministic expert and even if it may query the expert at the states it visits. With the transition model known and a deterministic expert, a different algorithm reaches , below the barrier. So in the worst case over tabular MDPs interaction cannot improve the horizon dependence, and the guarantees of DAgger-style methods must come from assumptions such as recoverability.
| What is matched | Data needed | Examples | Upper bound | Lower bound |
|---|---|---|---|---|
| Reward moments, on-policy | Environment interaction | GAIL, SQIL | ||
| Q-value moments, off-policy | Demonstrations only | Behavior cloning, ValueDICE | ||
| Q-value moments, on-policy | Interaction and a queryable expert | DAgger, AggreVaTe |
Swamy et al. also show (their Lemma 7) that in a problem whose recoverability constant is of order , a classification error in a single state can cost even with an interactive expert (for , since no loss can exceed ): neither family escapes compounding there.
Foster, Block and Misra (2024) revisit cloning itself. With the logarithmic loss and a policy class of controlled complexity that contains the expert's policy, the horizon dependence can be far milder than the classical analysis suggests: horizon-independent when the range of the total return is controlled, and linear in the horizon for deterministic stationary policies under dense per-step rewards. They also show that, without further assumptions on the policy class, online interaction cannot improve on offline log-loss cloning in the worst case. Part of the classical thus reflects how the learner's error is measured (a 0–1 error per state, rather than the log loss of whole trajectories), while the lower bounds above say what no method can avoid.
Key takeaways
- Coupling the learner with the expert proves ; an error concentrated at the first step, followed by a trap, attains it exactly when the expert's own cost is 0.
- Telescoping hybrid policies gives : the learner's error on its own distribution, weighted by the recoverability constant .
- Forward training, SMILe and DAgger all train on the states the current policy reaches. DAgger does it as no-regret online learning, with mixing handled by , and achieves after rounds.
- Without structure, interaction cannot beat order (Rajaraman et al., 2020). Swamy et al. (2021) separate reward matching (), off-policy Q-matching () and on-policy Q-matching (), and log-loss cloning can be much less horizon-sensitive than the 0–1 analysis suggests (Foster, Block & Misra, 2024).
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
The coupling proof gives . With the average held fixed, which error profile can make the extra cost as large as ?
- The same error at every step
- All of the error at the last step,
- All of the error at the first step, , with a first mistake that leads to a trap
- Errors at random steps, independent of the state
Show the answer
C. All of the error at the first step, , with a first mistake that leads to a trap
The weight is largest at , so front-loaded errors maximize the sum, and a trap after the first mistake gives : exactly more than the expert when the expert's own cost is 0.
Suppose the task's cost is the imitation loss itself, . What is the recoverability constant , and what does the performance-difference bound give?
- , so
- , so
- , so every policy is as good as the expert
- is undefined, because the expert's cost-to-go depends on the learner
Show the answer
B. , so
Under the imitation loss the expert's cost-to-go is 0 from every state, so a wrong action costs exactly 1 and the expert pays nothing afterwards: . The bound becomes , the number of mistakes the learner makes on its own trajectories.
Why does the term appear in DAgger's guarantee?
- It is the regret of follow-the-leader in round
- It accounts for estimating the loss from finitely many trajectories
- It is the recoverability constant of the expert
- Round 's data come from the mixture , whose state distribution differs from that of by at most in , since the mixture follows at all steps with probability
Show the answer
D. Round 's data come from the mixture , whose state distribution differs from that of by at most in , since the mixture follows at all steps with probability
The online learner is charged on the mixture's states, but the performance bound needs the learner's error on its own states. The lemma converts one into the other, which is why the expert's share must decay: eventually, or a geometric schedule.
Rajaraman et al. (2020) prove an lower bound that holds even for learners who can query the expert at the states they visit. What does it imply?
- DAgger's theorem must be wrong
- Behavior cloning is always the best method in practice
- Over all tabular MDPs, interaction cannot improve the worst-case horizon dependence; DAgger's linear bound relies on extra structure such as recoverability
- Knowing the transition model cannot help either
Show the answer
C. Over all tabular MDPs, interaction cannot improve the worst-case horizon dependence; DAgger's linear bound relies on extra structure such as recoverability
DAgger's guarantee is linear only when is small, and the hard instances behind the lower bound are not of that kind. The two results are consistent: one is a worst case over all MDPs, the other a guarantee under an assumption.
Further reading
- S. Ross & J. A. Bagnell, "Efficient reductions for imitation learning," AISTATS (2010).
- S. Ross, G. J. Gordon & J. A. Bagnell, "A reduction of imitation learning and structured prediction to no-regret online learning," AISTATS (2011).
- N. Rajaraman, L. F. Yang, J. Jiao & K. Ramchandran, "Toward the fundamental limits of imitation learning," NeurIPS (2020).
- G. Swamy, S. Choudhury, J. A. Bagnell & Z. S. Wu, "Of moments and matching: A game-theoretic framework for closing the imitation gap," ICML (2021).
- D. J. Foster, A. Block & D. Misra, "Is behavior cloning all you need? Understanding horizon in imitation learning," NeurIPS (2024).