[PR #3615] [CLOSED] [Engine] conversation cache: --conversation-cache-min-tokens WRITE[,READ] gates parked reads #4714

Closed
opened 2026-11-07 15:38:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3615
Author: @G0-0000
Created: 10/21/2026
Status: ❌ Closed

Base: main ← Head: feat/conversation-cache-read-min-tokens


📝 Commits (1)

  • 9844762 conversation cache: --conversation-cache-min-tokens WRITE[,READ] gates parked reads

📊 Changes

4 files changed (+122 additions, -19 deletions)

View changed files

📝 docs/DETAILS.md (+13 -8)
📝 include/strata/core/conversation_cache.hpp (+37 -0)
📝 src/core/conversation_cache_test.cpp (+34 -0)
📝 src/program/generate.cpp (+38 -11)

📄 Description

Problem

--conversation-cache-min-tokens N (WRITE, #1597, now in main) stops short side requests from parking themselves and evicting the long conversation they are interleaved with. The read side has no equivalent: every request calls ConversationCache::best(), and a short request can restore a short parked copy that it rewrites at once.

Change

--conversation-cache-min-tokens WRITE[,READ]:

  • WRITE keeps today's meaning: the shortest outgoing conversation worth a slot (ConversationCache::wants).
  • READ is the shortest complete prompt, cached history included, worth searching the parked conversations for. Below it the engine calls no best() and restores nothing. The active session's prefix, its checkpoints and the batch slots are chosen before the gate and are unaffected.
  • A single value is WRITE,0, the default is 0,0, and READ=0 searches every prompt as before. A startup with READ=0 prints the line it printed before.

This extends #1597 rather than replacing it; that flag is already in main and keeps its meaning.

Validation

Passed:

  • CUDA build on a Tesla V100 (sm_70): cmake -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=70 ... && cmake --build build-pr -j8
  • conv_cache_test: PASS (4792 checks); the same source also passed under -fsanitize=address,undefined
  • strata --serve --help shows the new WRITE[,READ] syntax

Not run:

  • An end-to-end GPU run of this exact branch. The gate wiring is static analysis plus unit tests on the parser, the boundary and the full-prompt counting.
  • HIP and SYCL builds: no such hardware here. The change is in shared code and looks backend-neutral; help welcome.

Failed: none.

Limits

  • READ counts the complete prompt, cached history included, so it only affects short requests; a long conversation's every turn is above any useful READ.
  • No disk/spill path is touched: main has no conversation disk tier (#1937 is still open).

Checks

  • Title starts with its area
  • One problem per pull request
  • Opt-in; the default path and startup line are byte-identical
  • Every backend the change touches was built: CUDA only so far; HIP and SYCL are not available here

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3615 **Author:** [@G0-0000](https://github.com/G0-0000) **Created:** 10/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/conversation-cache-read-min-tokens` --- ### 📝 Commits (1) - [`9844762`](https://github.com/Niko1221/Strata/commit/9844762a97fb326bc3338624ff2ba512c5108bad) conversation cache: --conversation-cache-min-tokens WRITE[,READ] gates parked reads ### 📊 Changes **4 files changed** (+122 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+13 -8) 📝 `include/strata/core/conversation_cache.hpp` (+37 -0) 📝 `src/core/conversation_cache_test.cpp` (+34 -0) 📝 `src/program/generate.cpp` (+38 -11) </details> ### 📄 Description ## Problem `--conversation-cache-min-tokens N` (WRITE, #1597, now in main) stops short side requests from parking themselves and evicting the long conversation they are interleaved with. The read side has no equivalent: every request calls `ConversationCache::best()`, and a short request can restore a short parked copy that it rewrites at once. ## Change `--conversation-cache-min-tokens WRITE[,READ]`: - WRITE keeps today's meaning: the shortest outgoing conversation worth a slot (`ConversationCache::wants`). - READ is the shortest complete prompt, cached history included, worth searching the parked conversations for. Below it the engine calls no `best()` and restores nothing. The active session's prefix, its checkpoints and the batch slots are chosen before the gate and are unaffected. - A single value is `WRITE,0`, the default is `0,0`, and `READ=0` searches every prompt as before. A startup with READ=0 prints the line it printed before. This extends #1597 rather than replacing it; that flag is already in main and keeps its meaning. ## Validation Passed: - CUDA build on a Tesla V100 (sm_70): `cmake -DSTRATA_ENABLE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=70 ... && cmake --build build-pr -j8` - `conv_cache_test`: PASS (4792 checks); the same source also passed under `-fsanitize=address,undefined` - `strata --serve --help` shows the new `WRITE[,READ]` syntax Not run: - An end-to-end GPU run of this exact branch. The gate wiring is static analysis plus unit tests on the parser, the boundary and the full-prompt counting. - HIP and SYCL builds: no such hardware here. The change is in shared code and looks backend-neutral; help welcome. Failed: none. ## Limits - READ counts the complete prompt, cached history included, so it only affects short requests; a long conversation's every turn is above any useful READ. - No disk/spill path is touched: main has no conversation disk tier (#1937 is still open). ## Checks - [x] Title starts with its area - [x] One problem per pull request - [x] Opt-in; the default path and startup line are byte-identical - [ ] Every backend the change touches was built: CUDA only so far; HIP and SYCL are not available here --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:38:32 +07:00
Sign in to join this conversation.
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
Niko1221/Strata#4714
No description provided.