mlx-bun library API
    Preparing search index...

    One sequence streamed through the layer stack in segments. Borrows the ids it began with; owns its caches, masks and per-layer inputs until dispose.

    interface SegmentedPass {
        input: MlxArray;
        dispose(): void;
        runRange(
            h: MlxArray,
            lo: number,
            hi: number,
            donorKvIn: Map<number, SharedKv>,
        ): { donorKvOut: Map<number, SharedKv>; h: MlxArray };
    }
    Index
    input: MlxArray

    The input embeddings [1, T, hidden] (the first segment boundary). The caller owns and disposes it.

    • Layers [lo, hi) over h, returning the residual stream after layer hi-1 (no final norm) and the fetched K/V of the reused donors in the range. h is never disposed; donorKvIn holds earlier segments' donor K/V (caller-owned). The caller owns and disposes what comes back.

      Parameters

      Returns { donorKvOut: Map<number, SharedKv>; h: MlxArray }