Skip to content

[recipes] Muse Spark SLAKE SFT: full vision tower + LoRA decoder - #6004

Merged
fegin merged 1 commit into
mainfrom
fegin/stack/31
Nov 12, 2026
Merged

fegin merged 1 commit into
mainfrom
fegin/stack/31

Conversation

@fegin

@fegin fegin commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Stacked PRs:


[recipes] Muse Spark SLAKE SFT: full vision tower + LoRA decoder

Summary (human-written)

This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

Why

The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

Example.

config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)

What changed

  • Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
  • Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
  • The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
  • Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

Memory

Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

Numerics

No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

Step lora_vision_decoder full_vision_lora_decoder
10 0.3814 0.4142
30 0.1036 0.1143
50 0.0749 0.0837
60 0.0658 0.0675

Testing

  • test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
  • On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
  • --print-config passes.
  • GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
  • CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

Known issues / follow-ups

  • The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
  • Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 10, 2026
fegin added a commit that referenced this pull request Nov 10, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 10, 2026
@fegin

fegin commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@claude review this PR

@claude

claude Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @fegin's task in 2m 29s —— View job


Verdict: Approve -- see the review on this PR.

@claude claude Bot 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.

Verdict: Approve -- a small change that only touches recipes. It reuses LoRATransform.trainable_modules from #6003, and the new test checks the one invariant that could fail silently: the optimizer group split.

What this PR does. It adds a third SLAKE variant, full_vision_lora_decoder. The decoder gets the same LoRA targets as lora_decoder. The whole vision tower (vision_encoder, vision_adapter, vision_projection) stays fully trainable. The vision params get their own AdamW group at lr 1e-5, inserted before the .* LoRA group. Only the Muse Spark 816B recipe uses the new variant.

Example.

LoRATransform(target_modules=["wqkv","wo","output_gate","w13","w2"],
              trainable_modules=["vision_encoder","vision_adapter","vision_projection"])
optimizers = [AdamW(pattern=r"^(vision_encoder|vision_adapter|vision_projection)\.", lr=1e-5),
              AdamW(pattern=r".*", lr=1e-4)]   # first match wins
# vision_encoder.conv1_linear.weight -> trainable, group 0
# layers.3.attention.wqkv.lora_a     -> trainable, group 1
# perception_emb_norm.weight         -> frozen

I checked these points:

  • No decoder target suffix matches inside the vision tower. If one did, _validate_trainable_modules would raise.
  • The new test's assertion that the LoRA group holds only .lora_ params ensures perception_emb_norm stays frozen.
  • replace(optimizers[0], ...) is safe because the only shared field is the betas tuple, which is immutable.

Should consider

  • torchtitan_recipes/sft/slake.py:251-255 -- Grad clipping (Optim.Config.max_norm = 1.0) is one global norm over both groups. The median grad_norm is 49.7, so every step clips, and the vision grads set the clip coefficient. Adam mostly cancels a constant scale. The coefficient still varies a lot between steps, though: the 35,763 spike at step 3 scales that step's decoder-LoRA grads by about 1/36,000 as well. So the validation-loss gap against lora_vision_decoder (whose grad_norm of about 1.4 barely clips) is not only "full vision vs LoRA vision". Before drawing conclusions from the ablation, report the per-group grad norm, or find which vision params dominate (my guess is conv1_linear or the positional embedding, unverified).

Questions

  • The step time is 17.0 s vs 11.97 s, and lora_vision_decoder already backpropagates through the vision tower. Extra weight-grad compute for about 1.9B params on 64-token images seems too small to explain 5 s. Do you plan to profile this (FSDP unit granularity of the encoder, or per-microbatch fp32 reduce-scatter) before this recipe becomes a reference config?

Not verified: the GB300 memory, step-time and loss numbers (they need a GPU run).

@fegin
fegin marked this pull request as draft November 10, 2026 08:37
@fegin
fegin changed the base branch from fegin/stack/30 to main November 10, 2026 08:37
@pytorch-bot pytorch-bot Bot added ciflow/rl and removed ciflow/fake-pg Run 1-GPU Fake PG integration tests labels Nov 10, 2026
fegin added a commit that referenced this pull request Nov 10, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@fegin
fegin marked this pull request as draft November 11, 2026 04:29
@fegin
fegin changed the base branch from fegin/stack/30 to main November 11, 2026 04:29
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@fegin
fegin changed the base branch from main to fegin/stack/30 November 11, 2026 04:29
@fegin
fegin marked this pull request as ready for review November 11, 2026 04:29
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@fegin
fegin marked this pull request as draft November 11, 2026 08:53
@fegin
fegin changed the base branch from fegin/stack/30 to main November 11, 2026 08:53
@pytorch-bot pytorch-bot Bot removed the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
@fegin
fegin changed the base branch from main to fegin/stack/30 November 11, 2026 08:54
@fegin
fegin marked this pull request as ready for review November 11, 2026 08:54
@pytorch-bot pytorch-bot Bot added the ciflow/fake-pg Run 1-GPU Fake PG integration tests label Nov 11, 2026
fegin added a commit that referenced this pull request Nov 11, 2026
## Summary (human-written)
This PR adds SLAKE recipes that fully fine-tune the vision encoder while applying LoRA on the decoder.

