[Docs] Add Mixture of Experts guide - #3494
Open
pggPL wants to merge 55 commits into
Open
Conversation
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…PI entries - Add code snippets and SVG figures referenced by mixture_of_experts.rst (moe_permute / moe_unpermute / grouped_linear tabbed examples for both PyTorch and JAX) - Add JAX API reference entries for token_dispatch, token_combine and grouped_dense so the cross-references from the MoE page resolve - Make wording framework-neutral where it was PyTorch-only (Grouped GEMM instead of GroupedLinear/grouped linear in shared sections, both m_splits and group_sizes mentioned, figure labels generalized) - Tighten routing-kernel intro: consolidate the redundant "multiple variants exist / see API ref" notes into one paragraph next to the example, and explicitly state that the kernels are differentiable - Sharpen merging_probs explanation (top-1 vs top-k) and explicitly describe what token_dispatch / token_combine return - Snippet cleanups: define previously undefined symbols, drop the JAX probs= argument from the basic example and explain its purpose in a comment, document the ignored permuted_probs / pad_offsets outputs - Reorder MoE entry in the docs/index.rst toctree Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…ecision Add Router (score function + top-k + load-balancing loss) and Putting-it-together sections, plus token-probabilities / padding-and-alignment / chunk-sort subsections and a fused-expert-MLP note. New SVG figures and PyTorch/JAX snippets. Add the router and moe_permute_and_pad_with_probs API reference entries (PyTorch and JAX) and sort_chunks_by_index (JAX). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…ument EP APIs Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…iagram Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…MM, grouped MLP, EP Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
… in introduction Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…e introduction Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…section Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…mework specifics to snippets Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…P conditions Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…LP figure Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…w layer figure Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…ections Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…-framework API) Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…, MXFP8 dispatch, shared experts Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…transfer path) Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…p placement footer Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…zero-copy vs CUDA graphs Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
…viour Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
for more information, see https://pre-commit.ci
…th -W Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com> # Conflicts: # docs/_static/css/diagram-colors.css
Contributor
Greptile SummaryAdds a comprehensive Mixture of Experts guide covering routing, token permutation, grouped expert computation, and expert parallelism across PyTorch and JAX.
Confidence Score: 5/5The PR appears safe to merge; no outstanding correctness, security, or repository-rule issues remain. The only change since the previous review constructs a per-expert validity mask from the fixed slot capacity and token counts, then zeros padded expert outputs while applying routing weights. This fully addresses the previously reported risk of undefined padded rows reaching expert combine, and the resolved thread is not outstanding. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Input tokens] --> B[Router scoring and top-k]
B --> C[Token or EP dispatch]
C --> D[Expert-contiguous tokens]
D --> E[Grouped expert computation]
E --> F[Token or EP combine]
F --> G[Output in original token order]
B -. routing weights .-> F
Reviews (2): Last reviewed commit: "[Docs] MoE: mask padded receive slots be..." | Re-trigger Greptile |
…P snippet Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
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.
Adds a Mixture of Experts guide covering routing, token permutation, grouped expert computation, and expert parallelism.
Includes concise PyTorch and JAX examples.