Skip to content

DSV4: Add LoRA support - #4907

Open
systalyze-ai wants to merge 1 commit into
AI-Hypercomputer:mainfrom
systalyze-ai:upstream-pr/deepseek4-lora-enablement
Open

DSV4: Add LoRA support#4907
systalyze-ai wants to merge 1 commit into
AI-Hypercomputer:mainfrom
systalyze-ai:upstream-pr/deepseek4-lora-enablement

Conversation

@systalyze-ai

@systalyze-ai systalyze-ai commented Aug 17, 2026

Copy link
Copy Markdown

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.
  • A five-layer deepseek4-tiny apply produces exactly 80 LoRA leaves in both scanned and unscanned layouts.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@systalyze-ai systalyze-ai changed the title Add DeepSeek-V4 LoRA support on the mainline trainer DSV4: Add LoRA support on the mainline trainer Aug 17, 2026
@systalyze-ai systalyze-ai changed the title DSV4: Add LoRA support on the mainline trainer DSV4: Add LoRA support Aug 17, 2026
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
systalyze-ai force-pushed the upstream-pr/deepseek4-lora-enablement branch from 2bc59cf to 4eb1e86 Compare August 17, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants