tests: measure batched-verify greedy divergence rate, not just worst gap - #756
tests: measure batched-verify greedy divergence rate, not just worst gap#756Flor1an-B wants to merge 1 commit into
Conversation
The verify-depth regressions teacher-force every committed speculative
token through ordinary decode and keep only the worst argmax gap, gating
on gap <= 2.0 (a catastrophic mis-commit). They never report how *often*
the batched Metal verifier commits a non-argmax token, nor whether those
divergences are harmless near-ties or material greedy changes -- the
characterization that decides whether the documented "may pick a
different greedy token when batched reductions perturb nearly tied
logits" compromise is worth closing.
Extend the shared teacher-forcing helper to accumulate a divergence rate
(committed token != autoregressive argmax) and a severity histogram
alongside the existing worst_gap; both --mtp-verify-depth and
--dspark-verify-depth now print it. The gated worst_gap <= 2.0 invariant
is unchanged.
Add a diagnostic --verify-divergence mode (no pass/fail gate) that points
the same instrument at an open-ended, higher-entropy prompt where nearly
tied logits actually occur -- the confident copy fixture the regressions
use structurally yields ~0 divergence. Prompt and sample size are
overridable via DS4_TEST_DIVERGENCE_PROMPT / DS4_TEST_DIVERGENCE_MAXGEN.
Test-only; no release-path change. Built and run on Apple M5 Max, Metal
backend, DeepSeek-V4-Flash-DSpark-support.gguf (stages=3):
make ds4_test # -Wall -Wextra, 0 warnings
./ds4_test --server # OK
DS4_TEST_DSPARK=... ./ds4_test --dspark-verify-depth
nspec=128 divergence=0/128 (0.00%) worst_gap=0.000
DS4_TEST_DSPARK=... ./ds4_test --verify-divergence
open-ended 256 tok: divergence=0/256 (0.00%) worst_gap=0.000
long-form 1024 tok: divergence=0/1024 (0.00%) worst_gap=0.000
Measured result: no batched-verify greedy divergence over 1408
teacher-forced positions on this config, across confident and
higher-entropy generation, with multi-row verify exercised (max_chunk
up to 6).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Ran the same instrument on the legacy MTP path (
MTP, open-ended ( Two takeaways:
So the compromise |
|
Re-ran on current
DSpark, current main ( DSpark was byte-exact-argmax before because it replayed accepted tokens through ordinary decode; committing the verified accept state directly (the speed win) now lets the batched verifier's nearly-tied-logit picks reach the output. So the ~3% is the measured greedy-divergence cost of the direct-commit default — all sub-catastrophic (worst 1.363), and none of it trips the existing Not arguing the tradeoff is wrong — direct-commit is a real speedup — just that it's now a measurable quality delta rather than an invisible one. |
Motivation
ds4.cdocuments that the non-quality Metal speculative path "may pick adifferent greedy token when batched reductions perturb nearly tied logits".
The
--mtp-verify-depth/--dspark-verify-depthregressions alreadyteacher-force every committed token through ordinary decode, but they keep
only the worst argmax gap and gate on
gap <= 2.0(a catastrophicmis-commit). They never report how often the batched verifier commits a
non-argmax token, nor whether those divergences are harmless near-ties or
material greedy changes — the characterization that decides whether that
compromise is worth closing with an exact verifier.
Change (test-only, no release-path change)
(committed token != autoregressive argmax) and a severity histogram
alongside the existing
worst_gap. Both verify-depth tests print it; thegated
worst_gap <= 2.0invariant is unchanged.--verify-divergencemode (no pass/fail gate) thatpoints the same instrument at an open-ended, higher-entropy prompt where
nearly tied logits actually occur — the confident copy fixture the
regressions use structurally yields ~0 divergence. Prompt and sample size
are overridable via
DS4_TEST_DIVERGENCE_PROMPT/DS4_TEST_DIVERGENCE_MAXGEN.Testing
Apple M5 Max, Metal backend,
DeepSeek-V4-Flash-DSpark-support.gguf(stages=3):Measured result: no batched-verify greedy divergence over 1408
teacher-forced positions on this config, across confident and higher-entropy
generation, with the multi-row verify path exercised (
max_chunkup to 6).On this hardware/model the documented divergence appears latent — a useful
"measure before you build" data point for anyone weighing an exact Metal
verifier. The
--verify-divergencediagnostic is the tool to extend thatsample to other models, prompts, and lengths.
🤖 Generated with Claude Code