Skip to content

feat(qwen38): add adaptive concurrent DSpark speculation - #626

Draft
Graffioh wants to merge 16 commits into
Luce-Org:mainfrom
Graffioh:codex/qwen38-dspark-adaptive
Draft

feat(qwen38): add adaptive concurrent DSpark speculation#626
Graffioh wants to merge 16 commits into
Luce-Org:mainfrom
Graffioh:codex/qwen38-dspark-adaptive

Conversation

@Graffioh

@Graffioh Graffioh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Depends on #605 + #625.

  • Runs Qwen3.8 DSpark chains through feat(qwen36): complete concurrent serving implementation with speculation #605's existing packed paged-tree verifier, treating each chain as a path-shaped tree. The inherited step_ddtree implementation remains byte-identical.
  • Supports mixed k-speculative + (C-k)-AR decode in two target launches: packed chain verification, then the existing fused commit-plus-AR step graph.
  • Adds --decode-mode ar|speculation|adaptive plus a per-request override, calibrated pre-norm confidence export, startup-profiled monotone tree/step/draft cost tables, and the acceptance gate.
  • Batches independent per-slot DSpark draft-KV backbones and the Markov/confidence heads into one graph/launch/sync, with stable lane buckets and a serial fallback.
  • Defaults vLLM-style always-drafting on after batching; DFLASH_SPEC_DRAFT_ALWAYS=0 and DFLASH_SPEC_BATCHED_DRAFT=0 remain diagnostic/fallback controls.
  • Adds fail-closed chain telemetry and a fresh-process matrix for AR, forced speculation, adaptive-on, and adaptive-off at C=1,2,3,4,6,8 over HumanEval, GSM8K, prose, and the C6 2-code+4-chat north star. The summary gates adaptive mean/median goodput and inverse TTFT at >=0.995 of the paired AR/speculation oracle.

Drafter

This PR uses only RadixArk/Qwen3.8-27B-DSpark. Device validation used the q4-mix requantized drafter produced from that repository.

Validation

  • HIP Release build for gfx1151 succeeded.
  • Full HIP CTest suite: 399/399 passed on Strix Halo.
  • Concurrency harness tests: 80/80 passed.
  • Forced AR/speculation parity, mixed-mode execution, per-request overrides, adaptive startup profiling, and gate telemetry passed on-device.
  • Batched vs serial DSpark produced identical real-model tokens and confidence survival traces; the fixed parity prompt produced identical output and speculative counters.
  • Default context-4096 batched profile completed with monotone tables; C2 batched drafting measured 29.2 ms vs 35.4 ms serial.
  • C6 forced-spec soak completed across packed lane widths 4 -> 6 -> 4 -> 3 -> 2 -> 1 with positive speculative counters and zero DDTree activity for all six requests.
  • The new C7 runner completed an end-to-end C2 forced-speculation smoke with recorded hashes, 19 speculative steps, 13 accepted tokens, zero DDTree steps, valid activation proof, and generated summary.

The full multi-repeat C1/C2/C3/C4/C6/C8 publication matrix is intentionally provided as the M3 acceptance harness rather than embedded as a one-off development artifact.

Review in cubic

Graffioh and others added 16 commits August 18, 2026 06:16
Wire the DSpark drafter heads (low-rank Markov bigram correction +
confidence head) into the qwen35 spec-decode loop, so Qwen3.8-27B DSpark
drafters (e.g. RadixArk/Qwen3.8-27B-DSpark) run with full head support:

- spec loop: markov-corrected greedy chain (fused single-graph variant
  with non-fused fallback) replaces plain argmax projection when the
  drafter ships DSpark heads; DDTree candidate top-k gets the markov
  bias too. Env-gated: DFLASH_QWEN35_DSPARK, DFLASH_QWEN35_FUSED_DSPARK,
  DFLASH_QWEN35_DSPARK_TREE (all default on).
- target capture layers now follow the drafter GGUF's
  dflash.target_layer_ids instead of the evenly-spaced derivation; the
  Qwen3.8 drafter is trained on layers 4/16/28/40/52, not 1/16/31/46/61.
- draft loader: dflash.mask_token_id from the drafter GGUF wins over the
  family default (Qwen3.8 drafter uses 248077, default was 248070), and
  optional YaRN rope scaling keys are parsed into DraftWeights.
- draft graph: rope calls honor the drafter's YaRN config (previously
  hardcoded plain NEOX rope).
- Qwen35DFlashTarget exposes lm_head for the fused head path.
- convert_dflash_to_gguf.py: handle single-file DSpark releases (markov/
  confidence heads inline in model.safetensors), transformers>=5 nested
  rope_parameters and dflash_config.mask_token_id, and emit YaRN scaling
  metadata.

The confidence-gate adaptive block length is not wired yet (q_len sizes
the per-request step buffers); the chain runs with the gate off.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants