Lego-RL

Runs

The sandbox-to-optimizer loop, and the three run types that share it

Three run types share one runner contract, one config format and one validation path:

Run typeWhat it doesGuide
trainoptimizes the policy on a task indexTraining
evalscores a fixed checkpoint on a held-out setEvaluation
infersamples the agent without training, to measure difficultyRollout Generation
task index ─▶ [ rollout generation ] ─▶ [ training ] ─▶ [ evaluation ]
                  difficulty filter      checkpoints     held-out score

A run is one .env config copied from a template. It launches by hand or through the agent plugin; both paths call the same runner and the same checks.

cp scripts/train/_template.env scripts/train/configs/my_run.env

PREFLIGHT_ONLY=1 bash scripts/train/train.sh scripts/train/configs/my_run.env   # validate
bash scripts/train/train.sh scripts/train/configs/my_run.env                    # launch

Each guide is written to the same shape — Prerequisites → Setup → Check → Run → Output → Dashboard → Cleanup — so the page tells you what it needs, what it writes, and which run type reads that output next. Running the Pipeline is the same material in run order, across all three at once.

Startup sequence

A train run comes up in this order: vLLM serves the policy, the in-process proxy fronts it, and verl drives the RL loop while the agent rolls out across tasks in Harbor sandboxes.

  1. Config: the runner sources scripts/lib/site.env and your config, applies the model preset, and resolves the scaffold and backend.
  2. Validation: nine classes of fatal assertion. The run stops here on any .
  3. venv: built once by scripts/setup_env.sh, or reused via VENV_PATH.
  4. Ray: the cluster comes up and waits for NNODES nodes to join.
  5. vLLM: verl launches DP × TP replicas. CUDA-graph capture on a 30B MoE (TP=4) is ~10–20 min before the first replica registers.
  6. In-process proxy: started by the verl agent loop. It advertises a per-session URL per trial (no standalone LiteLLM, no fixed port).
  7. verl loop: generate rollouts → run trials in Harbor → reward → update → checkpoint every SAVE_FREQ steps.

Where to go next

The three run types, each a full walkthrough:

What applies to a run once it is up:

Start single-node

A sync_* template on one 8×GPU host is the minimal-cost configuration. Move to an async_* template and more machines only when it is no longer sufficient; see Scaling Up.

Stop cleanly between runs

Between runs, bash scripts/cleanup_before_run.sh stops Ray, frees ports, and reaps stale vLLM/verl processes. Checkpoints and wandb runs are preserved; set KEEP_TRIALS=0 to also clear the trials dir. It never kills running GPU tasks.

On this page