Data scaling and generalization
Measure what matters for deployment: how many demonstrations are needed and what happens outside the training distribution. Plot success against the number and diversity of demonstrations for each policy, and evaluate unseen positions, objects, lighting, and perturbations using simulator domain randomization.
After this lesson you can
- Design a scaling experiment with nested demonstration subsets and multiple seeds.
- Compare the effect of more demonstrations against more scene diversity.
- Evaluate out of distribution with controlled perturbations.
- Summarize results with intervals and practical recommendations.
Before you start
More data are no guarantee
A policy can improve on states it already knows and still fail when lighting or object position changes. A data scaling curve plots a rollout metric against demonstration count while fixing policy family, training procedure, and evaluation distribution. It is not a universal law: a curve for one expert, task, and distribution does not automatically predict another.
The experiment by Lin et al. studies numbers of environments, objects, and demonstrations in real manipulation. Its abstract describes more than 40,000 demonstrations and more than 15,000 rollouts, and finds that environment and object diversity were especially important in the studied tasks. That evidence does not mean any new scene is worth more than any repetition, or that our simulator reproduces their curves.
Diversity can also concern the robot itself. Open X-Embodiment brings together data from 22 robots and studies cross-platform transfer using models trained on multiple datasets. That is a different question from changing the lighting of one simulation: a broader mixture may provide useful experience, but attributing an improvement requires specifying which robots, tasks, and data are present in each comparison.
Nested subsets
To separate size and composition, fix a permutation of training episodes and take its first 10, 25, 50, 100, and 200. The set of 25 contains the set of 10; the set of 50 contains that of 25, and so on. The main contrast uses training seeds 0 and 1 for each size and family, saving exact indices, architecture, update, and normalization. A third BC seed is retained as additional evidence. Two training runs per point offer a very limited view of variation; they are not two episodes and do not represent every possible initialization. To quantify episode-selection variation as well, repeat the design with several permutations: changing only training seed for one permutation does not measure that uncertainty source.
For each size, calculate new statistics using only its episodes. Use the same number of updates and checkpoint-selection rule for compared families, or report compute differences. A gradient step processes batches, not complete episodes: with a fixed step budget, examples from the smaller set are reused more often. A fixed epoch budget would answer another question.
The estimated quantity is specific. If is the subset, the training seed distributed as , and an independent scene drawn from test distribution , define as 1 if rollout succeeds and 0 otherwise. The goal is to estimate for the training procedure and selected set. If only changes while stays fixed, you obtain a data curve for that distribution; changing yields another curve. No single “OOD success” summarizes all possible changes.
Episode order can matter even at the same size. Nesting means the jump from 25 to 50 adds 25 episodes to the same prefix, but a single permutation may have included easy scenes earlier. A second permutation and a second collection design can separate composition uncertainty from network-initialization variation. Save the episode list, not just the generator seed: if file order changes, the same seed no longer selects the same examples.
The original 80 training demonstrations and 120 additional ones generated by collect_extra.py form a pool of 200. Also download p13_collector.py and the adapter from the first lesson. scale_bc.py receives both paths, fixes a permutation, and saves its manifest. The subset indices and seeds can be reconstructed with export_episode_selection.py; the file identifies both dataset hashes. Evaluation seeds are held out before collecting new demonstrations.
python scale_bc.py --data RUTA_ORIGINAL RUTA_ADICIONAL --out resultados \
--sizes 10 25 50 100 200 --seeds 0 1 2 --steps 2000 --episodes 100
The program and policy are in scale_bc.py and p13_bc.py; also place training_resume.py beside them. The baseline uses privileged state, while compact ACT and diffusion implementations use images and proprioception: a success difference does not identify the architecture’s effect alone. A causal comparison would require matching observations and controlling compute, data, and selection.
The visual sweep uses sweep_policies.py, act_experiment.py, and diffusion_experiment.py. Also place act_model.py, diffusion_model.py, window_data.py, ood_task.py, and the p13_pusht.py adapter beside them. The following command trains both models per size; it saves a resumable checkpoint and statistics calculated only from each subset:
python sweep_policies.py --data RUTA_ORIGINAL RUTA_ADICIONAL --out resultados_visuales \
--act-script act_experiment.py --diffusion-script diffusion_experiment.py \
--families act diffusion --sizes 10 25 50 100 200 --seeds 0 1 \
--steps 2000 --phase train --train-device cpu
To distribute already-trained rollouts, parallel_eval.py assigns each checkpoint-condition combination to a separate process. It retains partial outputs and checks manifest, hash, seeds, backend, and PyTorch version before reusing a result; --workers sets concurrency. This page’s results were run sequentially on CPU, so they do not measure parallel speedup.
An integration test ran the same ACT checkpoint with one and two processes under two conditions and two diagnostic scenes per condition, distinct from the final holdout. Success, length, and pusher and object position traces, angle, and coverage matched exactly. That test did not save actions: it does not establish they match or equivalence for every episode. Nor can it estimate speedup for a complete campaign.
python parallel_eval.py --families act diffusion --act-dir resultados_visuales \
--diffusion-dir resultados_visuales --act-script act_experiment.py \
--diffusion-script diffusion_experiment.py --workers 2 --device cpu
All three sweep families have been measured. Each chart point summarizes two models, one per main-contrast seed, and 100 scenes per model and condition. The aggregate data and additional third BC seed are retained separately. BC receives privileged state, while ACT and diffusion receive images and proprioception; the comparison does not isolate architecture’s effect.
In the unperturbed CPU test, the 25-demonstration model with seed 0 achieved 1/100; all other models of the two main seeds achieved 0/100. The additional third seed achieved 1/100 with 50 demonstrations and 0/100 at other sizes. Under changed lighting, unperturbed records were reproduced exactly for all 15 models, as expected when the policy receives privileged state and physics is unchanged. This is an interface control for this run, not a conclusion about a pixel-dependent policy.
The ACT evaluation includes two networks trained for each of five sizes, each tested under five conditions. All 50 evaluations finished with 0/100 successes; for every network and condition, the 95% Wilson interval reaches approximately 3.70%. These are CPU rollouts of checkpoints trained for 2 000 updates, with images and proprioception. Two seeds show limited training variation; the results do not identify the cause of failure by themselves.
The diffusion evaluation also comprises two networks per size and five conditions of 100 scenes; all 50 evaluations obtained 0/100. Mean final in-distribution coverages for seeds 0 and 1 were 2.89% and 5.58% with 10 demonstrations, 5.22% and 5.27% with 25, 4.10% and 5.20% with 50, 5.29% and 5.39% with 100, and 4.49% and 5.46% with 200. Each network received 2 000 updates and was deployed on CPU with ten-step DDIM and eight actions per prediction. Two networks per size offer a limited view of dispersion between runs; these failures do not explain their own cause.
Out of distribution means specifying the change
Out-of-distribution evaluation defines a test distribution different from training and measures the policy without tuning its parameters on that test. “OOD” alone does not describe the change. Separate at least initial position, appearance or lighting, geometry and dynamics, and perturbation during execution. A lighting test does not demonstrate robustness to an object with a different shape.
Hold out conditions before training: for example, positions in a region excluded from demonstrations, light intensity outside the training interval, and an impulse at a time chosen by an independent seed. Change one dimension at a time, then test combinations. If object geometry changes, also update the geometric definition of coverage and the target; otherwise the indicator could report “success” for a task different from the one shown. Training domain randomization can improve robustness, but evaluating within the same ranges measures only interpolation inside that randomization.
In this sweep, ood_task.py fixes the interventions in the table. The 100 evaluation seeds are 20000 through 20099; the horizon is 300 steps and success means reaching at least 95% target coverage. Coverage is estimated by counting points of a 2 mm grid over the T, making it a discrete approximation of overlap. The same seed list is used for each checkpoint and condition. A common seed links the draw, but does not imply identical physical pose after deliberate changes or geometric rejection.
| Condition | Specific intervention |
|---|---|
| In distribution | Usual Push-T reset, without an additional change. |
| Position | The horizontal coordinate of the T’s origin is proposed between 0.06 and 0.09 m, the vertical coordinate between 0.10 and 0.40 m, and the angle between and . Reject poses outside the table, in initial collision, or with initial coverage of at least 0.5. |
| Lighting | Multiply the light’s diffuse component by 0.3; physics is not intentionally changed. |
| Object | Multiply the in-plane dimensions of the T and its target by 0.8, and update the geometry used to calculate coverage. |
| Impulse | At an integer step between 50 and 150 inclusive, add or m/s to the T’s horizontal velocity. Time and sign are drawn with a generator derived from the scene seed. |
The impulse is an instantaneous velocity change, not a force applied throughout the episode. If the policy has already finished before the drawn step, the record indicates it was not applied: it would be incorrect to count that as an observed recovery. The object change retains masses and height, but not in-plane volumes. Thus, in addition to size, each box’s implied density changes; that condition does not allow a difference to be attributed solely to image or geometry.
A lighting change directly affects the camera but should not change dynamics. This is a useful control: if a privileged-state policy changes result when only light is modified, look for another accidental change or a different randomness source. The visual policy can change because its pixels differ. To isolate appearance alone, leave geometry and dynamics intact; to study dynamics, record mass and friction explicitly.
Our lighting-diversity control uses 100 trajectories replayed with fixed light and variable intensities: identical privileged states and actions were verified in both sets, while the initial image changed in all 100 episodes. For two seeds, training BC for 2 000 steps on each set produced identical weights and statistics. Evaluating each model on the same 100 scenes also produced matching records under usual light and intensity 0.3; all four models achieved 0/100 in both conditions, with an upper Wilson limit of approximately 3.70% per model. This is expected for a policy receiving no image: it detects accidental changes and does not demonstrate visual robustness.
The visual contrast with ACT and diffusion compares two training seeds per branch, each with 100 paired scenes under usual light and light 0.3. With ACT and fixed light, seeds 0 and 1 achieved 0/100 and 1/100 respectively in both conditions; with variable light, both achieved 0/100. For seed 1 one scene was solved only by the network trained under fixed light, in both usual and altered conditions. The variable-minus-fixed difference was -1 percentage point in each condition, with paired scene-bootstrap interval from -3 to 0 points. Seed 0 had no discordant successes: its bootstrap of differences collapses to zero and does not eliminate uncertainty.
All four diffusion networks achieved 0/100 under each condition. For seed 0, final coverages matched scene by scene between both branches, but only 69 of 100 trajectories were exactly equal in each condition: equal final outcomes do not imply the robot moved identically. For seed 1, mean coverage under usual light was 5.50% with fixed training and 5.39% with variable training; under light 0.3 it was 5.61% and 5.60%. A local test with four image pairs and the same physical input detected small changes in the network’s noise prediction, but does not measure success or demonstrate robustness. With two training runs per branch, these results do not show a conclusive improvement from varying light.
A perturbation during an episode asks another question. An impulse applied at a random instant can arrive before contact or while the policy executes a chunk. Save time, direction, and magnitude, and use the same seed sequence for compared policies. Aggregate success can hide that a policy fails only when the impulse arrives near a transfer: segment afterward by phase, but identify that analysis as exploratory if it was not prespecified.
To isolate lighting diversity from trajectories, generate_light_diversity.py replays recorded actions with light factors between 0.5 and 1.2 and renders again. In our own check of 100 episodes, actions and physical states exactly matched the originals while all 100 initial images changed. The original dataset and its varied-light copy form pairs for a training experiment; that check does not yet show improved robustness. Hold out an intensity outside the range, such as 0.3, for a separate test and keep the episode count equal across both arms. This studies lighting, not object or movement diversity.
python generate_light_diversity.py --source RUTA_ORIGINAL --out luz_variada --count 100
To run it, also place p13_pusht.py and p13_collector.py in the working directory. The program checks length, success, and states during replay before accepting each episode. After generating data, compare frames and save both dataset hashes to confirm the visual intervention was applied to the same trajectories.
To reproduce the visual contrast, run the following command once with the fixed-set path and once with the varied-light set path, using a different output directory for each branch. The limit is applied before permutation: select the first 100 episodes from each paired set and then use permutation 2026. This avoids accidentally including the 20 additional episodes from the fixed pool.
python sweep_policies.py --data RUTA_RAMA --out RESULTADOS_RAMA \
--act-script act_experiment.py --diffusion-script diffusion_experiment.py \
--families act diffusion --sizes 100 --pool-limit 100 --seeds 0 1 \
--steps 2000 --phase train --train-device cpu
Repeat the command for each branch, replacing --phase train with --phase eval and adding --eval-device cpu --conditions id light: it will evaluate each checkpoint in both conditions with 100 episodes by default. Keep checkpoints and results separate by branch to avoid confusing which lighting was used in training. In this contrast, “variable” refers to light intensity during demonstrations, not collecting new trajectories or changing object shape.
Use the same initial seeds for each policy when possible. This allows examination of paired differences by scene. Report successes and episodes per condition, mean coverage and its uncertainty, and dispersion among models trained with different seeds. A Wilson interval for 100 episodes of one checkpoint describes uncertainty in that checkpoint’s rate under those conditions; it does not alone capture training variation. Do not add 300 episodes from three networks as if they were 300 rollouts of one fixed network.
A descriptive alternative for the mean across training runs is to resample training seeds and scenes. If models are evaluated on the same scenes, use the same indices for all when resampling scenes: this preserves pairing. With only two training runs per family the interval is especially unstable and does not replace repeating more seeds; bootstrap also cannot correct a scene set that does not represent intended deployment.
The empirical bootstrap can only reselect observed results. If all 200 rollouts from two models fail, every replicate is zero and the percentile interval collapses to . That band does not mean the true success probability is exactly zero. For that reason, per-model counts and each model’s Wilson interval are retained alongside the descriptive band for the mean across training runs.
When two policies are tested on the same scene, each pair can fall into four categories: both succeed, only the first succeeds, only the second succeeds, or both fail. A ten-point rate difference can correspond to ten scenes where only one policy succeeds, or many more discordant scenes that offset each other. Saving per-seed results distinguishes these cases and lets you look for scene features accompanying each failure. If a policy is evaluated with another observation or budget, scene pairing improves comparison but does not make architecture the only difference.
A 0% rate in 100 rollouts does not prove success probability is exactly zero. For a 95% Wilson interval, the upper endpoint is approximately 3.7% under the binomial model for that checkpoint and distribution. Variation among trained networks, switching to another simulator, and measurement errors fall outside that interval. If rare successes occur, report numerator and denominator alongside the interval instead of rounding the rate without context.
Exercises
import numpy as np
class Perturbador:
def __init__(self, env, cambio, inicio, fin):
pass
def reset(self, seed):
pass
def step(self, action):
passA scaling curve only makes sense alongside its subsets, seeds, and test distribution. More episodes and more diversity are distinct variables; measure each out-of-distribution change separately and report uncertainty at episode and training levels.