feat(kimi-k3): add expert LoRA and tune full SFT - #3683
Draft
HuiyingLi wants to merge 2 commits into
Draft
Conversation
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
akoumpa
previously approved these changes
Aug 26, 2026
Signed-off-by: HuiyingLi <willwin.lee@gmail.com>
HuiyingLi
marked this pull request as draft
August 26, 2026 06:21
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 does this PR do ?
Adds a production-scale Kimi K3 ordinary-LoRA SFT example and updates the existing full-FT SFT recipe to use HybridEP with reshard-after-forward.
Changelog
examples/llm_finetune/kimi/k3_hellaswag_lora.yamlwith PP4/DP32/EP32, HybridEP,torch_mmexperts, selective activation checkpointing, and reshard-after-forward.moe_rank_scaling, which gives the 16-active-expert K3 MoE modules rank 2.examples/llm_finetune/kimi/k3_hellaswag.yamlfull FT from the torch dispatcher to HybridEP and enable reshard-after-forward.Before your PR is "Ready for review"
Pre checks:
Validation
pytest -q tests/unit_tests/recipes/llm/test_k3_lora_recipe.py(2 passedafter the full-FT HybridEP/reshard update)pytest -q tests/unit_tests/recipes/llm/test_k3_lora_recipe.py tests/unit_tests/models/kimi_k3/test_state_dict_adapter.py tests/unit_tests/moe/test_moe_lora_state_dict.py tests/unit_tests/_transformers/test_recipe_doc_coverage.py(39 passed, 3 skippedbefore the full-FT config-only update)python tests/ci_tests/utils/validate_new_recipe_ci.py examples/llm_finetune/kimi/k3_hellaswag_lora.yamlruff format .ruff check --fix .torch_mm+ selective AC + resharding. The adapter contained all routed-expert LoRA tensors at expert rank 2.Additional Information
Based on
mainafter HybridEP token-count equalization in #3641. K3 expert-LoRA HF adapter key conversion is already covered by #3435. The full-FT HybridEP/reshard update is covered here by a config-contract test; it has not yet been rerun as a separate GPU job in this PR.