Skip to content

fix(orchestrator): restore zero-advantage filtering flag - #3515

Closed
S1ro1 wants to merge 1 commit into
mainfrom
fix/restore-zero-advantage-filter
Closed

S1ro1 wants to merge 1 commit into
mainfrom
fix/restore-zero-advantage-filter

Conversation

@S1ro1

@S1ro1 S1ro1 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Removed from the NVFP4 stack as requested. The remaining stack is main → #3513 (vLLM) → #3511 (NVFP4 training), rebased on main a1822f7a0.

The proposed orchestrator.train.filter_zero_advantages flag and this PR's associated code/documentation changes are absent from both remaining PRs. Main's existing filtering behavior is retained.

@S1ro1
S1ro1 added this pull request to stack #3516 September 9, 2026 19:46
@S1ro1
S1ro1 marked this pull request as ready for review September 9, 2026 19:47
@S1ro1
S1ro1 marked this pull request as draft September 9, 2026 19:47
@S1ro1
S1ro1 removed this pull request from stack #3516 September 9, 2026 21:01
@S1ro1
S1ro1 force-pushed the fix/restore-zero-advantage-filter branch from 1885c2a to dbcd9e4 Compare September 9, 2026 21:01
@S1ro1
S1ro1 changed the base branch from main to feat/selective-moe-compute September 9, 2026 21:02
@S1ro1
S1ro1 added this pull request to stack #3519 September 9, 2026 21:02
@S1ro1
S1ro1 force-pushed the fix/restore-zero-advantage-filter branch from dbcd9e4 to 01fecc4 Compare September 9, 2026 21:33
Base automatically changed from feat/selective-moe-compute to main September 9, 2026 22:11
S1ro1 added a commit that referenced this pull request Sep 9, 2026
Select the model layers that use the configured MoE compute backend with
`model.moe.compute.apply_to`:

- `"all"` (default): all routed-expert groups.
- `"85%"`: the first 85% of model layers, rounded down; 48 layers
selects indices 0–39.
- `[0, 1, 2, 3]`: explicit zero-based model layer indices. `[]` selects
none.

Non-MoE blocks in hybrid models count toward indices and percentages.
Other expert groups use BF16 compute and transport while retaining the
configured dispatch backend and expert parallelism. Out-of-range indices
and invalid percentages fail early. Dense linear quantization is
unchanged.

```toml
[trainer.model.moe.compute]
type = "mxfp8"
apply_to = "85%"
```

BF16, DeepGEMM FP8 and MXFP8 configs inherit the common selector. NVFP4
inherits it in #3511. Inference precision remains configured separately.

First PR in the stack: main → #3518 → #3515 (filter flag) → #3513 (vLLM
upgrade) → #3511 (NVFP4).

Validation: 62 focused MoE/config tests passed on this main-based
branch, including all three forms through CLI/config round trips,
percentage rounding, hybrid-layer indexing, and invalid indices. Ruff
lint/format and whitespace checks passed. GB200 mixed DeepGEMM-FP8/BF16
forward/backward passed with an exact BF16 fallback output and unchanged
parameters/checkpoint keys. EP2 with layer-index selection verified
MXFP8 transport for the selected group, BF16 transport for the excluded
group, both forwards, and BF16 fallback backward. MXFP8 backward has a
separately reproduced CuTe TMA-alignment compiler failure in the
existing kernel; that kernel is unchanged here.

<sub>Stack created with <a
href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Per-layer MoE precision and transport wiring affects forward/backward
numerics and expert-parallel paths; misaligned trainer vs inference
precision could skew RL logprobs if rollout config is not matched
manually.
> 
> **Overview**
> Adds **`model.moe.compute.apply_to`** so BF16, DeepGEMM FP8, and MXFP8
routed-expert backends can target **all layers**, a **leading
percentage** (e.g. `"85%"`, rounded down), or **explicit zero-based
layer indices** (including `[]` for none). Shared
**`MoEComputeConfigBase`** validates inputs and **`resolve_layers`**
maps selections to layer sets; out-of-range indices fail at resolve
time.
> 
> **`configure_moe_runtime`** maps selection onto language-model
**`layers`** (including VLM via **`get_language_model`**): selected MoE
modules get the configured grouped GEMM; others **fall back to BF16**
compute and matching token dispatch alignment. **MXFP8 torch transport**
is used only when that layer’s grouped GEMM is actually
**`MXFP8GroupedGemm`**, so excluded layers no longer take MXFP8
all-to-all when compute is partial. Startup logging reports selected vs
total MoE layers.
> 
> Docs describe hybrid-layer counting, dense-quant independence, and RL
rollout/inference precision alignment. Unit tests cover config/CLI
round-trips and BF16 fallback without loading MXFP8 backends when
nothing is selected.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f367d48. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: matejsirovatka <matejsirovatka@users.noreply.github.com>
@S1ro1
S1ro1 force-pushed the fix/restore-zero-advantage-filter branch from 01fecc4 to 0f52a95 Compare September 9, 2026 22:11
@S1ro1
S1ro1 force-pushed the fix/restore-zero-advantage-filter branch from 0f52a95 to 7cf4dbb Compare September 17, 2026 14:24
@S1ro1
S1ro1 removed this pull request from stack #3519 September 21, 2026 14:15
@S1ro1 S1ro1 closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant