Skip to content

Add DFlash acceptance capture and offline selector analysis - #550

Open
linson007 wants to merge 2 commits into
incoai:mainfrom
linson007:feat/dflash-acceptance-diagnostics
Open

linson007 wants to merge 2 commits into
incoai:mainfrom
linson007:feat/dflash-acceptance-diagnostics

Conversation

@linson007

@linson007 linson007 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Aggregate acceptance counters cannot show whether DFlash lost a token because it missed the candidate set or chose the wrong candidate. This adds development-only completed-scratch capture to decode-profile and a model-free Python replay that separates those cases, checks conditional acceptance/calibration, and compares greedy, expected-prefix-length, Viterbi and scalar edge-score variants.

The accessor is defined only in the instrumented Runtime object. The capture uses the actual dispatch width to locate packed edge tables, omits position zero's unwritten predecessor rows, and records ordinary greedy cycles with every verify row. Replay reconstructs correct continuation from committed outputs, censors unavailable/terminal suffixes, and checks captured greedy choices and confidence before reporting.

Includes ten compressed real-model captures (552 lane cycles), exact prompt IDs, source/checkpoint identities, checksums, reproducible reports and a training/architecture analysis. The small correlated probes show selection headroom; look-ahead and scalar calibration have mixed results. No trained checkpoint, production policy change or serving speedup is claimed.

Related to #258 (selector capture/analysis portion) and #542. Stage attribution and stochastic-distribution capture remain separate work. Training and architecture experiments are tracked in #543–#548; the report also records the existing #499/#537 training PRs and the closed #259/#187 proposals.

Validation:

  • 20 replay tests pass, including exhaustive DP references, FP32 ties, terminal censoring, complete batches, malformed captures and checksum/report reproduction for every archived capture.
  • Full make -j6 check passes: CPU runtime, shader-validated Metal suites (including both MoE format sweeps), native builds, 1,335 Python tests with 27 skips, compileall, Ruff and architecture/source checks. Final replay additions pass all 20 tests separately; final CLI guards pass six invalid-input/context-limit checks.
  • Final rebuilt tool captures/replays Qwen3.8-27B at B4 and Qwen3.6-35B-A3B at B1; terminal-censoring and original dispatch-profiling smoke runs pass.
  • Production Runtime preprocessing matches upstream main byte for byte; the new accessor is excluded from production. Original captures include a Metal shader-validated B3 run. CI results are reported independently on this PR.

Analysis and recommendation coverage · Measurements and reproduction

Trained-export native replay

Published CUDA/native evidence adds native loading and capture/replay of the released Qwen3.8-27B draft and four actual CUDA-trained BF16 exports: 540 lane-cycles on the same 4-bit target, INT8 KV, FP32 state, greedy decoding, all verification rows and frozen budget learning. All twenty sanitized published captures replay exactly. Non-draft input digests match across all five assemblies, and target output common prefixes agree in every comparison. No consistent acceptance improvement or throughput claim is supported by these four short prompts. This adds use of the existing diagnostics at b4006b12cdd7, without modifying its implementation.

The pinned teacher template defaults to thinking enabled with xhigh reasoning effort; native probes explicitly disabled thinking. This mode mismatch, together with the BF16/low-bit target difference and short captures, prevents a matched-distribution effectiveness conclusion. Future capture controls should make thinking mode explicit and include it in cache/run provenance.

@linson007

Copy link
Copy Markdown
Contributor Author

Follow-up use of the native diagnostics with actual CUDA-trained exports

The published matrix captured/replayed the released Qwen3.8-27B DFlash2 draft plus four actual CUDA-trained compatible exports: 540 lane-cycles, 108 per model, across code/math/prose/JSON. All 20 published captures replay exactly. The target/other non-draft input digests match across all five assemblies, and target output common prefixes agree.

The binary used was b4006b12cdd7e0eff0b759b2f5f1aa9d53e93610 from #556, which includes this PR's ef0e95d4fa09f265f1cb071d43591ff32367b372 head. Thus the new matrix exercises the combined diagnostics including this PR, rather than claiming the unextended #550 binary produced it. Earlier direct #550 qualification remains recorded in its existing benchmark artifacts and current-head CI.

Configuration: Apple M5 Pro, fixed 4-bit Qwen3.8-27B target, INT8 KV, FP32 recurrent state, width one, greedy decoding, thinking disabled, all verification rows, frozen budget learning. The captures measure diagnostic behavior/acceptance, not serving throughput. No consistent acceptance gain from the trained exports was demonstrated; training/default-thinking and target-quantization mismatches are documented.

Full report and reproduction · native/results.json · native/comparison.json

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.

Look-ahead draft selector for greedy lanes

1 participant