How to deduplicate and balance robot demonstration data before training

•
9 min read
Author
black and white photo of Jesse Mostipak
Director of Growth
Jesse Mostipak is the Director of Growth at Voxel51, where the work is helping humans find and trust what the brand knows, and teaching the Google knowledge graph and the LLMs answering on their behalf to do the same. That question, how knowledge gets built inside a system, is one Jesse has been chasing for years. Earlier versions of it ran through a New York City high school science classroom, data science and machine learning, and developer relations at Kaggle, Posit (formerly RStudio), and Baseten. The answer doesn't change much depending on whether the learner is a teenager, a software engineer, or a knowledge graph. Jesse holds a Master's in Education from CUNY Hunter College. LinkedIn
See all articles by Jesse Mostipak

Try Voxel51 for yourself

Deduplicate robot demonstration data before you balance it, because duplicates inflate the counts you balance on. Remove exact copies, find near-duplicate episodes within the same task and source using episode embeddings, and cap how many you keep from each cluster. Then count episodes by task, source, robot, scene, operator, and outcome, and cap, reweight, or collect more data toward the conditions your robot will face. In Voxel51, you count episodes per source, task, and robot type in the sidebar, inspect clusters in the Embeddings panel, tag the extras instead of deleting them, and download the kept episode list.

Key takeaways

  • Pooled robot demonstration data is lopsided. In the 2,378-episode LeRobot Community dataset in Voxel51, the 10 largest of 117 source datasets hold 73.6% of the episodes, and 100 source datasets have exactly one episode each. Training on it as is means mostly learning from ten source datasets.
  • In the LeRobot Community dataset in Voxel51, labels that should match often don't. The same robot appears to show up under several robot_type names (so101, so-101, so101_follower), and one source dataset's gear task is split across four slightly different task strings. Normalize labels before you count, or your balance numbers will be wrong.
  • Near-duplicate robot demonstrations cluster by recording order. In one 200-episode LeRobot Community source, no two episodes were exact copies, but 82 episodes had their closest match within five episodes of themselves in recording order, and 15 had a match far closer than a typical pair of episodes from the same source.
  • Capping each LeRobot Community source dataset at 50 episodes keeps 931 of 2,378 episodes and drops the top ten source datasets' share from 73.6% to 53.7%. Whether that's the right trade depends on what your robot will do, so test the cap before you adopt it.

Who this post is for

This post is for anyone about to train an imitation learning policy or fine-tune a vision-language-action model on robot demonstrations they didn't all record themselves, especially pooled LeRobot datasets from the Hugging Face Hub. If you've read our guide to data curation, this is the robot-specific version of its duplicate and balance steps, with numbers from a dataset you can open in your browser.

Why deduplicate before you balance?

Deduplicate first because every duplicate you leave in adds weight to its group when you count. If one operator recorded the same pick-and-place 50 times from the same starting layout, balancing by source would treat those 50 near-copies as 50 independent examples. Remove or cap the copies, then count what's left.

Where do duplicates come from in robot demonstration data?

Duplicates in robot demonstration data usually come from how teleoperation sessions run. The common sources are:
  • Reset loops. An operator resets the scene to the same layout and records the same motion again and again.
  • Repeated sessions. The same operator, robot, and setup produce many episodes that differ only slightly.
  • Merged and re-uploaded datasets. Pooled collections can include the same recordings under different repository names, or converted copies of the same data.
  • The same task under different names. Free-text task strings split one task into several, which hides how much of the data is really the same task.
Not every similar episode is a duplicate, which is why near-duplicate detection needs a human check. Two grasps from the left and the right, or a grasp followed by a recovery, can look alike in an embedding plot and still teach different things. That's why the method below caps clusters instead of keeping one episode from each.

How do you deduplicate and balance robot demonstration data?

