Skip to content

ricursive: serve Ripple-65B on two GB10s with up to 1M tokens of context - #2522

Open
ajensenwaud wants to merge 24 commits into
ashhart:mainfrom
ajensenwaud:ricursive-tp2-cuda
Open

ajensenwaud wants to merge 24 commits into
ashhart:mainfrom
ajensenwaud:ricursive-tp2-cuda

Conversation

@ajensenwaud

@ajensenwaud ajensenwaud commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What this is

This PR serves Ripple-65B-Preview on two NVIDIA GB10s (DGX Spark, sm_121) at --tp 2, from the 5.0 bpw ExLlamaV3 pack of the release. The full (global) layers run to a 1,048,576-token context, and the two ranks serve through main's lanes with kept prompt states.

It is the two-GPU counterpart to #2302, which serves one GPU from the NVFP4 release. As agreed in review, it will fold into #2302's ricursive family once #2302 lands, and drop its copy of #2231's commits then.

  • Model. Each rank holds half of every projection and of the head, and the whole bf16 embedding. Every projection and the head run on main's exl3.Dense.
  • Precision. Activations stay in the release's bf16: the norms' outputs, every projection's input, the value residual and its seed, the gate and the MLP's intermediate. The residual stream, the two ranks' o_proj and down_proj sums and the logits stay in fp32.
  • Ranks. Rank 0 drives, and before each call it sends rank 1 a plan word that rank 1 follows. The partial sums of o_proj and down_proj are gathered over NCCL, or over RoCE writes for the small gathers, and added once in rank order.
  • Pack. Only the measured pack loads: ajensenwaud/Ripple-65B-Preview-exl3-5.0bpw, which averages 5.0 bits a weight with an 8-bit head. The loader identifies it by its config and refuses any other pack by name.
  • Limits. A GPU other than sm_121, a single rank or a third rank is refused by name. Metal refuses an EXL3 pack by name.
  • Notice. The layer order and the arithmetic come from the release's modeling_ricursive.py, and the notice now credits the release alone.
  • New capability key. Every /v1/models entry now has capabilities.reasoning_optional. It is true for Ripple, whose reply opens its own think block or answers bare, and false for every other model. docs/api.md lists it.

Results on this head

  • Closeness. Against ExLlamaV3's forward on the same pack, true-token NLL is within 0.13 % on every text, and greedy decoding matches for 32 of 32 tokens on every text. ExLlamaV3 runs in fp16, so the fp16 build sat closer to it; the table compares the two builds. Every top-1 miss is a near-tie in ExLlamaV3's own logits (below the table).
  • Kernel contract. ricursive-tp2-contract: 10 kernels pass gates 1-4, and all 8 planted controls fail as planted.
  • Exactness. Eager NCCL and CUDA graphs with RoCE give byte-identical logits and greedy ids. Served at --tp 2, drafted equals plain under greedy and seeded sampling, two concurrent streams equal their solo runs, and a resumed prompt equals a fresh one.
  • Speed. One stream decodes at 9.7 to 9.8 tok/s, the same as the fp16 build within 2.2 %, in no consistent direction. Prompt speed on the benchmark's short prompt is also unchanged; a long cold prompt was not measured again.
Closeness, builds and commits

Closeness against ExLlamaV3 (5.0 pack, teacher-forced, TP=2). KL is KL(ExLlamaV3 || ours). The floor is ExLlamaV3 against itself with attention rounded to bf16, on the same rows as the path.

Text Path KL, fp16 build KL, this head bf16 floor Top-1, fp16 / this head NLL ExLlamaV3 → fp16 / this head
agent prompt 2.3e-4 6.1e-4 8.5e-4 1.000 / 0.991 3.2804 → 3.2794 / 3.2845
agent decode 1.3e-3 4.1e-3 1.7e-3 1.000 / 0.972
code prompt 4.1e-6 1.2e-5 5.2e-6 1.000 / 1.000 0.4810 → 0.4809 / 0.4813
code decode 2.4e-6 8.8e-6 4.3e-6 1.000 / 1.000
prose prompt 1.1e-5 2.0e-4 1.5e-5 1.000 / 1.000 1.9699 → 1.9699 / 1.9703
prose decode 1.1e-5 3.1e-5 1.1e-5 1.000 / 1.000

