[PR #611] [CLOSED] DeepSeek --parallel: the DSpark drafter in the steps of several requests #624

Closed
opened 2026-10-29 21:27:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/611
Author: @needmorevram
Created: 10/28/2026
Status: ❌ Closed

Base: main ← Head: ds4-parallel-dspark


📝 Commits (3)

  • 3c2e935 DeepSeek --parallel: the DSpark drafter in the steps of several requests
  • c97b0c3 DeepSeek --parallel: two or three requests' drafts in one drafter pass
  • 193b851 docs: DeepSeek --parallel with the drafter on one RTX 3090 + two RTX 5060 Ti

📊 Changes

4 files changed (+807 additions, -108 deletions)

View changed files

📝 docs/SETTINGS.md (+20 -5)
📝 src/ds4/ds4_main.cpp (+290 -61)
📝 src/ds4/ds4_model.cu (+480 -42)
📝 src/ds4/ds4_model.hpp (+17 -0)

📄 Description

What

With --parallel above 1, DeepSeek's batched steps carried no drafts: as soon as two requests ran at once, each decoded one plain token a step and ran slower than it did alone with the DSpark drafter. Now the requests' rounds go through the model together with their drafts:

  • each request's drafter proposes its next tokens, its share of a 16-row window. Two or three requests draft in one drafter pass: their blocks' rows go through the DSpark blocks together, each block attending to its own conversation's drafter ring;
  • every request's token and drafts are verified in one step through the model. A request's rows attend to each other as a verify window's do;
  • each request takes its own verdict by verify()'s rule (greedy, or the speculative-sampling rule with the drafts as points) and undoes only its own rejected rows.

A round with no drafts (low confidence, --dspark off) is still step_multi's token of each.

Why

On a PC with most experts in RAM, the drafter is what makes one request fast, so two at once without it gave up most of what batching won. On one RTX 3090 + eight RTX 5060 Ti (--tp 8, EXL3 3.5 bpw), two short prose answers at once ran at 32.1 + 34.7 tok/s each before, against 43.7 / 55.2 alone.

How

src/ds4/ds4_model.cu:

  • step_runs (Model::step_multi_spec): step_multi with a run of rows per conversation. step_multi is now its runs of one, with the same rows, seeding and sampling. layer() calls attn_core once per run.
  • A verify window's backups are kept per run:
    • the ring backup and the compressor rows at the run's own rows (r0);
    • a compressor snapshot per run (c_snap is o.seqs snapshots long; it was one).
  • verify_multi: verify()'s verdict over the run's rows, with the penalties over its conversation's tokens. rollback_run restores that conversation's rings and compressors (ring_restore_batch / comp_restore_batch with its buffers), then seed_drafter seeds it with the kept rows.
  • draft_multi: draft_()'s steps for n conversations' blocks as rows, then each conversation's markov chain (also over a head group, mk_split) and confidences. It's used for 2–3 conversations whose blocks fit a window; otherwise each drafts with draft().

src/ds4/ds4_main.cpp:

  • With several requests running, each writes its whole round's tokens at once, so every request needs the model in the same step.
  • The last request still running decodes in its own rounds with the drafter. The prompt lookup is used only by a request running alone.
  • --multi-check adds three greedy passes with the drafter: each alone (draft / verify), together with a drafter pass each, and together in one pass. Every draft is verified whatever its confidence, so rejected rows are undone in most rounds.

One request is unchanged, with or without --parallel:

  • draft_(), verify(), rollback(), step() and the one-conversation serve path are not touched.
  • attn_core's backup offsets are 0 for a single window.
  • c_snap is the same size with one conversation.

Tested

Greedy, EXL3 3.5 bpw, --parallel 2, --dspark on. --multi-check uses a 554-token prompt of code; the second conversation is the same prompt 5 tokens shorter.

One RTX 3090 + eight RTX 5060 Ti, --tp 8 (two thirds of the experts in RAM), 2 × 200 tokens:

tok/s in all
together, no drafts (before) 56.4
each alone with the drafter, one after another 73.0
together, a drafter pass each 72.4
together, one drafter pass 79.3

Server, two requests at once (prose / code), per request:

  • just started: 37.3 + 44.5 / 46.3 + 50.1 tok/s;
  • warmer: 46.7 + 53.6 / 62.9 + 62.8 tok/s;
  • before, prose: 32.1 + 34.7 tok/s.

One RTX 3090 + two RTX 5060 Ti, --tp 2 (207 GB of experts read in place from the model's files), 2 × 160 tokens:

tok/s in all
together, no drafts (before) 19.8
each alone with the drafter, one after another 19.5
together, a drafter pass each 19.4
together, one drafter pass 25.2

Server, two requests at once, per request (two runs):

  • prose: 16.7 + 14.2 and 18.1 + 15.7 tok/s;
  • code: 17.3 + 17.3 and 18.3 + 18.8 tok/s;
  • each alone with the drafter: 15–25 tok/s;
  • the pair's wall time against one after another: ×1.66 / ×1.61 for prose, ×2.07 / ×1.22 for code.

Exactness: the first conversation's tokens match its plain decode alone in every pass on both setups, with 177–250 drafts rejected and undone per pass. The second conversation's prompt ends at a near tie and drifts from its plain decode alone also without drafts. On these PCs the CPU lane's rounding changes the logits' last bits between a window and a step: the together pass without drafts, step_multi as on main, matches 0 rows bit for bit.

It builds with no new warnings.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/611 **Author:** [@needmorevram](https://github.com/needmorevram) **Created:** 10/28/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `ds4-parallel-dspark` --- ### 📝 Commits (3) - [`3c2e935`](https://github.com/mw00/project-maya/commit/3c2e9359f10c21d6f586f3b586044da08331cffc) DeepSeek --parallel: the DSpark drafter in the steps of several requests - [`c97b0c3`](https://github.com/mw00/project-maya/commit/c97b0c3fb4cefeaf5bb3e2de8f7744f2c49d5b05) DeepSeek --parallel: two or three requests' drafts in one drafter pass - [`193b851`](https://github.com/mw00/project-maya/commit/193b8517b0037cea72fa062bac97c053f2f4a870) docs: DeepSeek --parallel with the drafter on one RTX 3090 + two RTX 5060 Ti ### 📊 Changes **4 files changed** (+807 additions, -108 deletions) <details> <summary>View changed files</summary> 📝 `docs/SETTINGS.md` (+20 -5) 📝 `src/ds4/ds4_main.cpp` (+290 -61) 📝 `src/ds4/ds4_model.cu` (+480 -42) 📝 `src/ds4/ds4_model.hpp` (+17 -0) </details> ### 📄 Description ## What With `--parallel` above 1, DeepSeek's batched steps carried no drafts: as soon as two requests ran at once, each decoded one plain token a step and ran slower than it did alone with the DSpark drafter. Now the requests' rounds go through the model together with their drafts: - each request's drafter proposes its next tokens, its share of a 16-row window. Two or three requests draft in **one drafter pass**: their blocks' rows go through the DSpark blocks together, each block attending to its own conversation's drafter ring; - every request's token and drafts are verified in **one step** through the model. A request's rows attend to each other as a verify window's do; - each request takes its own verdict by `verify()`'s rule (greedy, or the speculative-sampling rule with the drafts as points) and undoes only its own rejected rows. A round with no drafts (low confidence, `--dspark off`) is still `step_multi`'s token of each. ## Why On a PC with most experts in RAM, the drafter is what makes one request fast, so two at once without it gave up most of what batching won. On one RTX 3090 + eight RTX 5060 Ti (`--tp 8`, EXL3 3.5 bpw), two short prose answers at once ran at 32.1 + 34.7 tok/s each before, against 43.7 / 55.2 alone. ## How `src/ds4/ds4_model.cu`: - `step_runs` (`Model::step_multi_spec`): `step_multi` with a run of rows per conversation. `step_multi` is now its runs of one, with the same rows, seeding and sampling. `layer()` calls `attn_core` once per run. - A verify window's backups are kept per run: - the ring backup and the compressor rows at the run's own rows (`r0`); - a compressor snapshot per run (`c_snap` is `o.seqs` snapshots long; it was one). - `verify_multi`: `verify()`'s verdict over the run's rows, with the penalties over its conversation's tokens. `rollback_run` restores that conversation's rings and compressors (`ring_restore_batch` / `comp_restore_batch` with its buffers), then `seed_drafter` seeds it with the kept rows. - `draft_multi`: `draft_()`'s steps for n conversations' blocks as rows, then each conversation's markov chain (also over a head group, `mk_split`) and confidences. It's used for 2–3 conversations whose blocks fit a window; otherwise each drafts with `draft()`. `src/ds4/ds4_main.cpp`: - With several requests running, each writes its whole round's tokens at once, so every request needs the model in the same step. - The last request still running decodes in its own rounds with the drafter. The prompt lookup is used only by a request running alone. - `--multi-check` adds three greedy passes with the drafter: each alone (`draft` / `verify`), together with a drafter pass each, and together in one pass. Every draft is verified whatever its confidence, so rejected rows are undone in most rounds. **One request is unchanged, with or without `--parallel`:** - `draft_()`, `verify()`, `rollback()`, `step()` and the one-conversation `serve` path are not touched. - `attn_core`'s backup offsets are 0 for a single window. - `c_snap` is the same size with one conversation. ## Tested Greedy, EXL3 3.5 bpw, `--parallel 2`, `--dspark on`. `--multi-check` uses a 554-token prompt of code; the second conversation is the same prompt 5 tokens shorter. **One RTX 3090 + eight RTX 5060 Ti, `--tp 8`** (two thirds of the experts in RAM), 2 × 200 tokens: | | tok/s in all | |---|---| | together, no drafts (before) | 56.4 | | each alone with the drafter, one after another | 73.0 | | together, a drafter pass each | 72.4 | | **together, one drafter pass** | **79.3** | Server, two requests at once (prose / code), per request: - just started: 37.3 + 44.5 / 46.3 + 50.1 tok/s; - warmer: 46.7 + 53.6 / 62.9 + 62.8 tok/s; - before, prose: 32.1 + 34.7 tok/s. **One RTX 3090 + two RTX 5060 Ti, `--tp 2`** (207 GB of experts read in place from the model's files), 2 × 160 tokens: | | tok/s in all | |---|---| | together, no drafts (before) | 19.8 | | each alone with the drafter, one after another | 19.5 | | together, a drafter pass each | 19.4 | | **together, one drafter pass** | **25.2** | Server, two requests at once, per request (two runs): - prose: 16.7 + 14.2 and 18.1 + 15.7 tok/s; - code: 17.3 + 17.3 and 18.3 + 18.8 tok/s; - each alone with the drafter: 15–25 tok/s; - the pair's wall time against one after another: ×1.66 / ×1.61 for prose, ×2.07 / ×1.22 for code. **Exactness:** the first conversation's tokens match its plain decode alone in every pass on both setups, with 177–250 drafts rejected and undone per pass. The second conversation's prompt ends at a near tie and drifts from its plain decode alone also without drafts. On these PCs the CPU lane's rounding changes the logits' last bits between a window and a step: the together pass without drafts, `step_multi` as on main, matches 0 rows bit for bit. It builds with no new warnings. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:27:36 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#624
No description provided.