Research
NEEDLEWORK: Offline Rewriting of Robot Data with Verified Local Stitches
Robot demonstration datasets are often mediocre: some episodes wander, some succeed on one part of a task and fail another, and some fail outright. Simply filtering these episodes away throws out…

- arXiv
- 2610.02339 · Preprint · not peer-reviewed
- Published
- 2026-10-01
- Authors
- Juntao Ren, Yifan Hou, Shuran Song
In plain words
Robot demonstration datasets are often mediocre: some episodes wander, some succeed on one part of a task and fail another, and some fail outright. Simply filtering these episodes away throws out genuinely useful behavior.
AI summary
Overview
Research area: Robot learning — offline imitation learning and offline dataset augmentation for manipulation (imitation learning, inverse dynamics models, trajectory stitching).
Technical level: Advanced. The paper assumes familiarity with goal-conditioned inverse dynamics models, diffusion policies, verifiers, and imitation-learning baselines.
Scope: An offline method ("Needle") that rewrites imperfect robot demonstration datasets by inserting short, verified action sequences — "bridges" — between recorded observations, using only RGB, proprioception and episode-level success labels.
What This Paper Is About
Robot demonstration datasets are often mediocre: some episodes wander, some succeed on one part of a task and fail another, and some fail outright. Simply filtering these episodes away throws out genuinely useful behavior. This paper asks whether it is possible to compose good behavior from the dataset itself — connecting an observation in one episode to a better continuation recorded elsewhere — and then to turn those connections into extra training supervision for a policy, without collecting new data or interacting with the environment.
Key Contributions
- An offline stitching algorithm built on local reachability. Instead of learning a global dynamics model or a task value function and asking it to reason over long horizons, Needle reduces stitching to many short, locally supervised problems: can these actions take me from observation s to observation g, and in how many steps?
- A two-module "needle and thimble" design. A goal-conditioned diffusion inverse dynamics model proposes candidate action sequences, and a separate action-conditioned verifier — which receives the source, the goal and the proposed actions — predicts whether and at which prefix length the goal is reached. Both are trained from short segments inside successful and failed episodes.
- A training formulation that uses bridges without synthesizing images. Accepted bridges are turned into action targets attached to real recorded observations, including observations several steps before the bridge source; losses stop at the bridge endpoint, and the original demonstrations (including the bypassed segments) are retained.
- Real-robot and simulated evaluation of success, completion within a fixed time/step budget, recovery from failure states, and ablations of the verifier and of the three stitching categories.
Main Findings
- Real-robot gains over the strongest baseline: Needle improves success by 24 percentage points on sweater folding and 18 points on dish racking; the abstract reports an average of 21 percentage points over the strongest baseline on each task. Evaluation used 50 paired starting states per task per policy on a bimanual ARX-5 setup with iPhUMI-collected data (108 successful / 78 failure sweater trajectories; 179 successful / 59 failure dish-racking trajectories).
- Simulation gains on suboptimal Robomimic data: On Multi-Human Can, Square and Transport, Needle beats every evaluated baseline, improving average success by 8.4 percentage points over standard Diffusion Policy and 6.9 points over the strongest competing baseline on each task. All methods used the same 40 successful demonstrations (plus 150 additional failures for methods that use them).
- Failures are dominated by cyclic repetition, and Needle reduces it: Video review of all 50 trials per policy and task localizes baseline failures to repeating suboptimal demonstrated motions (e.g., folding and unfolding a sleeve, circling the gripper). Pooled over gripper travel on both real tasks, the fraction of travel re-entering a previously exited 2 cm region is 9.2% for Needle, versus 10.8% for DP and 16.7% for AWR.
- Faster completion within a fixed budget: On both real tasks and in simulation, Needle reaches comparable success sooner and solves more starts by the full horizon; successful simulation rollouts also take fewer steps on average than DP's on Can and Square.
- Accepted bridges really do shorten the remaining path: Replaying bridges versus original continuations from the same source state shifts the distribution toward fewer remaining steps to success on all three simulated tasks — the effect the continuation-gain criterion was designed to induce.
- Failure funnels expand coverage and improve recovery: Starts introduced by failure funnels occupy regions of the learned visual representation beyond those covered by successful demonstrations, and Needle recovers more often than DP on all three evaluated failure-state populations, and more often than AWR (the strongest non-DP baseline).
- Verification is essential, not cosmetic: With source and target fixed, the verifier distinguishes demonstrated actions from logged substitutes with AUROC 0.85–0.98 on 1,500 held-out pairs per task. Accepted bridges land within 5 cm more often than rejected ones by 21.9, 34.6 and 61.1 percentage points on Can, Square and Transport (absolute: about 61%, 76% and 78%). Removing verifier filtering while keeping the same number of added bridges drops Transport success from 53.2% to 20.4% (a 32.8-point, 61.7% relative decrease) and hurts all three tasks.
- Boundary condition — near-optimal data: On DexMimicGen's Coffee, Three Piece Assembly and Threading (100 successful demos plus 200 unsuccessful per task), gains are small: 62.0 ± 1.2 → 63.3 ± 0.7, 51.3 ± 0.7 → 55.3 ± 1.8, and 46.0 ± 1.2 → 46.0 ± 1.2 (unmoved), a maximum gain of about four percentage points, with no regression relative to behavior cloning.
Methodology in Plain English
The intuition. Any recorded episode — successful, sloppy, or failed — is a chain of short segments. Each segment is a ready-made example of "these two observations can be connected, by exactly these actions, in exactly this many steps." So rather than asking a model to predict the long-term future, you can ask a much narrower question many times: given these two images, which actions get me from one to the other, and how soon?
Step 1 — Find candidate connections worth trying. The method scans the dataset for three kinds of pairs: (S1) within-trajectory shortcuts that skip a detour inside one successful episode; (S2) cross-trajectory transplants that hook a successful episode up to a shorter successful ending recorded in a different episode; (S3) failure funnels that connect a state on a failed episode to a point on a successful one. To keep the search tractable, candidate targets are retrieved by nearest-neighbor search in the inverse model's visual features. Usefulness is scored by a simple arithmetic test: an ℓ-step bridge from a source with T_i − t steps remaining to a target with T_j − t′ steps remaining only counts if (T_i − t) − [ℓ + (T_j − t′)] > 0 — that is, it actually saves steps.
Step 2 — Propose actions (the "needle"). A goal-conditioned diffusion inverse dynamics model is trained on short recorded segments: pick a source frame, pick a goal frame δ steps later (δ ≤ H), and supervise with the recorded actions up to that goal, padding by holding the final action when the segment is shorter than the horizon. It then samples K candidate action sequences for each source–goal pair.
Step 3 — Verify them (the "thimble"). A second network sees the same source and goal plus the proposed actions and outputs, for every prefix length, whether the goal will have been reached by then. Causal attention over action tokens stops it from cheating by looking ahead, and it can be trained in parallel with the inverse model since they share a visual encoder. It is trained with three kinds of tuples sharing one anchor: a within-horizon positive goal, a beyond-horizon goal as a negative, and a cross-trajectory goal as a negative. Thresholds are tuned per horizon on held-out trajectories with an emphasis on low false-positive rate — because a false positive injects wrong action labels. The shortest accepted prefix becomes the bridge.
Step 4 — Turn bridges into training data. For each accepted bridge, the method builds training windows starting at the source and at observations a few steps before it, with targets formed by the recorded actions leading in, followed by the bridge actions. Losses are masked past the bridge endpoint so the policy is never taught a fictional concatenation of bridge and target episode. Crucially, no intermediate images are generated and no shared coordinate frame is required, and the original training examples — including the segments the bridge skips — stay in the dataset, with their sampling frequency controlled relative to the new windows. At deployment, the resulting policy is just a normal Diffusion Policy; no search or verification happens at inference.
Step 5 — Evaluate. Real-robot sweater folding and dish racking, plus simulated Robomimic tasks and DexMimicGen tasks, compared against MBTS (explicit stitching), SBR, AWR, SARM and IDQL, all using the same DINOv3 encoder and Diffusion Policy architecture so that differences come only from the training supervision.
Why This Matters
Impact on research. The paper makes a pointed argument: improving offline robot data need not be limited to selecting which recorded behavior to learn from. It also shows that the hard part of stitching in high-dimensional image space can be decomposed into short, locally supervised reachability questions rather than requiring an accurate global model or value function — and that action-conditioned verification, not just plausible-looking proposals, is what makes added data helpful rather than harmful (the Transport collapse from 53.2% to 20.4% is a stark illustration).
Real-world applications:
- Household and laundry robotics — bimanual deformable-object tasks like the sweater folding setup, where no single teleoperated demo is clean and corrective grasps are common.
- Kitchen and dish-handling automation — the dish-racking task, with rim pickup, handover coordination and precise insertion.
- Reusing existing fleet teleoperation logs — datasets collected with handheld UMI-style devices on which a shared absolute coordinate frame does not exist, so methods requiring one are inapplicable.
- Manufacturing and assembly data curation — the DexMimicGen Coffee, Three Piece Assembly and Threading tasks stand in for structured assembly, where the paper's finding is that gains shrink when demos are already near-optimal.
Industry relevance. Companies sitting on large archives of mixed-quality teleoperation data can use this to extract more value from data they already own — no new environment interaction, no privileged object state, no per-step rewards — while keeping their existing Diffusion Policy stack and inference cost unchanged.
Future Directions
- Guiding data collection. The authors note that smaller gains on near-optimal demonstrations mean Needle depends on opportunities for recomposition, and suggest future work could identify where coverage is insufficient and target collection there.
- Beyond short bridges. Connections requiring sustained contact, substantial object reconfiguration, or feedback during execution may exceed the current short-bridge formulation; variable-length inverse-model predictions are proposed as one route.
- Additional modalities. Incorporating signals such as force is suggested to better capture contact-rich connections.
- Sharpening the usefulness criterion. Utility is currently estimated from recorded continuation lengths and success rather than a learned value function; whether richer utility estimates widen the set of useful stitches is left open.
Target Audience
Robotics and imitation-learning researchers and graduate students working on offline RL, data augmentation for manipulation, or trajectory stitching; applied engineers building behavior-cloning pipelines from teleoperation datasets; and practitioners who need to squeeze more performance out of a fixed, imperfect demonstration corpus without new robot time. Readers should be comfortable with diffusion policies and inverse dynamics models — the paper is not an introductory treatment.
Authors’ abstract
Robot demonstrations may contain useful behavior even when individual episodes are inefficient or unsuccessful. Trajectory stitching offers a way to compose these behaviors into improved training data, but identifying useful connections and verifying their feasibility is difficult in high-dimensional robot data, where many prior methods rely on low-dimensional state representations. We introduce NEEDLE, an offline dataset-augmentation algorithm that addresses these…
The full abstract on arXivRelated papers
- Mulligan: Performance-Guided Data Collection for Efficient On-Robot Learning 2026-10-05 · cs.RO · Also by Shuran Song
- PanTact: Teaching Whole-Body Dexterity with a Wearable Contact Interface 2026-10-08 · cs.RO · Also by Shuran Song
- Chronos Policy: Learning Robot Policies on Physical Time 2026-10-09 · cs.RO · Also by Shuran Song
- LOGIV: Graph-Verified Execution with Causal Local Repair for Long-Horizon Robot Tasks 2026-10-29 · cs.RO · Key terms of the title in common
- BATCH: Behavior Alignment for Cross-Embodiment Learning from Humans 2026-11-06 · cs.RO · Also by Shuran Song