[DeepSeek-V4] Implement model integration, decoders, and configuration stack#4153
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
2a19018 to
23adce0
Compare
Contributor
|
🤖 Hi @parambole, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
bb75291 to
631941c
Compare
shuningjin
reviewed
Jun 17, 2026
Collaborator
There was a problem hiding this comment.
Thank you!
- The unscanned seems have error. Could you fix and add it to train compile unit test as well?
python -m maxtext.trainers.pre_train.train_compile src/maxtext/configs/base.yml compile_topology=v5p-256 compile_topology_num_slices=1 model_name=deepseek4-284b per_device_batch_size=1 scan_layers=false run_name=test attention=dot_product
https://paste.googleplex.com/6636383660802048
The param structure seems different from other models. Could you make it more consistent?
For the scanned structure, while it seems different from deepseek3, it is consistent with gemma4. I guess this is fine
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=deepseek3-671b scan_layers=true
https://paste.googleplex.com/6550606788558848
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=deepseek3-671b scan_layers=false
https://paste.googleplex.com/6331198317133824
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=llama4-17b-16e scan_layers=true
https://paste.googleplex.com/6228521688104960
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=gemma4-26b scan_layers=true
https://paste.googleplex.com/4838680605884416
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=deepseek4-284b scan_layers=true
https://paste.googleplex.com/6297935070494720
python src/maxtext/checkpoint_conversion/inspect_checkpoint.py maxtext \
model_name=deepseek4-284b scan_layers=false
07344c7 to
b2cd306
Compare
ed80280 to
1750de1
Compare
Collaborator
Author
@shuningjin Great catch and thank you for adding the tool. I have fixed the error and rerun the test |
1750de1 to
9a378f3
Compare
shuningjin
approved these changes
Jun 18, 2026
228323c to
48bdd7a
Compare
aireenmei
approved these changes
Jun 18, 2026
dipakg-lang
approved these changes
Jun 22, 2026
48bdd7a to
7a4172f
Compare
4 tasks
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
This PR introduces native architectural and routing support for the DeepSeek V4 model in MaxText.
Why & What: DeepSeek V4 introduces non-uniform architectural features that require explicit configuration unrolling. This PR solves the integration by implementing:
[0, 0]prefix compression ratios, the perfectly alternating[4, 128]scanned middle layers, and the[4, 0]suffix layers.Tests
tests/unit/deepseek_v4_vs_reference_test.py.v5p-512mesh to guarantee memory constraints and HLO generation.Compile Command to Reproduce:
Proof of Compilation:
Checklist
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.