mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1455] [CLOSED] serve: optionally reuse prompt tokens at safe boundaries #3467
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#3467
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1455
Author: @W1nge
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:codex/prompt-reuse-review📝 Commits (3)
94befcePrepare local prompt reuse adaptation referencing community PR 56747c3e38Merge remote-tracking branch 'upstream/main' into codex/prompt-reuse-reviewba4f1c6serve: make prompt reuse explicitly opt-in📊 Changes
3 files changed (+268 additions, -3 deletions)
View changed files
📝
serve/server.py(+7 -2)➕
serve/test_prompt_encoder.py(+177 -0)📝
tools/strata_tokenizer.py(+84 -1)📄 Description
Summary
With
STRATA_PROMPT_REUSE=1, continued chats reuse prompt IDs up to a safe special-token boundary. Adapted from gputier's #567, with credit for the core algorithm.What changed
Keep at most four prompts, each bounded to 256K characters / 64K tokens. Return fresh lists before image expansion. Protected literal spans, unsupported tokenizers and unsafe boundaries use full encoding. Default encoding stays unchanged; preserve main's piece cache.
Validation
On main
61b3fb5d,python -m unittest serve.test_prompt_encoder serve.test_server tools.test_strata_tokenizer tools.test_tokenizer_plain_spans -qpasses all 314 tests, including opt-in/default equivalence, edits, overlapping literals, tools, images and concurrency.No engine changes. Earlier independent token-ID and latency measurements are in KarlGrier's comment.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.