Skip to content

Align the chunked-loss config access between SFT and Distillation - #6744

Merged
qgallouedec merged 3 commits into
mainfrom
align-chunked-ce-config-access
Aug 20, 2026
Merged

qgallouedec merged 3 commits into
mainfrom
align-chunked-ce-config-access

Conversation

@qgallouedec

@qgallouedec qgallouedec commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Both trainers resolve the same per-model logit post-processing (logit_scale / output_multiplier / final_logit_softcapping) for their chunked loss, but reached it two different ways. DistillationTrainer uses config.get_text_config(); SFT branched on an is_vlm flag.

  • _patch_chunked_ce_lm_head now reads model.config.get_text_config(), so the resolution block is word-for-word identical to the one in distillation_trainer.py.
  • is_vlm stays — it still gates two transformers < 5.0.0 fallbacks (VLMs set base_model_prefix = "", and take config-level MoE aux-loss parameters) — but its docstring no longer claims a config-reading role it no longer has.
  • TestPatchChunkedCELMHead + TestChunkedCrossEntropyLoss: 79 passed.

Note

Low Risk
Narrow refactor of config resolution for chunked NLL training; behavior should improve consistency for VLMs without touching auth or data paths.

Overview
SFT chunked-loss patching now resolves logit post-processing (logit_scale / output_multiplier, final_logit_softcapping, and MoE output_router_logits) via model.config.get_text_config() instead of choosing between top-level model.config and model.config.text_config when is_vlm is true. That matches DistillationTrainer’s chunked-loss path so both trainers read the same config surface for VLMs and text-only models.

The is_vlm argument is unchanged for behavior: it still only drives transformers < 5.0.0 fallbacks (VLM backbone via self.model and config-level MoE aux-loss fields). Its docstring no longer describes config selection, since that is handled uniformly by get_text_config(). Inline comments were updated to document the logit_scale / output_multiplier fallback semantics in line with distillation.

Reviewed by Cursor Bugbot for commit f4fe9e5. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Base automatically changed from add-muse-glimmer-chat-template to main August 18, 2026 03:29
@qgallouedec
qgallouedec force-pushed the align-chunked-ce-config-access branch from fd4a9ec to fb1e276 Compare August 18, 2026 16:24
@qgallouedec
qgallouedec requested a review from cmpatino August 18, 2026 16:27
@qgallouedec
qgallouedec force-pushed the align-chunked-ce-config-access branch from 4ccfdc5 to 834ec80 Compare August 18, 2026 17:08
@qgallouedec
qgallouedec force-pushed the align-chunked-ce-config-access branch from 834ec80 to f4fe9e5 Compare August 19, 2026 19:55

@cmpatino cmpatino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@qgallouedec
qgallouedec merged commit 3f738b9 into main Aug 20, 2026
13 checks passed
@qgallouedec
qgallouedec deleted the align-chunked-ce-config-access branch August 20, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants