DSV4: Add LoRA support - #4907
Open
systalyze-ai wants to merge 1 commit into
Open
Conversation
systalyze-ai
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
vipannalla and
xibinliu
as code owners
August 17, 2026 15:25
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
Maps LoRA to the DeepSeek-V4 attention and shared-expert modules and derives the qwix warmup batch from the active logical-axis rules. Co-authored-by: Sudarsanan <sudarsanan@systalyze.com> Co-authored-by: Armin <armin@systalyze.com> Co-authored-by: utlz <utilyze@systalyze.com>
systalyze-ai
force-pushed
the
upstream-pr/deepseek4-lora-enablement
branch
from
August 17, 2026 18:09
2bc59cf to
4eb1e86
Compare
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.
Description
MaxText currently does not support DeepSeek-V4 with LoRA. This PR adds the module mapping: LoRA applies to the attention projections (
wq_a,wq_b,wkv,o_a_proj,o_b_proj) and the shared-expert MLP (wi_0,wi_1,wo), in both scanned and unscanned layouts, with routed experts excluded.Tests
JAX_PLATFORMS=cpu XLA_FLAGS=--xla_force_host_platform_device_count=8 pytest -q tests/post_training/unit/lora_utils_test.py— 23 passed.deepseek4-tinyapply produces exactly 80 LoRA leaves in both scanned and unscanned layouts.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.