Skip to content

ricursive: load Ripple's EXL3 packs through main's shared EXL3 code - #2514

Open
ajensenwaud wants to merge 19 commits into
ashhart:mainfrom
ajensenwaud:ricursive-cuda-exl3
Open

ajensenwaud wants to merge 19 commits into
ashhart:mainfrom
ajensenwaud:ricursive-cuda-exl3

Conversation

@ajensenwaud

@ajensenwaud ajensenwaud commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before, the CUDA ricursive family (#2302, with its drafter from #2475) served only the publisher's NVFP4 release. After, it also serves the
5.0 bpw ExLlamaV3 pack of the bf16 release (quant_method exl3, mul1 codebook, 8-bit head): every projection and the head run through
main's cuda.exl3.Dense with bf16 inputs and outputs, and everything else in the forward is #2302's unchanged (glue,
Q/K prep, window and tree attention, caches, graphs, lanes, kept states). This is not a second family: it is one
loader path and one dispatch in @jrb-ai's family, on @BobClawblaw's host config from #2231.

  • config.zig: quantization_config.quant_method == "exl3" sets exl3 only for the measured pack, 5.0 bits a weight
    with an 8-bit head. Any other EXL3 pack is refused by name (UnmeasuredRicursiveBitrate). The NVFP4 check is unchanged.
  • cuda_exl3.zig (new): maps a pack's tensors (trellis, suh, svh, the mul1 marker) by dtype and shape and
    refuses a leftover tensor, as cuda_weights.map does; value_res_lambda (fp32 in a pack) must hold a bf16 value
    and goes through ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302's blendOf. Proj is either ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302's lane weight or an exl3.Weight; Qkg keeps q, k and
    g fused for the release and three EXL3 projections for a pack.
  • cuda_model.zig: linear runs an EXL3 projection on exl3.Dense (prompt for chunks, decode for rounds; both
    are 128-row blocks of the same kernel, so a row's bits do not depend on the path or the chunk); a pack's q, k and
    g land as three planar blocks that prep and the gate read at their own strides (no copy for g). Dense's scratch
    is grown for every projection at init, so captured rounds allocate nothing. The head goes through the same
    linear. The file stays at 600 lines.
  • The drafter (ricursive: Ripple-65B-Preview's DFlash2 drafter on native CUDA #2475) reads the target's head: on a pack it runs it through the same exl3.Dense, on the release
    through the lane matmul as before.
  • Metal refuses a pack by name (UnsupportedRicursivePrecision) instead of failing on a missing tensor.
  • cuda_native.zig: the family's capability formats list exl3 beside modelopt-nvfp4, so capabilities --json
    offers what the loader admits.
  • Docs: the recipe's intro and licence name the pack, and the recipe index links its section.

No kernel is added or changed, and no shared file outside the family is touched (Metal's weights.zig gets the one
refusal line).

Checks on this head

GPU checks (one GB10, nvcc build of #2475's head 3065161da and cd9e0209d, 2026-11-08)

ce544b413 and a763b8a78 only narrow which packs load and add the capability entry, so these runs still describe the head.

  • tf-cuda-test ricursive-contract: 22 kernels, 22 pass gates 1-4, 0 fail; 27 controls, 27 red as planted, 0 missed
    (base and head alike).
  • ripple-forward 40/40, ripple-serve 9/9, ripple-drafted 10/10 PASS lines on both base and head (the NVFP4 lane
    path through the new Proj dispatch).
  • Prompt chunks: tensorfold kl dumps at 2,048-row and 64-row chunks are bit-identical on every row (agent 211, code
    210, prose 155 rows) on the 5.0 pack.
  • Fidelity against exllamav3's own logits on the same pack (teacher-forced, mean KL / top-1 / true-token NLL), with
    exllamav3 under bf16-rounded attention as the floor:
Pack Text Path KL (ours) KL (floor) Top-1 NLL exllamav3 -> ours
5.0 agent prompt 3.6e-3 8.5e-4 0.981 3.280 -> 3.289
5.0 agent decode 6.0e-3 1.7e-3 0.972 2.900 -> 2.914
5.0 code prompt 9.2e-5 5.2e-6 0.995 0.481 -> 0.480
5.0 code decode 6.4e-5 4.3e-6 1.000 0.327 -> 0.326
5.0 prose prompt 4.8e-4 1.5e-5 1.000 1.970 -> 1.968
5.0 prose decode 6.1e-4 1.1e-5 1.000 1.713 -> 1.711

The floor rounds only attention to bf16; this family keeps every activation in bf16 with fp32 sums, which
exllamav3 (fp16 activations) does not, so the KL sits above that floor; true-token NLL stays within 0.5 % of exllamav3's for every text and path.

  • Served, 5.0 pack with the drafter, --context 32768 (8 streams), greedy unless stated:
    • tools/bench_concurrent.py --levels 1,4 --alone --serial: chat 1 stream 13.3 tok/s, 4 streams 38.5 tok/s
      aggregate; code 4 streams 50.5 tok/s aggregate; every concurrent reply equal to its solo run (chat 3/3 and 12/12,
      code 12/12) and to the serial run.
    • tools/bench_openai.py: fibonacci-raw 31.5 tok/s at temperature 0 and 21.7 at 1.0; gpu-chat-no-think 14.6 and
      12.5.
    • tools/bench_cache.py --require-cold: qualified; a cold 2,570-token prompt reaches its first token in 9.7-10.2 s
      (4 of 5 runs; one 19.8 s), with equal first tokens on every run.
  • Not run: the NVFP4 release end to end (no copy on our machines); the lane path's change is a tagged-union dispatch
    around ricursive: Ripple-65B-Preview on native CUDA (NVFP4) #2302's calls, covered by its suites above.

GPU checks on this head (one GB10, nvcc build of a763b8a78, 2026-11-21)

5.0 pack, --drafter, --context 131072; streamed chat requests, token SHAs from the server's tensorfold block.

  • capabilities --json: ricursive lists ["modelopt-nvfp4", "exl3"].
  • Drafted vs "draft": false, 512-token replies, code, chat and agent (with tools), 6 streams: token SHAs equal
    greedy 3/3, seeded (T 0.7, seed 7) 3/3.
  • Two streams at once, code and chat: drafted and plain each equal their solo replies.
  • Resumed vs fresh, 2 streams (so the 16.0 GiB prompt cache keeps ~30k-token states):
    • A 32,243-token chat sent twice: the second takes 32,240 tokens from the cache and gives the same token SHA (first
      token 0.3 s vs 125.9 s).
    • An agent's turn 2 (30,636 tokens) resumes 30,184 tokens from turn 1's state; its SHA equals the same turn on a
      fresh server (first token 2.5 s vs 121.0 s).

Receipt

  • Pack: ajensenwaud/Ripple-65B-Preview-exl3-5.0bpw
    (revision 1d260f752b753d2b17571de237029b5e2251db07, 39 GB; exllamav3 1.6.6, mul1, head 8 bits, embeddings
    bf16). It is the only pack this PR admits. Apache-2.0, as the release.
  • Environment for the GPU run: this head, Zig 0.17.0, CUDA 13 (nvcc from the build image), DGX Spark (GB10,
    sm_121).
  • Paths and platforms the change reaches: the CUDA ricursive family's loader and projections; Metal's loader (a
    refusal). No shared kernel, server or lane code.
  • Exactness, speed and quality: the GPU checks above.
  • Licence of any new weights or drafter: the pack is an Apache-2.0 derivative of the release.

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.

@ashhart

ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud. #2171 now has a yes for Ripple-65B-Preview from the publisher's bf16 and NVFP4 releases, landing as #2231, #2260, #2302 and #2475 after our 1.2.6 release. This PR is on hold until those are in. It's a hold, not a no.

We're applying one CUDA family per model and one activation precision per pack format, and this PR already fits. The packs load inside #2302's family, and their activations stay in bf16. Our contributing guide says to keep the checkpoint's activation precision, and the release these packs are made from is bf16, so bf16 is the precision for Ripple's EXL3 packs. #2522 will move from fp16 to match, and the config.zig hunk the two share should exist once.

Once #2475 lands, please:

  1. Rebase onto main with CI green, and take it out of draft.
  2. Post NVFP4 token hashes equal to main on the rebased head, since the Proj dispatch sits on the NVFP4 path. If you can't fetch the NVFP4 release, say so and we'll run it.
  3. Link the 6.0 bpw pack at a revision, or admit only 5.0 for now.
  4. Add "(ricursive: load Ripple's EXL3 packs through main's shared EXL3 code #2514)" and your own name to the CHANGELOG line.

Thank you for the fidelity table against exllamav3. It made this easy to judge.

  • Synthena (Ash's Agent)

@ajensenwaud ajensenwaud changed the title ricursive cuda: EXL3 packs through main's exl3.Dense (stacked on #2475) ricursive: load Ripple's EXL3 packs through main's shared EXL3 code Nov 12, 2026
@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. I will take care of all four once #2475 lands, and the PR will admit only the 5.0 bpw pack, which is published at a fixed revision.

@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

@ajensenwaud, this remains under the agreed prerequisite hold. Your stated lack of the NVFP4 release answers the alternative in that request; we will run that non-regression check on a GB10 and handle the landing rebase and changelog attribution.

The fixed 5.0 pack is identified. Please align the description and published qualification with the agreed 5.0-only scope, or supply the fixed pack revision and receipts if you want 6.0 included. A 5.0-average pack can still contain an 8-bit head, so the scope must identify the qualified pack rather than require every tensor to be 5-bit.

  • Synthena

ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 18, 2026
The config must name 5.0 bits with an 8-bit head, as in ashhart#2514. The
loader no longer checks each tensor's bit width.
@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. The PR now admits only the 5.0 bpw pack at revision 1d260f7.

  • The loader identifies the pack by its config, 5.0 bits a weight with an 8-bit head, and refuses any other EXL3 pack by name. It checks no individual tensor's bit width.
  • The description, the recipe and the changelog line now name that pack alone, and the 6.0 rows are gone.

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Is there anything else we need to get this PR over the line, noting it is in draft mode?

ashhart pushed a commit to ajensenwaud/TensorFold that referenced this pull request Nov 19, 2026
The config must name 5.0 bits with an 8-bit head, as in ashhart#2514. The
loader no longer checks each tensor's bit width.
@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud for narrowing the loader to the published 5.0 bpw pack and using the shared Dense dispatch. The 5.0-only admission and host/kernel receipts are useful.

Three items remain on your side. First, zig/src/families/ricursive/cuda_native.zig:14 still advertises only modelopt-nvfp4; add exl3 and a capability regression like the GLM test. Second, replace the description's stale "both packs" wording and include the EXL3 pack in the recipe index. Third, please attach explicit EXL3 drafted-versus-"draft": false and resumed-versus-fresh equality receipts; the current packet establishes concurrent/solo equality but not those two cases.

The supplied full stack also conflicts with current main in 22 files and reconstructs two lower-stack files over 600 lines: zig/kernels/cuda/contract_controls.cu at 621 and zig/src/server/reply_text.zig at 613. I will handle the agreed NVFP4 token-hash run on a GB10, landing rebase and changelog attribution; no NVFP4 download is needed from you.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. All three are fixed in a763b8a78.

  • Capabilities: cuda_native.zig now lists exl3 next to modelopt-nvfp4. A new test checks that the 5.0 pack's config parses as EXL3 and that the format list includes exl3. It fails on ce544b413. On a GB10 build, capabilities --json prints ["modelopt-nvfp4", "exl3"] for ricursive.
  • Docs: "both packs" is gone from the description. The recipe's intro and licence name the pack, and the recipe index links to its section.
  • Receipts (5.0 pack, one GB10, drafter loaded, 512-token replies):
    • Drafted equals "draft": false for code, chat and agent (with tools): greedy 3/3, seeded (T 0.7, seed 7) 3/3.
    • With two streams at once, drafted and plain each match their solo replies.
    • Resumed equals fresh. A 32,243-token chat sent twice takes 32,240 tokens from the cache the second time and gives the same reply. An agent's turn 2 takes 30,184 of its 30,636 tokens from turn 1's kept state and matches the same turn on a fresh server (first token after 2.5 s instead of 121 s).
  • Over-600 files: our commits don't touch contract_controls.cu or reply_text.zig. On this branch they are 565 and 600 lines, so the overrun comes from the lower stack meeting current main.

Thanks for taking the NVFP4 run and the rebase.

@ajensenwaud
ajensenwaud marked this pull request as ready for review November 21, 2026 03:21
@AIFlowML

Copy link
Copy Markdown
Contributor

I reran the capability regression on M5 Max with Zig 0.17.0. With only the new test applied to ce544b413, zig build test-ricursive-cuda-host -Dcpu=apple_m1 -j3 --summary all failed with FormatNotOffered. The same command passed all 69 tests on a763b8a78 and on a clean trial merge with the current #2475 at 409d34ee2.

Against 5f53c445e, this head and its embedded #2475 parent at 3065161da conflict in the same 21 file paths. The rebase recipe should record those parent conflicts before repeating the host check on the landed stack. The GB10 drafted and resumed comparisons are the author's device receipt.

Igor Lessio - AIFLOW LABS

ashhart pushed a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
The config must name 5.0 bits with an 8-bit head, as in ashhart#2514. The
loader no longer checks each tensor's bit width.
@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Rebased onto the new #2475 head (f243fcb0c); head is now f466f6cdb, our 3 commits on top as before.

Checked on the rebased head: zig fmt --check on the changed files, zig build test-ricursive-cuda-host native compile-cuda-tests compile-cuda-cli test-gradient-serving (28/28 steps pass), and lean shows no new problems against #2475.

ashhart pushed a commit to ajensenwaud/TensorFold that referenced this pull request Nov 21, 2026
The config must name 5.0 bits with an 8-bit head, as in ashhart#2514. The
loader no longer checks each tensor's bit width.
@ashhart
ashhart force-pushed the ricursive-cuda-exl3 branch from f466f6c to b29961a Compare November 22, 2026 02:37
@AIFlowML

Copy link
Copy Markdown
Contributor

I checked the rebased b29961ad against main 25586070b. It trial-merges cleanly with no local edits. On M5 Max with Zig 0.17.0, all 70 host tests passed, including the EXL3 capability and serving pins. The native CUDA check and Linux ARM64 CUDA runner compiled.

zig build test-ricursive-cuda-host test-gradient-serving check-native-cuda-host -Dcpu=apple_m1 -j3 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dcpu=baseline -Doptimize=ReleaseSafe -j3 --summary all

For landing order, the embedded parent d3be418c has the same Git tree as the published #2475 at 3fd4942f. I applied just this PR's three-commit delta to that parent in a scratch index. The result is byte-identical to this published head (tree d6991561), so the EXL3 slice can be replayed without merging both parent histories. The pack's device exactness and performance runs remain separate.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud. The current head offers EXL3 explicitly, limits admission to the measured 5.0-bit pack with its 8-bit head, and refuses a lambda that would need rounding. The earlier drafting and resumed-prompt results are now recorded too.

The EXL3 slice looks ready for controlled comparisons using the published pack. Maintainer integration needs to preserve the current draft backend and notices, followed by exact token comparisons and the existing NVFP4 control on that final tree. No further pack download or rebase is needed from you for this review.

  • Synthena

jrb-ai and others added 19 commits November 25, 2026 04:09
…re hooks

tf_rc_tap copies a tapped layer's residual rows into a slot's ring, as
dflash2.metal's rc_tap does: prompt chunks and rounds, under the kernel
contract with three controls. The forward writes the taps after each
tapped layer; the backend gives the drafter a stream's held rows by
position (prepare_features, features).

The slots' caches move to cuda_arena.zig and the forward tests' weight
fixture to ripple_fixture.zig, unchanged, so each file stays under 600 lines.
…er's packed weights and the selector walk

The drafter's config parse moves from dflash2_config.zig to dflash2_spec.zig,
which needs no Metal, so the CUDA build shares it; dflash2_config.zig
re-exports it. ashhart#2260's refusal of a clamped MLP (ffn_clamp_threshold) moves
with it, and max_streams stays in dflash2_config.zig.

cuda_dflash2_weights.zig reads the release through that parse and packs its
projections for the lane matmul; cuda_dflash2_select.zig is the host walk
over each row's top-32 candidates, as rc_df_walk.
…s under the contract

ricursive_dflash2.cu runs dflash2.metal's add-norm, attention prep, block
conv and SiLU step for step, streams batched in 16-row blocks;
ricursive_dflash2_attn.cu runs the draft attention split over keys and
merged, and the top-32, at dflash2.metal's rounding points. Both are
registered with the kernel contract (usage pending until nvcc measures it)
and gated by ricursive-dflash2-contract and ricursive-dflash2-attn-contract,
with controls.

The prep's contract entries, stream plan and check move to
contract_ricursive_dflash2_prep.zig, unchanged, so each file stays under
600 lines.
…rafted replies equal plain ones

The drafter runs dflash2.zig's op order over the target's taps, streams
batched in 16-row blocks, and serves through the lane core's Drafted
wrapper. --drafter's config.json goes through ashhart#2260's qualified parse and
the CUDA kernels' gate before any stream, so its bytes are admitted with
the streams'; a drafter that leaves no room for one stream is refused by
name. ripple-drafted checks drafted == plain at 1, 2 and 8 streams.

The config read and the gate move to cuda_dflash2_config.zig, unchanged,
with a test that a clamped MLP (ffn_clamp_threshold) is refused as ashhart#2260
refuses it. THIRD_PARTY_NOTICES lists the CUDA drafter files beside
dflash2.zig and dflash2.metal.
…masks

The drafted wrapper always offers first_masked and forwards to the family,
so a family without masks answered response_format and forced tool calls
with HTTP 500. Read the family's own vtable, as hip.zig does, so the server
refuses them up front with 400.
… SMs

kernel-contract-limits on the Spark measured tf_rc_tap and the eight DFlash2
launches on sm_80, 86, 89, 120 and 121. Their receipts go in pending_133.zig,
as the model's launches do, and the records files keep zero usage for 13.0.
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.
The CUDA family from ashhart#2302 (jrb-ai) on the host config from ashhart#2231 (BobClawblaw) loads an ExLlamaV3 pack of the bf16
release besides the NVFP4 one: config.zig reads quant_method exl3, cuda_exl3.zig maps the pack's trellises (mul1,
suh, svh) and refuses a leftover tensor, and every projection and the head become a Proj, either the lane weight
as before or an exl3.Weight. Model.linear runs the latter on exl3.Dense (128-row blocks for prompt chunks and
decode rows alike), with its scratch grown at init so captured rounds allocate nothing. q, k and g stay three EXL3
projections, written as planar blocks that prep and the gate read at their own strides. Metal refuses a pack.
A pack's quantization_config must name 5.0 bits with an 8-bit head, the
pack measured against exllamav3; any other is refused by name.
The family's formats now list exl3 beside modelopt-nvfp4, as its loader
admits the 5.0-bit pack; a test ties the two. The recipe's intro, licence
and the recipe index name the pack.
Keep current main’s detailed Ricursive attribution and Qwen3 ASR control while adding the CUDA reference files, DFlash2 attribution and Ricursive preparation controls from the stacked patches. The split control file keeps contract_controls.cu beneath the 600-line ceiling.
@ashhart
ashhart force-pushed the ricursive-cuda-exl3 branch from 897b0f8 to b6b0a6e Compare November 25, 2026 04:11
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud. The rebase retains your EXL3 commits, measured pack admission and refusal to round lambda, along with the current draft backend and notices. The earlier drafting and resumed-prompt results remain recorded.

This is ready for controlled comparisons after maintainer integration. Exact tokens against the same pack's serial path, plus the existing NVFP4 output and speed control on the final tree, remain before landing.

  • Synthena

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants