Skip to content

perf(nemotron cuda): the lone driver takes thinking budgets and loop guards - #778

Merged
ashhart merged 5 commits into
ashhart:mainfrom
plotarmordev:perf/nemotron-lone-think
Oct 13, 2026
Merged

ashhart merged 5 commits into
ashhart:mainfrom
plotarmordev:perf/nemotron-lone-think

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

On top of #777 (its commits come first here; this pull request adds the last three). Nemotron CUDA's lone driver takes a lone request with a thinking budget above 32 tokens, or with --loop-guard. It hands the stream to the lane rounds just before the budget's cut falls within its next window, or when a loop guard's close is pending. The lane rounds force the close as before, so replies are unchanged. Budgets of 32 or fewer stay in the lane rounds from the start.

  • stream.zig: budgetWithin(rows).
  • cuda_lone.zig: the hand-over keeps only the tokens the commit landed; min_budget.
  • engine_api.zig Lone.min_budget, lane_host_lone.zig fits.

Receipt

  • Environment: DGX Spark (GB10), Nemotron 3.5 Lightning MLX-4bit @ d9d758fb, on 1.0.8 (0efbd447), --context 16384 --parallel 4. Every server start measured its own window-cost table (a fresh cache), arms alternated.

  • Exactness: thinking replies (700 tokens, two prompts) have the same token_sha as 1.0.8 with no budget and with budgets of 20, 120, 400 and 4,000, each 3 times in 2 starts, and with --loop-guard. Pairs where a second request arrives 0.4 s later (budgets 120, 400, 4,000) also match. Drafted output equals "draft": false at budgets of 200 and 2,000.

  • Speed, per-request wall times across starts:

    1.0.8 this change
    budget 4,000 (no cut), prompt 1 4.38-4.53 s 4.26-4.27 s -3.3%, separated
    budget 4,000, prompt 2 5.05-5.22 s 4.76-4.78 s -8.1%, separated
    budget 400 (cuts), prompts 1 / 2 -4.2% / -3.6%
    budget 120, prompts 1 / 2 -5% / -1.5%
    budget 20 no change (below the minimum)
    --loop-guard, no budget, prompts 1 / 2 -4% / -8%
  • Tests run: zig build test 616/621 (5 skipped); test-cuda-host 25/25 steps; server tests 155/155 and 96/96; goldens 309/319 with 0 unexpected differences; zig fmt; lean_check as on 1.0.8.

  • Not run, and why: Metal (unchanged). The NVFP4 checkpoint and RTX cards (no hardware here). The Grill's workloads set no thinking budget.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off. (The lone driver is main's existing path for a lone drafted stream; this widens which requests take it. Arrivals still hand the stream to the lane rounds as before.)
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. (Same kernels and draws; only which loop drives the stream changes.)
  • Prompt processing is no slower than the last release. (The prompt pass is unchanged.)
  • The description says which platforms I ran: CUDA GB10 only.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency. (No new test: the forced close is the lane rounds' own, under their existing tests.)

It commits each round's kept rows as the lane core's windows read them (logprobRows on the window's logits)
and opens the stream with the prompt's last row, so a lone logprobs request decodes on the lone driver's
graphs and confidence depth rule.
…guards

A stream with a budget past the driver's minimum or a loop guard decodes on the lone driver until a loop
guard's close is pending or the budget's cut falls within the next round, then goes to the lane core, which
forces the close as before.
@ashhart
ashhart merged commit e4d01cb into ashhart:main Oct 13, 2026
2 checks passed
jschmied pushed a commit to jschmied/TensorFold that referenced this pull request Oct 13, 2026
jschmied pushed a commit to jschmied/TensorFold that referenced this pull request Oct 13, 2026
The contributor's commit landed above with the same code, on top of ashhart#778's; this keeps the PR's head in the history with no change to the tree.
@ashhart

ashhart commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Thank you, @plotarmordev. Handing the stream over just before a forced close, and leaving the close itself to the lane core, keeps one place that forces it, and the 32-token floor makes the first round safe by construction. It landed in 1.0.9 under your name (9cc2385fb, and the CHANGELOG line 7ae5634dc) with the same code. Your head, which also holds #777's and your merge of the two CHANGELOG lines, is merged after it with no change to the tree (e4d01cb87), so GitHub shows this PR as merged.

What we measured on a GB10 (sm_121), against the build without it:

  • Budgets. Thinking replies with budgets of 33, 48, 400, 1,000 and 4,000 tokens equalled the lane core's token for token on MLX 4-bit and NVFP4, greedy and seeded sampled, cut at the same token, and equalled "draft": false. The replies' min_rows show the hand-over working as you describe: the 33, 48 and 400 budgets went to the lane core before their cut, while the 1,000 and 4,000 ones stayed on the lone driver to the end. A budget of 32 stays with the lane core, as your minimum says.
  • Loop guard. Our first prompts asked the model to repeat itself and it politely declined, so we put the repetition in the user's text (a long number to count, a passage to copy, a pattern to continue). The guard then fired in 15 of 24 replies across both formats. Every reply matched the previous build's tokens and loop period, and "draft": false. Replies that fired went to the lane core for the close, and those that didn't stayed lone.
  • Speed. Four servers a build in a mirrored order, MLX 4-bit: 700-token thinking replies with a 4,000-token budget finished 6.3% and 8.7% sooner, and one cut at 400 tokens 4.0% sooner.

@ashhart ashhart mentioned this pull request Oct 14, 2026
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
The contributor's commits landed above with the same code, on top of ashhart#777's; this keeps the PR's head, which also holds ashhart#777's and the contributor's merge of the two CHANGELOG lines, in the history with no change to the tree.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
The contributor's commit landed above with the same code, on top of ashhart#778's; this keeps the PR's head in the history with no change to the tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants