Repository navigation
[data] fix: preserve GLM historical answer loss - #5633
Merged
Merged
Conversation
Signed-off-by: Yu Yao <yaoyu.094@gmail.com>
Contributor
Author
|
/ok to test 1968bea |
Contributor
|
Light review — LGTM. The fix is correct and well-scoped. A few notes:
Minor observations (non-blocking):
Suggested test cases:
|
Contributor
Author
|
/ok to test 1968bea |
Contributor
Author
|
/ok to test 7e4721d |
2 of 5 tasks
This branch was previously deployed
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.
Summary
GLM multi-turn SFT with
enable_thinking=trueandtruncate_history_thinking=truecould silently exclude a historical assistant answer from the loss mask. The official template clears historical reasoning in the full render but retains it in the per-turn prefix render, so the common-prefix boundary can land inside the assistant turn.This is a follow-up to the runtime surface introduced in #5541.
Root cause and fix
For assistant turns without an explicit terminator, the mask builder treated the common-prefix mismatch as the end of the turn. The mismatch may instead be caused by history-dependent template rendering.
The fix teaches the GLM boundary configuration its official role markers and ends a nonterminal assistant span at the next rendered role marker. It fails closed to the tokenizer-native assistant mask when role markers cannot be trusted or found. No public API, dependency, CI, or Megatron-Core changes are included.
Validation
Fail-before, with the regression test applied to unmodified production code:
Pass-after:
Adjacent coverage:
Scope
This patch is limited to no-terminator GLM assistant-mask boundaries and their regression coverage. It does not claim full-suite, convergence, model-quality, or performance validation.