mlx-bun library API
    Preparing search index...

    A single DPO batch. Each branch is padded to the longest sequence of its kind within the batch (port of dpo.py _make_batch). The response masks are 0 at both prompt AND pad positions, so per-sequence log-probs naturally ignore padding without a separate length array. For B=1 there is no padding and the masks/forward are bit-identical to the single-example trainer.

    interface DpoBatch {
        chosenIds: number[][];
        chosenLengths?: number[];
        chosenMask: number[][];
        rejectedIds: number[][];
        rejectedLengths?: number[];
        rejectedMask: number[][];
    }
    Index
    chosenIds: number[][]
    chosenLengths?: number[]

    Per-row true (unpadded) length of the chosen branch — drives the chosen attention mask. Absent ⇒ no padding (B=1), so chosenIds[i].length.

    chosenMask: number[][]
    rejectedIds: number[][]
    rejectedLengths?: number[]

    Per-row true (unpadded) length of the rejected branch.

    rejectedMask: number[][]