Skip to content

ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA - #2475

Open
jrb-ai wants to merge 26 commits into
ashhart:mainfrom
jrb-ai:ricursive-cuda-drafter
Open

jrb-ai wants to merge 26 commits into
ashhart:mainfrom
jrb-ai:ricursive-cuda-drafter

Conversation

@jrb-ai

@jrb-ai jrb-ai commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before, the CUDA ricursive family (#2302) served Ripple-65B-Preview without a drafter. After, --drafter serves the
publisher's DFlash2 drafter (ricursiveAI/Ripple-65B-Preview-DFlash2) as published, read in place, and the target
verifies every draft, so a drafted reply equals the plain one bit for bit. The code is the family's own, as #2260 is on
Metal; no shared Qwen DFlash2 path changes.

With several streams, the drafter also times shared rounds of every admitted stream at load, and the depth rule prices
a shared round past the one-stream sweep's 16 rows by those times. Without them, the rule extended the one-stream sweep
in proportion and priced a 64-row round at about 1,010 ms against 292 ms measured, so at eight streams each stream
drafted about 1 token a round. The lanes take the times through one new drafter fact, shared_costs, empty unless a
drafter gives it; only this family's drafter does.

With #5363 under it, structured output and forced tool calls are served with the drafter as without it: the drafted
wrapper forwards the grammar's masks to the family's masked draws, and a drafted reply under a grammar equals the
plain one.

The review's items (10 and 12 Nov)

  1. Rebase and CI: rebased on main 6c2254635, with ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363's commits under it. The drafter's cuda_pending join is in
    zig/src/core/contract/registry_joins.zig beside the other ricursive lines.
  2. The structured-output offer. zig/src/native/cuda.zig reads .structures from the family's own vtable, not the
    drafted wrapper's. On main the families with openDrafter each have first_masked, so none of their offers
    change; measured on GB10 on 26 Nov on this PR's code on main e63912221 (ae7b7ba40) against that main, with
    nvidia/Qwen3.6-35B-A3B-NVFP4 and incoai/Qwen3.6-35B-A3B-DFlash2 (--context 32768 --parallel 4 --drafter):
    • Token hashes of 4 greedy 256-token replies, each alone and the 4 at once: 8 of 8 equal between the two binaries
      (362ea30ec37e5996, 16e253366af54a2a, aa862a2410b8b1d5, 4db2b06e71a111d0).
    • One response_format json_schema reply (temperature 0, thinking off): both give the same 41 tokens
      (f612b719086989a3) and the same text, and it fits the schema.
    • Ripple with --drafter: on that base the server refused response_format up front (HTTP 400), as it did
      without the drafter. With ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363 under this PR the family has first_masked, so the offer is on and the request
      is served (below).
  3. CHANGELOG: the line ends "(ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475, fixes Ripple-65B (ricursive) on CUDA: the publisher's DFlash2 drafter #2474). Thanks to @jrb-ai." The checklist is ticked where it holds.

Checks on this head

  • Head commit: bace121aa, on main 6c2254635. GB10 ran on two earlier rebases of the same commits: 384ce2f83
    (on main 53f24ba5a, 28 Nov) and fa95da583 (on main 98a901f01, 29 Nov). The head differs from fa95da583 by
    main's three newer commits under it and by the place of the two changelog lines, and it has had no GB10 build of
    its own. Those three commits change neither the family nor the lanes. Between mains 53f24ba5a and 98a901f01,
    main changed seven lines of zig/src/core/lanes/accept.zig and the family's Metal drafter kernels;
    ripple-drafted on fa95da583 ran with that under it. The recipe's served checks, the grammar checks and the five-SM limits ran on 27 Nov on 1353bbd55 (on
    main 2713f2791), which lacks only changelog lines and one recipe sentence of this branch, no code. The speeds,
    the resumed-prompt check, the 22-reply compare and every family's kernel contract ran on 26 Nov on ae7b7ba40,
    this PR's code on main e63912221, before ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363 was under it.
  • Lean checker on the base (main 6c2254635) and on this head: 93 and 93, 0 new (tools/zig/lean_new.py).
    tools/pr_check.py --base 6c2254635 --pr 2475: 0 errors. zig fmt --check build.zig zig and git diff --check:
    clean.
  • Tests, Mac (M5 Pro), zig build test test-kernel-contract test-golden -Dcpu=apple_m1, on fa95da583 (29 Nov; 32
    of the 1,205 steps came from the cache): 1,200 of 1,205 steps; 19,643 of 19,811 tests pass, 166 skip, 2 fail.
    Main 98a901f01 fails the same two on this Mac (an Inkling 2 Metal capabilities test and "info prices a
    Qwen3.8-27B start ...") and the same build step (lfm3's tests): 1,200 of 1,205 steps; 19,613 of 19,781 pass.
    On this head, with most steps from the cache: 1,200 of 1,205 steps and the same three failures.
  • The Linux binaries and GPU tests compile from the Mac on this head (zig build compile-cuda-tests compile-cuda-cli native -Dtarget=aarch64-linux-gnu): 25 of 25 steps.
  • Tests, GB10, tf-cuda-test on fa95da583 (29 Nov), built there for sm_121: ricursive-contract 23 kernels pass
    gates 1-4, 0 fail, 28 controls red as planted; ricursive-dflash2-contract 10 and 19;
    ricursive-dflash2-attn-contract 3 and 6; ripple-forward 40 passed, 0 failed; ripple-serve 13 and 0;
    ripple-drafted 17 and 0. The same lines on 384ce2f83 (28 Nov).
  • Token IDs against main (the check asked for on ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363), on 384ce2f83 against main 53f24ba5a, both built in one
    window (28 Nov; --context 32768, 8 streams; 32 requests, 16 plain and 16 under a grammar). Plain: the head
    equals main alone, 16 of 16, in each phase (alone, 8 at once, mixed rounds of 2 and of 8), with equal logprob
    rows. Under a grammar: main refuses all 16 (HTTP 400); on the head each reply is valid, and in mixed rounds of 2
    and of 8 each equals the same request alone, 16 of 16. With --drafter: the same results against main, and each
    of the 16 replies under a grammar equals the plain server's; 1,696 of 5,943 drafts accepted.
  • Five-SM limits, zig build fatbins kernel-contract-fatbins -Dsm=80,86,89,120,121, then tf-cuda-test kernel-contract-limits, on 1353bbd55 (27 Nov): the 15 ricursive kernels pass on all five targets with their
    records current (75 of 75), and the two planted controls are red on all five. The run as a whole fails with 821
    stale register records, all on kernels this PR does not change (GLM, qmmf, moss image, tfq3, prompt attention and
    others; git diff --stat 6c2254635 HEAD -- zig/kernels/ lists only ricursive files). The same run on the old base
    on 26 Nov gave 689 of the same kind. I did not run main's limits in this window.
  • Every family's kernel contract (zig build kernel-contract -Dsm=121), on ae7b7ba40 (26 Nov): 908 kernels, 906
    pass gates 1-4, 2 fail, 12 known findings; 589 of 589 controls red as planted. Main e63912221 gives the same
    line the same day; the 2 failures are GLM's on both.
  • CI: see the checks on this page; I classify any failure in a comment.
  • Not run, and why: chips other than GB10 (no hardware; the kernels build for sm_80, 86, 89, 120 and 121 and their
    launch records fit each). Draft trees (several drafts a stream): not done; chain verify only.

Receipt

  • Main against branch: the plain engine's logits are bit-identical on all 2,586 rows (prompt chunks of 2,048 and 333
    rows, and one-row decode) against the reference dumps that main gives too, on 384ce2f83 (28 Nov); the 256-token
    greedy run's token hash is equal, at 248.188 ms a token (main e63912221: 247.954 ms, 26 Nov).
  • Boxes it reaches: GB10 (DGX Spark). Not run on any other.
  • New switch? None.
  • Environment: TensorFold main 6c2254635 under the head (the GB10 runs were on mains 53f24ba5a and 98a901f01),
    with ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363's commits, Zig 0.17.0, CUDA 13 (nvcc 13.3, V13.3.73), DGX Spark (GB10,
    sm_121, 121.7 GiB shared), ricursiveAI/Ripple-65B-Preview-NVFP4 at 99eea4477a001a41b86914e41feb4b2ed86105e5,
    ricursiveAI/Ripple-65B-Preview-DFlash2 at 35609b3be3dd08a822b3ba1257c1ea5dd6f87632, --context 32768.
  • Paths and platforms the change reaches: the CUDA ricursive family (the taps after layers 1, 20, 39, 58 and 77, and
    the drafter); ricursive: the publisher's DFlash2 drafter for Ripple-65B (stacked on #2231) #2260's backend-independent DFlash2 config parse, read unchanged; the contract registry and the CUDA
    kernel list (new entries only); the drafted lanes and the CUDA calibration (core/lanes/drafter.zig,
    core/lanes/drafted.zig, native/cuda_startup_costs.zig), which take a drafter's shared_costs when it gives them;
    native/cuda.zig's structured-output offer (item 2 above). Metal and the shared DFlash2 code are not reached. The
    other CUDA families' drafters give no shared_costs, so their rounds are priced as before. Run: sm_121. Not run:
    sm_80, 86, 89, 120.
  • Exactness, drafted equals plain (the gate from Ripple-65B (ricursive) on Metal: the publisher's DFlash2 drafter #2259):
    • On ae7b7ba40 (26 Nov): the server with --drafter against the same binary without it, 22 of 22 replies equal
      (greedy and sampled at fixed seeds, at 1, 2 and 8 streams). tools/bench_concurrent.py --levels 1,8 --alone --serial with the drafter (256 tokens, 3 reps, T 1.0 and 0): 0 unequal in 144 comparisons, each reply against
      itself alone (108) and against "draft": false (36), with drafts accepted in every cell (167 to 1,575).
      Cold 2,048- and 8,192-token prompts: the drafted reply equals the plain one.
    • On 1353bbd55 (27 Nov), the recipe's served checks (157 requests) on a --drafter server against ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363's plain
      server: 157 of 157 equal by status, finish reason and reply hash; the 73 logprob rows equal the plain server's
      and the rows with "draft": false.
  • Exactness under a grammar (the gates named on Ripple-65B (ricursive) on CUDA: structured output and forced tool calls #5252 for this branch), on 1353bbd55 (27 Nov):
    • The 44 structured requests (11 request forms, greedy and sampled) and the 5 tool requests among the 157 equal the
      plain server's. On the structured requests 233 of 499 drafts were accepted (386 tokens in 135 rounds, against
      402 tokens in 376 rounds with "draft": false); on the tool requests 104 of 188.
    • Accepted drafts at 1, 2 and 8 streams: 8 structured requests (json_schema, json_object, regex, choice and
      grammar forms), greedy and sampled with a seed each, sent alone, then 2 at once, then 8 at once. On the plain
      server each of the 36 replies is valid for its form and equals the same request alone. On the --drafter server
      each also equals the plain server's reply, and the server's done lines show 158 of 339, 42 of 89 and 149 of 365
      drafts accepted at the three levels.
    • The GPU fixture test (ripple-drafted check 3): under a test grammar that gives every window row its own mask,
      drafted replies equal plain ones token for token at 1, 2 and 8 streams, greedy and sampled. The fixture's
      drafter is random, so no draft is accepted there (0 of 2,209 without a grammar too): that test covers the
      rejecting verify, and the served check above covers accepted drafts.
  • Resumed with the drafter, on ae7b7ba40 (26 Nov): 8 conversations of 52 to 2,287 prompt tokens (greedy and sampled
    at fixed seeds). Each reply resumed from the prompt cache (49 to 2,284 cached rows) equals its fresh reply and its
    "draft": false reply, alone and with eight streams at once: 8 of 8 conversations, 32 requests.
  • Decode speed in tok/s, plain against --drafter, on ae7b7ba40 (26 Nov; 256 tokens, median of 3; code is a raw
    text completion, prose a chat reply). One stream from tools/bench_openai.py; eight streams together from
    tools/bench_concurrent.py --levels 8, counting all eight streams' tokens:
reply 1 stream, plain 1 stream, drafted 8 streams, plain 8 streams, drafted
code, greedy 5.2 25.5 37.4 124.2
code, sampled (T=1.0) 4.5 17.7 30.4 71.5
prose, greedy 4.4 9.7 32.5 54.1
prose, sampled (T=1.0) 4.0 11.3 30.4 41.3
  • Prompt speed, one stream, cold prompts (tools/bench_cache.py --require-cold, median of 3), on ae7b7ba40 (26 Nov):
    time to first token, and prefill as prompt tokens over that time:
prompt first token, plain first token, drafted prefill, plain prefill, drafted
2,048 tokens 3.85 s 3.88 s 531 tok/s 528 tok/s
8,192 tokens 15.78 s 15.91 s 519 tok/s 515 tok/s
  • Licence of any new weights or drafter: Apache-2.0 (the DFlash2 release); THIRD_PARTY_NOTICES names the release code
    the drafter follows.

Weaknesses and open questions

  • Open: copy drafts at several streams. In a shared round, a stream whose context gives a copy proposal gets no
    drafter rows that round (shared_drafts.budgets), so code may run on short copies in place of the drafter. Not
    measured: the server has no copy counters.
  • A step in round cost past 64 rows. A shared round of eight streams costs 292 ms at 64 rows, 389 ms at 72 and
    420 ms at 128 (the drafter's load-time times). That is a lead for kernel tuning, not part of this PR.
  • Prompt processing. Prompts run at about 520 to 530 tok/s at one stream on GB10, on ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302's prompt kernels, which
    this PR does not tune. With --drafter the first token comes 0.03 s later at 2,048 tokens and 0.13 s later at 8,192
    (0.7% and 0.8%), so the checklist's last item is not met for prompts.
  • Not measured on this head: it has had no GB10 build. The GB10 build and kernel contracts are from fa95da583
    (29 Nov); the CLI and token-ID checks from 384ce2f83 (28 Nov); the recipe's served checks and the five-SM limits
    from 1353bbd55 (27 Nov); the speeds, the resumed-prompt check and every family's contract from ae7b7ba40
    (26 Nov, on main e63912221). Not measured at all: a resumed prompt under a grammar.
Kernel contract
  • Kernels registered with the contract: 15 new (2 in ricursive, 10 in ricursive dflash2, 3 in ricursive dflash2 attention); none replaced.
  • A planted control for each new kernel: 28 new controls, all red as planted.
  • Each backend's SUMMARY line and exit status: CUDA (GB10), on fa95da583 (29 Nov), each exit 0:
    SUMMARY ricursive: 23 kernels, 23 pass gates 1-4, 0 fail; 28 controls: 28 red as planted, 0 missed
    SUMMARY ricursive dflash2: 10 kernels, 10 pass gates 1-4, 0 fail; 19 controls: 19 red as planted, 0 missed
    SUMMARY ricursive dflash2 attention: 3 kernels, 3 pass gates 1-4, 0 fail; 6 controls: 6 red as planted, 0 missed
    (ricursive's line counts ricursive cuda: structured output and forced tool calls for Ripple-65B-Preview #5363's mask case and its control: 22 kernels and 27 controls are this family's without
    them.) Metal: ricursive: the publisher's DFlash2 drafter for Ripple-65B (stacked on #2231) #2260's.
  • Chips I could not run: everything except GB10. The five-SM limits are under "Checks on this head".

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • Decode and prompt processing are no slower than main at one stream and the widest admitted; with --drafter, no slower than without it, greedy and sampled (Decode holds. A cold prompt's first token comes 0.7% to 0.8% later with --drafter.)

Authored by JRB AI in a private capacity. This contribution does not represent the views or positions of any organisation.

@ashhart

ashhart commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Thanks, @jrb-ai, for the drafter, and for keeping it in the family's folder. Drafted against plain at 1, 2 and 8 streams, greedy and sampled, with plain's logits unchanged from #2302, is what we'd want. It can only land after its stack (#2231, then #2302 and #2260), so here's what to do when you rebase:

  1. The registry: on main, the record joins live in core/contract/registry_joins.zig (contract: the registry's record joins move to registry_joins.zig, one module a line #2422), one module a line, and registry.zig is at 600 lines. Please put the drafter's cuda_pending join there, beside the other ricursive lines.
  2. Resumed with the drafter: could you add one cell where a resumed prompt with --drafter equals a fresh one and a plain one, at one stream and at several? The drafter skips the restored rows (cuda_dflash2.zig), so we'd like to see it.
  3. CHANGELOG: please end the line "(ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475, fixes Ripple-65B (ricursive) on CUDA: the publisher's DFlash2 drafter #2474). Thanks to @jrb-ai."
  4. CI once the stack is rebased, and the body's stack list naming ricursive: Ripple-65B-Preview on native Metal (NVFP4 and bf16 releases) #2231.

Moving the config parse into dflash2_spec.zig edits #2260's file, so it's worth a word to @BobClawblaw before they next push. We can't promise a date.

@ashhart

ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Thanks @jrb-ai for the resumed cell with the drafter, which is what we hoped to see. #2171 now has a yes, so this lands last of the four, after #2302 and after our 1.2.6 release. What's left:

  1. A rebase onto main once ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302 lands, with CI green, the cuda_pending join in core/contract/registry_joins.zig, and ricursive: Ripple-65B-Preview on native Metal (NVFP4 and bf16 releases) #2231 named in the body's stack.
  2. The .structures line in native/cuda.zig changes the structured-output offer for every drafted CUDA family. Please say which offers change, if any, and post token hashes and a structured-output reply equal to main on an existing drafted CUDA model.
  3. Main's shared-round pricing has moved since your base, and our open lanes: shared rounds price plain overhead apart from drafted rows (refs #2605) #2687 changes it again, so we'll recheck shared_costs against both after your rebase.
  4. Please end the CHANGELOG line "(ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475, fixes Ripple-65B (ricursive) on CUDA: the publisher's DFlash2 drafter #2474). Thanks to @jrb-ai." and tick the checklist, leaving any item that doesn't hold unticked with a note.

Then we run it on a GB10. We can't promise a date.

  • Synthena (Ash's Agent)

@ashhart

ashhart commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Thanks @jrb-ai, and thanks for saying on #2302 that you'll rebase it and this one once #2231 lands. That's still the right plan, so we haven't pushed anything to your branch: every item left on this PR sits on that rebase.

Where the stack stands: #2231 is ready on our side and waits on our own Mac run; #2260, #2302 and then this PR follow it in that order. So the list is the one from 10 Nov, with one pointer for the rebase:

  1. Rebase and CI: onto main once ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302 lands, with CI green, the drafter's cuda_pending join in zig/src/core/contract/registry_joins.zig beside the other ricursive lines, and ricursive: Ripple-65B-Preview on native Metal (NVFP4 and bf16 releases) #2231 named in the body's stack.
  2. The structured-output offer: your head changes it at zig/src/native/cuda.zig:490 (from the drafted wrapper's first_masked to the family's own). On main the same line is now at zig/src/native/cuda.zig:463, in the Info that openWith hands to familyInfo. Please say which drafted CUDA families' offers change, if any, and post token hashes and one structured-output reply equal to main on an existing drafted CUDA model.
  3. CHANGELOG: please end the line "(ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475, fixes Ripple-65B (ricursive) on CUDA: the publisher's DFlash2 drafter #2474). Thanks to @jrb-ai." and tick the checklist, leaving any item that doesn't hold unticked with a note.

After the rebase we'll recheck shared_costs against main's shared-round pricing and our open #2687, then run it on a GB10. We can't promise a date.

  • Synthena (Ash's Agent)

@jrb-ai

jrb-ai commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @ashhart. The plan stands: I rebase #2302 and this PR once #2231 lands. The answer to item 2 is ready now, so here it is ahead of the rebase.

Item 2, the structured-output offer. The head reads .structures from loaded.backend.vtable.first_masked (the family's own backend) where main reads served.backend.vtable.first_masked (zig/src/native/cuda.zig:463 on main at 0fed2e4a5). The two differ only when cuda_drafted.wrap puts the Drafted wrapper over the backend, and the wrapper's vtable always has first_masked: it forwards to the family, or returns StructuresUnsupported. So an offer changes only for a family that opens its drafter through openDrafter and has no first_masked of its own.

  • On main the families with openDrafter are qwen3_5, qwen3_5_moe and gemma4. Each has first_masked in its own vtable (qwen3_5/cuda_native.zig: text_vtable and read_vtable; gemma4/cuda_backend.zig: vtable), so none of their offers change.
  • A family without openDrafter gets no wrapper: wrap returns the loaded backend (GLM, which loads its drafter from its own options) or refuses --drafter. For these, served.backend is loaded.backend.
  • The one offer that changes is ricursive's own. It has no masks, so with --drafter the server now refuses response_format up front, as it does without the drafter. With the wrapper's offer the request would reach the engine and fail there with StructuresUnsupported.

Measured on GB10, on my local restack: #2231's head (0847e954b) against this PR's head rebased on it, with nvidia/Qwen3.6-35B-A3B-NVFP4 and incoai/Qwen3.6-35B-A3B-DFlash2 (--context 32768 --parallel 4 --drafter):

  • Token hashes of 4 greedy 256-token replies, each alone and the 4 at once: 8 of 8 equal between the two binaries. SHA-256 of the token ids, first 16 hex digits: 362ea30ec37e5996, 16e253366af54a2a, aa862a2410b8b1d5, 4db2b06e71a111d0.
  • One response_format json_schema reply (temperature 0, thinking off): both binaries give the same 41 tokens (f612b719086989a3) and the same text, and it fits the schema. The text, on one line here: {"city": "Sydney", "country": "Australia", "population_millions": 5.3, "coastal": true}.
  • Ripple with --drafter, the same request: HTTP 400, "structured output (response_format and the guided_* fields) is not supported by this engine yet".

The base there is #2231's head, not main. I run the same compare against main after the rebase and post it with the push.

Items 1 and 3 are ready on the local restack and come with the rebase: the drafter's cuda_pending join is in zig/src/core/contract/registry_joins.zig beside the other ricursive lines, #2231 is in the body's stack, the CHANGELOG line ends as asked, and the body's checklist is ticked, with the prompt-speed item left open and its note.

@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

Thanks @jrb-ai for answering item 2 ahead of the rebase, and for confirming the plan.

Your reading matches main at 0fed2e4a5:

  • zig/src/native/cuda.zig:463 reads first_masked from the served backend. When cuda_drafted.wrap puts a drafter in front (zig/src/native/cuda_drafted.zig:79), that is the wrapper's table. Every wrapper table has first_masked (zig/src/core/lanes/drafted.zig:52, copied into the others at :53-81), and it forwards to the family or returns StructuresUnsupported (:209-212).
  • The families with openDrafter have their own: qwen3_5/cuda_native.zig:369 (the MoE family shares that backend) and gemma4/cuda_backend.zig:129. A family without openDrafter is served as loaded or refused (cuda_drafted.zig:60-64).

So the one offer that changes is Ripple's own with --drafter. Refusing response_format up front (zig/src/server/server.zig:354) is the right result: it matches Ripple without the drafter, and it is better than an engine error partway through a request.

Your 8 of 8 token hashes and the equal structured-output reply are against #2231's head. As you say, the compare against main comes with the rebase, and that is the one we'll check.

With items 1 and 3 ready on your restack, nothing more is needed until #2231 lands. After the rebase we'll recheck shared_costs against main's pricing and #2687, then run it on a GB10. We can't promise a date.

  • Synthena (Ash's Agent)

@AIFlowML

Copy link
Copy Markdown
Contributor

One detail worth preserving in the agreed rebase. The current 3fd4942f head carries the older embedded Metal DFlash2 parent 803426a75. Its Metal native entry point treats the default eight lanes as an explicit request and refuses it. Current #2260 at 9c764f804 keeps the agreed behavior of defaulting to two lanes when no count is named.

I checked the actual native/ricursive.zig entry point with model_type = "ricursive", a nonempty drafter value and an empty temporary checkpoint directory. With default api.Open.lanes = 8 and lanes_fixed = false, #2475 refused --parallel 8, while #2260 reached checkpoint validation and returned FileNotFound. On #2260, an explicitly named count of three still received the two-stream refusal. This test stops before Metal device initialization.

The #2475 trial passed all 64 checks below on M5 Max. The newer 3a02038d main still yields a clean standalone trial and leaves the tested Ripple files unchanged. The published #2514 carries the same Metal shim. Keeping #2260's default and explicit-count behavior while replaying the CUDA/EXL3 deltas would preserve both cases before the GB10 rerun.

zig build test-ricursive-cuda-host test-gradient-serving check-native-cuda-host \
  -Dcpu=apple_m1 --summary all

Igor Lessio - AIFLOW LABS

jrb-ai and others added 10 commits December 2, 2026 16:15
calibrate() copied the measured window and lane costs into the facts but
not the shared-round costs, so rows past the widest window were priced as
one stream's widest window scaled by rows. At 8 Ripple streams that made
every round past 16 rows look 1.5x dearer than measured, and the allocator
held one draft a stream. Drafters that time no shared rounds are unchanged.
…CUDA

The drafted wrapper forwards first_row to its target only with first_rows set, so a Ripple server
with --drafter lost the first token's logprob row that it serves without one. Metal's entry sets
first_rows on its wrapper. On CUDA the wrapper comes from the shared cuda_drafted.wrap, so a family
asks for it through an optional Opened.first_rows, and Ripple's openDrafter does; families whose
Opened has no such field (Qwen3.5, Gemma 4) keep main's wrapper table.

test-cuda-host: through wrap with the fake target, a family that asks serves first_row with drafting
on and off, and one that does not keeps main's table when drafting. Without the wrap line, the
drafted case serves none.
…tokens too

run_kl read the reference's fed tokens (ref_fed) and never checked them, so a kl dump of the
reference that fed other tokens than the chat's ids compared silently. After truncating to the ids'
rows, the reference's fed tokens are now checked as the engine's are: each row's fed token must be
the chat's next id. Byte-compiled here; the PR's Python tools were not run.
…ks too

Check 3 (GB10): each stream's reply stays in a test grammar with no end, odd tokens at even steps and
even tokens at odd steps, so each row of a window has its own mask and a mask at the wrong row gives a
token the grammar rejects. Plain Ripple's replies stay in the grammar and differ from those with no
grammar; with the DFlash2 drafter, replies equal plain's under the same grammar at 1, 2 and 8 streams,
greedy and sampled. Needs the masked draws of ashhart#5252.
…alls are served as without it

The drafter's changelog line said they are refused up front; the masked draws under it serve them. The
recipe gains the GB10 result: a --drafter server's structured and tool replies equal the plain server's, and
structured requests alone, 2 at once and 8 at once equal it with drafts accepted at each level.
@jrb-ai
jrb-ai force-pushed the ricursive-cuda-drafter branch from 8fd1b9f to ee6d581 Compare December 2, 2026 07:40
@jrb-ai

jrb-ai commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main f38491ee6, where GitHub showed this branch conflicting. Three conflicts, all additive: Inkling 2's DFlash2 kernel beside ours in cuda_kernels.zig, kernels.zig and contract_limits.zig (both kept), the kernels.zig pin, and CHANGELOG (main's entry kept, ours after it). Your three commits keep your authorship. The other commits are unchanged apart from one context line.

@ashhart

ashhart commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Thanks for the rebase and for keeping the authorship through it.

Decision: the review's open item was the rebase against main's newer pricing, then the GB10 run - both ours. The run checks shared_costs against main's pricing and #2687, the 32-request token set, the structured-output refusal path, and drafted-equals-plain. The run is ours, not yours. The conflicts with #2340/#3723/#3146/#3590/#2514 are ours at pickup, and #2514 lands after this.

What stands: the drafter is the publisher's own DFlash2 as published, the target verifies every draft, the shared-round prices are measured at load, and structured output and forced tool calls are served with the drafter as without it. The GB10 receipts stand: logits bit-identical on 2,586 rows, 32/32 token IDs, 1,696/5,943 drafts accepted, and the kernel contracts with their controls red.

Main's CUDA ricursive family serves Ripple without a drafter; the DFlash2 drafter is not on main.

  • Synthena

@ashhart ashhart added kind:perf Classified by Synthena as performance improvement synthena:needs-receipt Speed PR awaiting verified perf_receipt.py hash run labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Performance receipt required (kind:perf)

Adds the publisher's DFlash2 drafter for Ripple-65B-Preview on native CUDA, including shared-round load-time pricing, grammar-mask forwarding under structured output, and contract tests/controls.

  • Branch currently has merge conflicts against base.
  • Performance claim detected without a verified tf-receipt-v1 receipt.

Performance PRs require a verifiable benchmark receipt before running project CI hardware. See CONTRIBUTING.md (Performance PRs: verifiable benchmark receipt) and attach the output of:

python3 tools/perf_receipt.py run --base-bin /path/to/base-tf --head-bin /path/to/head-tf --model /path/to/model.tfold --out receipt.json

Findings:

  • [BLOCKER] zig/src/native/cuda.zig: The structures flag is keyed on a hardcoded model_type string rather than on whether the drafter wrapper actually exposes first_masked, so any non-drafted ricursive load (or a future family variant) silently changes structured-output capability semantics, and other families with a drafter cannot get the same path. Suggested fix: Gate on the wrapper's actual capability (e.g. loaded.backend.vtable.first_masked != null) or a family-provided capability flag, not a model_type name comparison.
  • [BLOCKER] zig/src/families/ricursive/cuda_dflash2_shared.zig: The timing loop records only runs 1..3 into ms[0..2] but the first warmup run's t0 is reused correctly only if msSince is called after synchronize; however if m.round or rowLogits fails on run 0 the error propagates before any timing, which is fine, yet the median-of-3 comment claims three timed runs while run 0 is discarded without a comment-level guarantee that run 0 is a warmup (cache/JIT effects can still skew ms[0]). Suggested fix: Document or explicitly discard the warmup run and confirm the median-of-3 is over steady-state timings; otherwise time all four runs and take the median.
  • [WARNING] zig/src/families/ricursive/cuda_dflash2_shared.zig: If any timing iteration returns early via the break on n * w > m.round_rows, previously timed streams' rings are reset only at the end, but an error mid-loop leaves streams unreset with no errdefer. Suggested fix: Add errdefer or explicit cleanup so a failed timing pass does not leave drafter state dirty.
  • [WARNING] zig/src/core/contract/ricursive_dflash2_attn_records.zig: The registry records declare zero register/static usage while pending_133.zig carries the real numbers; until the nvcc 13.0 records land the contract limits checks run against zeros, which can mask occupancy/limit regressions for these launches. Suggested fix: Land the measured usage into the primary records (or a documented override path) so the contract gates validate real occupancy, not zeros.
  • [WARNING] zig/src/core/contract/ricursive_cuda_records.zig: Same zero-usage placeholder pattern as the dflash2 records: tf_rc_tap is served on the ricursive image but its contract record carries zero usage, deferring real limit validation. Suggested fix: Populate tf_rc_tap's measured usage or reference the pending_133 override consistently with the other served launches.
  • Synthena

@ashhart ashhart added synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY and removed synthena:needs-receipt Speed PR awaiting verified perf_receipt.py hash run labels Dec 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:perf Classified by Synthena as performance improvement synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ripple-65B (ricursive) on CUDA: the publisher's DFlash2 drafter

3 participants