Repository navigation
Add Muse Glimmer (30B) model and integration tests (#4106) - #4106
Merged
Merged
Conversation
jinsooihm
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
August 11, 2026 04:22
|
@jinsooihm has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115475586. |
tianyu-l
approved these changes
Aug 11, 2026
jinsooihm
added a commit
to jinsooihm/torchtitan
that referenced
this pull request
Aug 11, 2026
Summary: Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models. Reviewed By: tianyu-l Differential Revision: D115475586
jinsooihm
force-pushed
the
export-D115475586
branch
from
August 11, 2026 04:58
0912205 to
b282638
Compare
jinsooihm
added a commit
to jinsooihm/torchtitan
that referenced
this pull request
Aug 11, 2026
Summary: Pull Request resolved: pytorch#4106 Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models. Reviewed By: tianyu-l Differential Revision: D115475586
jinsooihm
force-pushed
the
export-D115475586
branch
from
August 11, 2026 05:43
b282638 to
f4af0af
Compare
Summary: Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models. Reviewed By: tianyu-l Differential Revision: D115475586
jinsooihm
force-pushed
the
export-D115475586
branch
from
August 11, 2026 06:07
f4af0af to
e09da27
Compare
tianyu-l
pushed a commit
that referenced
this pull request
Aug 12, 2026
) ## Summary Muse Glimmer currently supports only FlexAttention — `get_attention_masks` raises `TypeError` for anything else. This adds **varlen (FA3)** as an opt-in second backend and makes the model servable by the TorchTitan RL vLLM generator, so a single ModelSpec drives both trainer and generator. Mirrors how `gpt_oss` already supports both. Builds on #4106. Two commits, reviewable independently: **1. `Add varlen (FA3) attention support`** — the two backends express the per-layer sliding window differently: flex puts it in the mask (a window-keyed dict of `BlockMask`s), varlen puts it in an FA3 kernel arg with one shared `VarlenMetadata`. - `__init__.py` — bake each layer's window into `VarlenAttention.window_size` as `(window-1, 0)`; full-attention layers keep `(-1, 0)` - `model.py` — varlen branch in `get_attention_masks`; `Attention.forward` only indexes the mask when it's a dict (`assert` → `if`) **2. `Let the vLLM generator serve the ModelSpec`** - `model.py` — `sliding_window_size` property aliasing `window_size` (the vLLM wrapper reads that name) - `parallelize.py` — `skip_dp` to bypass FSDP for inference (its forward hooks conflict with `inference_mode`) No change needed in the RL generator: it already picks the backend from the inner attention type, with no model-name special-casing. **flex remains the default and is unchanged**; varlen is opt-in via `model_registry(..., attn_backend="varlen")`. ## Test plan **Bitwise parity, trainer == vLLM generator.** Subclassed the existing `test_bitwise_parity.py` harness with a Muse Glimmer debugmodel config (varlen both roles, TP=2, batch-invariant, weights synced trainer → vLLM), mirroring `TestBitwiseParityGptOssVarlen`: torchrun --nproc_per_node=2 -m pytest -s <test> -v test_batch_invariance prefill(bsz=2) vs prefill(bsz=5) test_trainer_vs_vllm_prefill trainer vs vLLM, 5/5 sequences test_vllm_decode_vs_prefill decode vs 2nd-pass prefill, 5/5 sequences every comparison: max_delta = 0.00e+00, bitwise_equal=True By transitivity of the last two, trainer == vLLM decode bitwise. **flex vs varlen** on the debugmodel (identical weights, bf16 forward, exercising both sliding and full layers; masks: `flex=dict`, `varlen=VarlenMetadata`): | metric | flex | varlen | rel | |---|---|---|---| | loss | 1.060066 | 1.059845 | 2.1e-04 | | grad_norm | 45.6010 | 45.8513 | 5.5e-03 | | logits | — | — | cosine 0.999538, rel-L2 3.0e-02 | Not bitwise identical by construction: FA3 varlen is bf16-only and a different kernel from flex's Triton, so the bar is training-equivalence rather than identity. Layer-0 attention output agrees to ~1e-4, and the same profile appears at `seq_len < window` where the sliding mask provably clips nothing. **Per-layer window bake** on the 30B spec: 39 sliding → `(2047, 0)`, 13 full → `(-1, 0)`, zero mismatches. Flex still reports the untouched default. ## Notes - Generator TP is capped at **2** by the model's 2 KV heads. - The parity subclass is on top of the existing harness and isn't included in this PR. Can inlcude if needed.
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.
Summary:
Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models.
Reviewed By: tianyu-l
Differential Revision: D115475586