## Why
The SLAKE ablation has LoRA on the decoder and LoRA on vision + decoder. It has no run that fully fine-tunes the vision tower, which is the usual way to adapt a pretrained ViT to a new image domain such as medical scans.

**Example.**
```
config = muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft()
# 8 GB300, dp_shard=8 x EP=8, 4K packed sequences, 60 steps
# trainable: the whole vision tower (1.93B params, lr 1e-5) and LoRA adapters on the decoder (lr 1e-4)
```

## What changed
- Add the full_vision_lora_decoder SLAKE variant and muse_spark_816b_a42b_slake_full_vision_lora_decoder_sft.
- Decoder LoRA targets are the same as lora_decoder. vision_encoder, vision_adapter and vision_projection stay fully trainable through LoRATransform.trainable_modules. This includes conv1_linear, the positional embedding and the vision norms, which lora_vision_decoder keeps frozen. perception_emb_norm stays frozen: it is on the decoder side, after the projection, and the decoder trains only LoRA adapters.
- The vision params get their own AdamW group (pattern ^(vision_encoder|vision_adapter|vision_projection)\., lr 1e-5), placed before the LoRA group. Other settings and the warmup and schedule are the same as the LoRA group. lr 1e-5 is an untuned starting point, lower than the LoRA lr.
- Steps, data, validation, parallelism and Dist-MoE settings are the same as the other SLAKE variants. Checkpoint folder: muse_spark_slake_full_vision_lora_decoder.

## Memory
Measured on 8 GB300 (job 2498954): 266.1 GiB reserved peak of 276.6 GiB, vs 261.6 GiB for lora_vision_decoder (job 2385319). The +4.5 GiB is close to the estimate: fp32 param, grad and AdamW state for the 1.93B-param vision tower are 3.6 GiB per GPU under FSDP 8, vs 0.45 GiB for the frozen bf16 tower.

## Numerics
No change to the existing recipes. The new recipe ran 60 steps on 8 GB300 (job 2498954), with the same data order as lora_vision_decoder (job 2385319). Validation loss:

| Step | lora_vision_decoder | full_vision_lora_decoder |
|---|---|---|
| 10 | 0.3814 | 0.4142 |
| 30 | 0.1036 | 0.1143 |
| 50 | 0.0749 | 0.0837 |
| 60 | 0.0658 | 0.0675 |

## Testing
- test_slake_full_vision_optimizer_groups builds the recipe's optimizer container on debugmodel_mm on meta: the vision group (lr 1e-5) holds exactly the vision params, so every vision param is trainable and none falls through to the LoRA group's ".*"; the LoRA group holds only adapters; the container checks that every trainable param is in exactly one group. It catches a vision param that trains at the LoRA lr, a frozen vision module, or a decoder param that leaks into training.
- On the 816B config on meta: 4,554,000,896 trainable params (1,928,137,216 vision + 2,625,863,680 decoder LoRA), vs 2,639,421,440 for lora_vision_decoder. The optimizer groups take 809 vision params and 620 LoRA params, every trainable param once.
- --print-config passes.
- GB300 run (job 2498954): 60 steps, no OOM or NaN. Median step 17.0 s vs 11.97 s for lora_vision_decoder.
- CPU tests: models/common/test_lora.py, recipes, models/muse_spark, config, models/common/test_dist_moe.py, components/test_loss.py: 375 passed, 1 skipped, 3 xfailed.

## Known issues / follow-ups
- The learning rates are untuned. Median grad_norm is 49.7 (1.37 for lora_vision_decoder), with a spike to 35,763 at step 3; grad clipping keeps the loss stable. A lower vision lr or a longer warmup may help.
- Steps are 42% slower than lora_vision_decoder. Not profiled yet. A likely cause is the 1.93B-param encoder as one FSDP unit.

stack-info: PR: #6004, branch: fegin/stack/31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants