mlx-bun library API
    Preparing search index...

    One replaceable binding owns all graph-specific operations used by the AR loop: the graph's named phases and the facts the loop reads once. The current method requires MLX tensors and the legacy Cache[] ABI. Weights are borrowed for the binding's lifetime; generated caches are owned by the run. Caller-provided caches and media remain borrowed.

    interface MlxAutoregressiveBinding {
        adapters?: { active: string[] };
        descriptor: GraphDescriptor;
        eosTokenIds: readonly number[];
        grammarJump?: boolean;
        knownSpans?: MlxKnownSpans;
        kv?: KvStorageScheme;
        memory: MlxModelMemory;
        pagedKv?: PagedKvComposition | null;
        phases: MlxPhaseDispatch;
        prefillPolicy?: PrefillPolicy;
        prefillTailSplit?: boolean;
        runtime?: RuntimeConfig;
        createDecode?(policy: { hasAdapters: boolean }): MlxDecodeStep | null;
        makeCache(): Cache[];
        prefillEmbeddings?(
            embeddings: MlxArray,
            state: Cache[],
            imageMask: MlxArray | null,
            ids: MlxArray,
            multimodalMask: MlxArray | null,
            width: number,
        ): MlxArray;
    }
    Index
    adapters?: { active: string[] }
    descriptor: GraphDescriptor
    eosTokenIds: readonly number[]
    grammarJump?: boolean

    The composition's grammarJump; absent: the default.

    knownSpans?: MlxKnownSpans

    The graph's committed known-token spans, when it declares them.

    The composition's KV scheme, which makeCache composes; absent: bf16.

    pagedKv?: PagedKvComposition | null

    The composition's paging (pagedKv); absent: none.

    The graph's phase operations.

    prefillPolicy?: PrefillPolicy
    prefillTailSplit?: boolean

    The composition's prefillTailSplit; absent: the default.

    runtime?: RuntimeConfig
    • The graph's compiled decode step for this run, chosen once after prefill: present when the graph declares one, the run allows replay and its composition kept compiled decode on. A compiled/fused decoder belongs to THIS graph, never to a model inferred from a name or inherited by a replacement.

      Parameters

      • policy: { hasAdapters: boolean }

      Returns MlxDecodeStep | null