Add online-live mode: train drafters from production serving traffic - #763
Open
sherlockwu wants to merge 2 commits into
Open
Add online-live mode: train drafters from production serving traffic#763sherlockwu wants to merge 2 commits into
sherlockwu wants to merge 2 commits into
Conversation
Retry/quarantine transient Mooncake get_into failures, teach the SGLang spec-capture path about dspark, force flex attention for short draft GQA queries, and refresh the multi-GPU example recipes with WandB and watermark settings. Co-authored-by: Cursor <cursoragent@cursor.com>
Real users send ordinary requests to a live-patched SGLang server; the server captures hidden states over prefill + generated tokens, writes tensors straight into Mooncake, and pushes tensor-free capture records to a producer-hosted intake. Everything downstream (channel, ref distributor, trainer, ack-driven frees) is the unchanged online-disagg consumer. - patches/sglang/online-live: layered patch on the v0.5.14 base (apply with scripts/apply_sglang_spec_capture_patch.sh --live). Config handshake (GET /v1/spec-capture/config) supplies store id, feature names, passthrough synthesis, and token bounds, so SGLang stays algorithm-agnostic; capture decisions and sample ids derive deterministically from the request id for TP-rank consistency; a bounded background writer keeps Mooncake/intake I/O off the scheduler loop and removes written keys whenever the record is not accepted. - Flow control is shed-based (429 above the in-flight/byte watermarks; the Mooncake pool is the final bound) because user traffic cannot be paused; a min_num_tokens floor keeps warmup/probe one-token requests out of training. Failures never touch the user response. - deployment.disaggregated.live selects the mode; live.mooncake + live.trainer_cuda_visible_devices opt into a one-command managed supervisor (Mooncake master + producer + consumer). - scripts/online_live/: launch_capture_server.py (derives all SGLang flags from the run config) and live_traffic_mimic.py (ShareGPT traffic generator matching driven-mode capture semantics). Validated end to end: two 10k-step qwen3-4b DSpark runs from live traffic (qps 5 and qps 4), acceptance accuracy ~0.49-0.54 and position-0 ~0.64-0.69, matching the driven disagg-online curve shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sherlockwu
requested review from
FlamingoPg,
FrankLeeeee,
shuaills and
sleepcoo
as code owners
August 10, 2026 17:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new online-live training mode: production SGLang servers capture hidden states from real user traffic and push them to SpecForge for drafter training — closing the serve→train loop. The existing driven disagg-online mode (SpecForge originates capture requests from a dataset) is unchanged and the two modes coexist.
Design
The tensor path was already push-based (sink → Mooncake); only the metadata path inverts:
min/max_num_tokens) from the intake, so SGLang stays algorithm-agnostic. Only two new SGLang flags:--spec-capture-intake-url,--spec-capture-sample-rate.prompt + output[:-1]); capture decision and sample id derive deterministically from the request id so all TP ranks agree.min_num_tokens: 2keeps SGLang warmup/probe one-token requests out of training (DFlash-family objectives need two consecutive supervised tokens).patches/sglang/online-live/on top of the v0.5.14 base patch;scripts/apply_sglang_spec_capture_patch.sh --liveapplies/reverses it with its own content-aware record.How to run (3 terminals)
Manual (non-supervised) launches also work: drop
live.mooncakefrom the config, run your ownmooncake_master, and start--role producer/--role consumerseparately; the producer prints the exact SGLang flag line at startup.Validation
test_live_intake,test_disagg_live_producer— real HTTP → real channel end-to-end,test_sglang_live_capture_patch) plus schema/launch-plan extensions; all suites green (config 58, runtime 632).v1 limitations (documented in
specforge/inference/sglang_patch_inventory.md)--chunked-prefill-size -1still required; the capture server cannot itself serve with speculative decoding; retracted requests drop their capture; a sink crash between Mooncake write and key removal leaks hard-pinned orphans until the store restarts; liveloss_maskis all-ones.