mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #10] [MERGED] serve: read short prompt parts through the decode windows (~1 s faster first token) #2413
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#2413
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/10
Author: @Mirtraxxx
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @Niko1221
Base:
main← Head:short-read📝 Commits (2)
23f6b15serve: conversation cache - keep the chat between requests, read only what is new9d9351bserve: read short prompt parts through the decode windows📊 Changes
5 files changed (+411 additions, -34 deletions)
View changed files
📝
README.md(+2 -2)📝
docs/DETAILS.md(+8 -3)📝
include/strata/core/mtp.hpp(+2 -0)📝
serve/server.py(+4 -0)📝
src/program/generate.cpp(+395 -29)📄 Description
Builds on #8. This branch is #8 plus one commit (
9d9351b); only that commit is new here. I can rebase it once #8 is merged or changed.What it does
The batched prompt path has a fixed cost of ~300 ms per run however few tokens it reads: it streams every non-resident expert the chunk routes to over PCIe. On top of that, refilling the 1,131 expert-cache slots it borrows takes ~180 ms. So "hi" waited ~1.4 s for its first token. With #8, every chat follow-up paid the same fixed cost for a message of a few dozen tokens plus the 6-token assistant header.
Now each part of the prompt (up to the turn checkpoint, then the header) picks its own path:
--short-read Ntokens (default 64,0= off) goes through the verify windows, S tokens at a time, as decode reads them:ver.run→ver.commit→mtp.prefill, with misses on the CPU pool. That's ~16 ms a token.STRATA_CKPT_REREADkeeps every read batched, so it still compares a checkpoint against a batched re-read.Measured
RTX 3090, Ryzen 7 5700X, 64 GB DDR4, Windows 11, Swift 1.5 IQ2_XS,
--serve --expert-cache auto --spec 4 --adapt-swaps 0. Old and new engine back to back, same flags.Output: greedy answers match the batched path except at near-ties, which the two paths round differently. On one prompt the first token flipped, and I dumped the logits to check it: "Think" 23.09 vs "Imagine" 23.02 through the windows, 23.03 vs 22.90 batched. The windows are the same computation decode uses.
Only tested on Windows / one machine, text prompts. Picture rows always take the batched path, so image prompts should be unaffected, but I haven't tested that.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.