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).

    Implements

    Index
    appendKnown: MlxKnownOperations

    Known tokens: this graph declares no committed spans, so they read as a window.

    cacheLayers: readonly MlxCacheLayer[]

    One cache per layer, sharing one mask memo. Their TurboQuant read is deferred (deferredTurboQuantKernels): attention runs on the rotated values and the read un-rotates its output.

    config: ModelConfig

    One new token per sequence: ids [sequences, 1].

    Unscaled token embeddings, for media prompts that splice embeddings.

    finalNorm: RMSNorm
    layers: LlamaLayer[]

    The one output head at every width.

    loraState: LoraState = ...
    multiSequencePrompt: readonly MlxPromptRange[]
    multiSequencePromptChunk: readonly MlxPromptRange[]
    prefixBase: "model"
    prompt: readonly MlxPromptRange[]

    One whole chunk of a prompt; rows are sequences times the chunk size. The GPU is this graph's one unit.

    promptChunk: readonly MlxPromptRange[]

    Optional chunk bindings when a file distinguishes chunks from prompt tails.

    sequence: readonly MlxSequenceRange[]

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

    A speculative window of depth + 1 positions per sequence. This graph declares no hidden-layer taps, so capture is always null.

    weightsBytes: number
    • Run decoder layers [aIdx, bIdx) on hidden h, returning the residual stream after the last layer in the range (NO finalNorm). The input h is NEVER disposed — the caller owns it (for segmented backward h is a leaf whose lifetime is managed by the autograd closure); intra-range intermediates ARE disposed. The segmented-backward and prefix-shared training paths' building block (02d723a:docs/design/orpo-training.md §5.3). MiniCPM5 is plain full-attention with no KV-sharing, so each layer reads its own stateless training cache cache[i].

      Parameters

      Returns MlxArray