Replay sampler expert routes and token supports in Miles training - #62
Conversation
|
Live MoE validation completed: two matched 10-step DAPO-math runs, using Qwen3-30B-A3B-Instruct-2507. Router replay reduced token-weighted mean absolute sampler–trainer logprob error by 39.2%. These measurements used PR revision
Each batch was also evaluated with replay both on and off on identical tokens and weights, before its optimizer update. Replay improved all 20 paired comparisons, separating the routing effect from differences in the two training trajectories: Expert-index correctness:
Changes needed to run this validation:
These implementation changes remain in the validation worktree; this comment does not claim the unmodified PR head passed the canary. The runtime compatibility fix, audit instrumentation and regression-test patch is available for review. The separate results branch contains documentation/assets; it does not change this PR's source branch. Infrastructure and checks: 35 sampler queue-full HTTP 503 retries, all 35 recovered (queue limit 8, sixteen concurrent sample requests). No observed CUDA/NCCL/OOM failures during completed training. Sampled GPU hardware throttle flags and uncorrected ECC counters were clear. Setup included a CPU controller preemption before any update, controller compatibility fixes, and checkpointed restarts; an occupied-slot resume error was resolved by unloading retired sessions. Both persisted W&B histories and final checkpoints were independently verified at optimizer step 10. 106 targeted replay/Miles tests passed, plus Ruff and diff checks. Experiment GPUs have been released. Scope: this is an attention-LoRA replay smoke test on DAPO math prompts, using group-normalized binary answer reward and asymmetric PPO clipping, with frozen experts. It is not a full DAPO reproduction, reward-convergence result or throughput benchmark. Both modes requested route metadata, while only the enabled mode supplied it to its gradient pass. At the 4,096-token response cap, about 71% of completions truncated. Equal-reward groups produced zero advantages, so 6/10 baseline and 7/10 replay updates had nonzero gradients; all ten optimizer steps succeeded. CP>1 and multi-node trainers remain untested. Per-step metrics and route audit · Matplotlib source · Experiment notes |
Not a blocker for this PR, but did this lead to any scheduling slow-down? Do we need to increase the queue limit?
Looking at the results, this seems like a net-positive change. Are there any downsides to having this an always-on capture that I'm not seeing? Or are we just adopting whatever the default is from Miles (which I'm also okay with) |
There was a problem hiding this comment.
Any reason these hooks need to live in Lilo? Should we eventually upstream this into Miles?
There was a problem hiding this comment.
Yes. The native Tinker route handoff and multi-LoRA replay lifecycle are being upstreamed in radixark/miles#3706 (currently draft). Miles already owns the router selection and CP/SP packing; these hooks fill the missing Tinker-to-training handoff. We can remove the corresponding Lilo adapter once that PR lands and the deployed Miles revision includes it. The sampler response extension and sampling-support/temperature adapter are separate from that upstream router-replay PR.
There was a problem hiding this comment.
No way i didnt realize my agent responded to your review commments
The main problem seems to be that in their sample and train payloads, they seem to adhere to the Tinker spec very closely (ie. for the sample path, make sure that the request follows tinker_types.SampleRequest, which doesn't have any flexibliity for bringing in replay indices/top p mask)
I made the upstream pr just in case but i doubt it'll get merged, for now seems that we can't rely on their willingness to make api changes
| ] | ||
|
|
||
|
|
||
| def install_bridge_replay() -> None: |
There was a problem hiding this comment.
--use-rollout-routing-replay can be passed through to miles via extra_args in config, but the miles tinker build_train_data doesn't pass this into the train batch https://github.com/radixark/miles/blob/cc76e23915b2132ecfff65b97331fd83b02637e6/miles/tinker/runtime.py#L27-L43
the patch we have now is a messy fix -- todo try and upstream this into miles multi lora
There was a problem hiding this comment.
Upstream draft is now open: radixark/miles#3706. It covers the native Tinker training-data handoff and multi-LoRA router replay lifecycle. The local adapter remains necessary until that is merged and included in our deployed Miles revision; sampler flag/response transport and sampling-mask replay are outside that upstream PR's scope.
|
Addressed the review in On the two questions above:
The upstream route handoff/lifecycle work is tracked in Miles #3706. After resolving the overlap with current |
…review # Conflicts: # src/lilo/providers/modal/definitions/qwen3_8_27b_miles_lora_256k.py



Sampling currently drops SGLang's expert routes and token sampling supports, so clients cannot replay either during training. This adds opt-in capture and a sampler-to-
forward_backwardhandoff for the Miles LoRA backend.Changes
lilo.sample_with_replay(...)returns per-sequence replay metadata;sequence.replay.training_inputs(...)turns it into Tinker tensors. JSON and protobuf use the existingloss_fn_inputstransport.sequence.logprobsseparately.Router capture requires
ROLLOUT_RETURN_ROUTED_EXPERTS = Trueon the pool definition and--use-rollout-routing-replayin Miles'extra_args. Sampling-mask capture requires no extra server flag. Both request flags default to false.Validation
forward_backwardto a recording trainer. Tests cover JSON/protobuf round trips, alignment, CP/DP padding, masked gradients, queue cleanup, and rejecting invalid routes without dispatching or poisoning the runtime.ebeeac6plus the compatibility/configuration fixes and instrumentation detailed in that comment. This revision includes the Miles import-path fix; the review changes have not been rerun on GPUs.The GPU experiment used attention LoRA with frozen experts, TP4/EP4/CP1 and activation recomputation. It does not establish reward convergence, capture overhead, CP>1, or multi-node GPU correctness. The helper handles a single continuation, not automatic multi-turn stitching. Full-parameter replay is not implemented here.