Latent Policy Barrier: Learning Robust Visuomotor Policies by Staying In-Distribution
Latent Policy Barrier: Learning Robust Visuomotor Policies by Staying In-Distribution
Abstract
Visuomotor policies trained via behavior cloning are vulnerable to covariate shift,
where small deviations from expert trajectories can compound into failure. Com-
mon strategies to mitigate this issue involve expanding the training distribution
through human-in-the-loop corrections or synthetic data augmentation. However,
these approaches are often labor-intensive, rely on strong task assumptions, or
compromise the quality of imitation. We introduce Latent Policy Barrier, a frame-
work for robust visuomotor policy learning. Inspired by Control Barrier Functions,
LPB treats the latent embeddings of expert demonstrations as an implicit barrier
separating safe, in-distribution states from unsafe, out-of-distribution (OOD) ones. Exp
Our approach decouples the role of precise expert imitation and OOD recovery into Exp
dis
two separate modules: a base diffusion policy solely on expert data, and a dynamics
model trained on both expert and suboptimal policy rollout data. At inference time,
the dynamics model predicts future latent states and optimizes them to stay within
the expert distribution. Both simulated and real-world experiments show that LPB
improves both policy robustness and data efficiency, enabling reliable manipulation
from limited expert data and without additional human correction or annotation.
analytical definitions of safety constraints and Expended expert distribution (w. correction demos) Rollout distribution
system dynamics are typically unavailable. In Figure 1: To mitigate covariate shift, prior DAgger-
learning-based visuomotor control, the analo- like methods (Left) expand the training distribution via
gous challenge arises from covariate shift [55]: human-in-the-loop corrections ( ), often introducing
minor deviations from demonstrated expert be- suboptimal trajectories. In contrast, our Latent Policy
Barrier treats the expert distribution ( ) as an implicit
haviors can quickly compound, pushing agents
barrier, using a learned dynamics model to detect de-
into out-of-distribution (OOD) states and caus- viations ( ) and steer the policy back toward expert
ing task failures. Traditional behavior cloning behavior ( ). The dynamics model is trained on both
(BC) methods are particularly vulnerable to co- expert demos ( ) and policy rollouts ( ), requiring no
variate shift, severely limiting their effectiveness additional human input.
and reliability in real-world applications.
Current approaches to address covariate shift primarily involve expanding the training distribution.
One common approach is human-in-the-loop interventions, such as DAgger [11, 55, 36, 29, 40, 39],
which repeatedly collect corrective demonstrations whenever agents deviate from expert behaviors
Preprint. Under review.
Caption: similar size to the legend
(Left) Prior methods using interactive expert corrections (e.g., DAgger). The expert d
shaded region) is expanded through iterative human-in-the-loop corrections (pink traj
trained on this expanded distribution (pink region) may lead to suboptimal trajectories
covariate shift (gray trajectories). (Right) Our approach, Latent Policy Barrier, decoup
(Figure 1 left). Another strategy involves synthetic data augmentation methods that leverage task-
specific invariances [17, 42]. However, these approaches are either labor-intensive or rely heavily
on strong prior assumptions about the environment. Moreover, both approaches risk introducing
inconsistent or suboptimal demonstrations into the training dataset, potentially degrading overall
policy performance [41]. This limitation exposes a fundamental trade-off in robust visuomotor policy
learning: precise imitation benefits from consistent, high-quality expert datasets, whereas robustness
inherently demands exposure to diverse and often suboptimal data. Constructing a single dataset that
balances these competing needs is inherently challenging.
To resolve this tension, our key insight is to explicitly decouple these conflicting objectives (Figure
1 right). Inspired by CBFs, we propose Latent Policy Barrier (LPB), which implicitly treats the
latent expert demonstration distribution itself as a barrier that separates safe, in-distribution states
from unsafe, out-of-distribution regions [7]. Unlike analytically defined CBFs, LPB does not require
explicit safety sets or system dynamics. Instead, it maps high-dimensional expert states into a learned
latent space and uses their embeddings to define a barrier for detecting and correcting deviations.
To decouple precise expert imitation and OOD recovery, LPB leverages two complementary compo-
nents: (a) a base diffusion policy trained exclusively on consistent, high-quality expert demonstrations,
ensuring precise imitation; and (b) an action-conditioned visual latent dynamics model trained on a
broader, mixed-quality dataset combining expert demonstrations and automatically generated rollout
data [4, 45, 9, 62]. We collect the rollout data by executing intermediate checkpoints saved during
base policy training. Importantly, the rollout data naturally covers diverse deviations around the
policy’s own distribution without requiring explicit success labels, task rewards, or additional human
teleoperation. At inference time, LPB ensures that the agent stays within the expert distribution by
performing policy steering in the latent space. LPB uses the dynamics model to predict future latent
states conditioned on candidate actions output from the base policy. Then LPB minimizes the distance
between the predicted future latent states and their nearest neighbors from the expert demonstrations
in the same latent space. This latent-space steering approach simultaneously achieves high task
performance and robustness, resolving deviations without compromising imitation precision.
In summary, we introduce Latent Policy Barrier in the context of behavior cloning. LPB offers the
following advantages: 1) mproves sample efficiency by decoupling expert imitation from out-of-
distribution correction - enabling the policy to focus on learning from a small amount of high-quality
human demonstrations; 2) enhances robustness through the use of a dynamics model trained on
inexpensive, lower-quality policy rollout data; and 3) plug-and-play compatibility with off-the-shelf
pre-trained policies, improving their robustness without requiring policy retraining or fine-tuning.
Experimental results across simulated and real-world manipulation tasks demonstrate that LPB is
able to enhances both the robustness and sample efficiency of visuomotor policy learning. Code and
data for reproducing the result will be made publicly available.
2 Related Work
Mitigating Covariate Shift in Imitation Learning: Behavior Cloning (BC), despite its simplicity,
remains a strong baseline for working solely with expert demonstrations [51]. An extensive body of
works mitigates covariate shift of BC by expanding the expert distribution. Prior works use interactive
expert interventions [55, 36, 29, 40, 14, 39, 25] that are iteratively integrated into the policy learning
loop to improve performance. Alternative ways to expand the training distribution include synthetic
data generation with task invariances [17, 42, 65], noise injection [36, 27], or dynamics model-guided
state-action pair generation [49, 28]. Instead of focusing on the data, Inverse Reinforcement Learning
combats covariate shift by alternately collecting on-policy rollouts and updating reward function
that penalizes deviations from expert trajectories, pulling the learner’s state distribution toward the
expert’s [68, 24, 18]. Other lines of work include training a recovery policy that automatically pushes
the agent back to the in-distribution region [53] and incorporating training objectives that penalize
distribution divergence [43]. Our method differs from these strategies by performing inference-time
steering in latent space, bypassing the need for additional expert queries or heavy data augmentation.
Policy Learning from Suboptimal Data: Offline RL algorithms prevents the learned policy from
drifting into OOD states by imposing an explicit regularization. This can take the form of policy
regularization that uses a penalty to keep the learned policy close to the behavior policy or a BC
prior [60, 34, 20, 19, 50], conservative value estimation that pessimistically down-weights out-
of-distribution actions [35, 33], or model-based uncertainty quantification that learns a dynamics
2
Base Policy Training (on expert data) End of
training Base
Expert
Data Policy
ckpt t0 ckptt +Δt …… ckpt t
0 final
Base
Policy
Rollot Rollot …… Rollot
Data Data Data Repeat Back to In-Distribution Base policy denoising
K times Steering
Latent Space
Minimize
Gradient distance Expert
Data
Dynamics Dynamics
Dynamics Model Training if
Model Model
(on both expert and rollout data)
future latent state Nearest
Training Phase Inference Phase neighbor
Figure 2: Latent Policy Barrier: 1) During training, we train a base diffusion policy on expert
demonstration data and a visual latent dynamics model on both the expert and rollout data. 2) During
inference, LPB keeps the agent within expert states by steering the base policy in the latent space.
We define the ℓ2 distance of a latent state to its nearest expert latent state as the latent OOD score δ.
If δ(zt ) exceeds a predefined threshold, back to in-distribution steering is invoked. Details on the
inference-time steering process can be found in Algorithm 1.
model and uses an uncertainty penalty to discourage trajectories from unfamiliar regions [64, 30, 8].
These strategies can exploit large, mixed-quality datasets, but they assume an external reward.
Methods that learn from suboptimal demonstrations fit a reward function via enforcing trajectory
rankings or regressing returns against noise-perturbed rollouts [5, 10]. Recent work shows that an
agent can exploit its own rollouts - using them to forecast and refine future latent trajectories [62], to
autonomously accumulate new task executions [4], or to label and filter heterogeneous demonstrations
[9] - to supplement the limited expert data. In contrast, we repurpose policy rollout data to learn a
dynamics model that, at inference time, nudges the agent back toward the expert distribution.
Inference-Time Policy Steering: A growing line of work improves a pre-trained policy at inference
time by steering, without requiring additional data or fine-tuning. Guided denoising biases diffusion-
based policies toward specified goals or reward signals by injecting gradient guidance into the
denoising process [26, 1, 54, 46]. Value-based filtering samples actions from a generalist policy
and executes the one ranked highest by a value function [47]. Human-in-the-loop steering treats
user provided sub-goals, corrections, or preferences as constraints injected into the policy’s sampler
[58, 61]. Model-predictive refinement combines a base policy with a dynamics model to improve task
performance or respect safety constraints [67, 56, 52, 48]. Similarly, LPB also uses a latent visual
dynamics model [22, 21, 23, 59, 66] to steer the policy. Unlike prior works, LPB performs gradient-
based action corrections using gradients from the latent dynamics model. The corrections pull
predicted future states toward the expert manifold, unifying classifier guidance with model-predictive
foresight while needing no explicit goals, rewards, or human input.
3
hθ (Ot ) that maps raw image observations into latent representations. The visual encoder and the
noise-prediction network are trained end-to-end with behavior cloning loss.
To enhance dynamics model’s generalization beyond the distribution of expert demonstrations, we
collect an additional dataset of exploratory rollouts. These trajectories are automatically generated
by rolling out intermediate checkpoints of the diffusion policy saved during training. Concretely,
after an initial warm-up phase of t0 training epochs, during which the base policy is still highly
random, we save policy checkpoints at fixed intervals. Every ∆t epochs we save a checkpoint
ckptt0 +n∆t and roll it out for N full episodes in the evaluation environment, recording all transitions
regardless of task success or failure. This schedule continues until the final training epoch tfinal . The
resulting rollout dataset covers both early exploratory and near-convereged behavior, yielding a much
wider state–action distribution than the original expert demonstrations. The diverse transitions in
the rollout dataset enables the dynamics model to generalize more effectively, especially to novel
states encountered at test time. Importantly, the rollout data is collected without human correction or
reward annotations. Since it is generated as a natural byproduct of base policy training, no additional
teleoperation or manual labeling is required. This makes it a inexpensive source of training data for
learning a generalizable dynamics model that can steer the policy back toward expert-demonstrated
states. We ablation the choice of data source for dynamics model training in Appendix A.
The visual latent dynamics model, denoted as dϕ , is trained to predict future latent observations given
current observations Ot and a sequence of future candidate actions At . It consists of two components:
a frozen visual encoder hθ , shared with the base policy, and a learnable dynamics predictor fϕ . The
full model is thus written as:
dϕ (Ot , At ) = fϕ (hθ (Ot ), At ) (1)
We reuse the visual encoder hθ from the behavior cloning policy, which is trained end-to-end
to optimize for task execution. This design choice is motivated by the following consideration:
during test-time optimization, the dynamics model is used to predict future latent states in the same
embedding space that the policy relies on to make action decisions. Freezing the encoder ensures
consistency between the latent representations used by the policy and those optimized through the
dynamics model (3.2). It also stabilizes training by preventing collapse of the representation space.
The dynamics predictor fϕ is implemented as a decoder-only transformer ([57, 44, 6, 66]. Given
encoded latent representations of current observations and a future action sequence, the dynamics
model predicts the encoded future latent observation at a specified prediction horizon.
The model is trained using a latent-space mean squared error (MSE) loss between the predicted future
latent and the ground-truth latent of the future observation:
Ldynamics (Ot , At , ot+Tp ) = ∥hθ (ot+Tp ) − fϕ (hθ (Ot ), At )∥22 (2)
4
Akt by minimizing the latent OOD score of predicted future state zt+h = dϕ hθ (Ot ), Akt . We
define the modified noise prediction as
√
ϵ̂ Akt = ϵθ Akt − η 1 − α¯k ∇ Akt δ dϕ zt , Akt
(4)
where η is the guidance scale. The classic classifier guidance approach requires training a classifier on
noisy data samples, which is less practical in robotics settings where executing random actions can be
unsafe or infeasible. Our rollout data offers a practical alternative: actions in policy rollouts naturally
exhibit greater variability than expert demonstrations. As a result, the dynamics model trained on this
data is well-equipped to predict the outcomes of noisy action samples. To avoid unreliable guidance
from highly stochastic early denoising steps - where actions diverge significantly from the expert
manifold - we restrict gradient-based guidance to only the final Kguide denoising steps, where samples
are more structured. For instance, Diffusion Policy often uses up to 100 denoising steps with DDPM,
we only choose to refine only a subset of the denoising steps, e.g., the last 10 steps. By reweighting
the action sampling distribution in favor of actions that lower the latent OOD score of predicted
future states, the gradient guidance effectively steers the agent toward expert-like states. To better
understand the effectiveness of the gradient guidance strategy, we also compare against alternative
optimization methods, including direct gradient descent on the action sequence and model predictive
control (MPC). Ablation results are provided in Appendix A.
Algorithm 1 Latent Policy Barrier (Inference time)
Require: Base policy πθ , dynamics model dϕ , visual encoder hθ , expert dataset Dexpert , latent OOD
score threshold τ
1: Preprocess: Encode all expert observations into latent states: Zexpert = {hθ (o) | o ∈ Dexpert }
2: for each timestep t do
3: Observe Ot = {ot−To +1 , . . . , ot }
4: Encode latent state zt = hθ (ot )
5: Compute latent OOD score δ(zt ) by performing nearest neighbor search in Zexpert (Eq. 3)
6: if δ(zt ) > τ then ▷ Out-of-distribution detected
7: for denoising step k = K, . . . , K − Kguide do
8: Sample noisy action Akt from πθ
9: Predict future latent state: ẑt+h = dϕ (zt , Akt )
10: Compute gradient: ∇Akt δ(ẑt+h )
11: Apply gradient guidance to get ϵ̂(Akt ) (Eq. 4)
12: end for
13: Output final action sample At after K denoising steps
14: else
15: Output At ∼ πθ (·|Ot )
16: end if
17: Execute first Ta steps of At
18: end for
4 Experiments
Our evaluation focuses on two questions: 1) Does LPB improve sample efficiency and robustness
of visuomotor policy learning compared to baseline methods? 2) When the agent drifts, can LPB
detect the deviation at the right moment and steer the agent back to expert-like states? We benchmark
across a suite of challenging robotic manipulation tasks in both simulated environments and on a real
robot (Figure 3). In simulation, we benchmark on three suites: Push-T [12, 16], Robomimic [41],
and the multi-task, language-conditioned Libero10 [38]. For Robomimic, we select its three most
challenging tasks, Square, Tool Hang, and Transport. For the real robot experiment, we test on
the Cup Arrangement task from [13] and the Belt Assembly task from the NIST board assembly
challenge [32].
4.1 Simulation Benchmarks
To evaluate the sample efficiency of our method, we focus on a limited demonstration regime, where
suboptimal rollout data can play a significant role in improving performance. For each Robomimic
task (Square, Tool-Hang, Transport) and for Push-T, we keep 20% of the original expert demonstra-
tions. For each task, a base diffusion policy is trained on these demonstrations. For Libero10, we use
5
Push-T Square Tool Hang Transport Libero-10 Cup Arrangement Belt Assembly
Figure 3: Benchmark Tasks. We evaluate our method on a diverse set of manipulation tasks in both
simulation and real-world.
all 50 provided demonstrations for each of the ten tasks to train a language-conditioned, multi-task
base diffusion policy. During policy training, we save intermediate checkpoints at fixed intervals and
use them to collect additional rollouts. See Appendix B for further implementation details.
We compare LPB against the following baselines:
• Expert BC [12]: Diffusion policy trained on only expert data.
• Mixed BC: Diffusion policy trained on both rollout data and expert data.
• Filtered BC [9, 45, 4]: We augment the expert data with successful rollout trajectories and
re-train the diffusion policy on the aggregated dataset. We use the success criteria defined by the
original benchmarks.
• CQL [35]: Conservative Q-Learning (CQL) is an offline RL algorithm that learns a value
function that explicitly penalizes overestimation of unseen actions. CQL requires task rewards.
For Push-T, we use the dense reward from [12]; for Robomimic and Libero10 tasks, we use the
sparse reward, which gives 1 on success and 0 otherwise.
• CCIL [28]: CCIL enhances the robustness of behavior cloning by generating corrective data to
augment the original expert data. Since the original method was proposed for tasks with low
dimensional state space, we adapt it to tasks with image observations by encoding images with
the frozen visual encoder in the base policy trained with behavior cloning loss.
As shown in Table 1, under the limited-demonstration setting, LPB matches or exceeds every baseline
on all simulated tasks, showing strong sample efficiency. The largest gains appear on the long-
horizon, precision-sensitive tasks, Tool-Hang and Transport, highlighting LPB’s ability to correct
minor action deviations that otherwise compound over time. On the most challenging Tool-Hang
task, Filtered BC offers only marginal improvement, indicating that even "successful" rollouts still
contain suboptimal or inconsistent actions that hurt BC. CQL obtains zero reward on Robomimic
and Libero10 tasks, possibly due to the absence of a dense reward function, consistent with results
reported in the Robomimic paper [41].
Inference-time Robustness. To investigate how well LPB mitigates covariate shift, we inject
noise perturbations to the output action at inference time. At every time step, with probability p ∈
{0.0, 0.1, 0.2, 0.3, 0.4}, a Gaussian noise is added to the output action. We evaluate LPB alongside
Filtered BC, Expert BC, and CCIL on the Transport task. Figure 4a shows that LPB maintains the
highest success rate across all noise levels. While the baselines exhibit worsening performance as p
increases, LPB degrades the least, indicating robustness to inference-time perturbations.
Sample Efficiency on Expert Demonstrations. We next vary the fraction of expert demonstrations
used to train the base policy on Tool-Hang, from 20% up to the full dataset, to see whether LPB
continues to add value as more expert data becomes available. Figure 4b shows that LPB’s advantage
is largest in the low-data regime (up to 60% demos), the margin narrows as the dataset approaches
100%, reflecting performance saturation.
6
1 5 '