Repository navigation
[recipes] Muse Spark SLAKE SFT: full vision tower + LoRA decoder - #6004
Conversation
## 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
## 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
16eed97 to
73ca106
Compare
7f2f9a1 to
8ced787
Compare
|
@claude review this PR |
|
Claude finished @fegin's task in 2m 29s —— View job Verdict: Approve -- see the review on this PR. |
There was a problem hiding this comment.
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_moduleswould raise. - The new test's assertion that the LoRA group holds only
.lora_params ensuresperception_emb_normstays frozen. replace(optimizers[0], ...)is safe because the only shared field is thebetastuple, 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 againstlora_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 isconv1_linearor the positional embedding, unverified).
Questions
- The step time is 17.0 s vs 11.97 s, and
lora_vision_decoderalready 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).
## 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
8ced787 to
df856a8
Compare
## 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
49ed776 to
c35ae49
Compare
2dd5099 to
468422e
Compare
## 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
c35ae49 to
62e17e3
Compare
468422e to
23a8430
Compare
## 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
62e17e3 to
da75226
Compare
23a8430 to
345e666
Compare
## 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
da75226 to
404bbfd
Compare
## 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
404bbfd to
e96386b
Compare
e71d46a to
68c0df8
Compare
## 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
e96386b to
33baeaa
Compare
68c0df8 to
455866b
Compare
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.
What changed
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:
Testing
Known issues / follow-ups