Robot demonstration collection often produces imperfect or failed trajectories in addition to successful demonstrations. Existing methods typically exploit failed trajectories by identifying segments that still make progress toward task completion, but largely overlook failure-critical behaviors that directly lead to task failure. Here we argue that these two types of segments provide fundamentally asymmetric supervision: progressive segments should be imitated, whereas failure-critical segments should be explicitly avoided. Based on this observation, we propose CARF, a Contrastive Attraction-Repulsion of Failure-guided framework for learning from imperfect robot data. CARF introduces a progress-based importance scorer, trained solely on successful expert demonstrations and its perturbation results, to estimate step-wise contributions toward task completion and identify informative regions in failed trajectories. These scores guide a unified flow-matching objective that attracts the policy toward progressive behaviors and repels it from failure-critical ones, while excluding ambiguous segments. This enables more comprehensive utilization of imperfect data and avoids unreliable supervision from ambiguous failure segments. Extensive experiments in simulation and the real world demonstrate consistent improvements over competing baselines across diverse failure scenarios, with ablations further validating the effectiveness of the proposed scoring and attraction-repulsion mechanisms. Our website is https://zhao-sq.github.io/carf/#.
Figures & tables
Fig. 1: CARF leverages a crucial yet largely underexplored source of data: Failure-Critical Segments . It further formulates an attraction-repulsion flow-matching policy that pulls the policy toward the correct action distribution while pushing it away from failure distributions.
Fig. 2: Overview framework of CARF. After automatically labeling success dataset based on subtask segmentation, CARF trains a progress prediction scorer that provides importance score for observation-action chunking sequence, which is used for attraction-repulsion flow matching training.
Fig. 3: Environment visualization of tasks in simulation and real world.
Tasks
Basic Interaction
Visual Object Detection
Precise Manipulation
Long Horizon
pick and Lift
✓
✓
✗
✗
put groceries in cupboard
✓
✓
✓
✗
put item in drawer
✓
✗
✓
✓
mug hanging tree
✓
✗
✓
✗
cooking sequence
✓
✗
✗
✓
TABLE I: Capability requirements of designed robotics tasks.
Dataset & Methods
Simulation
Real World
pick and lift
put groceries in cupboard
put item in drawer
mug hanging tree
cooking sequence
Success data
200
200
200
100
50
Failure data
56
110
68
26
29
Success-only IL [ 25 ]
0.38
0.23
0.62
0.50
0.55
All-data IL [ 25 ]
0.32 (-15.8%)
0.20 (-13.0%)
0.53 (-14.5%)
0.35 (-30.0%)
0.45 (-18.2%)
CGFM [ 33 ]
0.24 (-36.8%)
0.14 (-39.1%)
0.47 (-24.2%)
0.45 (-10.0%)
0.40 (-27.3%)
TABLE II: Quantitative result comparison between CARF and other baselines.
Task
pick and lift
put grocery in cupboard
mug hanging tree
Success-only IL
0.38
0.23
0.50
IL w/ only positive terms
0.39
0.21
0.70
IL w/ only negative terms
0.43
0.26
0.60
CARF (ours)
0.48
0.28
0.85
TABLE III: Ablation study on attraction-repulsion items.
Fig. 4: Scorer performance on representative failure trajectories. Green and Red respectively mean Progressive Segments and Failure-Critical Segments , and arrows in pictures mean current action moving direction of gripper end effector.
Fig. 5: Visualization of failure improvement, where the improvement parts are annotated in the pictures using highlight rectangles with text descriptions.
Imitation learning for robotic tasks has relied primarily on policies trained only on successful demonstrations, although failures are unavoidable during human data collection. Many existing approaches for exploiting failure data require additional data processing or iterative policy updates through autonomous rollouts, making it difficult to directly and stably utilize failure data accumulated during data collection. In this work, we propose a method that learns latent representations of success-failure discrepancies and incorporates them into the attention mechanism. During inference, an appropriate latent mode is selected from the initial observation to improve action stability. Furthermore, we introduce a post-training metric that quantifies the attention discrepancy between each failure sample and successful demonstrations to select failure data. Simulation results show that the proposed method improves task success rates when trained with failure data and that the proposed metric identifies failure samples that are beneficial for learning when combined with successful demonstrations. These results suggest that the proposed method can support more efficient use of collected demonstrations in robotic data collection pipelines.
Kana Miyamoto, Kanata Suzuki, Tetsuya Ogata
Faculty of Science and Engineering, Waseda University, Tokyo, Japan · Physical AI Laboratory, Fujitsu Limited, Kanagawa, Japan
Robot policies inevitably encounter failures when deployed in real environments. Naive retries often repeat the same mistakes, while many existing recovery methods rely on human intervention. In this paper, we propose Failure-Aware Retry (FAR), a framework that enables robots to learn from previous failures at test time, adapt their behavior accordingly, and eventually complete the task autonomously. FAR combines Failure-Contrastive Preference Adaptation, which constructs preference learning data from failures to steer the policy away from previously unsuccessful behaviors, with lightweight action perturbations during retries to encourage local exploration. We further incorporate successful recovery trajectories into a training loop for continual policy improvement. Experiments in both simulation and real-world manipulation tasks show that FAR substantially improves success rates and robustness, with average gains of 17.6% over the standard diffusion policy in simulation and 11.7% in the real world. In addition, FAR improves data efficiency under both reset and timestep budgets during continual policy improvement by exploiting informative failure cases. Videos and code are available at https://hoar012.github.io/FAR-Project.
Contrastive reinforcement learning (CRL) scales effectively in goal-conditioned tasks by casting policy learning into a self-supervised contrastive objective. However, in a failure-terminated Markov decision process, established CRL considers pre-failure future goals only when constructing positive samples, without accounting for the probability mass removed by failure termination. Our theoretical analysis shows that this omission induces a systematic overestimation bias in goal-reaching values. Consequently, near-failure trajectories provide disproportionately strong supervision of success despite retaining little future occupancy. Unsafe actions can thereby be reinforced through catastrophic failure bootstrapping, leading to failed policy learning and unsustainable goal-reaching behaviours. To address this problem, we introduce two minimal yet strong corrections: mass-weighted InfoNCE corrects the overweighting of short surviving futures in critic learning, and a log-survival-mass score restores the missing survival mass in policy optimization. The resulting method, Safe Contrastive Reinforcement Learning (Safe-CRL), requires only the one-bit signal provided by failure termination to scale safe goal-conditioned policy learning. Across twelve failure-prone robot navigation and locomotion tasks, Safe-CRL consistently improves survival and substantially outperforms the Scaling-CRL baseline in goal-reaching performance. Additionally, deep Safe-CRL policies exhibit complex failure-avoidance behaviours. This study completes the CRL theory under failure termination and provides a scalable safe RL framework. The code is available via https://github.com/RomainLITUD/safe-crl.
Guopeng Li, Yiyang Duan, Yiru Jiao +1
Southeast University Nanjing, China · Lab, Yinwang Intel. Tech. Co. Ltd. Shanghai, China