Agent top-1 misses. All five (2 prompt rows, 3 decode rows) are near-ties in ExLlamaV3's logits, and in each our pick is ExLlamaV3's second choice:

Row ExLlamaV3's lead (logits) ExLlamaV3's top two Our lead the other way
133 (decode) 0.191 53.7 % / 44.3 % 0.170
194 (prompt, decode) 0.066 51.0 % / 47.8 % 0.019, 0.035
209 (prompt, decode) 0.015 21.0 % / 20.7 % 0.053, 0.167

The median top-two gap on agent rows is 1.7 to 1.8 logits. Most of the agent decode KL is one row, 130, which is not a miss (both pick the same token): KL 0.338 there, where the bf16-attention floor itself is 0.164. Without row 130 the agent decode KL is 9.6e-4, below that path's floor of 1.7e-3.

Decode speed (tools/bench_openai.py, one stream, tok/s, median of five).

Prompt Temperature fp16 build This head
fibonacci-raw 0 9.73 9.79
gpu-chat-no-think 0 9.66 9.83
fibonacci-raw 1.0 9.92 9.70
gpu-chat-no-think 1.0 9.87 9.74

Prompt speed on fibonacci-raw, from the same runs: 120.5 and 121.5 tok/s on the fp16 build, 120.4 and 118.7 on this head.

Run. Two DGX Sparks (GB10, 128 GB unified memory), the nvcc 13.3 build image and Zig 0.17.0, on 18 Nov 2026. The fp16 build is 6c6a250af. The device runs used 6c2fbf2b5, and the contract was run again on 2574838e0, whose only change is the contract fixture. Since then, the rebases and Ash's commits moved tests, build helpers, the reasoning flags and a registry pin; no kernel or forward code changed.

