Expand description
DFlash block-diffusion drafter (DFLASH-BRINGUP-PLAN.md, 2026-07-13).
5-layer qwen3-class mini-transformer that drafts a 16-token block in ONE non-causal
forward, conditioned on the TARGET’s hidden states at 6 tapped layers (concatenated
through fc + hidden_norm). No embed / lm_head of its own — the round reuses the
target’s. Reference: z-lab/dflash dflash/model.py (semantics frozen in the plan doc);
oracle: tools/dflash_oracle.py -> /data/cache/dflash-oracle.npz.
FIRST LIGHT = f32-resident weights + fresh full-context forward (no draft KV cache) — correctness vs the oracle, then the cache/quant/window arms land measurement-gated.
Structs§
- Confidence
Head - AcceptRatePredictor: raw linear proj over [hidden ; markov_prev_embedding(rank)] (with_markov=true on the q38 arm-a export) — output is the PRE-sigmoid scalar.
- Dflash2
Conv - One
GroupedDynamicCausalConvmodule (reference model.py): a causal 2-tap depthwise conv over the BLOCK rows (block-local — row 0 zero-pads its missing predecessor; stateless across rounds), with per-position dynamic per-group coefficients projected from the module INPUT.prepareconvolves the sublayer input with base_kernel[0] + dyn half 0;finishconvolves the sublayer OUTPUT with base_kernel[1] + dyn half 1 (both dyn halves come from the SAME projection of the pre-conv input). - Dflash2
Head - Dflash
Cfg - Dflash
Draft - Dflash
Kv - Draft KV cache (round-cost fix, 2026-07-13): per-layer normed+roped ctx K and raw ctx V, append-only in committed order. Block K/V land TRANSIENTLY at [len..len+b] each round (never committed — the reference crops them identically). Kills the per-round full-ctx projection recompute (first light was O(ctx)/round -> 7 tok/s).
- Dflash
Layer - Dspark
Spec Session - Markov
Head
Enums§
- Dspark
Harvest - Draft-row harvest convention for DFlash-family block drafters (darklanes research/deepseek-flash-20260818/DSPARK-POSTMORTEM-20260820.md).
- Dspark
VtPolicy - Verify-window policy for the dspark round (H4, DSPARK-POSTMORTEM-20260820.md §3).
Functions§
- dflash2_
walk_ greedy - Greedy selector walk (reference
CandidateSelector.selectat T=0): per draft slot p, score(k) = unary[p,k] + <pred_codebook[prev] .* hidden_proj_row[p], succ_codebook[cand[p,k]]>, argmax over the top-k candidate set; the CHOSEN candidate seeds the next slot (sequential — the chain is the semantics, not an optimization). Host math (~ndkrank fused ops per round) over host-resident bf16 codebooks; ties break to the LOWEST k (torch argmax convention). Pure so the selector semantics are CPU-gateable. - dflash2_
walk_ sampled - Sampled selector walk (reference
CandidateSelector.select, temperature>0 arm): per draft slot the pair scores over the top-k candidate set become a softmax attemp(temperature ONLY — the reference passes no top-k/top-p here), one uniform draws the candidate (fixed-order CDF walk), and the CHOSEN candidate seeds the next slot exactly like the greedy chain. Returns (path, q_chosen[nd], q_rows[ndtop_k]) — q_rows are the recorded per-slot candidate probabilities (the residual’sscatter_add_input), and q_chosen[j] == q_rows[jtop_k + chosen_j] is the accept-test q. Pure (uniforms injected) so the T->0 limit, the chain conditioning, and the recorded-q contract are CPU-gateable. - dspark_
accept_ prefix - Accepted-prefix length of a round’s candidates against the trunk’s verify argmaxes:
cand[0]= the round anchor (already decided),cand[1..]= the drafts;vam[j]= the trunk’s argmax prediction for position anchor+j+1. Returns m = number of accepted drafts (cand[1..=m]committed,vam[m]becomes the next anchor). Pure so the harvest-alignment fixture can exercise it CPU-side. - dspark_
confidence_ vt - H4 window sizing (the sglang-planner/vLLM-#47808 mechanism, thresholded):
raws[k]= the accept-rate head’s PRE-sigmoid score for draft slot k+1; survivalS_k = prod_{j<=k} sigmoid(raws[j]); the window keeps leading slots whileS_k >= tau. Returnsvt= 1 (anchor) + kept drafts, clamped to[2, vt_cap]: the draft forward is already paid, so at least one draft rides every verify — one extra verify row costs less than a guaranteed empty round. Pure, so the policy’s knee is testable CPU-side likedspark_accept_prefix. - dspark_
slot_ confidence_ vt - Owner-directive arm (2026-08-20, “take only high confidence offers”): keep the
longest draft PREFIX whose EVERY slot clears
tauon its own sigmoid — truncate at the first sub-threshold slot, so the low-confidence tail (B2 measured 0.2–0.5 slot rates at depth) never enters verify. Prefix truncation is forced by the accept rule anyway (dspark_accept_prefixstops at the first miss — a kept slot after a dropped one could never commit); the policy fork vsdspark_confidence_vtis only the stopping statistic (per-slot marginal vs cumulative survival). Same floor/cap contract. - dspark_
strategy_ census - Checkpoint training-strategy census over the raw config.json text (the loader’s
minimal-extractor idiom — no json dep in-tree). TRUE iff the export declares the
DSPARK strategy:
architecturesnaming a DSpark model class (Qwen3DSparkModel, the SpecForge OnlineDSparkModel export form) ordflash_config.projector_type == "dspark". z-lab / OnlineDFlashModel mask-fill exports carry neither signal. Pure, so the census is testable against config fragments without files. - rejection_
accept_ len - Rejection-sampling prefix walk: accept draft j while
u_j * q_j < p_j(strict, f64 — byte-identical to the frspec accept test).p/qare the FILTERED target/proposal probabilities of the drafted tokens;uthe per-slot uniforms. Pure so the composition gate can pin the rule on CPU.