mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #607] DS4: reuse the system-prompt prefix across conversations (like MAYA_GLM_PREFIX_CUT) #250
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#250
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 @ireznik-hash on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/607
Request
Please add a system-prompt prefix snapshot for DeepSeek (DS4), like
MAYA_GLM_PREFIX_CUTdoes for GLM. When a prompt isread from token 0, also keep the state at the end of the system prompt (before the first user turn). A new
conversation that starts with the same system prompt and tools could then restore it and read only the rest.
Why (measured on 1.1.26,
maya-ds4, DeepSeek-V4.1-Flash Q8_0, 7× RTX 2080 Ti 22 GB,--tp 2,MAYA_DS4_SLOT_KEEP=1)Agent clients (Hermes Agent here) start each conversation with a large, identical system prompt + tool schemas.
From our relay log, first turns of new conversations (
prompt_tokens,cache_n, reading time):Within a conversation the kept state works very well (97.9% of input tokens reused over 1,125 requests). Only the
first turn of every new conversation pays the full read, although its first ~5-16k tokens are byte-identical to the
previous conversation's. On this hardware the chat user waits about 1.5 minutes before the model even starts thinking.
We tested two conversations with the same system prompt and saw
cache_n0 on the second.Questions:
KV or Engram state at the cut)?
@talisp commented on GitHub (Oct 28, 2026):
+1, with a data point from DeepSeek Harness (1× L40S 48 GB, Maya v1.1.34, DeepSeek-V4.1-Flash-1017 UD-Q8_K_XL,
MAYA_DS4_SLOT_KEEP=1).We read the token arrays in our
slots/folder. Three DSH conversations from the same evening (9.4K, 15.3K and 23.8K tokens) share their first 5,923 tokens exactly, and the shared part ends right at the first user turn: the system prompt plus the tool schemas. So the cut point you describe is just as clean for DSH, in the same placeMAYA_GLM_PREFIX_CUTcuts for GLM.None of them could reuse it. Each one's checkpoints were its own end and an anchor at ~7.1K, past the shared part. On our box a fresh prompt of ~10K tokens reads at ~540-700 tok/s, so every new DSH conversation spends ~9-11 s on the same ~6K tokens before it starts. That's smaller than your 93 s on the 2080 Tis, but it's the same shape, and DSH starts a new conversation for every sub-agent, so a single task can pay it several times.