mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #606] DS4: a checkpoint at every turn, so going back or editing an earlier message does not re-read the conversation #251
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#251
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 @mgabor3141 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/606
Setup: v1.1.34 (no change to this code in v1.1.35), DeepSeek-V4.1-Flash Maya-S on 4x RTX 3090,
MAYA_DS4_SLOT_KEEP=1. Client: pi coding agent; one user, long agent sessions (100-220K tokens).What happens. A conversation, in the model or in a slot, can be resumed only at its three checkpoints: the end of the last prompt, the position before it, and the anchor (from #394). When a client goes back to an earlier turn, or the user edits their last message, the prompt leaves the conversation before the last prompt's end. Maya then falls back to the anchor or to token 0 and re-reads everything after it.
Example from today's slots (the token arrays in the
.metafiles):A checkpoint at the end of the previous answer (95,962, where the last user message starts) would have left 17 tokens to read. Going back several turns is the same, only further: the next checkpoint behind the last prompt is the anchor, or nothing.
Two things make it worse:
slot_putdrops every saved state that is a prefix of the one being saved, so the earlier states of a conversation, which could serve as resume points, are gone after the next save.Proposal. Keep a checkpoint at the end of every turn (the end of each prompt, and the end of each answer), up to a cap per conversation (say the last 32), in the model and in the slot's
.meta/.bin.slot_takealready picks the latest checkpoint at or before the shared prefix; what is fixed at 3 today isCheck ck[3]and the.metareader'snc > 3check. The GLM engine already keeps earlier checkpoints (MAYA_GLM_CKPTS,MAYA_GLM_CKPT_EVERY); this would be the same idea for DS4, at turn ends.Cost. A checkpoint is the window rings plus the compressors' partial groups. Across our 124 slots, a slot's size is exactly 924 bytes per token plus 11.7 MB, whether its
.metalists 2 checkpoints or 3. That fixed part holds the checkpoints and the live window rings, so by our estimate one checkpoint is about 3 MB: 32 would add about 100 MB per conversation, against 0.2 GB of KV for a 200K-token conversation. Taking one is a device-to-host copy of that size per turn.Happy to test a build.