mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #636] DeepSeek --parallel: who drafts in a round of several by a measured cost policy, in place of the one-pass gate (MAYA_DS4_MULTI_DRAFT_POLICY); --multi-check holds the expert cache #642
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#642
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/636
Author: @somnergy
Created: 10/28/2026
Status: 🔄 Open
Base:
main← Head:pr/ds4-multi-draft📝 Commits (5)
1b3c66cDeepSeek --parallel: prompts read a piece at a time (a chunk per pipeline stage), every answer a token between pieces, a one-piece prompt ahead of longer reads; MAYA_DS4_READ_ORDER=arrival keeps the old order. agent_bench 4x8 on 3 GPUs: first token 5.23 s mean / 13.5 s p95 against 6.14 / 29.1, turn done and wall the same; parallel_test --lanes 4 token for token8185908DeepSeek --parallel on events (ds4_evt.hpp, #557's): the reader's lines and the turns - a round of tokens or a prompt's piece - each queueing the next; a line outranks a turn, nothing polls (Lines::poll goes). parallel_test --lanes 4 and 2 every check; agent_bench 4x8 first token 5.20 s mean / 13.4 s p95, wall 190.3 s (as before)e90b747DeepSeek --parallel: a prompt read alone goes in one run and yields to a request at the next chunk all stages reach (Model::set_yield: the Stop's cut, keeping what it read); a piece tells the model how much of its prompt follows, so the long prompt's skip counts from the prompt's end; MAYA_DS4_READ_PIECE (chunks a stage) and MAYA_DS4_READ_ROUNDS (tokens each between pieces). 3 GPUs: a 101K prompt alone 49.2 s, against 58.7 s before and 49.1 s read whole; a question 5 s into it, first token 19.3 s (47 s read whole); parallel_test --lanes 4 and 2 every check; agent_bench 4x8 first token 5.21 s mean / 13.6 s p95, wall 190.4 s (as before)86a3757DeepSeek --parallel: a yield lands sooner - in a run that may yield, no GPU starts chunk k before chunk k - (stages + 1) is through every layer (a host ran ~2 chunks ahead of its GPU and each stage ~2 ahead of the next: the cut came 5 chunks past the done ones); MAYA_DS4_READ_SHARE= lets running answers write for that share of the time between pieces (off: on agent_bench it made first tokens later). 3 GPUs: a question 5 s into a 101K read, first token 15.7 s (19.3 s before); the read alone 49.0 s; agent_bench 4x8 first token 5.27 s mean / 13.6 s p95, wall 188.2 s; parallel_test --lanes 4 and 2 every checka43df58DeepSeek --parallel: who drafts in a round of several, a measured cost policy (MAYA_DS4_MULTI_DRAFT_POLICY, on by default) in place of the one-pass gate; --multi-check holds the expert cache📊 Changes
7 files changed (+1621 additions, -167 deletions)
View changed files
📝
docs/SETTINGS.md(+47 -9)➕
src/ds4/ds4_evt.hpp(+162 -0)📝
src/ds4/ds4_main.cpp(+590 -138)📝
src/ds4/ds4_model.cu(+98 -17)📝
src/ds4/ds4_model.hpp(+20 -3)➕
tools/ds4/agent_bench.py(+283 -0)➕
tools/ds4/parallel_test.py(+421 -0)📄 Description
DeepSeek
--parallelwith #611's drafting: a round of several now decides who drafts, and how many drafts each, from measured costs. This replaces the all-or-nothing gate "draft only where every drafter fits one pass". With four requests and DSpark's 5-row block, that gate never drafts.MAYA_DS4_MULTI_DRAFT_POLICY=0restores the gate exactly.--multi-checkalso holds the expert cache for the whole check.Depends on #587. The branch is #587's four commits (
86a3757) plus one commit, this PR. #611's core is used as it is:verify_multi,draft_multi,step_multi_spec, the cut andcool. Only the choice of who drafts changes. This replaces the earlier version of the PR, which carried its ownverify_multi/draft_multi. The 8-row window cap from that version is gone, because windows of 9-16 rows are exact on the async path (see the #608 correction).What it does
The cost policy (
MAYA_DS4_MULTI_DRAFT_POLICY=1, the default). As it serves, the engine:Each round it prices the plans "the j conversations with the best acceptance draft, (16 − n) / j each at most", each with the drafter calls it needs: one pass holds three with DSpark's block, and more drafters take another call. It takes the plan that expects the most tokens per millisecond, if that beats a round without drafts by
MAYA_DS4_MULTI_DRAFT_MARGIN(0.03). Otherwise the round is a token of each.MAYA_DS4_MULTI_DRAFT_RETRYrounds (8). The gap doubles up toMAYA_DS4_MULTI_DRAFT_PROBE_CAP(128), so its acceptance stays measured.draft_groups(). A round's drafters go todraft_multiin calls of as many as one pass holds (Model::draft_pass()). A single leftover drafter drafts alone withdraft().--multi-check.Model::cache_hold). The swaps already in progress switch in first; after that nothing switches, swaps or fills until the release. So the runs alone and together see the same expert placement when experts are on the CPU lane. Otherwise an expert the cache moved between the GPU and the lane in between would round differently.Logs.
MAYA_DS4_MULTI_DRAFT_LOG=1writes a line for each round of several (drafts kept / offered per request, drafter and round time, tokens against the plan's expectation), plus each request's averages when it ends.Docs.
docs/SETTINGS.md: the "Two or more" bullet is updated and a new bullet, "Who drafts in a round of several", is added.A request alone is unchanged. Greedy, the choice of who drafts changes only how many tokens a round takes, not which tokens.
Settings
MAYA_DS4_MULTI_DRAFT_POLICYMAYA_DS4_MULTI_DRAFT_MARGINMAYA_DS4_MULTI_DRAFT_RETRY/_PROBE_CAPMAYA_DS4_MULTI_DRAFT_LOGResults
Setup: two 72 GB Blackwell cards (GPU peer copies at 54 GB/s each way), a 64-core Zen 4 host. DeepSeek-V4.1-Flash, IQ2_XXS GSQ-RCO pack, DSpark drafter on,
--parallel 4 --tp 1(layer split), 512K context. Pooled tok/s, greedy (T=0), conversations started together. "v1.1.36 + #587" is the same build without this commit.Verdict by hardware class:
Copy prompt: "output this code again with a one-line comment above each function", over ~1.5K-token source files. Essay: 700-token prose answers. Measured with
MAYA_DS4_MULTI_DRAFT_LOG=1. Its round lines show the plan's expected rate close to the measured one, for example "2 answering, 7 rows: drafter 2.7 ms, round 39.5 ms, 7 tokens (166 tok/s; the plan expected 166, without drafts 103)".Exactness
Measured on a two-GPU layer split at
--parallel 4, with the expert cache held:--multi-check --n 160:tools/ds4/parallel_test.py --lanes 4 --spec 1: every check passes (together = alone for all four, stop, slots).These ran on the commit before a one-line change, which made the settings also read their
STRATA_names, the way the server passes them. Without the settings set, that change is a no-op.Suggested settings
POLICY=1)POLICY=0if the drafter is slow thereChecks
maya-ds4(sm_120, CUDA 13.4), no new warnings in the changed files.tools/check_hip_compat.py: passes.serve/test_multi.py(13),tools/test_maya_parallel.py(11) andtools/test_ds4*.py(33) pass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.