Repository navigation
Conversation
ashhart
added a commit
that referenced
this pull request
Nov 14, 2026
This was referenced Nov 15, 2026
…ame launch TF_DSV41_TREE=2..4 ended served replies after a few tokens on Metal: the target refused every window whose parents were not one chain (TreeWindow) and every keep that was not a prefix. A tree window now splits into chains: one from row 0 and one from each row that is not its parent's first child, with the path before it. Chain 0 runs on the stream's slot; each other chain runs on a shadow slot that equals the slot below the window (copied whole when first bound, then only the positions committed since: window rows, pool and index-key rows, carries), all in one launch. A row run again in front of a branch must choose as on its own chain. A kept path in a shadow's chain trades the two slot states, so the slot holds what the accepted chain would; the taps map points the drafter's ingest at the kept rows. Shadows are made on the first tree window. serve_lanes.Model gains `trees` so tests set the knobs without the environment. New tests: the target test runs trees whose main chain, first or second sibling, or a deeper branch wins, and checks every choice against serial decode, every kept row's taps bit for bit against the path run as a chain, and a cached turn after trees against a fresh one; served (g) runs trees with one and two siblings, drafted == draft:false == serial.
…; kept branches copy into the slot Review of #3326: the target held one tree state, so two streams' tree windows in one window call (draft/lanes.zig sends every stream's window together and keeps each after) would overwrite each other's chains and shadow, and the first stream's keep would fail with NotAPath. Each slot now has its own tree window (Tree.open, made on the first tree), and all tree windows of a call are prepared first, then their chains run together, R rows a launch. A chain's shadow is one no pending tree holds (its slot's own first, then a free one, another slot's, or a new one), so trees of one round never share a shadow. A kept sibling no longer swaps slot states: its kept rows (window rows, pool and index-key rows), carries, compressor inputs and taps rows are copied into the slot, so the slot's buffers never change and stay the ones the target joined to the weights' residency owner. A new shadow joins that owner when the target did (Resident.tryAddNow, refused past its load limit) and leaves it before it is freed. Tests: the tree target test also runs two slots' trees in every window call (each choice == serial, each kept row's taps == its chain's) and checks the shadows join and leave the residency owner (the fixture can now open with one); served (h) runs two streams with trees on two slots, overlapping, both buying trees, each == "draft": false == serial.
…urn and before a thinking prompt's <think> A thinking prompt ends in <|Assistant|><think>, and the next turn renders that turn as <|Assistant|></think>..., so the whole-prompt entry was never a prefix of a follow-up and every thinking turn read the whole conversation again. A new conversation sharing the system prompt and tools found nothing either. Prefill now runs the prompt in up to three parts and keeps a state at each cut (before the first <|User|> once the system part is 256 tokens or more, and before the final <think>); the resume path is the one cached prompts already take.
ashhart
force-pushed
the
lead/dsv41-think-snapshot
branch
from
November 15, 2026 11:18
ec8486a to
4fbbddf
Compare
ashhart
added a commit
that referenced
this pull request
Nov 15, 2026
ashhart
added a commit
that referenced
this pull request
Nov 15, 2026
Owner
Author
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.
DeepSeek-V4.1 on Metal: the prompt cache kept whole prompts only, and two common follow-ups never matched one.
<|Assistant|><think>, and the template renders that turn in the next prompt as<|Assistant|></think>…(reasoning dropped), so the previous prompt was never a prefix. Every turn read the whole conversation again: 7.5K tokens of an agent harness's system prompt plus the conversation, about 6-8 s a turn at the start and tens of seconds once a session grows.Prefill now runs a prompt in up to three parts and keeps a state at each cut: before the first
<|User|>(once the system part is 256 tokens or more and not already kept), and before the final<think>of a thinking prompt. A thinking prompt's own whole-prompt entry is no longer saved, since a later prompt would only ever match it exactly. Resuming from a kept state is the path cached prompts already take, so replies are unchanged. The<think>cut costs one extra row. The system cut costs the decoder cone once when a system prompt is first seen.The three token ids are new config fields with the release vocabulary's values (
user128803,assistant128804,think_open128821); the fixtures set their own.Tests (new served cases):
<think>), and both replies equal fresh runs.test-dsv41-metal-serveandtest-dsv41-metalpass on an M5 Max (1,137 checks). Lean: 0 new.On an M5 Ultra, served to an agent harness (omp) with thinking on:
The first conversation after a server start is still cold (6.9 s for 7.5K tokens).