NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning When to Stop: Selective Imitation Learning Under Arbitrary Dynamics Shift

Surbhi Goel, Jonathan Pei, James WangNeurIPS 2026

TL;DR

When an AI agent trained by watching an expert encounters a change in physics or environment dynamics at deployment, blindly guessing its next move can be catastrophic. This paper introduces selective imitation learning, giving agents a mathematically grounded "fail-safe" to stop or hand control back to a human the exact moment their training data no longer justifies their actions. Using only labeled training demonstrations and cheap, action-free observations from the new environment, their algorithm learns when to quit—without needing massive amounts of data for long-horizon tasks.

What Problem Does This Paper Address?

Imagine training an autonomous car by imitating expert drivers on dry, sunny roads (behavior cloning). Suddenly, it’s deployed in a blizzard. The physics of tire traction have shifted. Classical offline imitation learning forces the policy to commit to an action at every single step, even on icy states completely absent from its training support, leading to compounding errors and crashes.

How do we teach a policy to recognize its own ignorance under arbitrary dynamics shifts? The authors tackle a realistic, asymmetric data setup: you have full (state, action) expert demonstrations from a training environment, plus unlabeled (state-only) expert trajectories from the test environment (think massive datasets of public dashcam footage without steering telemetry, or public stock tickers without proprietary trade logs). The goal is to output a selective policy balancing two competing desires:

  • Completeness: It rarely stops in the familiar training environment (otherwise, a policy that always stops is trivially safe, yet useless).
  • Soundness: In the shifted test environment, it incurs very low regret compared to the expert right up until the moment it decides to stop (or hand off control).

Methods

Standard selective classification (like the PQ-learning / Rejectron framework) makes one-off abstain decisions. Applying that naively to sequential decision-making step-by-step requires union-bounding over the episode horizon $H$, introducing a painful $H^2$ sample-complexity penalty.

Instead, the authors introduce SeqRejectron, which certifies entire trajectory prefixes at once:

  1. Base Policy & Version Space: Train a base policy $\pi_0$ on the labeled source data, and consider the "version space"—all other candidate policies in your class that also explain the training data.
  2. Validator Committee: Use a minimax game over the unlabeled test trajectories to select a small, sparse set of competing policies ("validators"). These validators agree with $\pi_0$ on training data, but are specifically chosen to catch test states where $\pi_0$ might diverge from plausible expert behavior.
  3. Stopping Rules:
    • Deterministic policies: Execute $\pi_0$ as long as every validator agrees with its chosen action; stop at the very first disagreement.
  4. Stochastic policies: Because probability distributions can differ softly at every step without a single alarming disagreement, SeqRejectron tracks a cumulative squared Hellinger distance—a divergence budget across steps—stopping once accumulated drift crosses a threshold $\theta$.
  5. Misspecified experts: If the true expert isn't in the learner's policy class, exact training consistency breaks. The authors relax the version space into a regularized game that trades off small training disagreements against late-stopping risks at test time.

Datasets

Rather than static datasets, the authors evaluate SeqRejectron across five simulated control and gaming environments from Gymnasium and the Arcade Learning Environment (Atari), modified to induce dynamics shifts between source ($M$) and target ($N$):

  • Pendulum: Pendulum mass increased by 40% in $N$.
  • BipedalWalker: Motor torque reduced to 40% of its original strength in $N$ (with ablations on 60% torque, wind, and initial shoves).
  • Atari (Crazy Climber, Freeway, Space Invaders): Source $M$ uses the default game mode; target $N$ switches to harder game modes/difficulties.

Key Insights and Ideas

  • Tiny committees suffice: By Lemma 1, the size of the validator set needed to guarantee safe stopping depends only on your target error tolerance—completely independent of the state space, action space, policy class size, and episode horizon $H$.
  • Horizon-free sample complexity: Because certifying prefixes avoids step-by-step union bounds, sample complexity scales with total trajectory cost rather than $H$, avoiding compounding-error penalties when costs are sparse.
  • Simple bootstrap ensembles aren't enough: In experiments, standard bootstrap clones of $\pi_0$ often fail to abstain because they agree with $\pi_0$ even on unfamiliar test states. Validators must be actively encouraged to disagree on unlabeled test states to detect trouble.
  • Soft divergence beats argmax for stochastic policies: Counting disagreements only on the most likely action fails for stochastic policies. Tracking cumulative distribution drift (Hellinger distance) is critical.

Key Results

  • Theory: For deterministic classes, SeqRejectron achieves tight, horizon-free $\tilde{O}(\log|\Pi|/\epsilon^2)$ sample complexity. For stochastic classes, they prove an $\Omega(1/\epsilon^3)$ labeled-sample lower bound for proper learners, matching the cost-driven term in their upper bound when analyzing expert handoffs ("switched regret").
  • Experiments: Evaluated via an expert handoff setup (learner acts until stopping, then the expert takes over) using only $m = 30$ labeled source demonstrations and tuning the stopping budget to $\le 5\%$ source handoffs:
  • Recovered 99.8% of the performance gap ("room for improvement") between naive behavior cloning and the expert in Pendulum (stopping in just 2.4% of source episodes).
  • Recovered 98% in Crazy Climber (6.2% source stops), 89% in Freeway (2.4%), 61% in Space Invaders (3.5%), and 51% in BipedalWalker (1.6%).
  • In Space Invaders, using the Hellinger stopping rule recovered 68% of the gap at a 5% budget, whereas counting argmax action disagreements recovered just 4%.

Limitations and Future Work

  • Data & Handoff Assumptions: The framework requires unlabeled expert state trajectories from the test environment prior to deployment, which aren't always available. Furthermore, the "switched policy" handoff view assumes an expert can seamlessly take control mid-trajectory at zero cost, and fail to help if dynamics shifts push the agent into unrecoverable states before looking unfamiliar.
  • No Test-Time Stopping Guarantees: Completeness ensures the agent rarely stops in training, but under severe test shifts, it may legitimately stop on nearly every episode. Incorporating partial knowledge of test dynamics could tighten test-side stopping bounds.
  • Theory-to-Practice Gap: While deterministic SeqRejectron admits an oracle-efficient reduction, cumulative Hellinger thresholding for stochastic policies lacks a known efficient reduction to standard empirical risk minimization (experiments relied on practical approximations of the version space and validator game). Closing the gap between the $\tilde{O}(\epsilon^{-4})$ variance-driven rate and the $\Omega(1/\epsilon^3)$ lower bound also remains open.

Summary updated

BibTeX
@inproceedings{goel2026learning,
  author = {Surbhi Goel and Jonathan Pei and James Wang},
  title = {{Learning When to Stop: Selective Imitation Learning Under Arbitrary Dynamics Shift}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=8YxGIUwNHt},
}
Figure