mlx-bun library API
    Preparing search index...

    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.

    interface SftBatch {
        ids: number[][];
        lengths?: number[];
        promptLens: number[];
    }
    Index
    ids: number[][]
    lengths?: number[]

    Per-row true (unpadded) length; defaults to ids[i].length when absent (the B=1 no-padding case, kept for back-compat with single-row callers).

    promptLens: number[]