[PR #540] [CLOSED] DeepSeek: prompt lookup beside DSpark - whole-file edits up to 1.5x faster, the same tokens #588

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

📋 Pull Request Information

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

Base: main ← Head: ds4-prompt-lookup


📝 Commits (3)

  • d348264 DeepSeek: prompt lookup beside DSpark - whole-file edits up to 1.5x faster, the same tokens
  • a2dc983 DeepSeek: prompt lookup without DSpark too - --dspark none / off, and the rounds DSpark rests
  • 01ce156 DeepSeek: prompt lookup without DSpark moves to a PR of its own

📊 Changes

9 files changed (+100 additions, -12 deletions)

View changed files

📝 CMakeLists.txt (+1 -1)
📝 docs/SETTINGS.md (+1 -0)
📝 include/strata/spec/draft_policy.hpp (+1 -1)
📝 serve/server.py (+3 -0)
📝 serve/test_server.py (+8 -0)
📝 src/ds4/ds4_main.cpp (+75 -8)
📝 src/ds4/ds4_model.cu (+2 -0)
📝 src/ds4/ds4_model.hpp (+5 -0)
📝 src/spec/draft_policy.cpp (+4 -2)

📄 Description

What

When DeepSeek's answer repeats earlier context - a file sent back with small edits, quoted text, a list that comes back -
a decode round can now verify the tokens that followed that earlier occurrence instead of DSpark's drafts: up to 15 of
them, where DSpark's block gives 4.

maya-ds4 reuses the suffix drafter and draft policy the GLM path already has (strata/spec/):

  • a lookup window is taken only when its first token agrees with DSpark's first draft, and the draft policy expects more
    committed tokens per millisecond from it - from this PC's measured round times by window size and the lookup drafts'
    measured acceptance, both learned while it decodes (nothing tuned to one machine)
  • only which drafts are verified changes: verify() keeps a draft the drafter did not draw with probability p(d) (q a
    point at it), so greedy answers are identical and sampled ones are still the model's own draws
  • not used beside DS4_DSPARK_SAMPLE=1's drawn drafts (the choice would then depend on a draw)

Settings

--suffix-draft N (maya-ds4) the shortest match it proposes from; 3 by default, 0 turns it off
request strata_tune suffix_draft 0 / 1: off / on for that request (an A/B in one engine)

Also: DraftPolicy's window cap 8 -> 16 (the GLM paths still pass 8 at most, so nothing changes there),
Model::verify_max() and Model::drafts_sampled(), a docs/SETTINGS.md row, a server test for the new key.

Measured

9 GPUs (RTX 3090 + 8x RTX 5060 Ti), the abliterated Mix-256G GGUF, --tp 8, --prefill-chunk 4096, DSpark on,
temperature 1.0 / top_p 1.0. One engine, lookup off / on per request, two passes in opposite orders (a prompt's second
run finds a warmer VRAM expert cache, so single pairs mislead), mean of both:

prompt off on
whole-file C++ edit (~1K tokens out) 84.3 tok/s 110.7 tok/s +31%
whole-file Python edit (~2.3K tokens out) 96.1 tok/s 143.6 tok/s +50%
greedy C++ edit (1024 tokens) 83.5 tok/s 131.9 tok/s identical tokens
new code (thinking) 67.9 tok/s 66.9 tok/s -1.4% (noise)
explanation (thinking) 44.4 tok/s 45.4 tok/s +2.3% (noise)
list (thinking) 55.8 tok/s 56.0 tok/s +0.3%

On the edits the lookup was taken in ~60 / ~140 rounds with 96-99% of its drafts kept; on ordinary answers in 0-15
rounds.

Note: main cannot load the Mix-256G GGUF yet (its layers mix IQ3 gate / ups with MXFP4 downs - #520), so these runs
are this commit applied on #520's branch; this branch itself was built and the tests below run on it.

Tests

  • serve.test_server (114 tests) pass, including the new test_suffix_draft_tune_key
  • draft_policy_test and suffix_drafter_test pass with the 16-token cap
  • maya-ds4 built for sm_86 / sm_120 (CUDA); HIP not built here
  • the lookup's memory: its index is sized for the context (about 32 MB at 256K, 128 MB at 1M), cleared once per request

🔄 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/540 **Author:** [@needmorevram](https://github.com/needmorevram) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `ds4-prompt-lookup` --- ### 📝 Commits (3) - [`d348264`](https://github.com/mw00/project-maya/commit/d348264867bc097ce57fe35f1697917029ab2950) DeepSeek: prompt lookup beside DSpark - whole-file edits up to 1.5x faster, the same tokens - [`a2dc983`](https://github.com/mw00/project-maya/commit/a2dc98314433b15adced2f8499e5227c94ebaa42) DeepSeek: prompt lookup without DSpark too - --dspark none / off, and the rounds DSpark rests - [`01ce156`](https://github.com/mw00/project-maya/commit/01ce15622505344c694ef12253f726c092ba4298) DeepSeek: prompt lookup without DSpark moves to a PR of its own ### 📊 Changes **9 files changed** (+100 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+1 -1) 📝 `docs/SETTINGS.md` (+1 -0) 📝 `include/strata/spec/draft_policy.hpp` (+1 -1) 📝 `serve/server.py` (+3 -0) 📝 `serve/test_server.py` (+8 -0) 📝 `src/ds4/ds4_main.cpp` (+75 -8) 📝 `src/ds4/ds4_model.cu` (+2 -0) 📝 `src/ds4/ds4_model.hpp` (+5 -0) 📝 `src/spec/draft_policy.cpp` (+4 -2) </details> ### 📄 Description ## What When DeepSeek's answer repeats earlier context - a file sent back with small edits, quoted text, a list that comes back - a decode round can now verify the tokens that followed that earlier occurrence instead of DSpark's drafts: up to 15 of them, where DSpark's block gives 4. maya-ds4 reuses the suffix drafter and draft policy the GLM path already has (`strata/spec/`): - a lookup window is taken only when its first token agrees with DSpark's first draft, and the draft policy expects more committed tokens per millisecond from it - from this PC's measured round times by window size and the lookup drafts' measured acceptance, both learned while it decodes (nothing tuned to one machine) - only which drafts are verified changes: `verify()` keeps a draft the drafter did not draw with probability p(d) (q a point at it), so greedy answers are identical and sampled ones are still the model's own draws - not used beside `DS4_DSPARK_SAMPLE=1`'s drawn drafts (the choice would then depend on a draw) ## Settings | | | | --- | --- | | `--suffix-draft N` (maya-ds4) | the shortest match it proposes from; 3 by default, `0` turns it off | | request `strata_tune` `suffix_draft` | `0` / `1`: off / on for that request (an A/B in one engine) | Also: `DraftPolicy`'s window cap 8 -> 16 (the GLM paths still pass 8 at most, so nothing changes there), `Model::verify_max()` and `Model::drafts_sampled()`, a `docs/SETTINGS.md` row, a server test for the new key. ## Measured 9 GPUs (RTX 3090 + 8x RTX 5060 Ti), the abliterated Mix-256G GGUF, `--tp 8`, `--prefill-chunk 4096`, DSpark on, temperature 1.0 / top_p 1.0. One engine, lookup off / on per request, two passes in opposite orders (a prompt's second run finds a warmer VRAM expert cache, so single pairs mislead), mean of both: | prompt | off | on | | | --- | --- | --- | --- | | whole-file C++ edit (~1K tokens out) | 84.3 tok/s | 110.7 tok/s | +31% | | whole-file Python edit (~2.3K tokens out) | 96.1 tok/s | 143.6 tok/s | +50% | | greedy C++ edit (1024 tokens) | 83.5 tok/s | 131.9 tok/s | identical tokens | | new code (thinking) | 67.9 tok/s | 66.9 tok/s | -1.4% (noise) | | explanation (thinking) | 44.4 tok/s | 45.4 tok/s | +2.3% (noise) | | list (thinking) | 55.8 tok/s | 56.0 tok/s | +0.3% | On the edits the lookup was taken in ~60 / ~140 rounds with 96-99% of its drafts kept; on ordinary answers in 0-15 rounds. Note: `main` cannot load the Mix-256G GGUF yet (its layers mix IQ3 gate / ups with MXFP4 downs - #520), so these runs are this commit applied on #520's branch; this branch itself was built and the tests below run on it. ## Tests - `serve.test_server` (114 tests) pass, including the new `test_suffix_draft_tune_key` - `draft_policy_test` and `suffix_drafter_test` pass with the 16-token cap - maya-ds4 built for sm_86 / sm_120 (CUDA); HIP not built here - the lookup's memory: its index is sized for the context (about 32 MB at 256K, 128 MB at 1M), cleared once per request --- <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:14 +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#588
No description provided.