Remove episodes with lerobot-edit-dataset --operation.type delete_episodes --operation.episode_indices, and add --new_repo_id or --new_root so the original survives; an in-place run moves it to an _old directory that the next in-place run deletes. Survivors are renumbered from 0, so record the pre-cut indices first. Choosing what to cut matters because behaviour cloning learns whatever you hand it: in the robomimic study, 300 mixed-skill demonstrations scored 52.7% on Square with plain BC against 78.7% from 200 demonstrations by one experienced operator. Recoveries are a per-policy call: adding lower-quality demonstrations cost BC 12.0 points on Square and gained BC-RNN 7.3. Four signals are computable from what LeRobot stores: episode length against the 60-second episode_time_s ceiling, idle runs, action second-difference spikes, and gripper toggles with no arm motion. Start by running the info operation and plotting episode lengths.
To remove bad episodes from a LeRobot dataset, run lerobot-edit-dataset with --operation.type delete_episodes, the list of indices, and --new_repo_id so the original survives. That is one command. The harder half is deciding which indices go on the list, writing the rule down, and keeping a record that still makes sense after the survivors are renumbered.
Every flag and code path below was read from LeRobot v0.7.0, released 2026-11-05.
# Writes a new dataset and leaves the original alone
lerobot-edit-dataset \
--repo_id yourorg/pick_place \
--new_repo_id yourorg/pick_place_filtered \
--operation.type delete_episodes \
--operation.episode_indices "[7, 23, 41]"Drop --new_repo_id and the edit runs in place. DeleteEpisodesConfig has one field, episode_indices: no dry run, no backup option. An issue on the LeRobot repository opened in January 2025, closed in October 2025, asked for exactly this capability after the asker "had to remove ~1/2 of the episodes". The command arrived. A selection rule did not, and a list of indices someone eyeballed once is hard to defend, because the next operator draws a different line and nothing records where the first one was. This post is that rule, as part of our robotics and physical AI guides.
What a bad episode is on a teleoperation rig
Define it by what happened, not by a score. Five kinds are worth separating.
timestamp < control_time_s, where control_time_s is --dataset.episode_time_s, and stops early only on the exit-early key. When it returns, the episode is saved unless the re-record key was pressed. A timed-out attempt is written exactly like a success.Add a grasp that closes on air, which has its own signature, and an attempt that simply failed, which has none, and there are seven failure kinds against what detects each:
Five are reachable by proxy, two need a person. Camera movement mid-session is covered in camera placement for imitation learning, and synthetic or human-video sources change which of these can occur at all, as covered in where robot training data comes from.
| What went wrong | What it looks like in the data | Detected by | Proxy or direct |
|---|---|---|---|
| Attempt ran out the clock | length at the episode_time_s ceiling, about 1,800 frames at 30 fps | Episode length against the ceiling | Proxy, but structural |
| Operator recovered mid-episode | A reversal followed by a second approach | Second-difference spikes | Proxy |
| Idle tail | A run where the largest per-joint action change stays near zero | Idle-run length | Proxy |
| Teleop dropout | A one- or two-frame discontinuity | Second-difference spikes, different width | Proxy |
| Grasp closed on nothing | gripper.pos toggles with no change in arm pose | Gripper toggle without motion | Proxy |
| Task string does not match | tasks disagrees with the video | A human watching | Direct |
| Attempt failed | Nothing distinguishing | The operator's label at record time | Direct |
Why behaviour cloning learns your bad episodes
Supervised imitation maps observed state to demonstrated action and has no channel for "this action was a mistake". The 2010 reduction analysis bounds the cost of naive supervised imitation by the expert's cost plus a term quadratic in the task horizon times the per-step error, because errors push the policy off the demonstrated distribution where errors grow: A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning. That is a property of the method, not a robot measurement.
The measurement is the robomimic study, What Matters in Learning from Offline Human Demonstrations for Robot Manipulation. It built a proficient-human set of 200 demonstrations from one experienced operator and a multi-human set of 300 from six operators of better, okay and worse skill, 50 each. Transport, a two-arm task, uses 300 demonstrations in both sets. Success rates averaged over three seeds, low-dimensional observations:
On the single-arm tasks the multi-human set is 100 demonstrations larger and loses wherever the task is hard enough to lose on. More episodes of uncontrolled quality is not a safe default. LeRobot's recording guidance makes the same point in one line: "Keep the cameras fixed and maintain consistent grasping behavior throughout the recordings." An acceptance rule is how you enforce that when a session produced something else, and how much data it takes to train a robot policy sizes programmes in accepted episodes for that reason.
| Task | BC, proficient human | BC, multi-human | BC-RNN, proficient | BC-RNN, multi-human |
|---|---|---|---|---|
| Lift | 100.0% | 100.0% | 100.0% | 100.0% |
| Can | 95.3% | 86.0% | 100.0% | 100.0% |
| Square | 78.7% | 52.7% | 84.0% | 78.0% |
| Transport | 17.3% | 11.3% | 71.3% | 65.3% |
Capture a success label at record time
Ten seconds of operator effort per episode beats every signal you can reconstruct later. The operator saw the attempt; nobody reading Parquet files a week later did.
LeRobot v0.7.0 has nowhere built in to put it: no success field in the episode metadata and no success prompt in the record loop. The default frame features are timestamp, frame_index, episode_index, index and task_index. That leaves two homes.
--operation.type modify_tasks rewrites tasks per episode with --operation.episode_tasks (a dict from episode index to task string), or by --operation.task_replacements, or sets one --operation.new_task for all. The cost is overloading a field the policy conditions on as language.delete_episodes renumbers survivors from 0, so a file keyed on the pre-cut index describes a dataset that stops existing at the first cut. Key it against a copy you never edit, or regenerate it from the cut log.Four proxy signals for bad episodes, run one at a time
When the label was not captured, compute four signals from what LeRobot already stores, and look at what each one caught before you union the lists. How much they overlap on a real session is something you will see in your own data; nothing we could open reports it.
import statistics
from lerobot.datasets import LeRobotDatasetMetadata
meta = LeRobotDatasetMetadata("yourorg/pick_place")
lengths = meta.episodes["length"]
median = statistics.median(lengths)
# --dataset.episode_time_s defaults to 60, so this is the timer ceiling
timeout_frames = 60 * meta.fps
timed_out = meta.filter_episodes(lambda ep: ep["length"] >= timeout_frames)
suspiciously_short = meta.filter_episodes(lambda ep: ep["length"] < 0.5 * median)
print(f"{len(lengths)} episodes, median {median:.0f} frames at {meta.fps} fps")
print("ran out the clock:", timed_out)
print("far below median:", suspiciously_short)import numpy as np
from lerobot.datasets import LeRobotDataset
# Build the dataset with no episodes= filter: the offsets below are dataset-global
ds = LeRobotDataset("yourorg/pick_place")
actions = ds.select_columns("action")
def episode_actions(ep: int) -> np.ndarray:
lo = ds.meta.episodes["dataset_from_index"][ep]
hi = ds.meta.episodes["dataset_to_index"][ep]
return np.asarray(actions.select(range(lo, hi))["action"], dtype=np.float32)
a = episode_actions(41) # (frames, 6) on an SO-101 follower
step = np.abs(np.diff(a, axis=0)).max(axis=1)
accel = np.abs(np.diff(a, n=2, axis=0)).max(axis=1)
gripper = a[:, 5] # gripper.pos, normalised 0 to 100Episode length against the session median and the timer ceiling
--dataset.episode_time_s defaults to 60 seconds. At 30 fps that is about 1,800 frames, and an episode at that length was ended by the clock. It is the one hard flag that needs no measurement. Below it, everything is relative to the session median. The 0.5 gets a first list on screen; replace it once you have seen the distribution. If you recorded with a different episode_time_s, use that value. filter_episodes returns sorted matching indices without touching a video file.
Idle runs, smoothness spikes and gripper toggles
The other three signals read the action array, one episode at a time: dataset_from_index and dataset_to_index are offsets into the full dataset, so building LeRobotDataset with an episodes=[...] subset makes them slice the wrong rows. Index 5 is the gripper on an SO-101 follower, whose six motors are shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll and gripper; check the motor order for your arm.
- Idle run: the longest run of consecutive frames where
stepstays under a threshold. Two numbers define it: how small a change counts as still, and how many still frames are worth flagging. - Smoothness spike: frames where
acceljumps. A recovery is a smooth reversal over tens of frames; a dropout is one or two frames wide. Separating them is a review job. Trajectory smoothness is a studied data-quality signal: a study published in April 2026 scores demonstrations with spectral arc length and a contact-aware deviation term, Learning from the Best: Smoothness-Driven Metrics for Data Quality in Imitation Learning. A maximum second difference is cruder and takes four lines. - Gripper toggle without motion: a close followed by a reopen within a short window while the body joints barely move.
gripper.poson the SO-101 runs 0 to 100, unlike the body joints, so it needs its own threshold.
Set every threshold from your own session
No source we opened gives an idle-run, spike or gripper threshold that transfers across arms, control rates and tasks. The procedure is the same for each signal: compute it per episode, sort, plot, and cut at the visible break in the distribution rather than at a round number. Then watch the five episodes just above the line and the five just below before you commit.
lerobot-dataset-viz \
--repo-id line4/weld_inspect \
--root /data/lerobot/line4/weld_inspect \
--episode-index 88Note the flag style: lerobot-dataset-viz takes hyphenated --repo-id and --episode-index, while lerobot-edit-dataset takes --repo_id. In v0.7.0 both pass --root straight to LeRobotDataset, so it is the dataset directory itself for both tools. A threshold with ten reviewed episodes around it is one somebody can defend next month.
Recovery data: cut it or keep it
The same robomimic data shows recoveries hurting one policy class and helping another. Its operator-quality subsets hold 100 demonstrations per quality group. On Square, compare the better-operator subset with that subset plus the worse-operator one:
Plain behaviour cloning averages two different actions from similar-looking states. The recurrent variant carries history and turns the same data into coverage of states the better operators never visited.
So the rule is per task and per architecture. If a failed grasp means a person intervenes, cut recoveries and keep the narrow distribution. If the policy runs unattended and must get out of trouble, recoveries are some of the most useful frames you recorded. If you want recovery data on purpose, DAgger-style correction collection gathers it from the policy's own mistakes instead of the operator's. Decide before recording, because it changes the instruction to the operator after a fumble: finish the task, or press re-record.
| Training corpus | Demonstrations | BC success | BC-RNN success |
|---|---|---|---|
| Better operators only | 100 | 58.7% | 66.0% |
| Better plus worse operators | 200 | 46.7% | 73.3% |
| Change from adding the worse half | +100 | 12.0 points lower | 7.3 points higher |
Making the cut on your own hardware
Compute the keep list with filter_episodes, then materialise it, so training points at a named dataset you can put in the run record. What the delete operation does in v0.7.0:
The statistics row deserves a second look if you train pi05 or another QUANTILES-normalized policy. Re-aggregation combines per-episode summaries, and in v0.7.0 quantile keys combine as a min/max envelope rather than percentiles of the surviving frames. Mean and standard deviation are exact. The fix and the check are the same as after a merge, covered in what breaks when you merge LeRobot datasets.
The perimeter version of the command names both roots:
lerobot-edit-dataset \
--repo_id line4/weld_inspect \
--root /data/lerobot/line4/weld_inspect \
--new_repo_id line4/weld_inspect_v2 \
--new_root /data/lerobot/line4/weld_inspect_v2 \
--operation.type delete_episodes \
--operation.episode_indices "[12, 88, 141]"--push_to_hub off.stats.json, and what to check when a fine-tune returns 0% success covers the normalization failures that show up at training time.| Question | What happens |
|---|---|
| Are survivors renumbered? | Yes, from 0. The original index is not stored. |
| Is the original kept? | Only with --new_repo_id or --new_root. In place, it moves to a sibling directory ending in _old. |
| Does a second in-place run keep both backups? | No. It deletes the existing _old first. |
| Are statistics recomputed? | Re-aggregated from the surviving per-episode statistics into the new root. |
| Are videos re-encoded? | Only files that mix kept and deleted episodes. Others are copied. |
| Does it refuse an out-of-range index? | Yes: Invalid episode indices with the offending set. |
| Does it touch the Hub? | Only with --push_to_hub true, which defaults to false. |
The acceptance policy you write once
This is acceptance of demonstrations entering training, a different document from acceptance of policies leaving evaluation, which how many trials it takes to evaluate a robot policy covers. Five things go in it.
If the policy that ships was trained on 214 of 300 recorded episodes, the record of which 86 went and why is part of the evidence that the training set was controlled. In a regulated setting that is one CSV. Capture before and after counts in it:
lerobot-edit-dataset --repo_id yourorg/pick_place --operation.type info lerobot-edit-dataset --repo_id yourorg/pick_place_filtered --operation.type info
The info operation is read-only and prints the repository ID, episode count, task count, frame count, average frames per episode, average episode length in seconds, fps and size in MB. Add --operation.show_features true to print the feature schema.
This week, run the info operation on the dataset you are about to train on, plot the episode-length distribution with the first snippet above, and list everything sitting at the timer ceiling. That is your first flagged list, produced without a threshold meeting. If you want the collection protocol and acceptance step built with you, see our robotics data collection service.
FAQ
Quick answers to the questions this post tends to raise.



