Skip to content

[Tunix] Enforce strict formatting rewards and stop instruction in GSM8K demo - #2116

Open
andytwigg wants to merge 1 commit into
mainfrom
gsm8k-strict-rewards-and-template
Open

[Tunix] Enforce strict formatting rewards and stop instruction in GSM8K demo#2116
andytwigg wants to merge 1 commit into
mainfrom
gsm8k-strict-rewards-and-template

Conversation

@andytwigg

Copy link
Copy Markdown
Collaborator

Summary

Improves trajectory completion and eliminates partial reward incentives for rambling generations past the numerical answer in the distributed GSM8K GRPO demo.

Details

  1. Prompt Template Clarification:
    Updated GSM8K_PROMPT_TEMPLATE to explicitly instruct the model:
    "After the closing </answer> tag, immediately end your response and stop generating."
  2. Strict Formatting Reward:
    Updated score_gsm8k_completion to assign 0.0 (instead of 0.5) when not format_correct and answer_correct. Without strict formatting enforcement, the model receives partial credit even when generating run-on tokens or failing to properly terminate at </answer>.
  3. Tests:
    Updated tests/experimental/examples/math_gsm8k_dist/gsm8k_test.py to verify the stop instruction in build_prompt and assert the strict formatting reward behavior (0.0 for malformed outputs).

Verification

  • Ran python3 -m unittest tests/experimental/examples/math_gsm8k_dist/gsm8k_test.py: all 9 unit tests passed.

…8K demo

- Update GSM8K_PROMPT_TEMPLATE with an explicit instruction to immediately end the response and stop generating after the closing </answer> tag.
- Update score_gsm8k_completion to require strict formatting: remove partial credit (0.5) when not format_correct and answer_correct, awarding 0.0 to avoid incentivizing rambling completions.
- Update gsm8k_test.py to verify prompt stop instruction and strict formatting reward behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants