Skip to content

dsv41 dspark: governor cost per token as a ratio of EMAs - #41

Merged
jjang-ai merged 1 commit into
mainfrom
fix/dsv41-governor-ratio
Oct 27, 2026
Merged

jjang-ai merged 1 commit into
mainfrom
fix/dsv41-governor-ratio

Conversation

@jjang-ai

Copy link
Copy Markdown
Owner

Summary

_Governor (adaptive dSpark) kept an EMA of per-step seconds / emitted. A mean of per-step ratios over-weights the one-token steps of a missed draft: a 6-token and a 1-token step of 50 ms each read 29 ms/token, not the 14 ms/token they cost. One miss could flip speculation that was winning into a 16-token AR stretch, and the faster AR gets (the decode kernels), the more often that happens.

It now keeps EMAs of step seconds and of tokens emitted per step and compares their ratio. spec / ar stay as read-only properties (seconds per emitted token), so callers and stats are unchanged.

Evidence

  • New test test_governor_cost_is_ratio_of_means: alternating 6/1-token spec steps against a 21 ms AR step stay speculative (< 12 AR steps of 400); the old estimator spends 320 of 400 steps AR. All 10 governor tests pass.
  • Same fix in the Swift port (DeepSeek-V4.1: split-by-keys decode attention; dSpark governor cost as a ratio of EMAs osaurus-ai/vmlx-swift#668), measured in the osaurus app on JANG_2K with the split decode attention: dSpark code 59.6 -> 76-80 tok/s, code2 53.9 -> 63-64; with the kernel off, code 70.3 -> 79.9. Prose / structured unchanged.
  • DECODE_DSPARK_METHODS.md M2 updated.

…of per-step ratios

A mean of per-step seconds/emitted over-weights the one-token steps of a
missed draft (a 6-token and a 1-token step of 50 ms read 29 ms/token, not
the 14 ms/token they cost). Once the decode kernels made AR faster, a
single miss on code text flipped speculation that was winning into a
16-token AR stretch. Keep EMAs of step seconds and of emitted tokens and
compare their ratio. Test: alternating 6/1-token spec steps against a
21 ms AR step stay speculative (old estimator: 320 of 400 steps AR).
@jjang-ai
jjang-ai merged commit b3d21c2 into main Oct 27, 2026
2 of 3 checks passed
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