mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #4950] [Engine] Mac (M3 Ultra, 96 GB): DeepSeek V4.1 answers short prompts but garbles prompts from ~100 tokens (chunked prompt pass) #2279
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2279
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?
Originally created by @2nd1st on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4950
Area
[Engine] (speed, kernels, models, the server and API)
Desktop app, Terminal or source?
Terminal (the
stratacommand)What happened
DeepSeek-V4.1-Flash IST-DAS 2.25 bpw on a Mac Studio M3 Ultra answers short prompts correctly, but from about 100 prompt tokens the answers stop matching the prompt, as if the model read a garbled prompt. The engine log says prompts from 96 tokens take the chunked pass (
prompt path: the chunked pass from 96 tokens, windows of 16 below), which lines up with where it breaks.Same prompt shape each time: a Chinese paragraph repeated n times, then "问题:上面这段说明的主题是什么?用一句中文回答。" (what is the topic of the text above, one sentence).
is_primefunction with explanation<thinking_process>block, then reasons about a problem that is not in the promptReal documents fail the same way: a 2,878-token English doc + "summarise in three Chinese sentences" gets an unrelated plan or English text about something else; a 12,526-token doc gets "It's got a lot of formatting issues and references that don't seem to be real".
Decode itself looks healthy: 7–8 tok/s, coherent text on short prompts.
The other engine is fine on the same Mac: Qwen3.8-Flash-Next IQ3_S (Strata engine, Metal) finds a needle at 103K tokens and reads prompts at ~630 tok/s, so the GPU and the install look OK.
Things that did not change it:
--set vram-experts=0.3, 2,245 of 15,360 experts in VRAM) vs the automatic 4 GB share--set DS4_ENGRAM_THREADS=1~/.local/state/strata/launch/ds4-slotsbefore starting (so no reused conversation)--set prefill-chunk=512--set DS4_BUSY_CAP=2000(from #4771; no speed or quality change here)I have not tried the 2.00 bpw set. Only M5 Max is listed as tested in docs/DEEPSEEK_MAC.md, so this may be specific to M3-generation GPUs.
Smallest steps or command that reproduce it
n=0 (about 40 tokens) answers on topic; n=5 and up do not.
Reproduction status
Reproduced locally (every run, across four engine restarts with different settings)
Strata version
Strata 0.2.9 · Terminal 0.1.55 · engine
strata-dsv410.1.55-macos-arm64-metalGraphics card, memory and system
Mac Studio (Mac15,14), Apple M3 Ultra (28-core CPU, 60-core GPU), 96 GB unified memory, macOS 26.6.2. Model on the internal SSD.
Model, size and settings
DeepSeek-V4.1-Flash IST-DAS 2.25 bpw (
deepseek-v4.1-flash-ist-das-2.25bpwpack, downloaded bystrata launch), 32K context, text only, Full quality (6 experts), DSpark off.Logs
Two smaller things noticed on the way, in case they are useful:
other programs hold 85.2 GB of anonymous memorywith 86% of RAM free permemory_pressure), so it fell back to 4 GB of experts.--vram-expertstakes a fraction;--set vram-experts=40(meant as GB) tried to place every expert in memory and the start ran for 15 minutes. A note in--helpthat F is a fraction would help.@mikog8tor commented on GitHub (Nov 2, 2026):
Environment
4cf0d8cd38--context 256k --vision off --parallel 1 --dspark none --tune skip --set cpu-threads=8 --set STRATA_METAL_LEAVE_SHARE=0.47chat_template_kwargs.enable_thinking: false), temperature 0, greedy in all recall checksReproduction (independent confirmation of #4950 on M4 Max + 2.00 bpw)
Every symptom from #4950 reproduces here, so this is not a single-machine failure:
--repetitions; a 26-token prompt answers correctly (--only appears at ≥96 tokens, matching the chunked-pass threshold in the log).--set prefill-chunk=0fixes quality completely but prefill is ~10x slower on this machine (numbers below).Needle-recall check (code word hidden at 10/50/90% of a fixed haystack, exact-match answer)
--set prefill-chunk=0--/1.0loopsReal coding tasks (3 tiny repos, held-out hidden tests; greedy; tools: read/write files + run visible tests)
--set prefill-chunk=0Prompt-read throughput (same hardware, same session settings)
--set prefill-chunk=0So on M4 Max the chunked path is not just wrong, it is also the only fast prefill available; the windows path is 7–10x slower. SSD expert streaming dominates both, but the windows path pays KWin-sized per-window work on the CPU lane (12.7–14K routed experts here).
Clue for the author
This Mac build also prints
ds4: tensor parallel 2 -> 1: the experts' 256-value blocks split n_ff 2304 no other way (each GPU its own layers). Happy to run a bisect build or dumpDS4_DUMP_Lrecords if useful — the isolated source build here (0.1.55-metal, no code changed) reports the same garbling as the signed engine, so it reproduces from a clean source build.Request
If the fix lands in an engine update, the ~10x prefill gap makes
prefill-chunk=0painful for 30K+ prompts; a correct-and-chunked path would restore the documented 600+ tok/s long-prompt prefill on the Mac. Happy to re-run the needle check and coding suite against a test build.Raw result files (JSON, engine logs, memory samples) retained locally and can be attached on request.
@mikog8tor commented on GitHub (Nov 3, 2026):
Follow-up: M4 Max (128 GB) against the freshly released dsv41 0.1.56-macos-arm64-metal (built from
f457ed7b9per the release notes).The chunked default prompt path still garbles prompts >= ~96 tokens here: a 6,567-token needle echoes filler text in both Faster (5 experts) and Full (6 experts).
--set prefill-chunk=0(windows of 16) stays the quality-safe path on Mac; this comment replaces an earlier draft with corrected engine versions.Coder support works on Mac (thanks for #4706): from
--model-pathagainst the HF repository folder (IQ2_XXS/ + Engram gguf at the top), all 7,680 experts stay resident (66 GB; CPU lane ~2%). 3-repo hidden-test coding harness: 15 of 15 with the windows path. 6K needle found and quoted exactly. Windows prefill 41 tok/s; decode 17-19 tok/s.For bug-hunters: engine prompt slots persist across launches (ds4-slots/, STRATA_DS4 slot files). A rerun after a chunked-path run reads back the saved conversation and its KV and answers with the old garbage while reading 0 new prompt tokens (6533 reused + 1 read). Reproduce cleanly with
--set STRATA_DS4_SLOT_KEEP=0 --set STRATA_DS4_REUSE=0and wipe the ds4-slots folder. May be worth an invalidation when the primary path settings change a prompt-affecting flag.Reference numbers on this Mac for the same Coder files via llama.cpp (requires b11870+ and the Engram gguf from the HF repository directly; the Strata repack of the Engram file lacks llama.cpp split metadata): prefill ~210 tok/s, short-answer decode ~28 tok/s, same 15/15 harness in 23.3%/13% of the Strata wall time (3.3 min vs 23.3 min).
@shpati commented on GitHub (Nov 4, 2026):
The same issue is seen on a Mac M1 Ultra 128GB running ISTA-DASLab DeepSeek-V4.1-Flash-1017 IQ2_XXS "ist-das-2.25bpw"
on dsv41 0.1.56 . The issue has been there in several (perhaps all) revisions of the dsv4.1 engine.
--set prefill-chunk=0 seems to fix it. Currently getting 9.9 t/s in inference.