Back to Roadmap
Phase 4.23 days

Distributed Training Setup

Upgrade the training infrastructure into a production-quality distributed pipeline with DeepSpeed ZeRO-1, bf16, gradient accumulation, distributed-safe checkpointing, and validated 8-GPU training mechanics.

Primary Goal

The current trainer can run basic DDP, but it still lacks the distributed features needed for production VLA training. Phase 4.2 closes that gap.

Fixed Upstream Decisions

VLAModel

Phase 4.1 already defines the forward(batch) contract with total_loss, text_loss, action_loss, and metrics.

Loss modules

Phase 4.1 already provides the text, action, and combined loss modules, with total_loss as the scalar used for backpropagation.

Batch format

The distributed pipeline must consume the fixed 8-key Phase 3.2.4 batch dict.

Cluster

Gilbreth remains the production target: 4 nodes, 2 A100 80 GB GPUs per node, InfiniBand, SLURM, and torchrun via srun.

Distributed stack

DeepSpeed ZeRO-1 with NCCL is the chosen production distributed stack.

Precision

bf16 remains the training precision defined by the existing trainer and DeepSpeed configs.

Key Stance: Adapt Existing Infrastructure

Build on the project’s current trainer, configs, SLURM templates, and tracking stack, then validate distributed mechanics with synthetic VLA batches before real Phase 2.3 data exists.

  • Upgrade the existing training stack instead of building a parallel one.
  • Use synthetic VLA batches to validate sharding, checkpointing, and throughput before the real VLA dataloader is ready.
  • DeepSpeed ZeRO-1 is the production path, while local development keeps DDP as the fallback.
  • Prioritize distributed correctness before throughput optimization.

Distributed Training Setup Tasks

Four core components to build and validate for the Phase 4.2 distributed training stack.

4.2.0

DeepSpeed-Integrated Training Loop

Upgrade the Trainer to support DeepSpeed ZeRO-1, bf16, gradient accumulation, warmup scheduling, tracking, and the VLAModel training interface.

Why This Matters

The current trainer only covers basic DDP. Phase 4.2 needs a real distributed training loop that can support a 4B VLA model at production scale.

Checklist
  • Add DeepSpeed initialization branch to Trainer.setup: create model_engine via deepspeed.initialize; skip manual optimizer/scheduler creation
  • Implement _build_deepspeed_config to bridge Hydra config values into DeepSpeed JSON format
  • Refactor training loop: route forward/backward/step through model_engine in DeepSpeed mode; consume VLAModel.forward output dict
  • Disable manual clip_grad_norm_ and optimizer.zero_grad when DeepSpeed is active
Milestone

This step is complete when the Trainer runs 100 distributed steps with DeepSpeed, bf16, accumulation, tracking, and no regressions in the local path.

4.2.1

Distributed Data Pipeline

Create a synthetic VLA dataset and collator that match the full Phase 3.2.4 batch contract and validate distributed sharding behavior.

Why This Matters

The distributed pipeline cannot be validated with the old dummy dataset because it does not match the VLA model batch format.

Checklist
  • Implement SyntheticVLADataset in data/synthetic_vla.py matching all 8 Phase 3.2.4 batch keys
  • Implement VLACollator in data/collator.py for variable-length padding
  • Add collate_fn parameter to create_dataloader in data/loader.py
  • Add data.dataset.name: "synthetic_vla" routing in Trainer._create_dataloaders
Milestone

This step is complete when the synthetic dataset, collator, and distributed sampler tests produce correct shapes, padding, and non-overlapping sample assignment across ranks.

4.2.2

Distributed Checkpoint & Resume

Replace rank-0-only checkpointing with collective DeepSpeed checkpoint save and load, while keeping a DDP fallback and full resume state.

Why This Matters

Production distributed training needs correct optimizer-shard checkpointing, deterministic resume behavior, and safe restarts without loss corruption.

Checklist
  • Refactor _save_checkpoint to dispatch between DeepSpeed and DDP modes
  • Implement DeepSpeed save with client_state containing global_step, epoch, config, wandb_run_id, rng_states
  • Implement DeepSpeed load with client_state extraction and RNG restoration
  • Implement _capture_rng_states and _restore_rng_states helper methods
Milestone

This step is complete when distributed checkpoint save and resume work correctly, RNG states round-trip, and the DDP fallback still loads cleanly.

4.2.3

8-GPU Production Scripts & Throughput Benchmarking

Create production SLURM templates and benchmarking scripts that run the project Trainer on 8 GPUs and record throughput and memory baselines.

Why This Matters

The existing smoke test proves infrastructure only in isolation; Phase 4.2 must validate the actual Trainer, data path, and checkpoint flow at distributed scale.

Checklist
  • Create infra/gilbreth/job_templates/09_smoke_distributed_trainer.sh: 8-GPU smoke test using actual Trainer with Hydra config
  • Create infra/gilbreth/job_templates/10_throughput_benchmark.sh: scaling efficiency measurement at 1/2/8 GPUs
  • Implement scripts/benchmark_throughput.py with sweep, warmup, metrics collection, and report generation
  • Implement scripts/validate_distributed.py with 8 checks and artifact output
Milestone

This step is complete when the 8-GPU smoke test, throughput benchmark, and distributed validation scripts all run and produce the expected artifacts.

Key Deliverables

Expected outputs by end of Phase 4.2:

  • DeepSpeed-integrated Trainer with ZeRO-1, bf16, gradient accumulation, warmup scheduling, tracking, and the VLAModel training interface.
  • Synthetic VLA dataset plus collator for the full 8-key batch format used by the distributed pipeline.
  • Distributed checkpointing with collective save and load, resume support, RNG preservation, and checkpoint pruning.
  • 8-GPU SLURM templates plus throughput benchmarking for the project Trainer on Gilbreth.
  • Validation and test coverage for config build, batch format, sharding, checkpoint roundtrip, resume continuity, and throughput checks.

Definition of Done

Distributed Trainer Running

Trainer.setup() initializes DeepSpeed ZeRO-1 with bf16 and gradient accumulation, while the local DDP path still works.

Synthetic Batch Pipeline Ready

SyntheticVLADataset and VLACollator produce the full Phase 3.2.4 batch format with correct padding and distributed sharding behavior.

Checkpoint Resume Verified

DeepSpeed checkpoint save and load, DDP fallback, RNG restoration, and W&B resume all work correctly.

8-GPU Smoke Test Passes

The project Trainer completes the 8-GPU smoke test on Gilbreth, including checkpoint save at step 100 and successful resume.

Throughput Baseline Recorded

Measured samples per second, peak VRAM, scaling efficiency, and effective batch size are recorded for 1, 2, and 8 GPU runs.

Validation Complete

Distributed tests pass, the validation script exits with all checks passing, and existing tests stay green.

Estimated Duration

3 days

Back to Roadmap