Skip to content

feat(qwen36): add all-C request-granular adaptive verification - #617

Closed
Graffioh wants to merge 18 commits into
Luce-Org:mainfrom
Graffioh:codex/adaptive-speculation-goodput
Closed

feat(qwen36): add all-C request-granular adaptive verification#617
Graffioh wants to merge 18 commits into
Luce-Org:mainfrom
Graffioh:codex/adaptive-speculation-goodput

Conversation

@Graffioh

@Graffioh Graffioh commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This draft adds request-granular adaptive speculation for every supported active concurrency (C <= 16). It does not classify prompts as code/chat and it has no fixed concurrency cutoff: each request may use the configured speculator or remain autoregressive, based on measured useful-token goodput.

The implementation is split into a reusable planning policy and a concrete DDTree adapter:

  • Common, model-neutral request, confidence-scout, verifier-work, and work-menu types.
  • One adaptive profile per exact (speculator, shape, proposal nodes, verifier rows) work key, with a shared exact-C AR baseline.
  • Separate hard executor capacity and adaptive efficiency limits, so forced requests remain correct without making ordinary adaptive routing too wide.
  • Confidence and accepted-token yield stay isolated per work shape; scout time is profiled separately from verifier-route time.
  • The Qwen concurrent engine supplies DDTree work menus and executes the selected DDTree subset together with AR peers in the existing packed mixed route.

The common selector accepts one configured speculator per call. DDTree, DSpark, and future speculation methods can implement the same adapter contract without changing the ranking policy. Simultaneously racing multiple speculators would be a separate portfolio policy and is intentionally not claimed here.

Decision process

At each decode step:

  1. The active speculator adapter enumerates the exact verifier work shapes executable for each request.
  2. Cold requests receive a bounded confidence scout. DDTree derives conditional prefix survival from draft probabilities; another speculator may provide the same signal from a confidence head.
  3. The selector orders requests by expected useful output, then progressively replaces that prior with target-verified accepted-token yield.
  4. It compares absolute predicted useful-token goodput for measured route widths against the naturally observed exact-C AR cost.
  5. Only the profitable request subset speculates; every other request stays on AR.

There is no prompt keyword heuristic, fixed code/chat label, or per-model offline performance table. Confidence expires by generated-token progress, and costs continue adapting through bounded EWMAs. New/refilled cohorts, draining tails, transient scout failures, AR-peer protection, and Always/Never request semantics have explicit safeguards.

DDTree integration

  • DDTree confidence scouting returns a reusable proposal artifact tied to request ID, slot, seed token, committed position, and top-k shape.
  • A selected artifact is reused only when all identity/position checks still match.
  • Only scout work actually consumed by the selected route is charged to that route; failed or unselected scouts cannot poison verifier profiles.
  • DDTree scouts are currently serial because draft KV is request-local. The batch scout interface permits a future DSpark confidence-head adapter to fuse that operation.
  • C <= 3 retains the established full DDTree verifier shape while routing requests independently.
  • C = 4 profiles the established full shape before a compact fallback.
  • C > 4 offers bounded compact shapes first, then wider work only after the cheaper exact profile loses.
  • Closed cohorts keep the AR-peer guard. Refill can relax it only when the exact work has broad executable coverage or stable target-verified evidence.
  • Forced speculation may use every eligible request up to hard executor capacity; it is not capped by the adaptive efficiency limit.

This PR wires DDTree end to end. DSpark is not executed concurrently by this PR; adding it later means implementing its scout/menu/executor adapter against the common contract.

Strix Halo results

All GPU workloads were pinned with HIP_VISIBLE_DEVICES=1; runtime logs confirmed Radeon 8060S / gfx1151. The R9700 was not used.

Protocol: Qwen3.6-27B Q4_K_M, local DFlash Q4_K_M draft, greedy decoding, fresh server per workload and mode, 24-token warmup, then two measured runs with exactly 64 output tokens per request. All requests completed with the exact token count and zero failures.

