Commit 5aa4da9
## Purpose
Regression test for
#621. Full
investigation in the issue thread.
MTP builds its mask on the dense `create_causal_mask` path, where
transformers auto-derives the block-diagonal packed mask from the
per-document `position_ids` the collate emits (positions reset per
document, attention_mask=None). So MTP training attention is already
document-local — implicitly via position_ids, not via an explicit
document_ids mask.
This test pins that invariant: a packed batch with per-document
position_ids must yield a causal and same-document mask in the MTP
forward. It fails if positions stop carrying segment boundaries or
packed-mask detection changes — the silent failure mode where loss still
decreases.
## Tests
This PR is test only.
## Checklist
I have filled in:
- [x] The purpose of the PR, such as "Fix some issue (link existing
issues this PR will resolve)".
- [x] The test plan/results, such as providing test command and pasting
the results.
- [ ] (Optional) The necessary documentation update.
- [x] I (a human) have written or reviewed the code in this pr to the
best of my ability.
---------
Signed-off-by: Ranran Haoran Zhang <ranzhang@redhat.com>
Co-authored-by: Rahul Tuli <rtuli@redhat.com>
Co-authored-by: shanjiaz <zsjwpianpian@gmail.com>
1 parent 0451356 commit 5aa4da9
1 file changed
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
0 commit comments