[DO NOT MERGE, pending rebase and sequential smaller PRs after eager-model merge] Kimi K3: full tree with 5D parallelism multimodal, LoRA, MoonViT Dynamic CP&DEP, MXFP4/MXFP8 QAT, quantile balancing - #4281
Draft
QIU023 wants to merge 15 commits into
Conversation
… CP for the tower
…ng the TP plan and the KDA DTensor shims
QIU023
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
August 22, 2026 06:41
QIU023
marked this pull request as draft
August 22, 2026 06:48
This was referenced Aug 22, 2026
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.
Draft, and not for merge, providing for early timeline and accessable for full 2.8T param 5D smoke while waiting for PR-4025.
Would need maintainers thorough review on later major parallelize.py sharding.py declaration on major module parallelism support in titan.
Pending final evaluations and fixes before publishing: MXFP4 QAT and packed-MXFP4 import, quantile load balancing, MTP, LoRA, the decoupled vision encoder, a MoonEP token dispatcher, and the HF <-> DCP key map for the released checkpoint.
PR-4025 is a separate implementation of the same model and is further along on the model itself. When it lands, this rebases onto it and what remains is the parallelism and the post-training pieces. Filing now is disclosure, not a request to review 28k lines.
98 files, +28307 -28. The 28 deletions are the thing to notice -- this is almost entirely additive, and the five core files it does touch are listed in commit 14.
The fifteen commits are sliced by content rather than by the 409 commits of history that produced them:
model.pymodel_configs.pyconfig_registry.pyattn_res.pyattn_res_model.pylayout.pymoe.pyquantile_balance.pycommon/moe.pymoonvit.pymultimodal_model.pyvision_preprocess.pyquant_scope.pykcp.pyvit_cp_plan.pypipeline_adapter.pydep_bubble_*.pyvit_prefetch.pymoon_ep_dispatcher.pymxfp4_qat.pypacked_mxfp4.pylora.pymuon.pyhf_key_map.pystate_dict_adapter.pyparallelize.pydistributed/{fsdp,utils}.pycomponents/{lr_scheduler,optimizer}.pytests/(56 files)Two upstream defaults have to be overridden to run it, both pinned in our gate rather than worked around in the model.
spmd_backendneedspartial_dtensor: underspmd_types,fully_shard()wants every parameter to already be a DTensor on the full SPMD mesh, and TP additionally tripsassert_type() does not support DTensor, so supporting it is the declarative conversion itself rather than a patch on top -- that is the largest gap between thisparallelize.pyand an upstream model's, and it is what we are doing next. And CUDA graph capture needs--training.disable-cuda-graphs, because the vision path's patch count varies per batch and capture validation rejects it; that one is not specific to this model, so it may deserve its own issue.Evidence: 58 of 58 gate cells pass on this tree, ten steps each, with those two pins. Per-cell loss and grad_norm for every step of all 58 are here, one line per cell:
https://github.com/QIU023/torchtitan_attention_residual/blob/f81a19319506ef1c3d3e2b8fc6eadbf7e6d99feb/phase13_k3like_48b_posttrain/gate_logs/gate_58_2026-08-21_final_percell.txt
The three model arms are text, multimodal, and multimodal+LoRA, 18 cells each, over dp / fsdp / tp / cp / pp / ep and their combinations up to
ep2_fsdp2_tp2_cp2; the remaining four are the two decoupled-encoder cells at pp4 and pp8 and the two pp8xvp4 cells.