Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueFinishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Code Review
This pull request introduces several significant updates, including the addition of support for Qwen3.5 models, improved configuration management with atomic file writing, and enhanced inference deployment flexibility. Key changes include the transition to uv sync --all-packages for environment management, updates to the orchestrator's rollout persistence logic, and improved validation for inference quantization. I have included one review comment regarding the future-proofing of the SM100 architecture check for MXFP8 quantization.
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.
| if capability != (10, 0): | ||
| detected = f"SM{capability[0]}{capability[1]}" | ||
| raise ValueError(f"inference.quantization='mxfp8' requires SM100, detected {detected}.") |
There was a problem hiding this comment.
The check capability != (10, 0) is too strict and not future-proof. It will reject future GPU architectures (e.g., with compute capability 10.1 or 11.0) that will likely support MXFP8. It's better to check for the minimum required major architecture version to ensure forward compatibility.
| if capability != (10, 0): | |
| detected = f"SM{capability[0]}{capability[1]}" | |
| raise ValueError(f"inference.quantization='mxfp8' requires SM100, detected {detected}.") | |
| if capability[0] < 10: | |
| detected = f"SM{capability[0]}{capability[1]}" | |
| raise ValueError(f"inference.quantization='mxfp8' requires at least SM100, detected {detected}.") |
k8s/README.md links to /prime-rl/kubernetes, /prime-rl/deployment and
/prime-rl/troubleshooting. All three return 404: those pages are not in
docs/ and have no entry in docs/mint.json. Drop the two Kubernetes links
and the troubleshooting bullet — the README's own sections are the chart
documentation — and retarget the deployment bullet at /prime-rl/scaling,
which is where the multi-node and SLURM content lives now.
The uninstall snippets also name the wrong PVC. templates/pvc.yaml names
it {{ .Release.Name }}-shared-data, so after the documented
`helm install my-exp`, `kubectl delete pvc prime-rl-shared-data` fails
NotFound and reads as if the data is already gone.
273cb63 to
666d2e2
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
CodeAnt-AI DescriptionRemove broken Kubernetes guide links and correct Helm PVC cleanup instructions What Changed
Impact
💡 Usage GuideChecking Your Pull RequestEvery time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later. Talking to CodeAnt AIGot a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask: This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code. ExamplePreserve Org Learnings with CodeAntYou can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input: This helps CodeAnt AI learn and adapt to your team's coding style and standards. ExampleRetrigger reviewAsk CodeAnt AI to review the PR again, by typing: Check Your Repository HealthTo analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health. |
…#3411) ## Summary ### Model and checkpoint contract - Replace the separate standard, GPT-OSS, and Nemotron expert/router implementations with one canonical MoE tree. - Store routed expert weights as separate `gate_proj`, `up_proj`, and `down_proj` parameters. Non-gated experts omit `gate_proj`. - Nest every custom router at `mlp.router.gate`, routed experts at `mlp.experts`, and optional shared experts inside `mlp`. - Store the single selection-only router bias at `mlp.router.selection_bias`; model-specific checkpoint names are converted only at the HF boundary. - Keep shared expert projections canonical. Qwen3.5 alone nests its scalar sigmoid gate at `mlp.shared_expert.output_gate`, with conversion mapping the standalone Hugging Face key at the boundary. - Use the same activation protocol and `FeedForward` implementation for dense MLPs, shared experts, and grouped experts. - Make shared-expert construction exclusively parent-owned: model layers pass an explicit `FeedForward`/subclass or `None`, while `MoEArgs` and `MoE` never infer or construct one. - Keep existing HF source layouts at the conversion boundary. GPT-OSS alone adds the structural split/join required for its interleaved source tensor. - Require `.prime-v1` in reusable `<conversion_dir>/prime` caches so legacy Prime layouts fail before loading. ### MoE runtime contract - Use one routed execution sequence for every backend: dispatch tokens, run canonical grouped experts, combine tokens. - Select grouped expert compute through explicit BF16, DeepGEMM FP8, or MXFP8 implementations. `MoEArgs` remains architecture-only. - Select local/Torch or DeepEP token dispatch once during model setup. Dispatchers own routing metadata, communication, padding, chunking, and synchronization. - Keep `TokenDispatcher` as the structural interface while a shared base owns the canonical run/synchronize sequence; local, Torch, and DeepEP implementations own only their dispatch/combine details. - Keep DeepEP combine events, concatenate streams, and flattened dispatch state owned by each dispatcher; chunking uses the equal input shape shared by EP ranks and does not synthesize empty chunks. - Ignore dispatch configuration when expert parallelism resolves to one rank; local dispatch remains active and DeepEP has no optimizer side effects. - Keep grouped expert execution directly in `GroupedExperts.forward` and router confidence accounting directly in `TokenChoiceTopKRouter.forward`. - Shard every canonical expert parameter with one backend-independent `Shard(0)` placement. - Keep dense linear quantization, routed-expert compute, and EP transport independent. - Remove the TorchTitan module hooks, expert decorator, dynamically attached process group, backend attributes, tensor-subclass interception, and process-global MXFP8 patches from the reachable path. - Vendor the narrow MXFP8 grouped-GEMM and Torch EP transport implementation in [prime-kernels PR #1](PrimeIntellect-ai/prime-kernels#1), preserving the pinned torchao revision and BSD license. ## Public contracts Checkpoint tree: - `mlp.router.gate`: `nn.Linear` - `mlp.router.selection_bias`: optional persistent selection-only buffer - `mlp.experts.gate_proj`: stacked `nn.Parameter` for gated experts, absent for non-gated experts - `mlp.experts.up_proj`: stacked `nn.Parameter` - `mlp.experts.down_proj`: stacked `nn.Parameter` - `mlp.shared_expert.{gate_proj,up_proj,down_proj}`: `FeedForward` projections when present - `mlp.shared_expert.output_gate`: Qwen3.5-only scalar `nn.Linear` - expert matrices: `[num_experts, output_features, input_features]` Runtime configuration: ```toml [trainer.model.moe.compute] type = "bf16" # bf16 | deepgemm_fp8 | mxfp8 [trainer.model.moe.dispatch] type = "torch" # torch | deepep transport = "bf16" # bf16 | mxfp8 for torch dispatch ``` DeepEP owns its tuning fields: ```toml [trainer.model.moe.dispatch] type = "deepep" num_sms = 20 token_chunk_size = 4096 ``` This is intentionally breaking. `enable_grouped_gemm`, `enable_a2a`, `ep_comm_backend`, `deepep_num_sms`, and `deepep_token_chunk_size` are removed without aliases. ## Validation completed - Foundation conversion, detector, marker, state-loading, checkpoint, NIXL graph, and wire-format tests passed. - Focused CPU configuration and MoE contracts: 143 passed. - Focused MoE runtime configuration parametrizations after the EP=1 no-op change: 6 passed. - Affected custom-model CUDA suite: 24 passed, 3 skipped across AFMoE, GLM, GPT-OSS, Nemotron, Qwen3/Qwen3.5, and state loading. - Final H200 model suite after execution-path cleanup: 81 passed, 3 skipped (Slurm 2597). - Torch EP on two H200 GPUs passed with BF16 and DeepGEMM FP8, top-k 2, both score locations, shared experts, gated/non-gated/bias variants, uneven routing, a rank receiving zero routed tokens, and input/router/expert gradients. - Final Torch EP BF16 and DeepGEMM FP8 matrix passed after the cleanup (Slurm 2596). - DeepEP on two H200 GPUs passed with BF16 and DeepGEMM FP8, chunking on/off, both score locations, shared experts, a rank receiving zero routed tokens, and gradients. - Final DeepEP BF16 and DeepGEMM FP8 matrix passed after the cleanup (Slurm 2595). - Parent-owned shared-expert construction: 16 focused CPU tests and 64 H200 model tests passed, with 3 expected skips (Slurm 2600). - Full-graph MoE and shared `FeedForward` compile validation passed after the ownership cleanup (Slurm 2601). - Local DeepGEMM FP8 passed across all supported topology, activation, and bias combinations. - `torch.compile(fullgraph=True)` forward/backward passed for the full MoE and shared `FeedForward` across all supported topology/activation combinations. - Single-rank DCP and Torch EP + FSDP DCP model/optimizer resume passed. - The `mxfp8_moe` wheel build includes its public module, manifest, and license; the module imports against the pinned torchao build. - Unsupported H200 MXFP8 selection fails before model mutation. - Review audit: every queued DeepEP combine event is now synchronized, including chunked execution (two-H200 Slurm 2604). - Dispatcher review cleanup passed on two H200s: DeepEP BF16/DeepGEMM with chunking and a zero-receive rank (Slurm 2847), plus Torch EP topology/bias/zero-receive coverage (Slurm 2848). - The exact `reverse_text_moe` integration passed end-to-end on two H200s with an isolated conversion cache (Slurm 2607). - Conversion ranks now make the create decision on master and validate `.prime-v1` only after the final all-rank barrier. - Canonical router selection bias: 12 CPU MoE/conversion tests passed; CUDA checkpoint loading, Nemotron, and GLM model tests passed, with the existing GLM BF16 gradient comparison passing on isolated rerun after one threshold-edge miss (Slurm 2851/2852). - Ruff, Ruff formatting, compileall, and `git diff --check` passed. ## Deliberate exclusions - MultiLoRA is not adapted to the new runtime and may fail. - Fused-MoE trainer integration is removed and will be reconsidered only after the canonical runtime is finalized. - Routed-expert selective activation checkpointing is removed; the remaining selective targets are unchanged. ## Remaining before marking ready - Run numerical MXFP8 grouped-GEMM and MXFP8 Torch EP transport forward/backward on SM100 hardware. The available Slurm fleet currently has only H200 nodes. - Merge prime-kernels PR #1, publish wheels containing `mxfp8_moe`, and update the `pyproject.toml`/lock wheel pins. The currently pinned v0.8.0 wheel does not contain this module. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **High Risk** > This changes the MoE forward/backward path, expert-parallel dispatch, checkpoint key layout, and trainer TOML in breaking ways across all custom MoE models. > > **Overview** > **Breaking trainer config:** MoE is configured via `[trainer.model.moe.compute]` (`bf16`, `deepgemm_fp8`, `mxfp8`) and `[trainer.model.moe.dispatch]` (`torch` with `transport`, or `deepep` with `num_sms` / `token_chunk_size`). Dense `[trainer.model.quantization]` no longer drives expert GEMMs or EP transport. Removed flags include `ep_comm_backend`, `deepep_*`, `moe_use_grouped_mm`, `moe_fused_kernel`, and quantization `enable_grouped_gemm` / `enable_a2a`. > > **Unified MoE execution:** All custom models share one `MoE` path—`TokenChoiceTopKRouter`, stacked `GroupedExperts` (`gate_proj` / `up_proj` / `down_proj`), and a pluggable `TokenDispatcher` (`LocalTokenDispatcher`, `TorchTokenDispatcher`, `MXFP8TorchTokenDispatcher`, `DeepEPTokenDispatcher`). `configure_moe_runtime` wires grouped GEMM backends and dispatch at setup; EP weight sharding is only `ExpertWeightParallel`. DeepEP dispatch/combine, grouped-GEMM permutation, and chunk pipelining live in the new dispatcher layer instead of ad hoc `MoE` hooks. > > **Checkpoint and model surface:** PrimeRL checkpoints rename routed weights from `w1/w2/w3` to `gate/down/up_proj`, move selection bias to `mlp.router.selection_bias`, and add GPT-OSS HF↔prime conversion. `LatentMoE` / Nemotron-specific expert classes are folded into the canonical tree; dense layers use `FeedForward`. Reusable `prime` conversion caches must include a `.prime-v1` marker. > > **Removed / docs:** Fused `flash_moe` trainer integration and `bench_fused_moe.py` are dropped; `routed_experts` selective activation checkpointing is removed. Docs and examples (e.g. GLM-5) are updated for the new tables. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ffd5be7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
666d2e2 to
3629b1b
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Summary
Fixes the broken Kubernetes guide link reported upstream.
k8s/README.mdpointed at three deleted public-docs pages (kubernetes,deployment,troubleshooting) after the upstream PR rewrotedocs/from 22 pages down to 8. The redirects that review flagged as mitigation were never added, andk8s/README.mdwas never updated.This PR makes the Helm chart README self-contained and honest:
k8s/README.mdandexamples/reverse_text/README.md: templates name the PVC<release-name>-shared-data, soprime-rl-shared-datawas wrong for the README's ownhelm install my-exp.tests/unit/test_docs_links.pyso markdown links intodocs.primeintellect.ai/prime-rl/*must resolve to a page indocs/mint.jsonand a file on disk (the reverse ofsync-docs.yml's nav→file check).Title vs body tradeoff
Issue title says "Missing K8S guide"; issue body is only the broken link. Restoring
docs/kubernetes.mdwould re-publish a guide whose Quick Start fails today: the chart example still referencesrl/{orch,infer,train}.tomldeleted by1826b1892(the upstream issue, 2026-02-24). This PR fixes the broken link and refuses to restore a guide that cannot work until the chart is fixed.Separate higher-priority bug (not this PR)
The Helm chart example (
k8s/prime-rl/examples/reverse-text.yaml+values.yamldefault cmds) still points at deleted split configs. Chart has been non-functional onmainfor ~5 months. Please open / label aneeds-chart-fixissue: either re-model on the currentexamples/reverse_text/rl.toml/uv run rlentrypoint, or deletek8s/until maintained.Also ask: should public-docs add Mintlify redirects for the old
kubernetes/deployment/troubleshootingslugs?How to test
Out of scope
docs/kubernetes.mdrl/*.tomlblock