Mixed matrix

C workload adaptive tok/s AR tok/s tok/s delta mean-latency delta measured steady route
2 1 code + 1 chat 22.184 16.833 +31.79% -46.12% DDTree used
4 2 code + 2 chat 31.029 31.459 -1.37% +1.39% AR
5 2 code + 3 chat 37.623 37.742 -0.32% +0.32% AR
8 4 code + 4 chat 53.410 53.645 -0.44% +0.44% AR
16 8 code + 8 chat 77.970 78.232 -0.34% +0.34% AR

At C=2, both requests used DDTree in the measured runs: the code request accepted 63/63 speculative tokens per run, while chat accepted 22 and 19. This is a real aggregate win for that fixed mixed workload, but it is not evidence that the controller selected only the code request.

For C >= 4 in this matrix, every measured request reported zero DDTree steps and exactly C * 63 target forwards. The controller therefore converged safely to pure AR; these rows demonstrate bounded overhead/parity, not a high-concurrency DDTree speedup. Sub-1% differences should be treated as noise-level parity, while the C=4 -1.37% is the clearest residual scout cost.

Targeted cohorts

C workload adaptive tok/s AR tok/s tok/s delta observation
3 2 code + 1 chat 24.683 18.783 +31.42% steady DDTree use
4 4 code 30.746 31.523 -2.46% one measured cold probe, then AR
5 5 code 37.574 37.715 -0.37% AR
6 3 code + 1 structured + 2 chat 42.129 42.133 -0.01% AR / exact parity
6 6 code 42.049 42.119 -0.17% AR / parity

A separate forced C=5 smoke test produced 5 x 24 tokens with zero failures, and all five requests recorded DDTree steps and accepted tokens. This confirms that hard capacity is not accidentally limited to the adaptive lane count.

Current conclusion: the controller preserves the real C=2-3 DDTree gains and avoids a steady regression at higher concurrency, but this Strix/Qwen/DDTree configuration does not yet demonstrate profitable steady speculative work at C >= 4. A cheaper/fused DSpark scout or a faster verifier shape can reuse the policy and be evaluated independently.

Validation

  • Release dflash_server and test_speculation_goodput build: passed.
  • Adaptive policy suite: 484 checks passed.
  • Focused CTest selection (server_unit, recurrent snapshots, engine contracts, batch plans, speculation policy): 375/375 passed.
  • Forced C=5 DDTree capacity smoke: passed on Strix Halo.
  • Final P0/P1 code review: no findings.
  • git diff --check: passed.

Stack

This remains the existing draft PR #617 and keeps its current stack/dependency relationship with #605. The latest cohesive implementation commit is cd6cf301.

@Graffioh Graffioh changed the title feat(qwen35): adapt DDTree using measured goodput feat(qwen35): adapt DDTree using measured goodput for concurrency Aug 17, 2026
@Graffioh
Graffioh force-pushed the codex/adaptive-speculation-goodput branch 2 times, most recently from fc6e493 to f31ce6e Compare August 17, 2026 09:49
@Graffioh Graffioh changed the title feat(qwen35): adapt DDTree using measured goodput for concurrency feat(qwen35): add request-granular adaptive verification Aug 17, 2026
@Graffioh Graffioh changed the title feat(qwen35): add request-granular adaptive verification feat(qwen36): add request-granular adaptive verification Aug 17, 2026
@Graffioh Graffioh changed the title feat(qwen36): add request-granular adaptive verification feat(qwen36): add all-C request-granular adaptive verification Aug 17, 2026
@Graffioh
Graffioh force-pushed the codex/adaptive-speculation-goodput branch from 5284034 to 66c1578 Compare August 18, 2026 06:30
@Graffioh
Graffioh force-pushed the codex/adaptive-speculation-goodput branch from ae3e6c6 to cd6cf30 Compare August 18, 2026 12:35
@Graffioh Graffioh closed this Aug 18, 2026
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.

1 participant