[None][feat] Add Gemma4 MTP assistant support - #15833
Conversation
|
/bot run --disable-fail-fast |
|
PR_Github #56933 [ run ] triggered by Bot. Commit: |
|
PR_Github #56933 [ run ] completed with state
|
346825e to
49e054e
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #57206 [ run ] triggered by Bot. Commit: |
|
PR_Github #57206 [ run ] completed with state
|
ca4cd19 to
4b170de
Compare
4b170de to
c250ca1
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #60734 [ run ] triggered by Bot. Commit: |
|
PR_Github #60734 [ run ] completed with state
|
e132e69 to
925108f
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #61013 [ run ] triggered by Bot. Commit: |
|
PR_Github #61013 [ run ] completed with state
|
cbae5b4 to
224b5a3
Compare
|
PR_Github #63163 [ run ] triggered by Bot. Commit: |
|
PR_Github #63163 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #63218 [ run ] triggered by Bot. Commit: |
|
PR_Github #63218 [ run ] completed with state |
|
/bot run --disable-fail-fast |
|
PR_Github #63254 [ run ] triggered by Bot. Commit: |
|
PR_Github #63254 [ run ] completed with state |
|
/bot run --disable-fail-fast |
Allow only the validated shared-KV one-engine path while preserving the existing guard for other FlashInfer combinations. Signed-off-by: Fanrong Li <23290157+lfr-0531@users.noreply.github.com>
|
/bot run --disable-fail-fast |
|
PR_Github #63356 [ run ] triggered by Bot. Commit: |
|
PR_Github #63356 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #63405 [ run ] triggered by Bot. Commit: |
|
PR_Github #63405 [ run ] completed with state
|
|
/bot run |
|
PR_Github #63481 [ run ] triggered by Bot. Commit: |
|
/bot run --disable-fail-fast |
|
PR_Github #63484 [ run ] triggered by Bot. Commit: |
|
PR_Github #63481 [ run ] completed with state |
|
PR_Github #63484 [ run ] completed with state
|
|
/bot run --disable-fail-fast |
|
PR_Github #63600 [ run ] triggered by Bot. Commit: |
|
PR_Github #63599 Bot args parsing error: usage: /bot [-h] |
|
PR_Github #63600 [ run ] completed with state |
Dev Engineer Review
Gemma4AssistantConfigand registersmodel_type="gemma4_assistant".Gemma4AssistantForCausalLM.PreTrainedConfigbase-class changes preserve compatibility with existing Gemma4 unified configurations.trtllm-genavailability and shared/separate KV-cache paths are handled consistently.QA Engineer Review
Test changes
tests/unittest/_torch/attention/test_flashinfer_attention.pyTestFlashInferAttention.test_separate_kv_draft_metadata_uses_draft_manager.tests/unittest/_torch/modeling/test_modeling_gemma4.pyTestGemma4Assistant.test_assistant_config.TestGemma4Assistant.test_assistant_rejects_partial_kv_sharing.TestGemma4Assistant.test_ordered_embedding_combines_vocab_parallel_shards.TestGemma4Assistant.test_assistant_uses_target_kv_sources.TestGemma4CUDAGraph.test_shared_kv_draft_view.kv_pool_id.tests/unittest/_torch/speculative/hw_agnostic/test_mtp.pytest_mtp_shared_kv_config.test_mtp_shared_kv_draft_inputs.tests/unittest/_torch/speculative/hw_agnostic/test_sa.pyTest-list coverage
tests/integration/test_lists/,test-db/,qa/, orwaives.txtchanges are described.Verdict
Description
Gemma4 provides dedicated MTP assistant checkpoints, but the TensorRT-LLM PyTorch backend previously did not recognize the
gemma4_assistantconfiguration or support these checkpoints in the MTP drafting workflow.This PR adds a compatibility configuration and model implementation for
Gemma4AssistantForCausalLM, covering checkpoint registration and weight mapping, target embedding and hidden-state fusion, assistant projections, ordered and centroid-masked logits, recurrent drafting, and speculative metadata forwarding through the Gemma4 multimodal wrapper. It also extends the MTP runtime and FlashInfer metadata handling so the Q-only assistant layers can read the target model's KV cache, including correct KV-page views, position handling, request turnover, and CUDA Graph capture and replay. Documentation and examples are updated for all four supported Gemma4 target/assistant checkpoint pairs.The changes span configuration, model execution, speculative decoding, attention metadata, checkpoint loading, and executor resource setup because KV-cache ownership and drafting state must remain consistent across these layers. The assistant reuses the target KV cache, avoiding allocation of another full-size GPU KV cache. Existing Gemma4 execution is unchanged unless a
gemma4_assistantcheckpoint is configured. There are no C++ changes, public API changes, or new dependencies.The current scope supports FlashInfer with linear MTP drafting. Dynamic-tree decoding, draft-length scheduling, suffix-automaton enhancement, rejection sampling, and guided decoding are rejected explicitly. The main implementation risk is shared-KV metadata correctness across context and generation requests; focused unit coverage and end-to-end CUDA Graph testing are included for that path.
Related PRs: None.
Test Coverage
tests/unittest/_torch/modeling/test_modeling_gemma4.pytests/unittest/_torch/modeling/test_gemma4_multimodal.pytests/unittest/_torch/speculative/hw_agnostic/test_gemma4_drafting_loop.pyAcceptance Length Results
E2E Speedup Results
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.