mlx-bun library API
    Preparing search index...

    The graph's operations and construction facts. Pooled embedding support is declared by its operation alone. Other operations accompany the promises in graphCapabilities; composition checks their pairing when it binds (declaredGraph).

    interface MlxDeclaredGraph {
        adaptiveDraftGates?: ReadonlyMap<string, AdaptiveDraftGateSettings>;
        adaptiveDraftWidths?: ReadonlyMap<string, number>;
        embed?: { encode(ids: MlxArray): MlxArray };
        embeddingPrompt?: readonly MlxEmbeddingsRange[];
        graphCapabilities: GraphDeclaration;
        knownSpans?: MlxKnownSpans;
        mixed?: readonly MlxMixedRange[];
        mixedSeparate?: MlxSeparateMixed;
        sequence?: readonly MlxSequenceRange[];
        sequenceLogits?: readonly MlxHeadRange[];
        trainable?: TrainableGraph;
        verifyRoundCosts?: ReadonlyMap<number, number>;
        bindMediaInput?(input: Vision): MlxPromptInput;
        compiledDecodeStep?(): MlxCompiledDecodeStep;
        dispose(): void;
        draftTarget?(caches: Cache[]): TargetView;
        embedPooled?(ids: MlxArray): MlxArray;
        expertResidency?(): Record<string, unknown> | null;
        mediaEncoders?(
            modelDir: string,
            probes: MediaSidecarProbes,
        ): Promise<MediaEncoders>;
        nativeDraftHead?(): NativeMtpHead;
        pixelInput?(): PixelInput | null;
        releaseCompiledDecode?(): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    adaptiveDraftGates?: ReadonlyMap<string, AdaptiveDraftGateSettings>

    The adaptive draft gate's settings per draft provider kind, measured on the hardware it serves (an adaptive drafter of a listed kind gates with them). Absent, or a kind it does not list: the gate's defaults.

    adaptiveDraftWidths?: ReadonlyMap<string, number>

    The widest adaptive round per draft provider kind, measured on the hardware it serves: an adaptive drafter of a listed kind drafts up to it instead of its own width, unless the request names a width. Absent, or a kind it does not list: the drafter's own width.

    embed?: { encode(ids: MlxArray): MlxArray }

    Unscaled token embeddings, for media prompts that splice embeddings.

    embeddingPrompt?: readonly MlxEmbeddingsRange[]

    Prepared embeddings without explicit positions, indexed by total rows.

    graphCapabilities: GraphDeclaration
    knownSpans?: MlxKnownSpans

    Committed known-token spans, declared when the composition qualifies them (appendKnown then reads committed).

    mixed?: readonly MlxMixedRange[]

    Mixed rows in one forward, declared by a composition that serves them.

    mixedSeparate?: MlxSeparateMixed

    Mixed groups that retain their own projection geometry. The scheduler routes each group independently when a verify group is present.

    sequence?: readonly MlxSequenceRange[]

    Full-sequence scoring operations, indexed by total token rows.

    sequenceLogits?: readonly MlxHeadRange[]
    trainable?: TrainableGraph

    What the trainer consumes: the head, segmented backward, prefix sharing, gradient checkpointing, flash-attention constraint and denoising objective this graph implements. Undeclared parts make the trainer refuse.

    verifyRoundCosts?: ReadonlyMap<number, number>

    Measured cost of a verify forward by its row count, relative to one single-row decode step (rows 1 = 1). Declared only by a graph measured on the hardware it serves; speculative depth scheduling reads it.

    • Release what the graph built at construction (computed constants, Neural Engine programs, its own weight source where it opened one) once every execution and compiled runner has stopped. A graph that built nothing releases nothing. Its owner (the host, a draft provider) calls it before releasing the weights it supplied.

      Returns void

    • Snapshot of the streamed expert residency, for diagnostics; null when the graph streams none.

      Returns Record<string, unknown> | null

    • Retire the compiled step before the graph unloads: its recorded graph borrows the graph's weights and constants. Safe to call when none exists.

      Returns void