Here's the method, step by step. Each step has a rule you can apply with any tool, and then the way I'd do it in Voxel51.
  1. Check integrity first. Drop or fix episodes with missing frames, broken timestamps, or a length that can't hold the task. The LeRobot curation metrics post covers the full set of checks. In Voxel51, filter the length field in the sidebar to find the shortest episodes.
  2. Remove exact duplicates. Hash the raw action and state arrays, or the episode files, and keep one copy of each hash. This step runs in your data pipeline, outside Voxel51.
  3. Find near-duplicates within the same task and source. Compare episode embeddings or segment embeddings only among episodes that share a task and a source, because a whole-dataset comparison mostly tells you which source an episode came from. Set the similarity threshold by reviewing a sample of the closest pairs, since no single distance works for every robot and task. The pairwise distance sort runs in your own code. In Voxel51, filter to one source in the sidebar, open the Embeddings panel, color the plot by task, and review the tight clusters by eye.
  4. Cap each cluster rather than keeping one episode. Keep the clearest, complete, successful episodes in each cluster up to a cap, and tag the rest instead of deleting them. Repetition at a modest level helps a policy learn a skill robustly, so the goal is to stop one setup from dominating, not to remove all repetition. In Voxel51, tag the extra episodes dup-capped so you can bring them back.
  5. Trim redundancy inside episodes. Long idle stretches at the start and end of a demonstration can teach a policy to pause. Research on SCIZOR goes further and filters redundant and low-quality state-action pairs, not whole episodes. The DROID walkthrough shows how common idle phases are.
  6. Audit the mix after normalizing labels. Merge task strings and robot names that mean the same thing, then count episodes by task, source, robot, scene, operator, and outcome. In Voxel51, the sidebar shows counts for each field value, and the agent can build a count table from a plain-English question.
  7. Balance with a cap, a weight, or new data. Cap the largest groups, reweight sampling so smaller groups count for more, or collect more data where a group is too small to represent well. Aim for the mix your robot will face in deployment, not equal counts in every group.
  8. Split by episode and by source, then export the list. Keep near-duplicates on the same side of the train and evaluation split, so the evaluation doesn't reward memorizing a setup. In Voxel51, save the kept episodes as a subset, then download the file paths and tags (More, then Export dataset, then Filepaths and tags) and build your training split from that list.
LevelMethodWhat it catchesRisk
FileHash the episode filesRe-uploads and exact copiesMisses re-encoded copies
EpisodeHash actions and state, or compare episode embeddings within task and sourceReset loops and repeated sessionsRemoves useful variation if the threshold is loose
SegmentCompare segment embeddingsRepeated sub-motions inside long episodesTreats a real retry as a duplicate
Frame or stepTrim idle stretches, filter state-action pairsPauses and redundant stepsCuts a deliberate wait the task needs
Deduplication levels for robot demonstration data, with the method for each, what it catches, and the main risk.
Deduplicate first, then balance: six steps from integrity checks to a split by source, with numbers from the LeRobot Community dataset in Voxel51.

Worked example: auditing and capping 2,378 LeRobot community episodes in Voxel51

To put numbers on this, I used the LeRobot Community dataset from the Explore library in Voxel51. It holds 2,378 tabletop manipulation episodes from 117 community LeRobot datasets on the Hugging Face Hub, with each episode's source repository, robot type, task string, length, and segment embeddings. Before reading further, take a second to guess: of the 117 source datasets, how many have just one episode?
The answer is 100. I asked the Voxel51 agent to count episodes per source, and the long tail is very long:
Group of source datasetsSource datasetsEpisodesShare of 2,378
Top 10101,75173.6%
Top 20202,28195.9%
Single-episode source datasets1001004.2%
How the 2,378 LeRobot Community episodes in Voxel51 are spread across 117 source datasets. The top 20 includes three single-episode source datasets.
The three largest source datasets have 200 episodes each. A policy trained on this mix as is would mostly learn from ten source datasets and see each of the 100 single-episode sources once. One of the top 20 sources has "merged" in its repository name, which is a good prompt to check whether any of its episodes are re-uploads of another source before you count it as its own group.

Labels that should match but don't

Before balancing by robot or task, I checked whether the labels agree with each other. They don't, which is normal for pooled data:
  • robot_type has 22 values, and several look like the same arm under different names, such as so101, so-101, and so101_follower, plus so100 next to so100_follower. Another 200 episodes are labeled so101_leader, which is the name of the teleoperation arm rather than the robot.
  • The task field has 111 distinct strings. One source dataset's gear task is split across four slightly different strings with 80, 40, 40, and 40 episodes, which together are that source's 200 episodes.
  • Nine episodes are under 50 frames, the shortest is 10 frames, and the median is 379. Those nine are worth watching before they go anywhere near training.
Bucket the task strings and map the robot names to a canonical list before you count, the same fix the DROID walkthrough applies to free-text task strings.

Why compare robot episodes within a source?

In an earlier look at 497 community LeRobot episodes, sampled 10 per robot type, Harpreet Sahota found that for 495 of the 497 episodes, the nearest neighbor comes from the same source dataset. As his post explains, that follows from the sampling, since each robot type's 10 episodes came from one source, so I treat it as a reason to check within a source rather than as a measurement of this dataset. Harpreet's within-source comparison is also what surfaced the real pairs in five problems hiding in 383 robot episodes, where a dataset-wide uniqueness score missed them. In Voxel51, the Embeddings panel for this dataset plots 12,990 segment embeddings. You can color the plot by task or robot type, then switch to Select and drag a lasso around a tight cluster to pick out its segments.

