Repository navigation
The 27B's checks drive the served host, and the serial host they kept alive goes - #659
Conversation
… alive goes tf-qwen27-served-check, tf-qwen27-dflash-served-check, tf-qwen27-reuse and tf-qwen27-lanes-* built against qwen27_host.zig, which stopped serving when ashhart#578 put the 27B on the lane host. They now build against qwen27_served.zig, the host the server opens. Its `open` loads a checkpoint and calls a new `attach`, which serves a model already in memory (and a drafter bound to it), so the synthetic checks run the same code as a served request. The checks keep their contracts where the served host keeps them: - served: 8 greedy tokens equal the direct session after a chunked prompt. - dflash-served: drafted, EOS, plain, sampled, custom-stop, BF16 and prepared-q4 requests give the CLI's tokens and final state, on the serial loop and with TF_QWEN27_LANES=1. Sampled and custom-stop requests draft now (ashhart#578), so only "draft": false must report no drafts. A cancel lands at the end of a round: the reply is a prefix of the expected one and the state is the CLI's at its length. The round-callback section and the zero-token request tested the serial host's batch delivery, which nothing serves any more; reuse covers prompt-only passes, which are warm passes on the served host. - reuse: the fresh run turns off both the store and the backend's reply keep. qwen27_host.zig and qwen27_lane_decode.zig had no other users and are removed, with the drafter's batch delivery, which only they called. On an M5 Ultra: the three synthetic checks pass (dflash-served on both paths), tf-qwen27-reuse on Qwen3.8-27B MLX-4bit with DFlash2 passes 9 of 9 by default and with TF_QWEN27_LANES=1, and tf-qwen27-lanes-run gives equal tokens (2 of 2).
|
Thank you, @BobClawblaw. These checks had been testing a host nothing serves since #578, and now they test the one that ships. Each of the three contracts you changed follows what the served host does, and your description says why for each. Your commit What we ran, Qwen3.8-27B MLX 4-bit with DFlash2 (q4), on an M3 Ultra (no tensor units, so drafted requests run on the lane core) and an M5 Max (tensor units, so a lone greedy request takes the serial loop unless
Three changes on our side, in commits after yours. With |
…adoptPrefilled) Only qwen27_lane_decode.zig, which ashhart#659 removes, handed a stream prefilled by another driver to the lane core. Nothing else calls the 27B backend's attach or the lane core's adoptPrefilled, on this branch or any other local one.
…ashhart#661 lets start ashhart#659 raised the check's context from 384 to 1024 because a new build's first start with a drafter could not time its windows in a small context. With ashhart#661 the timing refills its slot, so the check now starts at 256, where every first start refills it, and fails if that path breaks.
tf-qwen27-reuse asks a resumed reply for the fresh reply's tokens, final state, rounds and accepted drafts. On the lane core (TF_QWEN27_LANES=1, or a Mac without tensor units) a drafted reply's trees are sized from the landing counts of every reply the server has drafted, so the first case's fresh reply, the server's first, drafts from empty counts and its resumed twin from two replies' worth. On an M5 Max with TF_QWEN27_LANES=1 that case resumed in 12 rounds with 51 drafts accepted against the fresh 13 and 50, every run, with the same tokens and final state; the build before ashhart#659 fails it the same way through the old host. The serial loop's rounds depend only on the drafter's and the target's state, which a resume restores, so that comparison stays there, as dflash_served already does for rounds.
…e served host (ashhart#659) and Nemotron's masked CUDA windows replaying graphs (ashhart#660)
core/serial_host.zig served one request at a time through a driver of callbacks. Its last engine was the 27B's single-stream host, qwen27_host.zig, which no server had opened since 1.0.6 and ashhart#659 removed with the drafter's batch path, so only its own tests used it. It goes with them: serial_host_test.zig, serial_batch_test.zig and cache_mode_host_test.zig, 1,113 lines in all and 20 tests, every one in the binary rooted at engine_api.zig. No build step, tool or doc named it, and its choose()/Logits sampling helper had no caller either. cache_modes keeps its callers: Engine.submit validates spans and the 27B's host keeps reply states. Three mentions follow it: the rewind test's comment names the 27B's host, the 27B's slot prefill comment drops its pointer to the serial host's rule, and ashhart#658's CHANGELOG line compares with Qwen's draws alone.
…adoptPrefilled) Only qwen27_lane_decode.zig, which ashhart#659 removes, handed a stream prefilled by another driver to the lane core. Nothing else calls the 27B backend's attach or the lane core's adoptPrefilled, on this branch or any other local one.
…ashhart#661 lets start ashhart#659 raised the check's context from 384 to 1024 because a new build's first start with a drafter could not time its windows in a small context. With ashhart#661 the timing refills its slot, so the check now starts at 256, where every first start refills it, and fails if that path breaks.
tf-qwen27-reuse asks a resumed reply for the fresh reply's tokens, final state, rounds and accepted drafts. On the lane core (TF_QWEN27_LANES=1, or a Mac without tensor units) a drafted reply's trees are sized from the landing counts of every reply the server has drafted, so the first case's fresh reply, the server's first, drafts from empty counts and its resumed twin from two replies' worth. On an M5 Max with TF_QWEN27_LANES=1 that case resumed in 12 rounds with 51 drafts accepted against the fresh 13 and 50, every run, with the same tokens and final state; the build before ashhart#659 fails it the same way through the old host. The serial loop's rounds depend only on the drafter's and the target's state, which a resume restores, so that comparison stays there, as dflash_served already does for rounds.
ashhart#659 landed above as ab2aaff8e (the author's commit, rebased onto this candidate), with our d61ad4d3e, c6d5fbf02 and 7416e6bd5 after it. This keeps the PR's own head commit in the history, with no change to the tree.
…e served host (ashhart#659) and Nemotron's masked CUDA windows replaying graphs (ashhart#660)
core/serial_host.zig served one request at a time through a driver of callbacks. Its last engine was the 27B's single-stream host, qwen27_host.zig, which no server had opened since 1.0.6 and ashhart#659 removed with the drafter's batch path, so only its own tests used it. It goes with them: serial_host_test.zig, serial_batch_test.zig and cache_mode_host_test.zig, 1,113 lines in all and 20 tests, every one in the binary rooted at engine_api.zig. No build step, tool or doc named it, and its choose()/Logits sampling helper had no caller either. cache_modes keeps its callers: Engine.submit validates spans and the 27B's host keeps reply states. Three mentions follow it: the rewind test's comment names the 27B's host, the 27B's slot prefill comment drops its pointer to the serial host's rule, and ashhart#658's CHANGELOG line compares with Qwen's draws alone.
The follow-up from #578's merge:
tf-qwen27-reuse, the served checks andtf-qwen27-lanes-*still built againstqwen27_host.zig, which no longer serves. They now build againstqwen27_served.zig, the host the server opens, so they test what ships.The change
qwen27_served.openloads the checkpoint and calls a newattach, which serves a model already in memory, with an optional drafter bound to it. The synthetic checks useattach, so they run the same code as a served request.qwen27_host.zigandqwen27_lane_decode.zighad no other users and are removed, with the drafter'sbatchdelivery that only they called. 67 lines in, 396 out.lanes_checkandlanes_runonly change their import:qwen27_servedexports the lane backend as the old host did.What the checks hold now
The contracts stay where the served host keeps them. Three changed with what the served host does:
"draft": falserequest must report no drafts. All three still give the CLI's tokens and state.tf-qwen27-reusecovers.In
tf-qwen27-reuse, the fresh run turns off both the store and the backend's reply keep, so a cache-off run can't leave a state a later turn resumes from.Measured
On an M5 Ultra:
tf-qwen27-served-checktf-qwen27-dflash-served-checkTF_QWEN27_LANES=1tf-qwen27-lanes-checktf-qwen27-reuse, Qwen3.8-27B MLX-4bit + DFlash2 (q4)TF_QWEN27_LANES=1tf-qwen27-lanes-run, same weights, 256 tokenszig build test,test-native,test-qwen27andzig build nativepass.Found on the way, not changed
lanes.Metal.measuretimes the drafter's windows on a build's first start: a 192-token prefill, then about 260 timed windows that each keep a row. So that first start needs a context of about 450 tokens or more. A server started with--drafterand a small--context(256, say) fails withBadRoundPlanuntil the costs are cached. The drafted check hit it at its old 384-token context, so it now uses 1024. Measuring at a fixed position, or re-prefilling when the slot fills, would fix it. Would you like that as its own PR?