vllm.models.inkling.nvidia.moe ¶
Inkling mixture-of-experts on vLLM's FusedMoE abstraction.
Overfit to the served checkpoint: sigmoid gate (+ selection bias) top-k over the routed experts, log-sigmoid renormalization over the k routed + S shared "sink" logits, scaled by route_scale * global_scale. The routed top-k goes through vLLM's FusedMoE (which handles TP/EP); the sink experts run in :class:InklingSinkExperts -- replicated across EP ranks (every token activates every sink) and always bf16 (the checkpoint excludes every shared_experts from quantization).
NVFP4 routed experts reuse vLLM's ModelOpt NVFP4 fused-MoE method; excluded (bf16) layers fall back to the unquantized method. The checkpoint's fused stacked tensors (interleaved gate/up rows, .scale / .scale2 / .input_amax aux tensors) are translated to the standard per-expert loads in :meth:InklingMoE.load_expert_weight.
Classes:
-
InklingGate–Sigmoid gate with selection bias, log-sigmoid renorm after top-k, and
-
InklingMoE– -
InklingSinkExperts–Shared "sink" experts with per-token gammas, in bf16.
Functions:
-
inkling_gate_select–Sigmoid + bias + top-k + log-sigmoid renorm; returns (weights, ids).
InklingGate ¶
Bases: Module
Sigmoid gate with selection bias, log-sigmoid renorm after top-k, and global scale (the served checkpoint's only configuration).
Methods:
-
compute_logits–fp32 gate logits [T, n_total_experts + pad] (pad columns are junk).
-
select_experts–Full selection: (weights, ids) of [T, K + S]. The first K entries
Source code in vllm/models/inkling/nvidia/moe.py
compute_logits(x) ¶
fp32 gate logits [T, n_total_experts + pad] (pad columns are junk).
select_experts(gating_output) ¶
Full selection: (weights, ids) of [T, K + S]. The first K entries are the routed top-k; the S trailing entries are the sink gammas.
Source code in vllm/models/inkling/nvidia/moe.py
InklingMoE ¶
Bases: Module
Methods:
-
finalize_load–Post-load fixups for zeroed padding experts.
-
load_expert_weight–Load one checkpoint expert tensor.
Source code in vllm/models/inkling/nvidia/moe.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
_local_expert_slots() ¶
Global expert id -> local slot for this rank's expert partition.
Source code in vllm/models/inkling/nvidia/moe.py
_select_routed(hidden_states, gating_output, topk, renormalize) ¶
FusedMoE custom_routing_function: the routed top-k slice of the full (routed + sink) selection.
forward() stashes its selection (keyed by logits identity) so the gate select runs once per layer; the fallback covers paths where the runner re-derives the logits (e.g. naive DP dispatch).
Source code in vllm/models/inkling/nvidia/moe.py
finalize_load() ¶
Post-load fixups for zeroed padding experts.
Source code in vllm/models/inkling/nvidia/moe.py
load_expert_weight(name, weight) ¶
Load one checkpoint expert tensor.
name is relative to the mlp module: experts.<t> (routed stack) or shared_experts.shared_<t> (sink experts). Returns the loaded param names (relative to this module).
Source code in vllm/models/inkling/nvidia/moe.py
InklingSinkExperts ¶
Bases: Module
Shared "sink" experts with per-token gammas, in bf16.
Replicated across EP ranks (every token activates every sink, so EP-sharding them would hotspot the owning rank) and TP-sharded on the intermediate dim so the output remains a TP-partial sum like the routed output. The sinks are always bf16 (the checkpoint excludes every shared_experts from quantization): the experts concatenate into two plain dense GEMMs with the fused sink epilogue between them.
Methods:
-
forward–sum_e gammas[:, e] * MLP_e(x)(TP-partial along d_mlp). -
load_weight–Load one checkpoint sink tensor (stacked over the S experts).
Source code in vllm/models/inkling/nvidia/moe.py
forward(x, gammas) ¶
sum_e gammas[:, e] * MLP_e(x) (TP-partial along d_mlp).
Source code in vllm/models/inkling/nvidia/moe.py
load_weight(key, weight) ¶
Load one checkpoint sink tensor (stacked over the S experts).
Source code in vllm/models/inkling/nvidia/moe.py
_inkling_moe_ep_size() ¶
EP size the FusedMoE layer will run with (mirrors FusedMoEParallelConfig.make: experts shard over tp * dp * pcp when expert parallelism is enabled).
Source code in vllm/models/inkling/nvidia/moe.py
inkling_gate_select(logits, n_gate_experts, n_routed_experts, topk, n_shared_experts, bias, route_scale, global_scale) ¶
Sigmoid + bias + top-k + log-sigmoid renorm; returns (weights, ids).