mlx-bun library API
    Preparing search index...

    DeepSeek's released DSpark drafter (DeepSpec): a block forward over cached, already projected context K/V.

    Implements

    Index
    embedScale: number
    eps: number
    gamma: number

    === config.block_size (γ), alias for the ground-truth term.

    headDim: number
    hidden: number
    nHeads: number
    nKvHeads: number
    projectContext: MlxRowTable<DrafterContextProjection> = ...

    The context projection for every positive B·L row count (matmulW: MLX's quantized matmul, matmul for a BF16 checkpoint).

    projectContextKVRows: MlxRowTable<DrafterContextKV> = ...

    Each layer's context K/V: the same operation for every positive B·L row count.

    ropeFreqs: MlxArray
    tapLayers: number[]

    === config.target_layer_ids, alias for the ground-truth term.

    • The whole per-round draft. Two-pass structure, matching the source exactly (draft_ops.py build_dspark_proposal calls sample_draft_tokens for the FULL block first, THEN predicts confidence over the full sampled sequence, THEN truncates — confidence does not short-circuit sampling):

      base_draft_logits = model.compute_logits(proposal_hidden_states) # [1,γ,V], softcapped sampled_tokens, draft_logits = model.sample_draft_tokens( # full γ, sequential Markov base_draft_logits, first_prev_token_ids=anchor, temperature=0) confidence_logits = predict_confidence_step( # full γ, over the SAMPLED prevs proposal_hidden_states, prev_token_ids=cat([anchor, sampled_tokens[:, :-1]])) proposal_draft_tokens = _confident_prefix_length(confidence_logits, threshold) verify_input_ids = cat([anchor, sampled_tokens[:, :proposal_draft_tokens]])

      Transcribed sequential Markov sampling (modeling.py sample_draft_tokens → markov_head.py VanillaMarkov.sample_block_tokens, temperature=0 ⇒ sample_tokens's argmax branch — RNG-free): prev = first_prev_token_ids # == anchorTok for k in range(block_size): step_logits = base_logits[:,k] + markov_w2(markov_w1(prev)) tok = argmax(step_logits) prev = tok

      Transcribed confidence truncation (draft_ops.py _confident_prefix_length): if threshold <= 0: return block_size # disabled — full γ below = sigmoid(confidence_logits) < threshold if not below.any(): return block_size return first index where below is True # ℓ can be 0 (EMPTY proposal)

      Here the graph and the sequential proposal head run at the active row count, one block per anchor (the just-verified or bonus token starting it); confidence selects each row's length after the full device chain. context reads the rows' cached context K/V (projectContextKVRows; the caller owns its lifetime and the crop after the round); position is each block's first absolute position.

      Parameters

      Returns DeepspecDraftRows