feat(speechlm2): distill MTP heads with LK loss - #16115
Draft
Slyne wants to merge 7 commits into
Draft
Conversation
Signed-off-by: SlyneD <slyned@nvidia.com>
Signed-off-by: SlyneD <slyned@nvidia.com>
Signed-off-by: SlyneD <slyned@nvidia.com>
Signed-off-by: SlyneD <slyned@nvidia.com>
Signed-off-by: SlyneD <slyned@nvidia.com>
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.
What changed
mtp.loss_type: lkobjective for head-only MTP fine-tuninglambda * KL(p || q) + (1 - lambda) * TV(p, q)This implements the fixed-mixture LK objective described in LK Losses: Direct Acceptance Rate Optimization for Speculative Decoding.
Why
When the speech encoder and backbone LLM are frozen and only the MTP module is trained as a speculative-decoding draft model, one-hot dataset labels are not the best target. Matching the verifier distribution directly trains the draft head toward higher speculative acceptance.
Configuration
lk_lambdais effective only whentraining_mode: head_onlyandloss_type: lk; LK loss is rejected for other training modes. The default cross-entropy path is unchanged.Dependency
#16071 has merged and
mainnow pins Automodel to7b15c9bf. This PR uses that pin and contains no Automodel source changes.Validation
black --checkandisort --check-onlyon modified Python filespython -m py_compileon modified implementation filestests/collections/speechlm2/test_salm_automodel_mtp.pytests/collections/speechlm2/test_salm_packed_sequences.pyint32partition indices12262461completed0:0in 5m35s on one 8xA100 node with CP=2, EP=4, TP=1, packed THD, TE attention, head-only LK, andlk_lambda=0.5:loss=5.780andmtp_loss=0.962step=1-last.ckptDCP checkpoint with all eight rank shards plus metadataThe IAD smoke used
TORCH_NCCL_USE_COMM_NONBLOCKING=0, the established workaround for the cluster's Mamba context-parallel collective issue. No checked-in configuration was changed for the smoke.