vllm.model_executor.models.param2moe ¶
Classes:
-
Param2MoEAttention–Grouped-Query Attention (GQA) for Param2MoE.
-
Param2MoEDecoderLayer–Single transformer decoder block.
-
Param2MoEForCausalLM–vLLM-native Param2MoE CausalLM.
-
Param2MoEMLP–SwiGLU feed-forward block used for dense layers.
-
Param2MoEMixtureOfExperts–Implements the vLLM MixtureOfExperts protocol for Param2MoE.
-
Param2MoEMoEBlock–Mixture-of-Experts block for Param2MoE.
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_valueweight. vLLM receives it already renamed toqkv_projby the weight-name translator and loads it directly;QKVParallelLinearsplits the fused[Q|K|V]tensor internally. - Optional per-head RMS norms on Q and K (
use_qk_norm=True).
Source code in vllm/model_executor/models/param2moe.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
Param2MoEDecoderLayer ¶
Bases: Module
Single transformer decoder block.
Dense for the first first_k_dense_replace layers; MoE thereafter.
Source code in vllm/model_executor/models/param2moe.py
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.
Source code in vllm/model_executor/models/param2moe.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
Param2MoEMLP ¶
Bases: Module
SwiGLU feed-forward block used for dense layers.
Source code in vllm/model_executor/models/param2moe.py
Param2MoEMixtureOfExperts ¶
Bases: MixtureOfExperts
Implements the vLLM MixtureOfExperts protocol for Param2MoE.
Source code in vllm/model_executor/models/param2moe.py
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.
Source code in vllm/model_executor/models/param2moe.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
_is_expert_bias_name(name) ¶
_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.