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.