Main against branch (after the rebase, one GB10, 21 Nov). Spark-X2.6-4B 8-bit (main's spark25 family) served by main f0b9cb855 and by this head, same flags, eight runs: main, branch, main, branch, then branch, main, branch, main. Greedy 256-token replies (code, chat, agent with tools) have the same token hashes in all eight runs. Decode speed (tools/bench_openai.py, mean of the four runs each, tok/s):

Prompt Temperature Main This head
fibonacci-raw 0 52.17 52.22
gpu-chat-no-think 0 49.43 49.47
fibonacci-raw 1.0 49.89 50.02
gpu-chat-no-think 1.0 49.69 49.75

Each run is slightly slower than the one before, whichever build it is, so both orders are needed. Over the first four runs alone, the branch looked 0.6 to 0.9 % slower.

Host checks on this head. zig build test-ricursive-tp2-host ricursive-tp2-cuda native compile-cuda-tests test-kernel-contract test-gradient-serving passes all 66 steps and 286 tests on Linux x86, without a GPU. The lean checker finds 168 problems on main f0b9cb855 and on this head, the same findings (one at a shifted line). git diff --check is clean.

Launch records. nvcc 13.0 and 13.3 compile ricursive_tp2.cu for sm_80, 86, 89, 120 and 121. Only tf_rtp2_lerp changed, from 14 to 12 registers on sm_80 to sm_89, and both record files say so.

Reply check. Chat, a tool call and a tool round trip pass. The two cases where max_tokens cuts a tool call need #2511, as before.

Long context. The 1M-token runs were measured on the fp16 build: a needle at 1,018,419 tokens was answered, with 52.69 GiB a rank. The bf16 change leaves the cache sizes unchanged.

Known. On the default prompt path, the full layers' prompt rows are not bit-equal to their decode rows, because a different attention kernel sums in a different order. Resumed equals fresh because both cut at the same marks, and the backend reports chunk_invariant = false.

Stack. On main f0b9cb855: #2231's five commits by @BobClawblaw, kept as authored, then this PR's commits.

  • 12fd25a12: the config reads an ExLlamaV3 pack as exl3.
  • 0b49bc343, ce8020710, 357b70b9d: the two-rank family, its kernel contract, the recipe and the notice.
  • c8a1ded84, 7144b7103, 65ab3ff7d, f67c41301: fixes for line limits, Zig 0.17, a contract fixture and reasoning_optional.
  • 012141473, 3e17f54c5, 6923bb1e5: the first review round.
  • 511b91e25, caa47bf23: bf16 activations, and the notice credits the release alone.
  • 10d7e4442: only the measured 5.0 bpw pack loads.
  • 78ed503ab, 2357f2428: the lerp kernel's new records, and a lerp fixture whose control fails in bf16.
  • f7a7bee9e, 8ff2ed132, c3cf4891c, 3262b0cc5, 8ea8d62a9 (Ash): sources kept at 600 lines, the reasoning flags through familyInfo, and the kernel registry's pin.

Changelog line (suggested). Ripple-65B-Preview runs on two GB10s at --tp 2 from the 5.0 bpw ExLlamaV3 pack, to a 1,048,576-token context; every /v1/models entry gains capabilities.reasoning_optional (true for Ripple, false elsewhere) (#2522).

Credits

@BobClawblaw for the host package this builds on (#2231). turboderp's ExLlamaV3 for the EXL3 format and the reference forward, and @auryn-macmillan for its ricursive support, which made the pack. ricursiveAI for the release.

ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 8, 2026
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 8, 2026
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 8, 2026
@ajensenwaud
ajensenwaud marked this pull request as ready for review November 8, 2026 16:20
@ajensenwaud
ajensenwaud marked this pull request as draft November 8, 2026 19:03
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 8, 2026
@ajensenwaud
ajensenwaud marked this pull request as ready for review November 8, 2026 22:01
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 8, 2026
@ashhart

ashhart commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@ajensenwaud thank you for this. It's a careful piece of work, and the admission tests and planted controls make it easy to read. Two things are on our side first: the ricursive family decision (#2171), and the notice's wording that these files follow the release "as ExLlamaV3's ricursive architecture runs it". Could you say exactly which parts (rounding points, fp16 activations, layer order) came from ExLlamaV3's ricursive code, rather than from modeling_ricursive.py and the EXL3 format? Meanwhile:

  1. With exl3 = true, an EXL3 pack on the Metal path no longer gets nvfp4Mlp's by-name refusal and fails later on a missing tensor (config.zig:268, Metal weights.zig:80). Please refuse it by name there, with a test.
  2. admit refuses world ≠ 2, so the world == 1 branches in tp2_forward.zig and tp2_weights.zig:97 can't be reached; please remove them, or tell us what reaches them.
  3. TF_RICURSIVE_COPIES: please route it through platform/environment.zig with a docs/environment.md row, or drop it.
  4. Bitrates other than 5.0 and 6.0 are admitted through the variant table; please refuse unmeasured ones by name, or tell us why the EXL3 contract covers them.
  5. For the shared native/cuda.zig edits, could you post main-against-branch numbers (token sha and decode tok/s) for one existing CUDA family?

ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 9, 2026
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 9, 2026
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 9, 2026
ajensenwaud added a commit to ajensenwaud/TensorFold that referenced this pull request Nov 9, 2026
@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash, and for the kind words.

On the notice

  • The layer order and the arithmetic come from modeling_ricursive.py.
  • What came from @auryn-macmillan's ExLlamaV3 branch (feat/ricursive at d71a6644) is narrower: the precision at each step. I matched it so that our logits could be checked against the forward pass that produced and measured the packs.
  • Concretely, the value-residual seed is held in fp16 and blended in fp16 with an fp32 weight; every EXL3 projection takes fp16 input; the MLP's intermediate is fp16; o_proj and down_proj write fp32; and the final norm hands the head fp16.
  • No ExLlamaV3 code is copied, and THIRD_PARTY_NOTICES now says exactly that.

On your five points

  1. Metal now refuses an EXL3 pack by name before any tensor is loaded, with the same error and message it gives other quantisations (Config.metal()). The config test covers it.
  2. You were right that nothing could reach them. The world == 1 paths in tp2_forward.zig and tp2_weights.zig are gone, along with the optional rank group and Cut's one-rank default. The TP=2 suites remain byte-identical to the recorded outputs: nine of nine files eager over NCCL, and nine of nine with CUDA graphs and RoCE.
  3. TF_RICURSIVE_COPIES is dropped; it was never measured on Ripple.
  4. Only the two measured bitrates, 5.0 and 6.0 with an 8-bit head, are admitted. Anything else fails with UnmeasuredRicursiveBitrate, checked once in the config and again for each trellis as it loads. The test tries 4.0, 5.5, a 6-bit head and a missing head_bits.
  5. To isolate the shared native/cuda.zig changes, I served Spark-X2.6-4B (spark25, 8-bit, one GB10) from main and from this branch with identical flags, alternating main, branch, main, branch.
    • Greedy output was identical in all four runs, across code, chat and a tool-calling agent prompt.
    • Decode speed was indistinguishable. On bench_openai's fibonacci-raw, the medians were 48.26 and 47.85 tok/s on main against 48.06 and 47.86 on the branch; on gpu-chat-no-think, 47.99 and 47.60 against 47.78 and 47.56.
    • The branch's 0.2-0.3% deficit is smaller than the 0.8% by which main varied between its own two runs.

The branch is rebased on main f212eeabd, and the GPU receipts are in the description.

ajensenwaud and others added 16 commits November 23, 2026 18:24
…e input the clamps leave non-finite, so the nonfinite gate has a NaN to check
… never measured on CUDA

Metal: Config.metal() refuses an EXL3 pack with UnsupportedRicursivePrecision, the
by-name refusal nvfp4Mlp gave it before quant_method exl3 was read, instead of a
missing tensor at load. CUDA (two ranks): only 5.0 and 6.0 bits with an 8-bit head,
the packs measured against ExLlamaV3, are admitted; the config's bits are checked
again on every trellis. Others: UnmeasuredRicursiveBitrate, explained by name.
…y; TF_RICURSIVE_COPIES dropped

admit() refuses any world but 2, so the world == 1 paths in tp2_forward.zig and
tp2_weights.zig, the optional rank group and Cut's one-rank default were unreachable.
The unmeasured opt-in TF_RICURSIVE_COPIES goes (the lanes keep the default copy policy).
…precision points from ExLlamaV3's ricursive support
The norms' outputs, every EXL3 projection's input, the value residual
and its seed, the gate and the MLP's intermediate move from fp16 to
bf16. The residual stream, the rank sums and the logits stay fp32.
The notice no longer names ExLlamaV3's precision points, and the
recipe states the bf16 activations and the pack comparison's metrics.
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.
nvcc 13.0 and 13.3 give tf_rtp2_lerp 12 registers on sm_80 to sm_89.
The other kernels' records are unchanged.
At an 8-bit weight the two lerp forms round to the same bf16, so the
start-anchored control stayed green. A full fp32 weight tells them apart.
Follow main 4b997f8
(glm metal dflash2: account tap-stage bytes, fix host build core import, trim comments).
Keep all current dispatches and refusals beside the incoming Ripple entries.
Remove two interior blank lines to restore the 600-line source limit.
… (seven blank lines fewer)

Main's cuda.zig (last 833c695, the MOSS-Image recognizer) is at 590 lines with the special families moved into
open_family.zig; ashhart#2522's ranked registry loop, its ranks refusal and its test put it at 607. Seven blank lines between
adjacent tests at the end of the file go; no code changes.
@ashhart

ashhart commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud for the two-rank work. Three things need fixing:

  • Value-residual blend: tp2_weights.zig line 155 keeps the sigmoid of value_res_lambda in fp32. The release's lambda is BF16, so its sigmoid rounds to BF16, as blendOf does on main and your ricursive: load Ripple's EXL3 packs through main's shared EXL3 code #2514 does for these same packs. For a lambda of 1, that is 0.73046875 against 0.7310586 here, which changes V's input. Please round it the same way, refuse a lambda that is not a BF16 value as ricursive: load Ripple's EXL3 packs through main's shared EXL3 code #2514 does, and add a test with a sigmoid that BF16 cannot hold exactly.

  • Model.load: if a later step fails, only the Model allocation is freed. The stream, rank group, weights, kernels, caches and scratch stay held, for example when the ranks disagree on --parallel or --context. The server can open an engine again in the same process, so please unwind each step.

  • Ripple.init: it has the same gap for its host arrays and device buffers.

  • Synthena

…does

The blend is now the bf16 sigmoid of the stored lambda, shared with
Metal's blendOf, and a lambda that is not a bf16 value is refused.
Model.load and Ripple.init now release what earlier steps made, and a
failed open stops rank 1's follow loop.
@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. All three are fixed on fdf82f603, and the two-GB10 runs on the 5.0 bpw pack pass.

  1. Value-residual blend. The blend is now the BF16 sigmoid of the BF16 lambda, computed by the same config.blendOf that Metal uses. A lambda that is not a BF16 value is refused, and the new test checks that a lambda of 1 gives 0.73046875.
  2. Model.load. Each step now frees what it made when a later step fails, from the stream and rank group through the weights, kernels, caches and scratch. A failed open also stops rank 1's follow loop.
  3. Ripple.init. Its host arrays and device buffers are unwound the same way.

At TP=2, greedy decode matches the exllamav3 reference 32/32 on all three prompts, and eager NCCL and CUDA graphs over RoCE give byte-identical outputs. Served at 4 x 262,144, drafted and plain replies are identical, and plain decode runs at 9.76 tok/s.

Results

Against the exllamav3 reference, 5.0 bpw pack, --tp 2, eager NCCL:

Prompt Tokens Prompt KL Decode KL Top-1 prompt / decode NLL vs reference Greedy
code 210 5.8e-05 3.0e-05 100.0% / 100.0% -0.08% 32/32
prose 155 2.8e-04 4.5e-04 100.0% / 100.0% -0.12% 32/32
agent 211 7.8e-04 5.1e-03 99.1% / 97.2% -0.15% 32/32

Served on fdf82f603, --tp 2 --parallel 4 --context 262144:

Check Result
Drafted vs plain, greedy and seeded (code, chat, agent) identical
Two concurrent streams vs solo identical, 18.8 tok/s aggregate
Resume, pair, fresh vs resumed pass
Reply check 5/6; the remaining case is a tool call cut by max_tokens, which #2511 fixes
Plain decode, bench_openai median 9.76 tok/s

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud. All three are fixed on fdf82f603:

  • Value-residual blend: both paths now share config.blendOf, so the blend is the bf16 sigmoid of the bf16 lambda, a lambda that isn't a bf16 value is refused, and the new test pins 0.73046875 for a lambda of 1.
  • Model.load: each step after the stream (rank group, weights, kernels, caches and scratch) is released when a later step fails, and a failed open stops rank 1's follow loop.
  • Ripple.init: its host arrays and device buffers are unwound the same way, including a part-made set of slot buffers.

Thanks for the two-rank results too. That closes our review of the code. There are a few overlaps with main (the CUDA family lists and the serving pins), and we'll sort those out on our side.

  • Synthena

The refusal tests called refusals.family directly, so they passed when
openWith stopped calling it. This test goes through cuda.open for every
registered family and fails with the call removed.

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.

3 participants