Skip to content

vllm.model_executor.models.param2moe

Classes:

Param2MoEAttention

Bases: Module

Grouped-Query Attention (GQA) for Param2MoE.

Notable differences from a vanilla GQA layer
  • The checkpoint fuses Q, K, V into a single query_key_value weight. vLLM receives it already renamed to qkv_proj by the weight-name translator and loads it directly; QKVParallelLinear splits the fused [Q|K|V] tensor internally.
  • Optional per-head RMS norms on Q and K (use_qk_norm=True).

Param2MoEDecoderLayer

Bases: Module

Single transformer decoder block.

Dense for the first first_k_dense_replace layers; MoE thereafter.

Param2MoEForCausalLM

Bases: Module, SupportsPP, SupportsLoRA, Param2MoEMixtureOfExperts

vLLM-native Param2MoE CausalLM.

Uses Grouped-Query Attention (GQA) with a Sigmoid-scored, grouped-topk Mixture-of-Experts MLP.

Param2MoEMLP

Bases: Module

SwiGLU feed-forward block used for dense layers.

Param2MoEMixtureOfExperts

Bases: MixtureOfExperts

Implements the vLLM MixtureOfExperts protocol for Param2MoE.

Param2MoEMoEBlock

Bases: Module

Mixture-of-Experts block for Param2MoE.

Routing
  • Sigmoid scoring (config.score_function = "sigmoid")
  • Grouped top-k (n_group, topk_group)
  • Per-expert bias (gate.expert_bias → e_score_correction_bias)
  • routed_scaling_factor normalisation

One set of shared (always-active) experts is added on top.

_is_expert_bias_name(name)

True when the weight is the MoE router's per-expert score bias.

_normalize_expert_bias(weights)

Zero-mean the MoE router's per-expert score bias for load balance.

The rename to e_score_correction_bias is done by the mapper; only the tensor adjustment lives here, since a WeightsMapper cannot transform data.