Skip to content

Add Muse Glimmer (30B) model and integration tests (#4106) - #4106

Merged
tianyu-l merged 1 commit into
pytorch:mainfrom
jinsooihm:export-D115475586
Aug 11, 2026
Merged

tianyu-l merged 1 commit into
pytorch:mainfrom
jinsooihm:export-D115475586

Conversation

@jinsooihm

@jinsooihm jinsooihm commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models.

Reviewed By: tianyu-l

Differential Revision: D115475586

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 11, 2026
@meta-codesync

meta-codesync Bot commented Aug 11, 2026

Copy link
Copy Markdown

@jinsooihm has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115475586.

@fegin fegin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved internally.

@meta-codesync meta-codesync Bot changed the title Add Muse Glimmer (30B) model and integration tests Add Muse Glimmer (30B) model and integration tests (#4106) 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 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
Summary:

Add Muse Glimmer 30B as a first-class torchtitan model under torchtitan/models.

Reviewed By: tianyu-l

Differential Revision: D115475586
@tianyu-l
tianyu-l merged commit 5de7d11 into pytorch:main Aug 11, 2026
20 of 21 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/8gpu CLA Signed This label is managed by the Meta Open Source bot. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants