Enable quantized multi-token-prediction - #5141
Open
shuningjin wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for quantizing Multi-Token Prediction (MTP) layers in MaxText when using FP8 quantization (fp8_full). It adds a new configuration parameter quantize_mtp (defaulting to false), along with validation rules, updates to Qwix quantization rules to target the mtp_block module path, and handling for cases where GMM quantization rules are absent. Additionally, a verification script and unit tests have been added to ensure correct interception behavior. There are no review comments, so I have no feedback to provide.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
shuningjin
force-pushed
the
shuningjin-mtp
branch
from
September 4, 2026 18:05
4ba5680 to
1ae817e
Compare
shuningjin
marked this pull request as ready for review
September 4, 2026 18:09
shuningjin
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
bvandermoon,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
jshin1394,
khatwanimohit,
liudangyi,
michelle-yooh,
richjames0,
shralex,
vipannalla,
xibinliu and
zxhe-sean
as code owners
September 4, 2026 18:09
CaptainO5
approved these changes
Sep 4, 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.
Description
Enables FP8 quantization support for Multi-Token Prediction (MTP) layers via Qwix interception.
Bug: b/552423947
Changes:
base.yml), Addedquantize_mtpflag (default:false). Requiresmtp_num_layers > 0andquantization='fp8_full'quantizaiton.py), Inget_fp8_full_qwix_rule_w_sparsity, expanded the rule target module path to include(decoder/.*layers.*|mtp_block/.*)whenquantize_mtp=True.multi_token_prediction_test.py):MTPQwixInterceptionTestAdditional Change:
fp8_full, main model's MoE blocks match Qwix rule. MTP's MoE blocks can have no Qwix rule ifquantize_mtp=False.More Context - model structure: log
Tests
Unit Tests
Verified Qwix interception tracing for
mtp_blockdot_general ops under CPU abstract evaluation:JAX_PLATFORMS=cpu pytest tests/unit/multi_token_prediction_test.py -k "MTPQwixInterceptionTest"Auxiliary Test
Qwix log: MTP interception correct. script, log
E2E Validation
Checklist
Before submitting this PR, please make sure (put X in square brackets):