Kimi-K3 lora RL day-0 support - #1825
Open
yueming-yuan wants to merge 3 commits into
Open
Conversation
yueming-yuan
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
guapisolo,
jybsuper,
maocheng23 and
yushengsu-thu
as code owners
July 27, 2026 15:55
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Megatron training backend for Kimi K3 plus the colocated SGLang rollout path it needs for RL. Model: KDA (delta-rule) and MLA attention per layer, the attention-residual snapshot bank, and situ activation, under TP/EP/PP/CP. Native LoRA adapters are applied in-model, with shared-A/per-expert-B factors for the 896-expert MoE, and exported to the rollout engines as HF-named chunks over CUDA IPC. Also included: mbridge and megatron_bridge plugins, megatron->HF conversion, MXFP4 pack/unpack plus an MXFP4->BF16 checkpoint tool, and the launchers.
6 tasks
…lts, EP derivation; disable sglang NUMA membind by default; drop manual CUDA-IPC collection from the LoRA push
This was referenced Jul 29, 2026
This was referenced Aug 8, 2026
Zhichenzzz
added a commit
that referenced
this pull request
Aug 11, 2026
…nkling Kimi-K3 now has a page. It documents the day-0 LoRA RL recipe from #1825: the MXFP4 to BF16 upcast, the 32-rank torch_dist conversion, and the validated 16-node launch, with the LoRA target modules and what a healthy run looks like on the GB300 validation cluster. A line at the top says the branch it comes from, since none of it is on main yet. The page leans on two things worth calling out. LoRA is not a nicety here, it is what makes the recipe fit: the base stays frozen and only the adapters carry gradients, with one shared A factor and per-expert B factors across the 896 experts. And the memory figure in "what a healthy run looks like" is the one to watch, because an adapter export that leaks shows up as allocated memory not returning to baseline after a weight sync, long before the run dies. Inkling still said its implementation "is open at" #1683. That merged on 2026-08-03 and the code is on main, so the line is gone; the page is the documentation now. Both tables link Kimi-K3 at the page instead of the pull request. MiMo and GPT-OSS move below JoyAI so the families the home page lists appear in the same order in both, with the two it does not carry after them.
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.
Blog
check details and experiment results in:
https://www.lmsys.org/blog/2026-07-27-kimi-k3-day0-support
Usage
sglang branch: https://github.com/sgl-project/sglang/tree/sglang-miles-k3
Docker image:
docker.io/radixark/miles:kimi-k3(multi-arch amd64/arm64; on Hopper setSGLANG_K3_ATTN_RES_MODE=jit)About
Megatron training backend for Kimi K3 plus the colocated SGLang rollout path
it needs for RL. KDA and MLA attention per layer, the attention-residual
snapshot bank, and native LoRA adapters under TP/EP/PP/CP — with shared-A /
per-expert-B factors for the 896-expert MoE, exported to the rollout engines
as HF-named chunks over CUDA IPC.
Reproduce
The image ships miles (
/root/miles, editable) and sglang(
/sgl-workspace/sglang, editable) at the validated pins, flashinfer0.6.15.post1, and a smallshm_unlinkshim preloaded via/etc/ld.so.preload(tolerates a benign PyTorch CUDA-IPC unlink race thatotherwise aborts colocated weight sync at scale).
Prepare (once). Only external asset: the Kimi K3 MXFP4 HF checkpoint.
Everything else derives in-repo (run from
/root/miles, Megatron onPYTHONPATH):Run (validated on 16 nodes x 4 GPUs). One container per node, bring up a
ray cluster across the nodes,
export MILES_SCRIPT_EXTERNAL_RAY=1, then:(
--rollout-max-concurrency 8explicitly: the field default is 64, thevalidated runs pin 8.)
Expected. Resolved config at startup shows
expert_model_parallel_size 8,max_tokens_per_gpu 8192,colocate_memory_peak_device gpu,lora_base_cpu_backup True. On our GB300 validation runs: ~11-13 min perrollout cycle; trainer allocated returns to ~91 GB after every weight sync;
rollout/raw_reward0.5-0.75 from rollout 0;eval/aime0.37-0.43 at eval@0(temp-0 nondeterminism band), rising >= +0.06 by eval@9 (we measured
0.367 -> 0.467).