mlx-bun library API
    Preparing search index...

    The DFlash 2 block drafter: target taps → projected context K/V; one greedy block per anchor. It loads in the basis it was trained on and learns the target's when a draft group binds.

    interface Dflash2DrafterModel {
        cfg: { layers: number; numTargetLayers: number };
        draft: DrafterOperations<Dflash2DraftBlock>;
        gamma: number;
        projectContext: DrafterOperations<DrafterContextProjection>;
        projectContextKVRows: DrafterOperations<DrafterContextKV>;
        tapLayers: number[];
        bindTarget(
            basis: ResidualBasis | null,
            projections: DraftProjectionKernels | null,
        ): void;
        blockColumns(depth: number): number;
        dispose(): void;
    }
    Index
    cfg: { layers: number; numTargetLayers: number }

    The draft block per row count or range of its rows (anchors times columns), indexed by the scheduler: every 4-bit projection on the kernel projectContext runs for the class; BF16 projections run one matmul at every class.

    gamma: number

    Draft tokens per block (block size minus the anchor).

    The context projection (fc over the target's taps, then the hidden norm) per row count or range of the rows projected (B × L: a prompt's rows at prefill, a commit's accepted rows), indexed by the caller (B × L). A 4-bit fc runs the kernel the target declares for the class or, by the drafter's own rule, the simdgroup matrix unit (Affine4MmaLinear, where the weight's shape fits it) at 5..8 and MLX's quantized matmul (QuantizedLinear) at every other class; a BF16 fc runs one matmul at every class. No entry runs before bindTarget.

    projectContextKVRows: DrafterOperations<DrafterContextKV>

    Each layer's k and v over the context rows (k norm, RoPE), per row count or range of those rows (B × L), indexed like projectContext and on the kernel it names for the class.

    tapLayers: number[]
    • The columns of a block drafting depth tokens: its anchor and up to depth mask positions, at most the trained block size.

      Parameters

      • depth: number

      Returns number