Repository navigation
prompt cache: planned families keep marks on prompts under min_prompt - #669
Merged
Merged
Conversation
…t (its marks fall on chunk starts the pass makes)
8 tasks done
Owner
|
Thank you, @jschmied. The argument from #584 carries over cleanly, and now Metal has numbers too. Your commit What we measured on Nemotron 3.5 Lightning MLX 4-bit:
One change on our side, in a commit after yours. |
This was referenced Oct 12, 2026
BobClawblaw
pushed a commit
to BobClawblaw/TensorFold
that referenced
this pull request
Oct 12, 2026
…rn_test.zig (pure move) prompt_cache_test.zig passed 600 lines with ashhart#669's test; the seven learned-state tests and the two imports only they use move unchanged.
BobClawblaw
pushed a commit
to BobClawblaw/TensorFold
that referenced
this pull request
Oct 12, 2026
BobClawblaw
pushed a commit
to BobClawblaw/TensorFold
that referenced
this pull request
Oct 12, 2026
BobClawblaw
pushed a commit
to BobClawblaw/TensorFold
that referenced
this pull request
Oct 12, 2026
A new entry gives the size of a kept state on the 2,048-row grid and the states and chats the 16 GiB default holds. The ashhart#669 entry said a CUDA state copies the whole window; it now gives the new size. The RUNBOOK's floor said 4,096 tokens, which ashhart#669 removed; on CUDA a prompt needs more than 2,048.
BobClawblaw
pushed a commit
to BobClawblaw/TensorFold
that referenced
this pull request
Oct 12, 2026
…hhart#670), with no prompt call A new ashhart#670 entry: states at any row, chunk invariance and the in-chunk keeps checked byte for byte, later turns' and cold first turns' times, and what a chat keeps now. The sizing entry gives the two parts a state allocates and the spare Mamba buffers; the ashhart#669 entry's CUDA lines point to both. The RUNBOOK's paragraph says where a turn resumes and what a state takes.
Closed
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…rn_test.zig (pure move) prompt_cache_test.zig passed 600 lines with ashhart#669's test; the seven learned-state tests and the two imports only they use move unchanged.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
ashhart#669 landed above as b90dea7fc (the author's commit, rebased onto this candidate). This keeps the PR's own head commit in the history, with no change to the tree.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
A new entry gives the size of a kept state on the 2,048-row grid and the states and chats the 16 GiB default holds. The ashhart#669 entry said a CUDA state copies the whole window; it now gives the new size. The RUNBOOK's floor said 4,096 tokens, which ashhart#669 removed; on CUDA a prompt needs more than 2,048.
BlivionIaG
pushed a commit
to BlivionIaG/TensorFold
that referenced
this pull request
Oct 20, 2026
…hhart#670), with no prompt call A new ashhart#670 entry: states at any row, chunk invariance and the in-chunk keeps checked byte for byte, later turns' and cold first turns' times, and what a chat keeps now. The sizing entry gives the two parts a state allocates and the spare Mamba buffers; the ashhart#669 entry's CUDA lines point to both. The RUNBOOK's paragraph says where a turn resumes and what a state takes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This generalises c79c431, from #584. There you said the
min_promptfloor exists for families whose marks end a prompt call early, and that GLM, which keeps only at chunk starts its pass cuts anyway, gained nothing from it, so GLM's store now sets 0. The same holds for every planned family.min_prompt(4,096) exists because a mark can cost an extra prompt call. A planned family's marks fall on chunk starts its pass already makes, so for those families the extra call never happens, yet prompts under 4,096 tokens still keep nothing. This PR skips the threshold whenrules.plannedis set. Unplanned families keep it.core/prompt_cache.zig:marksRewindreturns no marks belowmin_promptonly when the family is not planned.core/prompt_cache_test.zig: a planned store keeps its mark on a 10-token prompt, and an unplanned one keeps none. The test fails with the old rule.Receipts on a GB10 (sm_121, CUDA 13.0, main e7c523e). CUDA Nemotron 3.5 Lightning MLX-4bit,
tensorfold-native serve --parallel 1, short agent loop of 12 turns growing from 1.2k to 5.2k tokens, two server starts per arm. The 0 arm setsmin_prompt = 0through a local switch, which is what this change does for a planned family:Data: results3.jsonl.
On Metal this covers Nemotron, and GLM's explicit
min_prompt = 0becomes redundant (I left it in). I haven't measured Metal.