Commit Graph
5 Commits
Author SHA1 Message Date
adm 7b617bc333 [Core] DSpark brick 5b+6: speculative runner + LOSSLESS GATE green (200 tokens)
LayerState: per-prefix ShortConv hist snapshots (snap_k/v/a/m[3]) captured during
a spec verify batch via spec_update_hist (gated by thread-local spec_begin/end);
rollback_spec restores hist<-snap[accepted]. KV ring truncates with no restore
(proofs/speculative_draft.lean kept_rejected_disjoint). Normal path unchanged.
DsparkContext: persistent bf16 ctx rings (k/v[3] + frnn) + commit (scatter).
spec_round: draft nd -> batched trunk verify (forward_batch_taps B=nd+1) -> per-row
greedy from taps[3] -> spec_accept_greedy -> commit ctx + rollback hist. Mirrors
strata ink_serve.h indexing exactly.
b6 GATE: spec_lossless_gate emits EXACTLY the same 200 tokens as plain batched
greedy (forward_batch B=1) on real trunk+mtp (163 rounds, nd=7). Diagnostics:
batch_determinism, rollback_hist (exact), spec_lockstep (200 rounds hist+KV exact).
Acceptance 3.2% on the arbitrary synthetic prompt -> NO speedup claim yet.
Verified: CPU -D warnings clean, Lean 0 sorryAx, hip 45/45, ld GPU 65/65.
2026-12-02 21:30:34 +01:00
adm 3812845f1a [Core] DSpark brick 5a: greedy speculative accept loop (exact reference indexing)
spec_accept_greedy + committed_prefix mirror strata ink_serve.h block-verify:
row i feeds anchor (i=0) / draft[i-1] at cur_pos+i, greedy[i] predicts
cur_pos+1+i; accept while argmax==draft[i], else emit correction (or bonus at
i==nd); accepted=emit.len(); rollback keeps cur_pos+accepted; the correction's
KV is deferred to the next round (becomes its anchor). Stop/length cap end the
request mid-round. Lossless per proofs/speculative_draft.lean spec_lossless.
CPU tests: all-accept+bonus, mid/first mismatch, stop, length cap, prefix.
CPU -D warnings green.
2026-12-02 20:48:30 +01:00
adm f9cde4954a [Core] DSpark brick 4c: full block-8 draft composition + exact oracle parity
- k_dspark_split3: split fused qkv [B,5120] -> q/k/v and gate_up [B,18432] -> g/u.
- dspark_draft(): the complete Step-1 linear draft — block [8,D] (slot0 =
  rms(embed(anchor)), rest mask_embed) -> 3 non-causal block-attn layers (fused
  qkv GEMM + per-head norm/NeoX-RoPE + block_attn over committed bf16 ctx ring +
  all B draft slots + o_proj) + SwiGLU MLP -> final norm -> 7-step recurrent
  Markov head (joint=[state;markov_w1[prev];cur[step];context], rnn GEMV, GRU,
  corr/combine, unembed argmax). f32 activations x bf16 weights throughout.
- Parity: full draft vs a complete CPU oracle on REAL mtp weights + synthetic
  trunk/ctx -> 7 token ids EXACT ([158,104,158,104,158,158,158]).
hip 43/43; ld GPU 56/56; CPU -D warnings green.
2026-12-02 20:44:01 +01:00
adm 0cbec2d847 [Core] DSpark brick 3b: dspark_context composition + real-weight parity (3e-6)
- Drafter proj weights now BF16 (f32-act x bf16-w via router_gemv_batched is
  exact vs reference matmul_f32); norms/fuse stay f32; qkv/gate_up fused bf16.
- dspark_context(): per layer mix(row=il,dflare_norm_il) -> k/v_proj_ctx ->
  per-head k_norm_ctx + NeoX half-RoPE -> k/v [M,kv_dim] f32; frnn = row-3 mix
  with markov_head.dflare_norm. bf16 ring scatter left to the caller (b5).
- GPU-vs-CPU-oracle parity on the REAL mtp weights: max_rel 3.0e-6 (global-scale
  metric; per-entry rel explodes on near-zero RoPE outputs).
CPU -D warnings green; ld GPU 54/54.
2026-12-02 20:24:39 +01:00
adm 3a9533afd0 [Core] DSpark brick 2: mtp.safetensors manifest + layout-check + fused loader
- SafetensorsArchive::open_file (single shard; mtp is not in the trunk index);
  header/bounds parsing refactored into load_shard shared with open().
- dspark.rs: expected_tensors() manifest (54 BF16 tensors, exact shapes),
  layout_check() CPU-only (missing/mismatched => drafter disabled, mirrors
  reference ink_dspark_layout_check), DsparkWeights::load() GPU resident
  (unpooled) with qkv [5120,2304] and gate_up [18432,2304] fused at load.
- Tests: CPU layout_check on the real file + wrong-shape rejection; GPU
  dspark_load_real_weights verifies fused/resident buffer sizes.
CPU -D warnings green; ld GPU 30/30; gw 15/15.
2026-12-02 20:08:11 +01:00