A single SFT training batch. ids is [B][L] row-major, every row padded
to the common batch length L. promptLens[i] is row i's prompt boundary
(loss starts at that position) and lengths[i] is row i's true unpadded
length — positions >= lengths[i] are padding and are excluded from both
the loss mask and the attention mask. For B=1 every row's lengths[i]
equals its ids[i].length (no padding), so the loss/forward paths are
bit-identical to the pre-batch single-example trainer.
A single SFT training batch.
idsis[B][L]row-major, every row padded to the common batch lengthL.promptLens[i]is row i's prompt boundary (loss starts at that position) andlengths[i]is row i's true unpadded length — positions>= lengths[i]are padding and are excluded from both the loss mask and the attention mask. For B=1 every row'slengths[i]equals itsids[i].length(no padding), so the loss/forward paths are bit-identical to the pre-batch single-example trainer.