How many near-duplicates are in one source?

To get a real number, I picked the source with the most repetitive task: 200 episodes of an SO-101 arm with the task string "Press the up arrow on the GBA," the same 200 episodes that carry the so101_leader label. I pulled the six-joint action stream for every episode from the source dataset on the Hugging Face Hub, resampled each episode to 50 evenly spaced steps, standardized each joint, and measured the distance from every episode to its closest neighbor in the same source. This ran in my own code, not in Voxel51, and resampling ignores speed, so two episodes with the same motion at different speeds count as close.
CheckResult
Exact copies (identical action streams)0
Median closest-match distance19% of the median distance between two episodes
Episodes with a closest match under 20%124 of 200
Episodes with a closest match under 10%15 of 200
Closest match recorded within five episodes82 of 200 episodes, and 13 of the 15 under 10%
Exact and near-duplicate checks on the 200 "Press the up arrow on the GBA" episodes in the LeRobot Community dataset, using resampled action trajectories. Distances are relative to the median distance between two episodes from this source.
So there are no copy-paste duplicates, but there is a lot of near-repetition, and most of it comes from episodes recorded back to back, such as episodes 150 and 153 or 197 and 198. That's the reset-loop pattern from earlier, and it's why a cap per cluster makes more sense than keeping one episode. The 15 closest pairs are the ones to watch first when you set a threshold, and I haven't watched them yet.

What a cap does to the mix

Here's what a simple cap of 50 episodes per source dataset does:
MeasureBefore the capAfter a cap of 50
Episodes2,378931
Top 10 source datasets' share73.6%53.7%
Single-episode source datasets' share4.2%10.7%
The LeRobot Community dataset before and after capping each source dataset at 50 episodes.
The cap removes 1,447 episodes, all of them from the 13 source datasets with more than 50. That's a big cut, and it isn't automatically right. If your robot is an SO-101 doing pick and place, the large SO-101 pick-and-place source datasets may be exactly the data you want more of, and reweighting would keep their episodes while lowering their influence. Treat 50 as a first setting to test.

Which balancing method should you use for robot demonstration data?

Use a cap when a few groups dominate and their extra episodes are near-copies. Use reweighting when you want to keep every episode but change how often each group is sampled, which changes the data mixture the model sees. Collect more data when a group is too small to represent well, because no weight can add a condition the data doesn't contain.
MethodWhat it doesUse it whenWatch out for
CapKeeps at most N episodes per groupA few groups are mostly near-copiesThrows away real variation if N is small
ReweightSamples smaller groups more oftenYou want to keep every episodeRepeats a few rare episodes until the model memorizes them
CollectAdds new demonstrationsA group is too small or missingCosts time and robot hours
Three ways to balance robot demonstration data, what each does, when to use it, and what to watch for.
A common heuristic for reweighting is to sample each group in proportion to its episode count raised to a power between 0 and 1, which sits between sampling every episode equally and sampling every group equally. Treat the power as a setting to test. Mixture weights matter enough to study directly, and Re-Mix learns dataset mixture weights for robot pretraining and reports large gains over uniform weights.

How do you keep near-duplicate robot episodes out of your evaluation split?

Split by episode, never by frame, and keep each source's episodes, or at least each recording session's, on one side of the split. A random split lets the model score well by recognizing a setup it already saw in training.

What I don't know yet

I haven't trained on the capped and uncapped versions of this dataset, so I can't tell you which one gives the better policy, and that's the test that settles it. The near-duplicate numbers come from one source and from action trajectories only, and I haven't yet watched the 15 closest pairs to confirm they look like the same motion on camera. If you run the cap-versus-reweight comparison on LeRobot community data, I'd love to see what you find.
Once the data is deduplicated and balanced, the next question is which episodes to label or recollect. That's covered in how to pick which robot episodes to label or retrain on next. For a closer look at near-duplicates on a smaller dataset, see five problems hiding in 383 robot episodes.

Frequently asked questions

black and white photo of Jesse Mostipak
Director of Growth
Jesse Mostipak is the Director of Growth at Voxel51, where the work is helping humans find and trust what the brand knows, and teaching the Google knowledge graph and the LLMs answering on their behalf to do the same. That question, how knowledge gets built inside a system, is one Jesse has been chasing for years. Earlier versions of it ran through a New York City high school science classroom, data science and machine learning, and developer relations at Kaggle, Posit (formerly RStudio), and Baseten. The answer doesn't change much depending on whether the learner is a teenager, a software engineer, or a knowledge graph. Jesse holds a Master's in Education from CUNY Hunter College. LinkedIn
See all articles by Jesse Mostipak

Try Voxel51 for yourself

Related posts

Boost your visual and physical AI workflows.
View all