[GH-ISSUE #375] DS4: keep a few conversation states, so agents with sub-agents stop re-reading their prompts #146

Closed
opened 2026-10-29 21:21:35 +07:00 by bsakaguchi · 4 comments
Owner

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

In short

The problem. We run DeepSeek-V4.1-Flash on Maya with DeepSeek Harness, DeepSeek's own agent client. It routinely starts sub-agents: a main agent hands 4 small tasks to 4 helpers, then continues. That gives the server 5 conversations taking turns. Maya queues them correctly, but the DeepSeek engine keeps only one conversation's state. So every time the turn passes to another agent, the engine reads that agent's whole prompt again.

How much it costs. In one session, 12 requests in a row reused nothing from the cache. 70% of the time went to re-reading prompts (310 s) and 30% to writing answers (135 s). The main agent's ~73K-token conversation took 54 s to come back on every turn, when only a few hundred tokens were new.

One agent alone Main agent + 4 sub-agents
Cache reused almost everything nothing (0 in 12 of 12 requests)
Main agent's turn (~73K tokens) ~1 s to read what is new 54 s to read everything again
Total over 12 requests - 310 s re-reading, 135 s writing

Why this is common. Sub-agents are standard in agent clients now: DeepSeek Harness, Claude Code, OpenCode and Hermes all use them. Strata saw the same thing with DeepSeek Harness (Niko1221/Strata#3493: Reused = 0 on 12 of 12 requests, 73% of the time in prefill). Maya's GLM path already solves it with MAYA_GLM_SLOTS; the DeepSeek engine just doesn't have the equivalent yet.

The proposal, in short:

  1. Keep 4-8 conversation states instead of one, and bring back the right one when its next turn arrives. On DeepSeek this is cheap: the compressed attention makes a conversation's state small (the engine reports 0.24 GB of caches at a 256K context, so roughly 70 MB for a 73K-token conversation).
  2. Keep a checkpoint at the end of the system prompt, so sibling sub-agents, which start with the same instructions and tools, read only their own task.
  3. Later, and only if useful: pause a long answer for a short request, and decode several conversations at once (#332).

Steps 1 and 2 alone would turn most of those 310 s into a few seconds. We're glad to test any branch on our machine and report the same numbers before and after. The technical details follow, written so that whoever implements or studies this, a person or an AI agent, has everything we found in one place.


Technical notes

All code references are to v1.1.21 (451f9cb).

1. Measurements

Hardware:

  • 1× NVIDIA L40S-48Q (vGPU, 48 GB), Xeon Platinum 8580 (32 vCPU), 503 GiB RAM, Linux.
  • maya-ds4, unsloth UD-Q8_K_XL, --max-context 262144 --mmap-experts off --dspark none, vision on.
  • 1,416 of 15,360 experts in VRAM, the rest copied into RAM.
  • Decode 14-18 tok/s. Prefill ~680 tok/s at 11K, ~1,370 tok/s at 73K (8K-token chunks).

Client: DeepSeek Harness v0.2.1-rc.2, pi-ai openai-completions provider pointed at Maya's /v1.

The engine log of one cycle, in order (maya ds4 serve: prompt ... reused ... read):

main      70,375 tokens = 70,347 reused +     28 read      0.6 s, 2289 generated
sub-agent 10,791 tokens =      0 reused + 10,791 read     16.1 s,  110 generated
sub-agent 10,801 tokens =      0 reused + 10,801 read     15.9 s,  123 generated
sub-agent 10,795 tokens =      0 reused + 10,795 read     16.0 s,  115 generated
sub-agent 10,767 tokens =      0 reused + 10,767 read     15.9 s,  116 generated
main      72,806 tokens =      0 reused + 72,806 read     53.6 s,  201 generated
sub-agent 12,392 tokens =      0 reused + 12,392 read     17.3 s,  151 generated
sub-agent 13,524 tokens =      0 reused + 13,524 read     17.5 s,  257 generated
sub-agent 31,680 tokens =      0 reused + 31,680 read     31.2 s,  413 generated
sub-agent 32,802 tokens =      0 reused + 32,802 read     30.2 s,  209 generated
main      74,737 tokens =      0 reused + 74,737 read     54.4 s,  222 generated
sub-agent 16,013 tokens =      0 reused + 16,013 read     19.7 s,  155 generated

What the workload looks like:

  • Sub-agent answers are short (110-413 tokens), so decode speed hardly matters. Prompt reading is the cost.
  • The four first sub-agent prompts are within 34 tokens of each other in length (10,767-10,801), so they almost certainly share the harness's system prompt and tool schemas. Still, each one read from 0.
  • The same symptom without sub-agents: any side request on the same server (a test, a second client) evicts the agent's state, and its next turn re-reads everything. With 160-195K-token conversations, that was 104-127 s.

2. Why it happens: the current DS4 path

  • One sequence, one FIFO place. src/ds4/ds4_main.cpp answers READY <max_context> stop. serve/server.py (around L471-472) sets can_pause and multi from that line, so for DS4 both stay off. FairLock then has capacity 1, and MAYA_FAIR_SLICE_S never applies, because it needs can_pause.
  • The reuse rule. The header of ds4_main.cpp (L9-12) says: "A prompt that continues the state (the conversation so far) reuses it; one that only shares the last prompt's start goes back to that prompt's end; anything else starts over." A different conversation, or a sibling that shares only a prefix ending inside the last prompt, starts over.
  • What a checkpoint holds. Model::checkpoint(int slot) and Model::restore(int64_t limit) are in src/ds4/ds4_model.cu (around L5035 and L5072). There are only two checkpoints (ck[slot & 1]). Each holds "the window rings and the compressors' partial groups". The comment adds that "the rest of the state is indexed by position, and what lies past a restored position is written again". In other words, a checkpoint can rewind within the one resident conversation. It cannot hold a second conversation, because the position-indexed caches (the compressed KV and the indexer's cache) exist once and the next conversation overwrites them.

3. How the sibling projects handle it

Maya GLM Strata (Qwen family) Xolotl (DeepSeek fork of Strata) Maya DS4 today
Several conversations set aside and restored MAYA_GLM_SLOTS (4, SSD files, or RAM with SLOT_RAM_GB) --conversation-cache-mib N --conversation-cache-slots K (host RAM) no: one snapshot at the last prompt's end no: one state
Checkpoints inside a prompt MAYA_GLM_CKPTS (system prompt end, last turn start, every CKPT_EVERY tokens) --prompt-cache N, turn-boundary checkpoint (docs/MESSAGE_BOUNDARY_CACHE.md) - two rewind checkpoints in the resident conversation
Pause / fair slices yes (READY ... pause) not checked not checked no
Several conversations decoding at once --parallel / MAYA_GLM_SEQS (READY ... multi=N) "parallel": N / --batch N (batch slots, 0.1.39+, docs/BATCHING.md) - no
Several GPUs on a split, each GPU works on a different conversation; MAYA_GLM_SPLIT_ROWS batches per part --batch-groups: pipelined groups on a layer split; parked conversations restored on every stage - --tp (tensor parallel) only

Pointers:

  • Maya GLM: src/program/generate.cpp around L1243-1250 describes the slot design. A request that does not continue the resident conversation first sets it aside (Glm5Model::slot_save: its snapshot and DSA caches), then loads the slot it does continue (slot_load). The limits are MAYA_GLM_SLOT_MIN (1024 tokens), SLOT_GB, SLOT_DIR and SLOT_RAM_GB. Conversations with pictures are not set aside there. Checkpoints are described around L1557-1572.
  • Strata:
    • docs/DETAILS.md, "Multiple conversations (opt-in)". It parks up to K conversations in a bounded host-RAM cache; reuse needs no session id, only exact token and image prefixes. A 9,276-token conversation was restored in 51 ms on a 4-GPU split, and the follow-up decodes exactly the same tokens (tools/parking_test.py).
    • docs/BATCHING.md, "Together with conversation parking": a parked conversation is restored on every stage of a layer split. Two alternating long conversations had their follow-ups at 0.46-0.53 s to the first token.
  • Xolotl: docs/DEEPSEEK_V41.md. "A conversation that extends the last request continues from it; one whose re-rendered history differs (DeepSeek's encoder drops earlier turns' thinking) restores the snapshot taken at the end of the last prompt." Same model as Maya DS4 today: one resident conversation.

Lessons from Strata's tracker:

  • #3493 (DeepSeek Harness on Strata, Reused = 0 on 12 of 12, 73% in prefill) was fixed by conversation parking alone, with no batching.
  • #2431 and #2518: parallel batch slots did not share prefixes, and concurrent requests broke prefix reuse. Concurrency without a cache design made things worse.
  • #3027: parked conversations should survive an engine restart (written to disk). Otherwise every config change or update costs a full re-read of a 100K+ agent session (50-60 s there).
  • #2049, in docs/DETAILS.md: parking copies can stall when the host is short of memory and the OS pages them. The fix was progress reporting to the watchdog and a bounded budget.

4. Possible paths for DS4

Step 1: K conversation slots (the main win).

  • State to save per conversation:
    • the position-indexed caches up to pos (the compressed KV and the indexer's cache for every layer, and every tensor-parallel member);
    • the window rings and the compressors' partial groups (what checkpoint() already copies);
    • pos, the live token ids and the picture keys (for the existing "same picture at the same place" rule).
    • The position-indexed part grows with the tokens actually used, not with --max-context. A 73K-token conversation should be roughly 70 MB, if the 0.24 GB per 256K reported at start is the full per-sequence cache.
  • Where to keep it: pinned host RAM by default, with a MiB budget and a slot count (Strata's knobs). VRAM is an option for a few small slots, and SSD as MAYA_GLM_SLOTS does (also covering #3027).
  • Matching: as now, by exact token and picture prefix, with no client session id. Choose the slot whose saved tokens are the longest prefix of the new prompt, and use LRU for eviction. Keep a minimum length (GLM uses 1024) so tiny side requests do not evict long agent states.
  • Flow: on a request that does not continue the resident state, save the resident conversation into a slot (or update its slot), then load the best matching slot (or start fresh), then read only the tokens past the match.
  • Logging: add which slot was used, for example reused N (slot k) on the existing prompt ... reused ... read line, so the server's Monitor and users can see hits and misses.

Step 2: checkpoints at turn boundaries.

  • Save a checkpoint at the end of the first system or developer block (plus tools), and one at the start of the last user turn, as MAYA_GLM_CKPTS does.
  • Siblings that share the harness's system prompt then restore from the first one. Clients whose re-rendered history drops earlier thinking restore from the second.
  • With slots, a checkpoint can be stored as a slot entry that is a prefix of another.

Step 3: pause. With states that can be set aside, the engine can announce pause, and the existing MAYA_FAIR_SLICE_S logic in serve/server.py works for DS4 too, so a short sub-agent request does not wait behind a 2,000-token answer.

Step 4: several sequences at once (#332).

  • READY ... multi=N, with per-sequence caches, on one GPU or with --tp.
  • On a layer split, pipeline the conversations across the GPUs, as GLM does with MAYA_GLM_SEQS and Strata with --batch-groups.
  • An untested idea for multi-GPU boxes where every GPU can hold the dense weights: one engine per GPU, all reading the same GGUF experts in place (--mmap-experts auto), so the host expert tier is shared through the page cache instead of being copied once per engine. Requests would go to the engine that holds their conversation.
  • Strata's experience (#2431, #2518) suggests doing this after steps 1-2, and making batch slots share the same conversation cache.

5. How to check it

  • Correctness: a follow-up turn must decode the same tokens whether its state stayed resident or came back from a slot. Strata's tools/parking_test.py does this at temperature 0, and the same check can be done through /v1/chat/completions.
  • The agent pattern (reproducible without the harness):
    1. main conversation of ~70K tokens;
    2. 4 requests sharing a ~10K prefix, each with its own short task;
    3. main conversation + 100 tokens;
    4. the same 4 requests + 100 tokens.
    • Expected: reuse near 100% in steps 3 and 4, and in step 2 only the part after the shared prefix is read.
  • Memory: the slot budget must stay bounded and visible in the log. The start must refuse, or shrink the budget, when it does not fit, rather than fail at the first switch (Strata #465 reported a late, fatal failure with batch slots).

We can run any of these on the machine above and post the logs.

Originally created by @talisp on GitHub (Oct 22, 2026). Original GitHub issue: https://github.com/mw00/project-maya/issues/375 ## In short **The problem.** We run DeepSeek-V4.1-Flash on Maya with **DeepSeek Harness**, DeepSeek's own agent client. It routinely starts **sub-agents**: a main agent hands 4 small tasks to 4 helpers, then continues. That gives the server 5 conversations taking turns. Maya queues them correctly, but the DeepSeek engine keeps **only one conversation's state**. So every time the turn passes to another agent, the engine **reads that agent's whole prompt again**. **How much it costs.** In one session, 12 requests in a row reused nothing from the cache. **70% of the time went to re-reading prompts (310 s) and 30% to writing answers (135 s).** The main agent's ~73K-token conversation took **54 s to come back on every turn**, when only a few hundred tokens were new. | | One agent alone | Main agent + 4 sub-agents | |---|---|---| | Cache reused | almost everything | nothing (0 in 12 of 12 requests) | | Main agent's turn (~73K tokens) | ~1 s to read what is new | 54 s to read everything again | | Total over 12 requests | - | 310 s re-reading, 135 s writing | **Why this is common.** Sub-agents are standard in agent clients now: DeepSeek Harness, Claude Code, OpenCode and Hermes all use them. Strata saw the same thing with DeepSeek Harness (Niko1221/Strata#3493: `Reused = 0` on 12 of 12 requests, 73% of the time in prefill). Maya's GLM path already solves it with `MAYA_GLM_SLOTS`; the DeepSeek engine just doesn't have the equivalent yet. **The proposal, in short:** 1. **Keep 4-8 conversation states instead of one**, and bring back the right one when its next turn arrives. On DeepSeek this is cheap: the compressed attention makes a conversation's state small (the engine reports 0.24 GB of caches at a 256K context, so roughly 70 MB for a 73K-token conversation). 2. **Keep a checkpoint at the end of the system prompt**, so sibling sub-agents, which start with the same instructions and tools, read only their own task. 3. Later, and only if useful: pause a long answer for a short request, and decode several conversations at once (#332). Steps 1 and 2 alone would turn most of those 310 s into a few seconds. We're glad to test any branch on our machine and report the same numbers before and after. The technical details follow, written so that whoever implements or studies this, a person or an AI agent, has everything we found in one place. --- ## Technical notes All code references are to v1.1.21 (`451f9cb`). ### 1. Measurements Hardware: - 1× NVIDIA L40S-48Q (vGPU, 48 GB), Xeon Platinum 8580 (32 vCPU), 503 GiB RAM, Linux. - `maya-ds4`, unsloth UD-Q8_K_XL, `--max-context 262144 --mmap-experts off --dspark none`, vision on. - 1,416 of 15,360 experts in VRAM, the rest copied into RAM. - Decode 14-18 tok/s. Prefill ~680 tok/s at 11K, ~1,370 tok/s at 73K (8K-token chunks). Client: DeepSeek Harness v0.2.1-rc.2, pi-ai `openai-completions` provider pointed at Maya's `/v1`. The engine log of one cycle, in order (`maya ds4 serve: prompt ... reused ... read`): ``` main 70,375 tokens = 70,347 reused + 28 read 0.6 s, 2289 generated sub-agent 10,791 tokens = 0 reused + 10,791 read 16.1 s, 110 generated sub-agent 10,801 tokens = 0 reused + 10,801 read 15.9 s, 123 generated sub-agent 10,795 tokens = 0 reused + 10,795 read 16.0 s, 115 generated sub-agent 10,767 tokens = 0 reused + 10,767 read 15.9 s, 116 generated main 72,806 tokens = 0 reused + 72,806 read 53.6 s, 201 generated sub-agent 12,392 tokens = 0 reused + 12,392 read 17.3 s, 151 generated sub-agent 13,524 tokens = 0 reused + 13,524 read 17.5 s, 257 generated sub-agent 31,680 tokens = 0 reused + 31,680 read 31.2 s, 413 generated sub-agent 32,802 tokens = 0 reused + 32,802 read 30.2 s, 209 generated main 74,737 tokens = 0 reused + 74,737 read 54.4 s, 222 generated sub-agent 16,013 tokens = 0 reused + 16,013 read 19.7 s, 155 generated ``` What the workload looks like: - Sub-agent answers are short (110-413 tokens), so decode speed hardly matters. Prompt reading is the cost. - The four first sub-agent prompts are within 34 tokens of each other in length (10,767-10,801), so they almost certainly share the harness's system prompt and tool schemas. Still, each one read from 0. - The same symptom without sub-agents: any side request on the same server (a test, a second client) evicts the agent's state, and its next turn re-reads everything. With 160-195K-token conversations, that was 104-127 s. ### 2. Why it happens: the current DS4 path - **One sequence, one FIFO place.** `src/ds4/ds4_main.cpp` answers `READY <max_context> stop`. `serve/server.py` (around L471-472) sets `can_pause` and `multi` from that line, so for DS4 both stay off. `FairLock` then has capacity 1, and `MAYA_FAIR_SLICE_S` never applies, because it needs `can_pause`. - **The reuse rule.** The header of `ds4_main.cpp` (L9-12) says: "A prompt that continues the state (the conversation so far) reuses it; one that only shares the last prompt's start goes back to that prompt's end; anything else starts over." A different conversation, or a sibling that shares only a prefix ending inside the last prompt, starts over. - **What a checkpoint holds.** `Model::checkpoint(int slot)` and `Model::restore(int64_t limit)` are in `src/ds4/ds4_model.cu` (around L5035 and L5072). There are only two checkpoints (`ck[slot & 1]`). Each holds "the window rings and the compressors' partial groups". The comment adds that "the rest of the state is indexed by position, and what lies past a restored position is written again". In other words, a checkpoint can rewind **within** the one resident conversation. It cannot hold a second conversation, because the position-indexed caches (the compressed KV and the indexer's cache) exist once and the next conversation overwrites them. ### 3. How the sibling projects handle it | | Maya GLM | Strata (Qwen family) | Xolotl (DeepSeek fork of Strata) | Maya DS4 today | |---|---|---|---|---| | Several conversations set aside and restored | `MAYA_GLM_SLOTS` (4, SSD files, or RAM with `SLOT_RAM_GB`) | `--conversation-cache-mib N --conversation-cache-slots K` (host RAM) | no: one snapshot at the last prompt's end | no: one state | | Checkpoints inside a prompt | `MAYA_GLM_CKPTS` (system prompt end, last turn start, every `CKPT_EVERY` tokens) | `--prompt-cache N`, turn-boundary checkpoint (`docs/MESSAGE_BOUNDARY_CACHE.md`) | - | two rewind checkpoints in the resident conversation | | Pause / fair slices | yes (`READY ... pause`) | not checked | not checked | no | | Several conversations decoding at once | `--parallel` / `MAYA_GLM_SEQS` (`READY ... multi=N`) | `"parallel": N` / `--batch N` (batch slots, 0.1.39+, `docs/BATCHING.md`) | - | no | | Several GPUs | on a split, each GPU works on a different conversation; `MAYA_GLM_SPLIT_ROWS` batches per part | `--batch-groups`: pipelined groups on a layer split; parked conversations restored on every stage | - | `--tp` (tensor parallel) only | Pointers: - **Maya GLM:** `src/program/generate.cpp` around L1243-1250 describes the slot design. A request that does not continue the resident conversation first sets it aside (`Glm5Model::slot_save`: its snapshot and DSA caches), then loads the slot it does continue (`slot_load`). The limits are `MAYA_GLM_SLOT_MIN` (1024 tokens), `SLOT_GB`, `SLOT_DIR` and `SLOT_RAM_GB`. Conversations with pictures are not set aside there. Checkpoints are described around L1557-1572. - **Strata:** - `docs/DETAILS.md`, "Multiple conversations (opt-in)". It parks up to K conversations in a bounded host-RAM cache; reuse needs no session id, only exact token and image prefixes. A 9,276-token conversation was restored in 51 ms on a 4-GPU split, and the follow-up decodes exactly the same tokens (`tools/parking_test.py`). - `docs/BATCHING.md`, "Together with conversation parking": a parked conversation is restored on every stage of a layer split. Two alternating long conversations had their follow-ups at 0.46-0.53 s to the first token. - **Xolotl:** `docs/DEEPSEEK_V41.md`. "A conversation that extends the last request continues from it; one whose re-rendered history differs (DeepSeek's encoder drops earlier turns' thinking) restores the snapshot taken at the end of the last prompt." Same model as Maya DS4 today: one resident conversation. Lessons from Strata's tracker: - **#3493** (DeepSeek Harness on Strata, `Reused = 0` on 12 of 12, 73% in prefill) was fixed by conversation parking alone, with no batching. - **#2431** and **#2518:** parallel batch slots did not share prefixes, and concurrent requests broke prefix reuse. Concurrency without a cache design made things worse. - **#3027:** parked conversations should survive an engine restart (written to disk). Otherwise every config change or update costs a full re-read of a 100K+ agent session (50-60 s there). - **#2049, in `docs/DETAILS.md`:** parking copies can stall when the host is short of memory and the OS pages them. The fix was progress reporting to the watchdog and a bounded budget. ### 4. Possible paths for DS4 **Step 1: K conversation slots (the main win).** - *State to save per conversation:* - the position-indexed caches up to `pos` (the compressed KV and the indexer's cache for every layer, and every tensor-parallel member); - the window rings and the compressors' partial groups (what `checkpoint()` already copies); - `pos`, the live token ids and the picture keys (for the existing "same picture at the same place" rule). - The position-indexed part grows with the tokens actually used, not with `--max-context`. A 73K-token conversation should be roughly 70 MB, if the 0.24 GB per 256K reported at start is the full per-sequence cache. - *Where to keep it:* pinned host RAM by default, with a MiB budget and a slot count (Strata's knobs). VRAM is an option for a few small slots, and SSD as `MAYA_GLM_SLOTS` does (also covering #3027). - *Matching:* as now, by exact token and picture prefix, with no client session id. Choose the slot whose saved tokens are the longest prefix of the new prompt, and use LRU for eviction. Keep a minimum length (GLM uses 1024) so tiny side requests do not evict long agent states. - *Flow:* on a request that does not continue the resident state, save the resident conversation into a slot (or update its slot), then load the best matching slot (or start fresh), then read only the tokens past the match. - *Logging:* add which slot was used, for example `reused N (slot k)` on the existing `prompt ... reused ... read` line, so the server's Monitor and users can see hits and misses. **Step 2: checkpoints at turn boundaries.** - Save a checkpoint at the end of the first system or developer block (plus tools), and one at the start of the last user turn, as `MAYA_GLM_CKPTS` does. - Siblings that share the harness's system prompt then restore from the first one. Clients whose re-rendered history drops earlier thinking restore from the second. - With slots, a checkpoint can be stored as a slot entry that is a prefix of another. **Step 3: `pause`.** With states that can be set aside, the engine can announce `pause`, and the existing `MAYA_FAIR_SLICE_S` logic in `serve/server.py` works for DS4 too, so a short sub-agent request does not wait behind a 2,000-token answer. **Step 4: several sequences at once (#332).** - `READY ... multi=N`, with per-sequence caches, on one GPU or with `--tp`. - On a layer split, pipeline the conversations across the GPUs, as GLM does with `MAYA_GLM_SEQS` and Strata with `--batch-groups`. - An untested idea for multi-GPU boxes where every GPU can hold the dense weights: one engine per GPU, all reading the same GGUF experts in place (`--mmap-experts auto`), so the host expert tier is shared through the page cache instead of being copied once per engine. Requests would go to the engine that holds their conversation. - Strata's experience (#2431, #2518) suggests doing this after steps 1-2, and making batch slots share the same conversation cache. ### 5. How to check it - **Correctness:** a follow-up turn must decode the same tokens whether its state stayed resident or came back from a slot. Strata's `tools/parking_test.py` does this at temperature 0, and the same check can be done through `/v1/chat/completions`. - **The agent pattern** (reproducible without the harness): 1. main conversation of ~70K tokens; 2. 4 requests sharing a ~10K prefix, each with its own short task; 3. main conversation + 100 tokens; 4. the same 4 requests + 100 tokens. - Expected: reuse near 100% in steps 3 and 4, and in step 2 only the part after the shared prefix is read. - **Memory:** the slot budget must stay bounded and visible in the log. The start must refuse, or shrink the budget, when it does not fit, rather than fail at the first switch (Strata #465 reported a late, fatal failure with batch slots). We can run any of these on the machine above and post the logs.
Author
Owner

@mgabor3141 commented on GitHub (Oct 22, 2026):

We found two more causes of this (retries, and the reasoning dropped at a new user message); a patch on top of #356 is in #394. Your step 2 is the piece still missing for new sessions.

<!-- gh-comment-id:6350781516 --> @mgabor3141 commented on GitHub (Oct 22, 2026): We found two more causes of this (retries, and the reasoning dropped at a new user message); a patch on top of #356 is in #394. Your step 2 is the piece still missing for new sessions.
Author
Owner

@mw00 commented on GitHub (Oct 22, 2026):

Thank you for the clear write-up and the numbers - the sub-agent pattern is exactly where a single conversation slot hurts. There is an open pull request for this, #356 (conversations cached across switches and restarts), and we are reviewing it for the next release. Keeping this issue open until it lands.

<!-- gh-comment-id:6353453246 --> @mw00 commented on GitHub (Oct 22, 2026): Thank you for the clear write-up and the numbers - the sub-agent pattern is exactly where a single conversation slot hurts. There is an open pull request for this, #356 (conversations cached across switches and restarts), and we are reviewing it for the next release. Keeping this issue open until it lands.
Author
Owner

@mw00 commented on GitHub (Oct 23, 2026):

This shipped in v1.1.25 with #356: MAYA_DS4_SLOT_KEEP=1 keeps several conversations (in RAM, and in a folder across restarts), and with #394's patch a retried prompt or a re-rendered turn is taken back at the conversation's checkpoints. Thank you for the clear write-up - closing; feel free to reopen if your sub-agent workload still re-reads.

<!-- gh-comment-id:6360200381 --> @mw00 commented on GitHub (Oct 23, 2026): This shipped in [v1.1.25](https://github.com/mw00/project-maya/releases/tag/v1.1.25) with #356: `MAYA_DS4_SLOT_KEEP=1` keeps several conversations (in RAM, and in a folder across restarts), and with #394's patch a retried prompt or a re-rendered turn is taken back at the conversation's checkpoints. Thank you for the clear write-up - closing; feel free to reopen if your sub-agent workload still re-reads.
Author
Owner

@talisp commented on GitHub (Oct 23, 2026):

Thank you, this works. A short follow-up with numbers from the same machine (one L40S-48Q, UD-Q8_K_XL), now on v1.1.25 with MAYA_DS4_SLOT_KEEP=1 (and MAYA_DS4_SLOT_CAP=8).

Switching conversations (two ~15K-token conversations alternating, measured the same way before and after):

v1.1.21 v1.1.25 + MAYA_DS4_SLOT_KEEP=1
Follow-up turn of a conversation that lost the model 0 reused, ~15,200 tokens read in ~14 s ~65 tokens read in ~2 s

Real agent traffic (DeepSeek Harness, 112-127K-token context): each turn reads only what is new, typically 14-600 tokens, with the rest reused.

While retuning after the update we also found that our earlier decode speed, 15 tok/s, came from our own configuration, not from Maya. With fewer CPU-lane threads plus DSpark, it is now ~41 tok/s on the same hardware. Details are in a separate issue, #433, so others don't repeat our mistake.

One small observation, in case it's useful. After we changed engine settings (--cpu-threads, --dspark), the next start dropped the kept conversations ("5 not this model's or incomplete - removed"), so the first agent turn re-read 112K tokens (88 s). That seems reasonable if the state depends on those settings. We mention it only so it can be documented: changing those settings costs one full re-read.

<!-- gh-comment-id:6371042912 --> @talisp commented on GitHub (Oct 23, 2026): Thank you, this works. A short follow-up with numbers from the same machine (one L40S-48Q, UD-Q8_K_XL), now on v1.1.25 with `MAYA_DS4_SLOT_KEEP=1` (and `MAYA_DS4_SLOT_CAP=8`). **Switching conversations** (two ~15K-token conversations alternating, measured the same way before and after): | | v1.1.21 | v1.1.25 + `MAYA_DS4_SLOT_KEEP=1` | |---|---|---| | Follow-up turn of a conversation that lost the model | 0 reused, ~15,200 tokens read in ~14 s | **~65 tokens read in ~2 s** | **Real agent traffic** (DeepSeek Harness, 112-127K-token context): each turn reads only what is new, typically 14-600 tokens, with the rest reused. While retuning after the update we also found that our earlier decode speed, 15 tok/s, came from our own configuration, not from Maya. With fewer CPU-lane threads plus DSpark, it is now ~41 tok/s on the same hardware. Details are in a separate issue, #433, so others don't repeat our mistake. One small observation, in case it's useful. After we changed engine settings (`--cpu-threads`, `--dspark`), the next start dropped the kept conversations ("5 not this model's or incomplete - removed"), so the first agent turn re-read 112K tokens (88 s). That seems reasonable if the state depends on those settings. We mention it only so it can be documented: changing those settings costs one full re-read.
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#146
No description provided.