AutoTP rollout engine: generate with a tensor-parallel copy of a ZeRO training model

Aperta
#9,022 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Start by reading the existing RolloutEngine interface, HybridEngineRollout, the build_rollout factory, and _resolve_autotp_partition plus the universal-checkpoint restore path. Then trace how ZeRO exposes master weights through safe_get_full_fp32_param and how AutoTP records layer layout metadata. Done means an opt-in AutoTP rollout engine syncs weights in memory, generates across ranks with matching tokens and rank-local output layouts, and is wired into the factory.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Is your feature request related to a problem? Please describe.

HybridEngineRollout generates with the training model itself, on each rank's own ZeRO replica. Users who train with ZeRO have no built-in way to run rollout tensor-parallel across ranks unless training also moves to AutoTP. Keeping a separately sharded inference model current today takes a checkpoint round trip, which is too slow to repeat at every RL step.

Describe the solution you'd like
A new opt-in engine, build_rollout(RolloutConfig(engine="autotp"), ...). AutoTPRollout leaves training on ZeRO and generates with a separate inference copy sharded across all ranks with AutoTP. sync_weights(step) refreshes the copy in memory after each optimizer step.

  • Sync: safe_get_full_fp32_param gathers each master weight, and _resolve_autotp_partition, the universal-checkpoint restore path, cuts this rank's shard from the layout metadata each AutoTP layer records. Sharing that function means sync and checkpoint restore cannot disagree about a layout.
  • Generation: one TP group spans all ranks, so ranks generate together. Each rank's left-padded prompts are gathered and padded to a common width, the union is generated once with a shared seed, tokens are checked to match on every rank, and each rank gets back only its own rows in its own [B', T_p + T_r] layout.
  • Size: one new module on the existing RolloutEngine interface, plus factory wiring. No changes to HybridEngineRollout, the engine, ZeRO or deepspeed.comm.
  • Cost: the inference copy needs roughly one more model's memory, divided by the number of ranks.
  • Not supported at first: graph capture, shared prefill, continuous batching, models with tied embeddings.

Describe alternatives you've considered

  • Keep using HybridEngineRollout. This is the simpler option, needs no second model and no weight sync, and remains the default (see #8942). This engine is an opt-in addition for users who want tensor-parallel generation while training on ZeRO.
  • Reload weights through a universal checkpoint. I tested this path and it produces correct weights, but it needs disk I/O for every update, and DeepSpeed has no reader from universal checkpoints into a plain inference model.
  • Train with AutoTP as well, so rollout can share the model (#9008 addresses the rollout cache sizing for this setup). That changes the training configuration, which not every user wants.
  • Keep this outside DeepSpeed, in DeepSpeedExamples. It would then depend on the private _resolve_autotp_partition, which is one of the questions below.
Lingua principale
Python
Stelle
43.3k
Fork
5.1k
Merge medio
5g 10h
PR unite (30g)
85

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di deepspeedai/DeepSpeed

Tutte le issue di deepspeedai/DeepSpeed

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.