Skip to content

Update client-server RL, distillation, and checkpoint workflows - #403

Merged
tastelikefeet merged 37 commits into
dev-swift-v5from
fix/transformers-task-head-checkpoint
Nov 23, 2026
Merged

tastelikefeet merged 37 commits into
dev-swift-v5from
fix/transformers-task-head-checkpoint

Conversation

@Yunnglin

@Yunnglin Yunnglin commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Update the synchronous and streaming GSM8K and Blackjack GRPO recipes. Standard vLLM sampling supports the streaming GSM8K recipe without a DataPlane deployment. The sampler pool keeps health probes responsive under load and settles in-flight work after a replica stops.
  • Add Twinkle SDK examples for GKD, OPD-RL, and OPSD. Reuse response-token scoring through forward_only, preserve GKD's batched teacher logits over HTTP, and support AdamW on Megatron.
  • Preserve task-head and LoRA checkpoint snapshots, fix Ray worker startup, simplify Serve routing, and report upload progress and revisions, and let clients reconnect to the original Hub upload. Keep stop_training and the returned training ID from dev-swift-v5. Cleanup can retry a lost release response against the same training ID.

Server and SDK simplification

  • The launcher and resource owners now read the worker environment allowlists from one module. The resource options model lives separately. Repository references to the former config module were limited to server internals and tests.

  • TwinkleClient.dataset() and TwinkleClient.dataloader() use the owning client's transport. Dataset and DataLoader already accept an explicit transport, and the removed RPC helpers served only their shared wrapper. Sampler construction stays guarded because it sends a request. Training model construction is local.

  • The training router delegates Hub uploads to a separate module. Upload and release use the existing background queue. Twinkle and Tinker creation share catalog and rank validation and keep their existing error messages.

  • Twinkle HTTP calls now use a distinct request ID with a stable client ID. Retries keep their request ID. Adapter ownership and sampling replay prefer the session, then the client ID, then the fixed request ID from older SDKs. The internal ClientContext field is now client_id. Tinker keeps a static request ID in its default headers.

  • Cookbook server scripts converge on twinkle-server launch -c. The three Python launchers' remote-code settings move into their YAML files and propagate to Ray workers. Megatron still supervises the same server child PID.

Validation

  • 429 focused CPU tests passed, including the three Blackjack cookbook entry points, interrupted rollout cleanup, release retries, continuation scoring, and checkpoint and upload regressions.
  • Local Ray Serve mock startup and the Twinkle and Tinker HTTP flows passed. CPU distillation smoke checks covered all three methods and rejected misaligned response tokens.
  • On PPU4, the sampler health fix in 886c655a completed two optimizer updates with the default sampler configuration, published a changed LoRA, and sampled again using it. The run used Qwen3.5-4B and fixed GSM8K-format inputs.

Simplification validation at 325a5007

  • 187 focused local tests passed after excluding one existing Megatron static guard failure. All route contract tests passed, and the route snapshot is byte-identical.
  • Nine server cookbook configurations passed schema validation. Two configurations used placeholder model paths for environment interpolation.
  • The full local non-slow server/client suite had 1,103 passes, 100 skips and seven failures. All seven reproduced on 7f315a95 in the same environment. The Ray Serve CPU probe passed managed HTTP flows for both SDKs, including release and recovery. Ruff passed for the changed server files, while repository-wide lint remains red.

Request identity and startup validation at 27a3defe

  • 256 focused tests passed. A broader non-slow run outside the integration directory and managed training HTTP probe recorded 1,109 passes and 35 skips, with the same seven failures as the baseline.
  • The installed CLI started a CPU Ray Serve mock. HTTP checks covered legacy and current client identities, session precedence, sampler health, and the pinned Tinker SDK connection. The driver shut down cleanly.
  • All nine cookbook server YAML files passed schema validation, and all four startup scripts passed Bash syntax checks. A shell probe also checked Megatron child PID tracking and Transformer config resolution. GPU cookbook startup remains pending.

Review follow-up

  • Twinkle commit 5c6ca5a9 fixes expired training-handle cleanup. Scoped close settles only structured terminal 404 responses and forgets both the local binding and its release closure. Explicit removal still reports the 404, while plain route-not-found responses remain failures and retain retry ownership. This prevents a terminal handle from blocking every subsequent close and leaking the HTTP connection pool without masking an API route mismatch.
  • A real ModelScope upload using modelscope-hub==0.7.1 created a private repository and uploaded two files successfully. The raw SDK response contained commit_id, and progress callbacks reported upload and commit events. A contract test now pins that real response shape. The ModelScope entry point also has an explicit dependency guard; the Hugging Face progress limitation and StreamingDriver.close() exception contract are documented.
  • Companion PR fix(recipe): preserve training errors during driver close ms-swift#10610 (c976a9a1d, based on dev-swift-v5) guards driver cleanup in GRPO, PPO, RFT, distillation, and inference. A close failure no longer masks an in-flight training exception or skips subsequent device reclamation; without a primary exception, close failures still propagate.
  • Follow-up validation: 11 focused expiration/release tests passed, including structured-expiry, explicit-removal, and plain-route-404 regressions. Another 30 asynchronous-component, rollout-resource, and Hub tests passed. Two Swift cleanup-contract tests passed, and all six modified Swift source files passed compilation. git diff --check passed in both repositories.

Supersedes #402.

Keep mock template setup independent of model assets so the sampler smoke tests can run offline.
Migrate the three Blackjack entry points to the session rollout API and document CPU client setup and training output.
Require one Processor replica and close expired Dataset and DataLoader workers. Preserve authentication, session IDs, request IDs, and worker plugin setup.

Remove redundant training session lookups and exercise Processor cleanup and both SDKs over HTTP.
Poll physical completion outside Serve so long generations cannot block health probes. Settle unfinished tasks by their persisted replica owner after shutdown is confirmed.
@Yunnglin
Yunnglin marked this pull request as ready for review November 20, 2026 09:13
Treat structured terminal 404 responses as settled during scoped close while preserving explicit removal errors and route failures. Pin the verified ModelScope commit response and document cleanup contracts.
@tastelikefeet
tastelikefeet merged commit dad54af into dev-swift-v5 Nov 23, 2026
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants