mlx-bun library API
    Preparing search index...

    Method-owned state membership, independent of scheduling and cache tiers. Open/append borrow checkpoints; capture returns owned immutable state. Membership changes and capture occur only between committed rounds. The caller retains the provider's residency lease for the group's lifetime.

    interface DraftRowGroup {
        namespace: string;
        rowCount: number;
        tapLayers: readonly number[];
        append(checkpoints: readonly DraftRowCheckpoint[]): void;
        capture(row: number): DraftRowCheckpoint;
        commit(
            accepted: readonly number[],
            context: MlxArray,
        ): void | Promise<void>;
        consume?(
            tokens: MlxArray,
            context: MlxArray,
            lengths: readonly number[],
        ): void | Promise<void>;
        dispose(): void;
        draft(
            pending: readonly number[],
            depth: number,
            steps: readonly number[],
        ): number[][] | Promise<number[][]>;
        draftDevice?(
            pending: readonly number[],
            depth: number,
            steps: readonly number[],
        ):
            | { tokens: MlxArray; resolve(read: readonly number[]): number[][] }
            | null;
        filterRows(keep: readonly number[]): void;
        materialize?(): void;
        prepareAppend(
            checkpoints: readonly DraftRowCheckpoint[],
        ): PreparedStateChange;
        preview?(
            pending: readonly number[],
            depth: number,
            steps: readonly number[],
        ): MlxArray | null;
    }

    Hierarchy

    • MlxDraftRows
      • DraftRowGroup
    Index
    namespace: string
    rowCount: number
    tapLayers: readonly number[]
    • Consume externally chosen target inputs at a committed round boundary. Context and tokens are borrowed rectangular windows; lengths retain each row's consumed prefix, excluding right padding and the pending output.

      Parameters

      Returns void | Promise<void>

    • Each row returns 0..depth proposals. The method verifies the returned lengths; an empty row still consumes its pending token.

      Parameters

      • pending: readonly number[]
      • depth: number
      • steps: readonly number[]

      Returns number[][] | Promise<number[][]>

    • Optional: the same proposals left on the device as [B, depth] ids, resolved from one later host readback. Lets the round build its verify graph while the GPU is still drafting. Null when unavailable for this call.

      Parameters

      • pending: readonly number[]
      • depth: number
      • steps: readonly number[]

      Returns { tokens: MlxArray; resolve(read: readonly number[]): number[][] } | null

    • Optional: the proposals draftDevice would make from pending [B, depth], owned and left on the device, without changing the rows' state (a recurrent head drafts under a round of its own state that it rolls back), so a method can compare them with the target's own next samples instead of verifying them. A drafter may propose fewer positions than depth (the first ones): a recurrent head proposes one.

      Parameters

      • pending: readonly number[]
      • depth: number
      • steps: readonly number[]

      Returns MlxArray | null