Repository navigation
stream: hold back only a marker-prefix suffix (removes the ~135 ms/delta SSE lag) - #67
Conversation
…x-1 bytes
With a leak-marker parser active (qwen3_coder: the Qwen3.8 recipes), the
streaming content sanitizer held the last `tag_max - 1` bytes (~18) of
EVERY delta so a marker straddling two chunks could fuse. Plain prose was
therefore delayed by several tokens on every delta, deltas were sliced
mid-word ('text consis' / 'ts of a r'), and the first content delta waited
on later tokens — the ~135 ms/delta, ~195 ms client-TTFT lag measured
against the scheduler's own TTFT= line on GB10.
A marker can only be completed by future bytes if the buffer ENDS in a
proper prefix of it. No complete marker is present in this branch (the
searches above would have matched), so every byte before the earliest
such suffix is final. `marker_prefix_hold_start` holds exactly that
suffix; the emitted bytes are identical, only earlier. End-of-stream
flush still receives any genuine partial marker.
Tests: prose passes through in the same delta; a partial `<tool_` is held
and resolved; and chunk invariance — 7 texts x 200 random chunkings each
must produce the same total output as feeding the text whole.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ontract Their first assertion encoded the old flat hold (the non-tag 'abc' before '<param' was withheld too). The leak properties they exist for are unchanged and still asserted: '<param' is held, fuses with 'eter=x>', the body is suppressed, and the total output is 'abctail'. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Live A/B on GB10 (job 241, 2026-09-25) — the lag is gonenvidia/Qwen3.8-Flash-Next-NVFP4,
Inter-delta gap unchanged (median ~52 ms, the decode step). Deltas are token-aligned again instead of byte-sliced. Every client-visible TTFT on a leak-marker parser drops by ~0.2 s — at short context that is more than the whole remaining gap to vLLM on this model. |
|
Merged as part of the GB10 merge train (main Gates on the combined tree:
Tree check: |
Problem
With a leak-marker tool parser active (
qwen3_coder, i.e. every Qwen3.8 recipe),sanitize_content_chunkheld back a flattag_max - 1bytes (~18) from every content delta so that a marker split across chunks could fuse. Plain prose was therefore delayed by several tokens on every delta:'text consis'/'ts of a r');TTFT=line (GB10, qwen4_exp, measured 2026-08-30).At short context that lag was larger than the entire remaining TTFT gap to vLLM.
Fix
A marker can only be completed by future bytes if the buffer ends in a proper prefix of it. In this branch no complete marker is in the buffer (the searches above would have matched it), so every byte before the earliest such suffix is final.
marker_prefix_hold_startholds exactly that suffix. The emitted bytes are identical; they are just emitted sooner. End-of-stream flush still receives any genuine partial marker (flush_content_sanitizeronly scrubs complete markers and a trailing partial one). The reasoning stream shares the same function.Tests
holdback_tests: prose passes through in the same delta; a partial<tool_is held and resolved; chunk invariance: 7 texts (markers, partial closes, bare<, unicode) × 200 random chunkings each produce the same total output as feeding the text whole.abcbefore<param; they now assertabcemits and<paramis held. Their leak assertions are unchanged.cargo test -p spark-server --bin spark: 2368 passed, 0 failed (reiner, GB10,a28c4684).Live A/B (GB10 job 241, 2026-09-25): the lag is gone
nvidia/Qwen3.8-Flash-Next-NVFP4,
--tool-call-parser qwen3_coder, 3 prompts x 5 reps per arm, run as A, F, A, F.lagis the client's time to the first content delta minus the scheduler's ownTTFT=for the same request.5b07b953a28c4684The inter-delta gap is unchanged (median ~52 ms, one decode step). Deltas are token-aligned again instead of byte-sliced. The only change from
a28c4684to the head is the clippy fix.Merge gate
This PR merges as part of the GB10 merge train (
main+ #78 + #67 + #68). That combined tree is gated by the ST-995 accuracy leg (bfcl-subset --pull-request-gateon the Flash-Next recipe) and the 2.5 h agentic perf leg. Results will be posted here before the merge.