Repository navigation
[Model] Add support for JetBrains' Mellum v2 code generation model - #27375
Conversation
[Mellum](https://www.jetbrains.com/mellum/) v2 is an update to JetBrains' open-weights code generation model that is built on a Mixture-of-Experts architecture.
There was a problem hiding this comment.
Code Review
This pull request adds support for the Mellum model architecture (MellumForCausalLM), a Qwen3-MoE variant featuring interleaved sliding-window/full attention, per-layer-type RoPE, and mixed dense/MoE MLP layers. The changes include updating model and benchmark configurations, implementing the model layers and class, and registering a custom configuration alias for older transformers versions. The review feedback highlights two critical issues: first, gate_up_proj should be defined in packed_modules_mapping at the class level rather than conditionally at the instance level to prevent issues with weight loaders and quantization frameworks; second, the __post_init__ method in the configuration alias must not accept **kwargs to avoid raising a TypeError during initialization.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
cc @wisclmy0611 @zijiexia @JustinTong0323 Any chance we could get this reviewed and merged this week? |
alexnails
left a comment
There was a problem hiding this comment.
all minor, please ping me on slack if any questions
|
/tag-and-rerun-ci |
# Conflicts: # python/sglang/srt/configs/model_config.py # python/sglang/srt/utils/hf_transformers/common.py
fc1ae51 to
03e1701
Compare
|
/rerun-failed-ci |
- Dense mlp_layer_types layers crashed: Qwen3MoeDecoderLayer.forward calls self.mlp(x, forward_batch) but Qwen3MoeMLP.forward only accepts x. Add a signature-compatible MellumMLP wrapper. - Reject the NPU prepare path: it primes shared rotary cos/sin on the first local layer only, which Mellum's per-layer RoPE breaks (get_rope returns distinct instances for the per-layer rope params). - Raise on missing config.sliding_window for sliding_attention layers instead of silently building full attention. - Honor the legacy rope "type" key alongside "rope_type" (get_rope accepts both, but the YaRN precompute and rope_scaling gating silently returned default-rope behavior for legacy-key configs). - Document the positions int32 over-approximation invariant; fix the MellumConfig version comment and docstring.
|
@Jiminator @alexnails Thanks a lot for picking this up 🙏 AFAICT, the test failures seem to be unrelated. Please let me know if anything else is required from my side. |
…gl-project#27375) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Jiminator <[email protected]> Co-authored-by: Alex Nails <[email protected]>
Motivation
Add support for JetBrains/Mellum2-12B-A2.5B-Thinking and related variants, a hybrid sliding-window-attention MoE code-generation model from JetBrains.
Modifications
MellumForCausalLMmodel file inheriting from Qwen with the following additions/changes: interleaved sliding-window/full attention vialayer_types, per-layer-type RoPE and per-layer dense/sparse MLP routing viamlp_layer_types._CONFIG_REGISTRY: prefers nativeMellumConfigwhen available (transformers>=5.10.2), falls back to aQwen3MoeConfig-based alias otherwise.model_config.py.MellumForCausalLMadded tocommon_utils.pyMoE tuning architecture dispatch.docs_new/docs/supported-models/generative_models.mdx.Usage
Launch Server
Basic Chat
Accuracy Tests
BF16, served via
sglang.launch_serverwithflashinferattention backend. SGLang TP=1 on 1×H200; SGLang TP=2 on 2×H200.Sampling:
temperature=0,max_tokens=512(GSM8K) /1024(MMLU, HumanEval). GSM8K uses/v1/completionsto bypass the chat template's<think>prefix; MMLU and HumanEval use/v1/chat/completionswithenable_thinking=false.Speed Tests and Profiling
BF16,
sglang.bench_serving --backend sglang --dataset-name random.Latency (10 prompts, cc=1)
Throughput (1000 prompts, cc=100)
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): 🚫 Run #29285622880
Latest PR Test (Extra): ❌ Run #29285622794