• feat(transports): trainer pulls each batch step (#4065)

    carsten released this 2026-10-14 09:58:27 +00:00

    Trainer ranks pull batches: every rank requests step N when it is ready
    to train it, and the orchestrator sends N only once every trainer rank
    asked. So the trainer only ever holds the batch it is training on, and
    the last step the orchestrator sent is always the one the trainer is on.

    • zmq: one ROUTER in the orchestrator, one DEALER per trainer rank (from
      #4066). The orchestrator replies to each rank on the connection it asked
      on, so there's no slow-joiner race, no READY barrier and no hwm.
      ROUTER_MANDATORY raises on a vanished rank instead of dropping.
    • Every trainer rank counts, not one per data rank: requests carry rank,
      world size, data rank and step. A request for any other step raises,
      since it means the two sides resumed from different steps.
    • filesystem: each rank drops step_N/rank_R.request holding the world
      size, and the orchestrator renames the step's files into place once all
      are there.
    • send blocks until the step went out and returns the hand-off
      seconds, logged as time/send_batch. The wait before it is now
      time/wait_for_policy (same key, measured at the send instead of while
      the dispatcher is paused). Encoding happens before the wait.
    • The ship-time policy-version hold is removed: it was a proxy for
      "trainer is ready", which the request now says directly. The dispatch
      gate and off-policy filter still bound rollout staleness.

    Tested on telus (3x H200: 2 trainer ranks + 1 inference, reverse-text,
    20 steps, commit-4b3319f3a + this patch):

    • zmq: finished, mean step 4.14s (steps 2-20), time/send_batch mean
      0.6ms / max 6ms
    • filesystem: finished, both ranks wrote their request marker each step
    • resume from step 15 (zmq): continued to step 20

    Linear: RES-1384

    Downloads