Repository navigation
Conversation
…n echo and capture paths apply_reward_penalties now calls has_malformed_think_tag per turn instead of running its own ID and string checks, so both paths run the same rule. The text check compares the decoded close-tag count against the count the ID check expects (0 or 1) when the IDs are known, keeping > 1 only when they are not: a spelled-out </think> in a thinking-off turn is now a violation. The parity test is kept and extended (it still guards the echo turn pairing and the capture link-span slicing), with new regression tests for the spelled-out close-tag case. Fixes NVIDIA-NeMo#5008 Signed-off-by: Muse <[email protected]>
Author
|
/ok to test 5025d47 |
Author
|
@claude /review-pr-team 5392 |
This branch has not been 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.
What and why
The echo path (
apply_reward_penalties) ran its own token-ID and string checks for malformed think tags while the capture path ranhas_malformed_think_tag, so the two could disagree. The echo path now calls the same predicate once per (user, assistant) turn.The predicate's text check also had a hole: it only flagged a decoded close tag when its count exceeded 1, so a thinking-off turn where the model spells out
</think>with ordinary tokens (ID check expects 0 close tags) was not penalized. When the tag IDs are known, the text check now compares the close-tag count against the count the ID check expects (0 or 1);> 1is kept only when the IDs are unknown.The parity test is kept and extended with the thinking-off spelled-out case (it still guards the echo turn pairing and the capture link-span slicing), plus two new regression tests for the spelled-out close tag on each path.
One known limitation, in the echo path only:
generation_stris decoded with special tokens skipped, so a thinking-on turn with one real close tag plus one spelled-out close tag still reads as one close tag and is missed there. The capture path (decoded with special tokens kept) catches it.Issues
Fixes #5008
Convergence / perf / functionality proof
N/A: reward-penalty logic only.
tests/unit/experience/test_capture_reward_penalties.py: 504 passed locally; new tests fail on unpatched source and pass with the fix. No GPU end-to-end run (no GPU on this machine).Needs upstream changes
None