Skip to content

Fix SFT mask to avoid calculating loss on generation prompt tokens#3284

Merged
copybara-service[bot] merged 1 commit intomainfrom
jimmytsai/fix-sft-masking
Mar 3, 2026
Merged

Fix SFT mask to avoid calculating loss on generation prompt tokens#3284
copybara-service[bot] merged 1 commit intomainfrom
jimmytsai/fix-sft-masking

Conversation

@ChingTsai
Copy link
Collaborator

@ChingTsai ChingTsai commented Mar 2, 2026

Description

FIXES: b/475383130

Tests

Unit Test

python3 -m pytest  tests/unit/sft_data_processing_test.py

Compare sft qwen3-4b initial loss

  • Drop from 5.868 to 5.1988
    maxtext_ori_vs_fix_mask

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ChingTsai ChingTsai changed the title Fix sft mask to avoid calcuate loss on generation prompt tokens Fix SFT mask to avoid calculating loss on generation prompt tokens Mar 2, 2026
@ChingTsai ChingTsai force-pushed the jimmytsai/fix-sft-masking branch from 58dc8e7 to 92af6ba Compare March 2, 2026 08:03
@ChingTsai ChingTsai marked this pull request as ready for review March 2, 2026 08:57
@ChingTsai ChingTsai self-assigned this Mar 2, 2026
@ChingTsai ChingTsai force-pushed the jimmytsai/fix-sft-masking branch from 92af6ba to 2a52097 Compare March 3, 2026 08:55
@copybara-service copybara-service bot merged commit b5f41ec into main Mar 3, 2026
48 checks passed
@copybara-service copybara-service bot deleted the jimmytsai/fix-sft-masking branch March 3, 2026 16:30
@ChingTsai ChingTsai mentioned this pull request Mar 9, 2026
4 tasks
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.

3 participants