Skip to content

Fix MLM seq2seq suffix window train/inference mismatch#48

Merged
dhruvdcoder merged 2 commits into
mainfrom
fix/mlm-seq2seq-suffix-window
Jun 19, 2026
Merged

Fix MLM seq2seq suffix window train/inference mismatch#48
dhruvdcoder merged 2 commits into
mainfrom
fix/mlm-seq2seq-suffix-window

Conversation

@dhruvdcoder

Copy link
Copy Markdown
Owner

Fixes #47

Summary

  • Add suffix_block_size to prepare_prefix_suffix_ids: fixed suffix slot after the prompt, with tail positions attention-hidden and excluded from MLM masking/loss
  • Wire through MLMSeq2SeqTrainCollator; auto-detect input_block_size == 0 for TinyGSM (batch-max padding, no shared 512-block packing)
  • TinyGSM configs: truncate: null on train/val lm collators; model.max_length: 2048 in experiment YAML
  • Unit tests for STAR (fixed input_block_size) and TinyGSM (variable prefix) layouts
  • Docs update for collator behavior and TinyGSM settings

Test plan

  • pytest tests/models/mlm/test_collator_mlm.py -k PreparePrefixSuffix
  • STAR easy: mask-eligible count per example equals block_size
  • TinyGSM: visible length equals len(prompt) + block_size

Made with Cursor

dhruvdcoder and others added 2 commits June 18, 2026 17:30
Cap MLM-eligible and attended suffix positions to block_size after the
prompt, hiding the tail from attention and loss. TinyGSM uses variable-
length prefixes with truncate: null and a larger model.max_length.

Fixes #47

Co-authored-by: Cursor <cursoragent@cursor.com>
input_ids reflect random MLM masking; suffix slot layout belongs in
target_ids.

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 38.09524% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 36.25%. Comparing base (231d680) to head (2cd520f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
xlm-models/mlm/datamodule_mlm.py 38.09% 23 Missing and 3 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #48      +/-   ##
==========================================
+ Coverage   36.04%   36.25%   +0.21%     
==========================================
  Files         128      128              
  Lines       11442    11470      +28     
  Branches     1555     1560       +5     
==========================================
+ Hits         4124     4159      +35     
+ Misses       7109     7097      -12     
- Partials      209      214       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dhruvdcoder dhruvdcoder added the bug Something isn't working label Jun 19, 2026
@dhruvdcoder
dhruvdcoder merged commit 59c94a8 into main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MLM seq2seq train/inference mismatch: cap training suffix window to block_size

2 participants