fix(ds4): preserve reference-exact speculative verification - #548
fix(ds4): preserve reference-exact speculative verification#548cheese-cakee wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
cba8487 to
82a3377
Compare
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Summary
DFLASH_DS4_SPEC_REFERENCE_EXACT=1as the supported reference-exact speculative verification modeDFLASH_DS4_FUSED_VERIFY=1intentionally approximate for throughput experimentsThis is the current-main rewrite of the superseded historical implementation. Reference-exact verification and approximate fused verification remain separate, explicit modes.
Exactness contract
The model-backed gate holds the target execution policy constant between greedy target-only generation and reference-exact speculation. It removes inherited DS4/MoE/MMVQ policy variables, then differs only in DSpark/spec/reference-exact activation.
A passing result requires:
matched/offeredcountersmatched < offered)full_snap=1, proving the rollback-capable path was activeEvidence is staged under unique attempt directories. Failed attempts retain diagnostics without occupying final evidence paths; complete logs and a manifest are promoted without overwriting existing evidence.
Demonstrated defect and fix
The first real-model gfx1151 run exposed a token-0 mismatch between target-only greedy generation and the DSpark-enabled reference-exact arm.
Root cause: q=1 target-feature capture did not enter the normal fused-decode graph unless approximate fused verification was enabled. Exact prompt replay therefore used a numerically different dynamic layer path before speculation began.
The first correction routes q=1 feature capture through the already-enabled fused-decode graph while leaving q>=2 approximate fused verification behind
DFLASH_DS4_FUSED_VERIFY.Cubic then identified that the capture execution scope still forced
mmvq_max_ncols=3while native gfx1151 AR inherited the process ceilingLUCE_MMVQ_MAX_NCOLS=4. Follow-up commit125b869removes that capture-only MMVQ override and executes q=1 capture eagerly, preserving the native MMVQ/MMQ selection while avoiding the known gfx1151 width-4 HIP graph-replay fault. q>=2 graph policy is unchanged. No exactness check, rollback requirement, or fail-closed condition was weakened.Validated revisions
125b869a6b90589f6aa1840f957425a2d8a40f8664205712b7824fd479fecd4cbdf84da751f4be3d4fa8937c69aa68658a14ec3cab16e1da22886dd0626e51384e3282e597ada97ed08e7db5cb5e531eSource and focused validation
git diff --checkpassedHIP / gfx1151 validation
Hardware and toolchain:
gfx1151Results:
37f7a6aacb7c6dee5567205698f7a4eca2a2c2bf8ca7e68bd3eb28c7d76bb9baggml_set_rowsfaults on HIP/ROCm after many reuses of a cached single-token graph (Strix Halo / gfx1151) #516 cachedggml_set_rowstrust gate passed:This bounded pass qualifies the cached-graph evidence used here; it does not claim to resolve issue #516 generally.
Real-model reference-exact proof
Pinned artifacts:
DeepSeek-V4-Flash-IQ2XXS-w2Q2K-AProjQ8-SExpQ8-OutQ8-chat-v2-imatrix.ggufefc7ed607ff27076e3e501fc3fefefa33c0ed8cf1eff483a2b7fdc0c2e616668DeepSeek-V4-Flash-DSpark-draft-Q4RMFP4-denseF16.gguf48883d35b8a67ecfd2858a90e12a47d04cb5ac581acef868ca0f58544816f7465801a972ad5f8d5297c5764f7c4f2f677872a9b50e41cf582945277cd21af179123496Target-only greedy versus
DFLASH_DS4_SPEC_REFERENCE_EXACT=1:Additional q=4 lifecycle evidence:
67/84matched/offered countersParity is exact token-ID equality; plausible text and approximate float comparisons were not used as the oracle.
CUDA negative-control validation
Hardware and toolchain:
sm_86Results:
test_deepseek4_unit:ERROR SUMMARY: 0 errorsCUDA is reported separately and is not presented as gfx1151 evidence.
Review and merge status
125b869Head
6420571is locally hardware-validated. The narrow MMVQ-policy follow-up at current head125b869passed local static/diff checks but has not been rerun on gfx1151 because lucebox3 is currently in active use; a focused q=2 parity rerun remains required when the box is free. No performance claim is made, and this PR does not include #554 or the separate August-10 exact-prefill optimization.