feat: 支持 Gemma 4 与原生多模态推理 - #27
Merged
Merged
Conversation
kuma-loong
marked this pull request as ready for review
August 13, 2026 14:48
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.
背景
本 PR 为 Sparse-vLLM 增加 Gemma 4 dense/MoE 文本推理与已支持模型的原生多模态推理,并针对 Gemma 4 26B-A4B 在 CUDA Graph 下的性能差距完成 Nsight Systems 定位和专项优化。
设计原则:模型适配沿用现有 cache-manager、调度和并行架构;优先新增 Gemma 专用算子,不扩展或扰动已经调优的通用算子;设备相关实现通过
OpSpec -> resolver(DeviceCaps) -> provider在构造期绑定。主要改动
Gemma 4 文本推理
Gemma4ForCausalLM,支持 dense、128 experts/top-8 MoE、PLE、共享 KV、K=V/K!=V、soft-cap logits。[gate, up]布局、分片和加载由 MoE provider 持有,模型层不依赖具体 kernel 或物理权重布局。专用算子与性能优化
原生多模态
MultiModalPrompt、checkpoint-native processor 和 rank-localMultiModalRuntime。性能结果
模型为 Gemma 4 26B-A4B BF16。Sparse-vLLM 与 vLLM 使用相同固定 token prompt、greedy、ignore EOS、CUDA Graph、关闭 prefix cache;每项 3 次 warmup、5 次计时,表中为 output tok/s 中位数。
TP1 / EP1
TP2 / EP1
TP2 / EP2
短文本和 32K/64K/128K 长文本矩阵均达到不低于 vLLM 0.8x 的目标,没有针对单一输入输出形状选择实现。
验证
1981 passed, 3 skipped, 24 failed, 223 subtests passed;24 项全部是测试树缺少 Git 元数据时由 benchmark 可复现性防线主动报错。为测试树补充本地、无远端的快照元数据后,相关 3 个测试文件93 passed, 36 subtests passed,无剩余功能失败。425 passed, 15 subtests passed。4 passed。兼容性与说明
main。