mlx-bun library API
    Preparing search index...
    • Iterate DPO batches. Sequential examples grouped into runs of batchSize, example order reshuffled with seed each epoch (port of dpo.py _batch_at + _make_batch). The trailing remainder that does not fill a batch is dropped.

      B=1: one example per step, no padding — bit-identical to the original.

      B>1: each branch is padded to the longest of its kind in the batch with padId (chosen/rejected padded independently, exactly like _make_batch). Response masks are 0 at pad positions; per-row branch lengths are recorded so the batched attention masks exclude padded keys. padId defaults to 0 (pad/eos resolved by the caller); padded scores are masked out regardless.

      Parameters

      • examples: DpoExample[]
      • batchSize: number
      • seed: number
      • loop: boolean
      • padId: number = 0

      Returns Generator<DpoBatch>