When Dynamics Shift, Robust Task Inference Wins: Offline Imitation Learning with Behavior Foundation Models Revisited

Rishabh Agrawal, Rahul Jain, Ashutosh Nayyar

TL;DR

Behavior Foundation Models (BFMs) excel at rapidly adapting to new tasks, but they easily break when real-world deployment dynamics differ from their training environment. This paper introduces Robust Behavior Foundation Models (RBFM), a framework that achieves robustness to environmental shifts (like changes in mass, friction, or gravity) entirely during the task-inference stage. By formulating task inference as a robust minimax optimization problem, RBFM delivers highly resilient policies in minutes using offline data from only a single training environment.

What Problem Does This Paper Address?

Imitation Learning (IL) allows autonomous agents to learn complex behaviors directly from expert demonstrations. To make IL scalable, researchers recently developed Behavior Foundation Models (BFMs). BFMs use large, task-agnostic offline datasets to learn general environment representations. At deployment time, they can adapt to a new task in minutes simply by finding a low-dimensional task embedding ($z$) that matches the expert's demonstrations.

However, standard BFMs suffer from a major Achilles' heel: they assume that the environment's physics (dynamics) during pretraining match the deployment environment exactly. In the real world, this assumption fails due to mechanical wear, sensor noise, or sim-to-real discrepancies. When the dynamics shift, standard BFMs fail to adapt. Prior attempts to fix this required collecting pretraining data across a massive variety of physical environments, which is incredibly expensive and often impossible. This paper asks: Can we make BFMs robust to dynamics shifts using offline data from only a single, nominal environment?

Methods

The authors answer affirmatively by redesigning the task-inference stage as a adversarial minimax game. Instead of just finding a task embedding $z$ that matches the expert data, the learner minimizes an imitation loss against an imaginary adversary that perturbs the environment dynamics within a defined uncertainty set. Crucially, this happens without modifying the pretrained BFM.

The paper proposes two algorithmic variants to balance computational efficiency and robustness:

  1. RBFM-Light: This variant relaxes the problem by looking at uncertainty directly within the state-occupancy space rather than modeling complex transition physics. It bounds the deviation from the training environment using a Total Variation (TV) distance ball. This simplifies the objective into a tractable dual optimization problem with minimal computational overhead.
  2. RBFM-Heavy: While RBFM-Light is fast, its occupancy-space relaxation can include physically impossible transitions, leading to overly conservative policies. RBFM-Heavy solves this by enforcing structural constraints via Bellman flow conservation. This ensures that the optimization only considers valid, physically realizable occupancy measures. It uses a dual formulation that trains a lightweight, internal Q-network to evaluate worst-case transitions.
Figure 1: Overview of the proposed RBFM framework. FB-IL, RBFM-Light, and RBFM-Heavy share an identical pretraining procedure; robustness is introduced only at the task inference stage. RBFM variants produce policies significantly more robust to dynamic perturbations than FB-IL.

Datasets

The authors evaluated their approach using the ExORL benchmark, which is built on the DeepMind Control Suite.

  • Pretraining Data: 1 million task-agnostic transitions collected via unsupervised exploration algorithms: Random Network Distillation (RND), Active Pretraining with Successor Features (APS), and Prototypical Representations (PROTO).
  • Evaluation Domains & Tasks:
  • Walker (Stand, Walk, Run, Flip)
  • Quadruped (Stand, Walk, Run, Jump)
  • Cheetah (Walk, Run, Walk_Backward, Run_Backward)
  • Dynamics Perturbations: Introduced at evaluation time only, including changes to gravity, body mass, joint friction, actuator strength, and range of motion.

Key Insights and Ideas

  • Robustness at Inference Time: The most significant takeaway is that you don't need a "robust pretraining" phase to get a robust policy. If your foundation model learns a sufficiently rich, task-agnostic representation, hedging against worst-case dynamics can happen entirely when inferring the task embedding.
  • Bypassing Explicit Dynamics Modeling: By framing the adversary's perturbations in terms of occupancy measures and utilizing dual reformulations, the algorithms optimize for robustness purely from offline data without ever needing to explicitly model or interact with the altered physics.
  • The Realizability Advantage: RBFM-Heavy consistently outperforms RBFM-Light. Forcing the optimization to respect Bellman flow conservation prevents the agent from worrying about physically impossible scenarios, yielding a much more effective and less timid policy.

Key Results

  • Superior Robustness: Across Walker, Quadruped, and Cheetah domains, both RBFM variants significantly outperformed standard BFM (FB-IL) as the severity of physical perturbations increased. RBFM-Heavy consistently achieved the highest returns.
Figure 2: Quadruped performance under dynamics perturbations (95% Confidence Interval), pre- trained on Quadruped RND dataset. Rows: tasks; columns: perturbation types with absolute values of the perturbed parameter. Nominal conditions correspond to the leftmost point for the first two perturbations and the rightmost for actuator control range. Average return on y-axis.
  • Outperforming Single-Task Baselines: RBFM variants beat specialized single-task robust offline IL baselines (like DRBC and BE-DROIL) under moderate perturbations, proving the value of multi-task foundation model representations.
  • Massive Speedups: While single-task robust baselines take 5 to 6 hours to compute a policy for a single task, RBFM-Light takes ~5 minutes and RBFM-Heavy takes ~10 minutes. This preserves the fast-adaptation spirit of foundation models.

Limitations and Future Work

The primary limitation of RBFM is its strict dependency on the quality and quantity of the pretraining data. The authors noted that if the foundation model is pretrained on too little data (e.g., 100k transitions instead of 500k+), the learned representations aren't expressive enough, causing the robust task inference to become highly unpredictable.

Future work could explore extending this framework to handle visual observations (pixels instead of states) and evaluating performance on real-world robotic hardware where sim-to-real dynamics shifts are notoriously difficult to model.

Summary updated

BibTeX
@inproceedings{agrawal2026when,
  author = {Rishabh Agrawal and Rahul Jain and Ashutosh Nayyar},
  title = {{When Dynamics Shift, Robust Task Inference Wins: Offline Imitation Learning with Behavior Foundation Models Revisited}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=vFC88YZZSH},
}
Figure