Repository navigation
lanes: hold a stream's draft depth against a noisy round; verify its probe (#3468) - #4012
Conversation
f33e33d to
d37d642
Compare
d37d642 to
e0e8918
Compare
|
Thanks @javierbits. Every item is in: the margin holds a priced depth against one noisy round while a clearly better depth still wins, the probe rows are marked and kept so a dropped stream can recover, the new test fails on main with the reported bug, and your GB10 receipt shows the stuck replies gone across 32 paired runs. Replies stand unchanged since the target still verifies every row. CI is green on the head and the code applies cleanly to today's main (only the changelog hunk needs the usual take-both at merge time). This is ready from our side.
|
…probe (ashhart#3468) - Rule.depth keeps the depth it priced until another beats it by depth_margin, like plain_margin, so one noisy round no longer drops a one-stream reply to one draft for the rest of it; a depth that keeps losing still gives way. - A depth probe's rows are kept by a lone window instead of trimmed back to the priced width, so the deeper depth's acceptance and round time are observed and a dropped stream can recover. - Host tests feed the reported 18.1/20.8 ms costs and the probe's rows; three lone-copy pins move by 1-2 drafted rows, their replies unchanged. Fixes ashhart#3468
e0e8918 to
bc59e14
Compare
|
Thank you @javierbits. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks for this one. The 1.3.2 release read found a trade-off on an M3 Ultra with Qwen3.8-27B and DFlash2 drafts: the depth hold makes one stream faster (2K-token prompt decode 85.3 -> 88.3 tok/s, and 74.6 -> 76.8 at a 10K start) but four streams slower. With and without this change, same tokens, two runs each:
With it, the sampled chat sweep is 3.2% under 1.3.1, so 1.3.2 ships without this change; main keeps it. Against 1.3.1, main's four-stream rounds draft more and accept fewer over the same tokens (drafted 6423 vs about 6315, accepted 2502 vs about 2537), which looks like the held depth staying wide when shared rounds are noisy. Would holding the depth only while a stream runs alone keep your one-stream gain? We can run the same comparison on a new head.
|
What this changes
atc overlap --jsonon the rebased head: 13 open PRs share a file; 5 conflicttextually and 8 do not (5 clean, 3 not test-merged). One is code: MiMo-V2.6-Flash on CUDA (2x GB10) with DFlash as the drafter #728 adds
State.alpha,Who.position, geometric-mode fields and an earlydepth()return todepth.zig; this change addsState.last/probebeside them and its margin only runs on thenon-geometric path, so the resolution is to keep both. idol: the octree and Gaussian decoders on CUDA (stacked on #1773, #1767; not yet run on a GPU) #1858, idol: BiRefNet background removal and preprocessing on Metal, so tf-idol-generate takes a raw photo (stacked on #1780) #1787, idol: tf-idol-generate, one picture to a 3DGS PLY end to end on Metal (stacked on #1773, #1774, #1775) #1780 and idol: the DINOv3 ViT-H+/16 image encoder on Metal (stacked on #1766) #1775 conflict
only in
CHANGELOG.md's Unreleased block, as does the local worktreefix/2941-qwen-cuda-unread-prefill, which every in-flight PR does; resolution is to keep bothentries. No conflict touches this change's code lines.
On CUDA, a one-stream reply could measure one noisy round, drop from two drafts a round to one,
and keep that depth for the rest of the reply (7 of 32 identical 256-token greedy replies here).
Two changes in
core/lanes:Rule.depthkeeps the depth it priced until another depth beats it by 5% on expected tokensa millisecond (
Constants.depth_margin, applied likeplain_margin). Estimates near the lineno longer flip the stream; a depth that keeps losing still gives way.
depth_probe_everyrounds) now marks its rows on theplan, and a lone window keeps those rows instead of trimming them back to the priced width.
The probe's acceptance and round time are therefore observed, which is what lets a stream that
dropped recover.
The second half follows the diagnosis in #3468: the lone window's trim removed every probe row,
so the deeper depth's estimate never moved.
Checks on this head
issue-3468-depth-margin), base 8ddcb75.python3 tools/zig/lean_check.pywithlean_new.py: 168 findings on 8ddcb75,168 on this head, 0 new.
zig fmt --check build.zig zigandgit diff --check: pass.zig test -lc --dep sys -Mroot=zig/src/core/lanes/lanes.zig -Msys=zig/src/platform/sys.ziggives 448 passed, 1 skipped, 0 failed on this head, and the project step that roots at that
module,
zig build test-shared-lane-regressions-host, exits 0.zig build teston Linux doesnot root at the lanes module, so that step is the one that reaches these tests. The new margin test fails on main at
depth_noise_test.zig:27(a noisy round does not take a stream off the depth it holds),which is the reported bug.
zig build test test-goldenon 4d3734e (8c3e7b8; every later rebase changed nozig/src/core/lanesfile): 754/757 build steps, 10680/10763 tests passed, 55/55 goldens equal,1 failed:
cli_config_test.test.serve --config: expand reads the file, passes other commands through and names what it cannot read. This box'sumaskis 0002, so the test's tempserve.tomlis 0664 and the reader refuses a group-writable config; upstream main's ownzig build test-cuda-hostfails the same test here (1617 pass, 8 skip, 1 fail). Inherited,not reachable from this change. The missing
libtfgrammar.soskips the grammar checks.benchmark-clients 2m58s/4m5s, release-paths 3m29s, zig 47m42s, zig-b 41m1s,
zig-windows 36m18s, zig-macos-dev-tools 13m1s).
Receipt
Machine: one NVIDIA GB10 (sm_121, unified memory), driver 580.178.04, CUDA compiler 13.0.88,
Zig 0.17.0,
--context 16384 --prompt-cache-gib 0 --no-thinking, greedy unless named,nvidia/Qwen3.6-35B-A3B-NVFP4@491c2f1etarget and drafter,tools/bench_concurrent.py --levels 1 --tokens 256 --reps 32(16 for the pages cells),--prompts tools/bench_prompts.json,A-B-B-A with a fresh server each arm. "Low mode" = drafted rows per round below 1.5; a stuck
reply measures 1.05-1.22, the others 1.6-5.1. The binaries were built from 4d3734e
(main 8c3e7b8); every rebase since changed no file under
zig/src/core/lanes.The seven replies main held at one draft run 15% to 28% faster on this head with identical
tokens (
tools/bench_concurrent.pyper-reply decode); the other 25 keep their rounds and rates.The same A-B-B-A repeated in a slower window (50 tok/s, a shared machine) also gave 7 vs 0 low-mode
replies. This box's decode rate drifts about 2x between runs (another user's cluster rank shares
it), so only the adjacent arms are compared: main's own arms span 51.8-52.7 tok/s on the pages
cell, 48.2-107.3 on the sampled one and 43.7-50.6 on the 27B. The 27B never reaches one draft
(its DFlash2 drafter prices 14-15 rows a round), so that cell checks that the change leaves it
alone rather than a fix.
changes no file under
zig/src/core/lanes):tools/bench_concurrent.py --levels 1,4 --tokens 256 --reps 3 --temperatures 0 --alone --serial: all four cells (code and chat,one and four streams) report
failed: 0for both the alone and the"draft": falsecomparisons.
roundsand
accepted=A/D, so drafted rows per round is public in every arm's log.zig/src/core/lanes/depth_noise_test.zigfeeds the reported noisy costs (18.1 msfor one draft against 20.8 for two, acceptance 0.72/0.54) and shows a stream keeps its depth,
a depth that keeps losing by more than the margin still gives way, a probe asks one draft past
the held depth, and a lone window keeps the probed rows. Three
lone_copy_price_testpins moveby 1-2 drafted rows because the rule now holds a depth; their replies, rounds and copy
behaviour are unchanged and the comments name CUDA lanes: at one stream the depth rule can drop to 1 draft on timing noise and stay there (~92 vs 99.5 tok/s on Qwen3.6-35B-A3B) #3468.
TF_QWEN_KV_PAGESon and off). Metal and CUDA shared rounds use
budgetsand are unchanged.Constants.depth_margin = 1.05.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.