[GH-ISSUE #638] DeepSeek ds4: requests end early with finish=length under --parallel (and rarely solo) - no error, engine-side #264

Open
opened 2026-10-29 21:23:28 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @handmade0octopus on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/638

DeepSeek ds4: requests under --parallel (and rarely solo) end early with finish=length — no error, engine-side

Summary

On Windows (CUDA, RTX 4090 D, sm_89), a maya-ds4 request's token stream sometimes just ends early:
the engine emits DONE with produced < max_new and finish=length, no error line, no NaN, no
illegal-memory-access, no restart, no WER event. The server side sees a normal end-of-stream and
reports the answer as complete. Reproduced on v1.1.34 (with local patches) and on a clean v1.1.36
(f031a23) build. Under --parallel 2 in the first-request-after-boot regime it reproduces on most
attempts; the worst case truncated both concurrent requests.

Cleanest reproduction (v1.1.36, f031a23, quiet box)

  • Windows 11, CUDA build (arch 89), RTX 4090 D 48 GB, 128 GB RAM, model on a fast TLC NVMe.
  • Pack: DeepSeek-V4.1-Flash ISTA GSQ-RCO IQ1_M (1.75 bpw; pack carries the DSpark drafter).
  • --pack ... --max-context 262144 --mmap-experts off --cpu-threads 12 --dspark on --parallel 2
  • Requests: raw token-id prompts (32,768 unique pseudo-random ids each, no reuse), max_new=2048,
    driven over the server (raw-ID SSE), two conversations concurrently, immediately after boot.
  • Custom env in play (both engines, present in clean runs too): DS4_STREAM_ZC=1 DS4_STREAM_ZC_ALL=1 DS4_STREAM_ZC_NOWAIT=1 DS4_STREAM_WIN=1 DS4_LAND=1 MAYA_DS4_PIN_BY_NEED=1 MAYA_DS4_PIN_GB=0 MAYA_DS4_Q8_BATCH=1 DS4_FAT_ROWS=0 MAYA_DS4_HC_FUSE=2 MAYA_DS4_DECODE_TRIM=7 DS4_ENGRAM_CACHE_MB=8192 DS4_ENGRAM_PREFETCH=1 DS4_ENGRAM_PREFETCH_CHUNKS=-1.

Attempt A — --dspark on: both requests truncated

maya ds4 serve: request 2: prompt 32768 tokens = 0 reused + 32768 read in 32260 ms (1015.7 tok/s),
  12 generated in 1005 ms (11.94 tok/s, 1 conversations running; drafts 3 of 6 kept)
maya ds4 serve: request 1: prompt 32768 tokens = 0 reused + 32768 read in 31930 ms (1026.2 tok/s),
  17 generated in 33375 ms (0.51 tok/s, 0 conversations running; drafts 6 of 9 kept)
[maya] done: 12 tokens in 65 s (11.9 tok/s) (length, cancel=False), expert cache 93.2% hit
[maya] done: 17 tokens in 65 s (0.5 tok/s) (length, cancel=False), expert cache 100.0% hit

Both conversations stop at the same wall-clock instant (~1-2 verify windows into the shared step).
Note request 1's own summary: 17 tokens took 33.4 s (0.51 tok/s) — the shared step appears to stall
~30 s before the requests are ended. No ERR, no engine restart, no CUDA error in the log.

Attempt B — --dspark off (same everything else): one of two truncated

maya ds4 serve: request 1: ... 1884 generated in 149170 ms (12.63 tok/s, ...; drafts 0 of 0 kept)
maya ds4 serve: request 2: ... 2048 generated in 120022 ms (17.06 tok/s, ...; drafts 132 of 182 kept)

The truncated request had no drafts at all (drafts 0 of 0 kept) — so the new #611 parallel
drafter path is not required; prompt-lookup-only and no-drafting requests truncate too. (The clean
one had lookup drafts.) Same boot regime, same everything else.

Attempt C — identical to A (fresh boot, fresh prompts): clean

2048/2048 both conversations (drafts kept 69–75%, decode aggregate 40.6 t/s). Same regime as A, so
within --dspark on --parallel 2 first-boot runs it is intermittent: A truncated 2/2 requests,
C truncated 0/2.

Earlier statistics (v1.1.34 + local commits, same box/pack)

  • Across a benchmark sweep: 10 of 32 decode requests truncated at 12, 20, 21, 831, 916, 1569,
    1638, 1696, 1713, 1991 of 2048 tokens — in --parallel 1/2/4 cells alike, almost always in the
    first requests after a fresh engine boot.
  • An instrumented build (extra stderr line at the solo DONE site: produced/limit/max_new/pos/ max_ctx/finish) ran 8 clean solo first-request attempts: 0/8 reproductions, and on every clean
    run limit was honored exactly (produced=2048 limit=2048 ... finish=length), pos sane.
    So the truncation is an intermittent extra exit from the generation loop that leaves the
    finish="length" default in place — not an off-by-one in the limit.

What it is not

  • Not the server mislabelling: the engine itself emits the short DONE ... length.
  • Not NaN: zero "non-finite" log lines; the server's NaN path never fires.
  • Not the watchdog: it _Exit(3)s (engine restart), which never happened in these runs.
  • Not a crash: process stays alive and healthy, serves later requests fine.
  • Not GPU OOM/IMA: no illegal-memory-access, no cudaHostAlloc failure in any clean-room reproduction.
  • Not Windows WER-visible: no Application-log events for maya-ds4.exe.

Observation

The exit leaves finish at its "length" default, so it is a third loop exit besides
produced >= limit (honest length) and EOS (stop)/cancel. The 33 s stall inside request 1's
shared step in attempt A, and both requests ending together, point at the parallel shared-step /
CPU-response machinery giving up and ending the affected requests. The bug also exists on
v1.1.34 (pre-#611), so #611's rewrite is not the sole cause — but attempt A shows the shared step
can stall before the truncation.

Happy to run instrumented builds or specific env matrices — this box reproduces it under
--parallel 2 readily (dspark on: 2 of 4 requests truncated across two fresh-boot attempts today).

Originally created by @handmade0octopus on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/638 # DeepSeek ds4: requests under `--parallel` (and rarely solo) end early with `finish=length` — no error, engine-side ## Summary On Windows (CUDA, RTX 4090 D, sm_89), a maya-ds4 request's token stream sometimes just ends early: the engine emits `DONE` with `produced < max_new` and `finish=length`, no error line, no NaN, no illegal-memory-access, no restart, no WER event. The server side sees a normal end-of-stream and reports the answer as complete. Reproduced on v1.1.34 (with local patches) and on a clean v1.1.36 (f031a23) build. Under `--parallel 2` in the first-request-after-boot regime it reproduces on most attempts; the worst case truncated **both** concurrent requests. ## Cleanest reproduction (v1.1.36, f031a23, quiet box) - Windows 11, CUDA build (arch 89), RTX 4090 D 48 GB, 128 GB RAM, model on a fast TLC NVMe. - Pack: DeepSeek-V4.1-Flash ISTA GSQ-RCO IQ1_M (1.75 bpw; pack carries the DSpark drafter). - `--pack ... --max-context 262144 --mmap-experts off --cpu-threads 12 --dspark on --parallel 2` - Requests: raw token-id prompts (32,768 unique pseudo-random ids each, no reuse), `max_new=2048`, driven over the server (raw-ID SSE), two conversations concurrently, immediately after boot. - Custom env in play (both engines, present in clean runs too): `DS4_STREAM_ZC=1 DS4_STREAM_ZC_ALL=1 DS4_STREAM_ZC_NOWAIT=1 DS4_STREAM_WIN=1 DS4_LAND=1 MAYA_DS4_PIN_BY_NEED=1 MAYA_DS4_PIN_GB=0 MAYA_DS4_Q8_BATCH=1 DS4_FAT_ROWS=0 MAYA_DS4_HC_FUSE=2 MAYA_DS4_DECODE_TRIM=7 DS4_ENGRAM_CACHE_MB=8192 DS4_ENGRAM_PREFETCH=1 DS4_ENGRAM_PREFETCH_CHUNKS=-1`. ### Attempt A — `--dspark on`: both requests truncated ``` maya ds4 serve: request 2: prompt 32768 tokens = 0 reused + 32768 read in 32260 ms (1015.7 tok/s), 12 generated in 1005 ms (11.94 tok/s, 1 conversations running; drafts 3 of 6 kept) maya ds4 serve: request 1: prompt 32768 tokens = 0 reused + 32768 read in 31930 ms (1026.2 tok/s), 17 generated in 33375 ms (0.51 tok/s, 0 conversations running; drafts 6 of 9 kept) [maya] done: 12 tokens in 65 s (11.9 tok/s) (length, cancel=False), expert cache 93.2% hit [maya] done: 17 tokens in 65 s (0.5 tok/s) (length, cancel=False), expert cache 100.0% hit ``` Both conversations stop at the same wall-clock instant (~1-2 verify windows into the shared step). Note request 1's own summary: 17 tokens took 33.4 s (0.51 tok/s) — the shared step appears to stall ~30 s before the requests are ended. No `ERR`, no engine restart, no CUDA error in the log. ### Attempt B — `--dspark off` (same everything else): one of two truncated ``` maya ds4 serve: request 1: ... 1884 generated in 149170 ms (12.63 tok/s, ...; drafts 0 of 0 kept) maya ds4 serve: request 2: ... 2048 generated in 120022 ms (17.06 tok/s, ...; drafts 132 of 182 kept) ``` The truncated request had **no drafts at all** (`drafts 0 of 0 kept`) — so the new #611 parallel drafter path is not required; prompt-lookup-only and no-drafting requests truncate too. (The clean one had lookup drafts.) Same boot regime, same everything else. ### Attempt C — identical to A (fresh boot, fresh prompts): clean 2048/2048 both conversations (drafts kept 69–75%, decode aggregate 40.6 t/s). Same regime as A, so within `--dspark on` `--parallel 2` first-boot runs it is intermittent: A truncated 2/2 requests, C truncated 0/2. ## Earlier statistics (v1.1.34 + local commits, same box/pack) - Across a benchmark sweep: **10 of 32 decode requests** truncated at 12, 20, 21, 831, 916, 1569, 1638, 1696, 1713, 1991 of 2048 tokens — in `--parallel 1/2/4` cells alike, almost always in the first requests after a fresh engine boot. - An instrumented build (extra stderr line at the solo DONE site: `produced/limit/max_new/pos/ max_ctx/finish`) ran 8 clean solo first-request attempts: 0/8 reproductions, and on every clean run `limit` was honored exactly (`produced=2048 limit=2048 ... finish=length`), `pos` sane. So the truncation is an intermittent extra exit from the generation loop that leaves the `finish="length"` default in place — not an off-by-one in the limit. ## What it is not - Not the server mislabelling: the engine itself emits the short `DONE ... length`. - Not NaN: zero "non-finite" log lines; the server's NaN path never fires. - Not the watchdog: it `_Exit(3)`s (engine restart), which never happened in these runs. - Not a crash: process stays alive and healthy, serves later requests fine. - Not GPU OOM/IMA: no illegal-memory-access, no cudaHostAlloc failure in any clean-room reproduction. - Not Windows WER-visible: no Application-log events for maya-ds4.exe. ## Observation The exit leaves `finish` at its `"length"` default, so it is a third loop exit besides `produced >= limit` (honest length) and EOS (`stop`)/cancel. The 33 s stall inside request 1's shared step in attempt A, and both requests ending together, point at the parallel shared-step / CPU-response machinery giving up and ending the affected requests. The bug also exists on v1.1.34 (pre-#611), so #611's rewrite is not the sole cause — but attempt A shows the shared step can stall before the truncation. Happy to run instrumented builds or specific env matrices — this box reproduces it under `--parallel 2` readily (dspark on: 2 of 4 requests truncated across two fresh-boot attempts today).
Author
Owner

@handmade0octopus commented on GitHub (Oct 29, 2026):

Full-matrix data point on v1.1.36 + our ws-trim/MSVC cherry-picks (exe C907980E), IQ1_M, --dspark on, full production env (ZC_ALL/ZC_NOWAIT etc.): 12-cell matrix (par 1/2/4 × 32k/64k/128k/256k prompts + 2,048 decode, fresh boot + fresh unique prompts per cell, --parallel N), with automatic retry — up to 3 fresh-boot attempts per cell until every conversation is 2048/2048.

Incidence: 10 of 54 requests truncated across 20 attempts (12 first-boot cells + 8 retries).

  • 6 of 12 first-boot cells hit (8 of 28 first-boot requests)
  • retries mostly clean (2 of 26); every cell reached VALID within 3 attempts
  • truncation depths of 2,048: 5, 10, 12, 17, 31, 58, 1328, 1727, 1904, 2003 — both immediate (1–2 verify windows in) and late (>65 % of the generation)
  • every truncation labeled finish=length (the token stream just ends), no error lines, no NaN/non-finite lines
  • engine flags clean in all 20 attempts: no restarts, no illegal-memory-access, no cudaHostAlloc failures — the par-4 big-context IMA from the earlier report did not recur on this build
  • depths hit: 32k/64k/128k/256k at both par-2 and par-4 (solo cells 4/4 clean this run)

Same intermittent first-boot-heavy pattern as the original report; adding this as a quantitative follow-up since the matrix gives a much larger N than the initial six-request tally. Raw per-attempt results (result-aK.json with per-conversation token counts) + engine logs: D:\ai\tests\maya\par-sweep-2026-10-28\v136w-p* (summary in PAR-SWEEP-RESULTS.md §7.4).

<!-- gh-comment-id:6487941353 --> @handmade0octopus commented on GitHub (Oct 29, 2026): Full-matrix data point on **v1.1.36 + our ws-trim/MSVC cherry-picks** (exe `C907980E`), IQ1_M, `--dspark on`, full production env (ZC_ALL/ZC_NOWAIT etc.): 12-cell matrix (par 1/2/4 × 32k/64k/128k/256k prompts + 2,048 decode, fresh boot + fresh unique prompts per cell, `--parallel N`), with automatic retry — up to 3 fresh-boot attempts per cell until every conversation is 2048/2048. **Incidence: 10 of 54 requests truncated across 20 attempts (12 first-boot cells + 8 retries).** - 6 of 12 first-boot cells hit (8 of 28 first-boot requests) - retries mostly clean (2 of 26); every cell reached VALID within 3 attempts - truncation depths of 2,048: **5, 10, 12, 17, 31, 58, 1328, 1727, 1904, 2003** — both immediate (1–2 verify windows in) and late (>65 % of the generation) - every truncation labeled `finish=length` (the token stream just ends), no error lines, no NaN/non-finite lines - engine flags clean in all 20 attempts: no restarts, no illegal-memory-access, no `cudaHostAlloc` failures — the par-4 big-context IMA from the earlier report did **not** recur on this build - depths hit: 32k/64k/128k/256k at both par-2 and par-4 (solo cells 4/4 clean this run) Same intermittent first-boot-heavy pattern as the original report; adding this as a quantitative follow-up since the matrix gives a much larger N than the initial six-request tally. Raw per-attempt results (`result-aK.json` with per-conversation token counts) + engine logs: `D:\ai\tests\maya\par-sweep-2026-10-28\v136w-p*` (summary in `PAR-SWEEP-RESULTS.md` §7.4).
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#264
No description provided.