Skip to content

Inkling-2-Mini: Serve on two GB10s with images and 1M context window - #5059

Open
ajensenwaud wants to merge 42 commits into
ashhart:mainfrom
ajensenwaud:ink-mini-tp2
Open

ajensenwaud wants to merge 42 commits into
ashhart:mainfrom
ajensenwaud:ink-mini-tp2

Conversation

@ajensenwaud

Copy link
Copy Markdown
Contributor

Running Inkling 2 Mini on TensorFold's CUDA server today needs the whole model on one GPU and serves text only. This is because main's Mini engine runs on a single rank and refuses images, so a pair of GB10s cannot split the model or read pictures. This PR fixes that.

Stacked on #4841 and #4746; only the last three commits are new. Refs the Mini plan in #4274.

What this changes

Checks on this head

  • Host: zig build test test-gradient-serving compile-cuda-tests -Dfixed-cpu passes 862 of 862 steps, with 13,439 of 13,535 tests (96 skipped). An nvcc build for sm_121 passes.
  • Lean, common-primitive and whitespace checks add no new findings over Inkling-2-Small: Serve on two GB10s from an EXL3 pack #4841.

Receipt

  • Parity. At TP=2 against exllamav3, Mini's logits sit at 0.98-1.48x of exllamav3's own noise floor, with true-token NLL within 0.80 %.
  • Messages. With the cross-pass messages zeroed, Mini's logits move to 4.7-911x of the floor, as exllamav3's do with its messages zeroed, so the loop is wired where the reference reads it.
  • Exactness. Prompt rows equal decode rows and streams together equal streams alone on 10 of 10 texts. Graph replay equals eager rows on 46 of 46 cases.
  • Replies. On this head, a chat and an image chat both finish with stop and split into reasoning and answer. All 28 served cases give the same tokens as the earlier base's run.
Run details
  • Hardware: two DGX Sparks (GB10, sm_121) over RoCE. Pack: ajensenwaud/inkspark-mini-2dgx at a2707bbdbfae47a66154dbd89603c546bf1fe634, EXL3 4.05 bpw.
  • The replies and the 28 served cases ran on this head on 26 November. The parity and exactness runs were measured on 25 November on an earlier base; since then the family and kernel files have changed only in the routing check and in Inkling-2-Small: Serve on two GB10s from an EXL3 pack #4841's ready check and setup cleanup, none of which touches the forward.
  • Commits: c358f605d lays out Mini's visit plan, 5865de0a0 serves Mini on two GB10s and holds the routing rule, 77075cd48 adds the recipe page.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud. The visit slots, rank slicing and routing boundaries are in place, and the shard/config ready binding is retained.

The live gate still needs main's ascending 64-term order: eight chunks plus a tree can change its FP32 result before tanh. Please also hash the optional loop as a presence tag and scalar fields rather than raw storage. After those fixes, the remaining evidence is exact same-checkpoint one-rank/two-rank tokens and logits on the final tree, with the advertised image/window cells and complete run identities. Noise-floor agreement does not close that gate.

  • Synthena

@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud.

The two correctness fixes are confirmed: the live gate now uses main's ascending 64-term FP32 order, and the ready digest hashes the optional loop's presence tag and scalar fields rather than its storage. Rank routing, visit cache slots and the virtual-rank exchange paths also look consistent.

One source cleanup is still needed. These added comments exceed 120 columns:

  • zig/build/cuda_kernels.zig:177
  • zig/src/cuda/exl3_experts.zig:43 and :205
  • zig/src/families/inkling2/engine.zig:63 and :95
  • zig/src/families/inkling2/forward.zig:433
  • zig/src/families/inkling2/prompt_dense.zig:229

Please wrap or move those comments without changing the code. The remaining qualification is final-tree, same-checkpoint one-rank/two-rank token and bit-identical logit evidence, plus the actual image, full-window and four-stream window cells. The noise-floor comparisons alone do not close that exactness gate.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. These are on ae578ad0c.

  • Gate order. The blend now sums each output's 64 forget and gain terms as one ascending FP32 chain from zero, which is main's gateUp order. The contract requires its bytes to equal a copy of main's chain at all five served shapes, and the old eight-chunk tree goes red as a control.
  • Digest. ec050d200 hashes the optional loop as a presence byte followed by its four fields, and every other config field as a fixed-width scalar. A host test scribbles an absent loop's storage and still gets the plain absent digest.
  • Exactness. ef7dd404a runs both ranks of the two-rank engine on one GPU. On the final tree, one GB10 and two GB10s give byte-equal tokens, per-rank logits hashes and run identities in three cells: one 1M stream, four 128K streams decoded together, and an image prompt. That is 352 of 352 tokens and 726 of 726 logits hashes.
Results

Run on 26 November 2026, 02:12-02:54 UTC, on two DGX Spark (GB10) nodes, driver 580.178.04. Head ae578ad0c12799e9f3225e3ecba586eece9c1d61, built once with zig build install native compile-cuda-tests -Dnvcc -Dtp-nvcc -Dsm=121 -Doptimize=ReleaseFast (nvcc 13.3.73) and copied to both nodes. The runtime image was built on each node (ids sha256:3a1d434aa8bb and sha256:c5a937216ed6).

Exactness cells. Each cell ran tf-inkling2-engine greedy with 32 new tokens, eager, at two real ranks and again with --virtual on one GPU. greedy.json, logits.r0.json and logits.r1.json are byte-equal, and run.json is equal apart from "virtual". A logits hash covers one rank's FP32 vocabulary half for the prompt's last row and every decode row.

Cell Shape Texts Tokens Logits hashes a rank Ready digest ids sha256 Real vs virtual
a 1M, one stream at a time agent0, agent1, code0, wiki0, wiki1, long40k 192 198 61c1bdab00f0f323 f0d4ecf0da8ef4ca equal
b 128K, four streams together agent0, agent1, code0, wiki0 128 132 cb9d2bbbc5a54be6 912a1256aa661a25 equal
c 128K, image prompt image0 32 33 e17c9854d0e51d76 ae7609ac1cb5b354 equal

The 1M cell includes a 40,000-token prompt of TensorFold source. The image prompt has 1,049 tokens, 1,024 of them picture rows (picture sha256 24361d503f48e2e8). Pack A: config.json 8bc6cec59d68e990, model.safetensors.index.json 4e216154fa6266d6, quantization_config.json 982897585005bb3d, the same on both nodes. The ready digest covers every shard byte, the parsed config and the stream shape.

Kernel contract. tf-cuda-test kernel-contract inkling2 on the GB10:

PASS shapes inkling2 loop tf_ink2_loop_blend in main's order (bit-equal to its ascending 64-term chain): 5 shapes bit-equal to the kernel it replaces (worst 0.000 of the bound), 0 edges refused by the kernel
CONTROL control: inkling2 loop tf_ink2_loop_blend's old 8-chunk tree against main's ascending chain: red at shapes, as planted
PASS limits live inkling2 loop tf_ink2_loop_blend: 256 threads launched, the driver allows 256; 44 registers, 16384 + 0 shared bytes (recorded 44, 16384)
PASS sums inkling2 loop tf_ink2_loop_blend ((1 - tanh(F g)) h + tanh(M g) msg): exact sums at k 3, where fp16 sums would miss by 8083627x and bf16 by 8318418x
SUMMARY 62 kernels: 62 pass gates 1-4, 0 fail, 0 known findings; 40 controls: 40 red as planted, 0 missed; 11 limit problems

The previous head 3af4f9eee under the same filter: SUMMARY 61 kernels: 61 pass gates 1-4, 0 fail, 0 known findings; 39 controls: 39 red as planted, 0 missed; 11 limit problems. The 11 limit problems are the same lines on both heads.

Parity. Logits move with the new order, so the TP=2 gate was rerun against the exllamav3 answer key and noise floor (five 1,024-token texts):

Text KL / floor before KL / floor now NLL above the reference before NLL above the reference now KL / floor, messages zeroed
agent0 1.22x 1.29x +0.80 % +1.28 % 23.7x
agent1 0.98x 0.96x +0.28 % +0.28 % 4.7x
code0 1.48x 1.49x +0.46 % +0.50 % 329.0x
wiki0 1.13x 1.21x +0.14 % +0.07 % 911.9x
wiki1 1.22x 1.17x -0.11 % -0.16 % 511.6x

Prompt rows equal decode rows and four streams together equal each alone on 10 of 10 text-rank pairs. Whole prompts, 128-row chunks, 37-row chunks and decode rows are byte-equal on 10 of 10. Graph replay equals eager on 46 of 46 steps.

Compiled code. On nvcc 13.0 and 13.3, for sm_80, 86, 89, 120 and 121, tf_ink2_loop_blend is the only function of the loop image whose SASS changes. Its new records are 36, 46, 46, 44 and 44 registers with 16,384 static shared bytes on both compilers. The two contract twins are new functions in the controls image, and its other functions are unchanged. One sm_89 control function there also differed between two nvcc 13.3 builds of the unchanged base, and a rebuild matches the head. The blend and the chain copy compile to the same SASS at main's -O3 and at the loop image's flags.

Blend time. Microseconds a launch inside a CUDA graph; cold reads rotate 16 copies of the weights. Every case also checked the new blend against main's chain bit for bit.

Rows x gates Old tree differs from main's chain Old, warm New, warm Old, cold New, cold
1 x 3 1,050 of 6,912 2.24 4.09 6.16 6.91
1 x 1 256 of 2,304 1.61 2.38 1.60 2.38
4 x 3 3,755 of 27,648 3.50 5.40 7.77 8.16
16 x 1 5,718 of 36,864 5.04 5.25 4.70 5.45
37 x 3 41,842 of 255,744 18.75 18.95 20.87 20.40
128 x 1 48,008 of 294,912 19.74 19.28 19.84 19.21
2048 x 1 765,810 of 4,718,592 398.70 377.22 393.17 374.31
2048 x 3 2,290,083 of 14,155,776 1447.74 1297.04 1460.61 1305.58

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. The seven comments now sit on their own lines in 69e99c251, with no code changed. The six that came from #4841 are fixed there too, in 29b5f9385.

@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud.

All seven comment-width fixes are confirmed. The new commit changes comments only; no executable code changed, no added comment exceeds 120 columns, and every changed Zig file remains below 600 lines. The gate-order, ready-digest and routing fixes remain intact. No new source defect was found.

SAFE TO A/B. The same ten integration conflicts remain and must preserve both sides' registry, profile, tests, notices and fixtures.

Your real-versus-virtual token and per-rank logits hashes are useful evidence, but virtual mode still runs the split engine rather than main's one-rank engine. The smallest remaining exact cells therefore compare the actual one-rank engine with real TP=2 on the same checkpoint, including full reconstructed logits. For the full-window proof, fill each window exactly: one 1,048,544-token prompt plus 32 decoded tokens, and four 131,040-token prompts plus 32 decoded tokens each. Include eager/graph and concurrent/solo equality. Finish with the recorded actual-image prompt, exact repeated tokens, stop, and reasoning/answer splitting on the integrated tree.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. Before I build the one-rank cells, I have one question about which engine you mean.

  • Main's one-rank engine. Main's Mini path reads the BF16 release or a ModelOpt NVFP4 checkpoint and serves text only. This PR reads an EXL3 pack, so the two cannot run the same checkpoint, and with different kernels their bits cannot match.
  • This engine at one rank. I can add a real one-rank mode to this engine, in the server and the test tool, that keeps the two-rank order for the split sums and the vocabulary halves. Its tokens and full logits would then equal real TP=2 byte for byte. A one-rank mode that adds each sum in a single pass cannot be byte-equal to any two-rank run.
  • The rest. I will rebase onto main, keeping both sides of the ten conflicts. On that tree I will then run the filled windows, one 1,048,544-token prompt and four 131,040-token prompts with 32 tokens each, with eager against graph and concurrent against solo. The served image prompt, repeated tokens, stop and the reasoning split follow on the same tree.

Does the second option meet the gate?

@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud, for the careful measurements and for laying out the one-rank options so clearly. The ascending 64-term gate order, canonical ready digest, routing boundaries and seven comment-width repairs are confirmed at the current head. Its final commit changes comments only, and I found no new executable defect.

Yes, your second option is the right same-checkpoint gate. A serial one-rank mode in this EXL3 engine can be the reference, provided it preserves the two-rank computation rather than replacing it with a one-pass equivalent. It must execute the same partial computations, combine rank 0 then rank 1 in the same order and at the same rounding points, and reconstruct the two padded vocabulary spans separately. Compare tokens and every reconstructed FP32 logit byte for byte, with no tolerance. The two existing virtual world-two engines are not that serial reference. The new reference mode should be opt-in and leave ordinary one-rank routing and the two-rank path unchanged.

The remaining cells are the filled single window, four filled concurrent windows, and the real image prompt, all against real two-rank execution on the integrated tree. Include eager against graph, concurrent against solo, repeated tokens, stop, and reasoning/answer splitting as applicable. Full reconstructed logits are needed; per-rank hashes alone are not enough. The ten integration conflicts still need both sides preserved.

This was a read-only review; no device run is promised.

  • Synthena

@ajensenwaud ajensenwaud changed the title Inkling-2-Mini: Serve on two GB10s with images and the full 1M window Inkling-2-Mini: Serve on two GB10s with images and 1M context window Nov 26, 2026
The family's attention was a copy of prefill_attention.cu's
vision_kernel, so the tower now calls vit.Attention.full at head dim 64,
the instance and record Qwen3-ASR already brought to main.
grouped_body takes the member tiles a program as a template parameter.
tf_exl3_grouped_wide_2 runs 32 members by 64 columns for prompt chunks;
the existing instantiations compile to the same SASS on every SM.
nvcc 13.3 changed tf_exl3_grouped_2's sm_120 and sm_121 SASS when the
wide instance followed it; defined first, every existing kernel compiles
as before under 13.0 and 13.3.
The item plan was limited to mcg and slot rows written to ey. It now
takes every codebook, writes scratch y when ey is 0, picks the wide
kernel for 32-member items and the capped epilogue for act_mode 3.
The family's grouper and grouped projections were copies of core's.
Inkling now runs exl3_experts.runWith on grouped.Router's item plan,
16-member items below 512 rows and the wide kernel from there; outputs
are bit-equal to the kernels this replaces. Expert widths up to 8 bits
are admitted, as core decodes them.
tf_ink2_gateup duplicated core's gate/up epilogue apart from the
softcaps, which core now runs as act_mode 3. Its registration moves to
tf_exl3_gateup_capped, with the swapped-caps control kept.
RADIO, MiniMax M3, Qwen 27 and Inkling 2 each kept their own copy of
the placeholder span and the cut that maps a prompt pass onto it. They
now share core.image_rows, started from RADIO's copy, and each family
keeps only its own splice.

The cut now works in usize and takes the offset before adding the
buffer row, as RADIO's did. MiniMax M3 and Inkling 2 already cut in
usize, so their results are unchanged. RADIO and Qwen 27 no longer
overflow u32 on a span that ends past 2^32; nothing else changes.
Inkling 2's tf_ink2v_scale_add was a layer-scaled residual add, which
is tf_vit_pointwise with a per-column scale between the activation and
the add. vit.cu now has tf_vit_pointwise_gamma for that, and the tower
calls it through vit.Kernels.pointwiseGamma. Its fp32 multiply, bf16
rounding and add are the same round-to-nearest steps the family kernel
took, so the tower's results are unchanged.

Every existing function in vit.cu and inkling2/vision.cu compiles to
the same SASS on sm_80, 86, 89, 120 and 121 under nvcc 13.0 and 13.3.
The contract now registers the core kernel, with the late-gamma control
retargeted to it; its records come from cuobjdump -res-usage, and 13.2
stays pending.
The Metal and residency builds give qwen27 its own core roots, which
lacked image_rows after the shared module moved into core.
ajensenwaud and others added 25 commits November 26, 2026 22:26
Core builds exl3_experts.cu with contraction on, so the soft-capped
SwiGLU's products and sum fused into FMAs, and Inkling 2 Small's tokens
no longer matched the build it was validated on. Explicitly rounded
operations give the SASS the old text has at the glue kernels' flags.
…ls, bit for bit

With ashhart#4127, Inkling 2's softcapped gate/up epilogue and vision layer scale
come from core (tf_exl3_gateup_capped, tf_vit_pointwise_gamma) in place of
main's family kernels (tf_ink2_gateup, built at --fmad=false, and
tf_ink2v_scale_add). A host test writes both kernels' arithmetic at their
rounding points: every product and sum on its own, the same order, the shared
rotation and the fp16 or bf16 store. Over 512 random 128-column blocks with
saturating and non-finite inputs, and 65,536 layer-scale values, the old and
new forms give the same bits. A control contracts one product into the
rotation's first sum, as core's fmad=true flags would without the explicit
_rn operations, and it differs, so the comparison can see one fused rounding.
Main added layer_norm_eps to the shared vision config, and the CUDA
tower's test config no longer compiled. The tower now reads eps from
the config instead of a constant; the release's 1e-5 is unchanged.
Reads an EXL3 pack from exllamav3 1.x on the mul1 codebook: every
attention projection and the head as EXL3 linears, each layer's experts
as one grouped layer, cut to a rank by key heads, columns or rows.
Rank 0 serves and sends every step to rank 1 over NCCL; the per-layer
partial sums cross by RoCE writes. Decode rows from several streams
share one graphed forward, prompts run in 2,048-row chunks with kept
states at chunk starts, and images go through the vision tower. No
drafter yet: a stream decodes one row a step.
The new map entry went in before pick scanned the lanes, so the scan
read the entry's unset slot, and a failed pick left the entry behind.
The slot is now chosen first and the entry added only once it has one.
checkpoint_digest stayed zero, so the ready check passed two ranks
holding different packs. Each rank now hashes every shard byte beside
the load and hands that digest to the check.
Buffers.deinit read ids and logits before init had made them. Both
now start empty, and a fake-driver test fails each allocation in turn.
Two ranks with identical shards but different configs, such as another
rms_norm_eps, passed the ready check. The digest now also covers the
parsed config and the stream shape each rank was started with.
Engine.init cleaned up a stale copy of its modules, which never held the
prompt projections. A failed kernel lookup leaked the GEMM workspace and
a failed plan insertion leaked its descriptor and layouts.
The cross-pass message attention, the four rank-64 message gates and
their norms, each with a float64 reference and a planted control. Their
nvcc 13.0 records keep 13.2 pending, with the 13.3 receipt beside them.
Both sets marked themselves loaded before their registrations were set
and appended without an errdefer, so a failed append left the module
loaded. They now follow the attention set, and the family set cleans
up the loop set as it does the others.
visits.zig orders Mini's 48 layer visits from the loop_config that
config.zig reads: the prelude, three passes over the core with a cache
slot per visit, then the coda. Drafter taps index visits. Small's plan
is its layers in order.
The forward walks the visit plan with a cache slot per visit, so
Small's plan is its layers in order and its launches stay the same.
Core visits after the first pass mix in the previous pass's bank
through the loop kernels. A rank whose rel columns miss the 128-wide
EXL3 blocks projects r whole and copies its columns, and Mini's prompt
rows keep the decode kernels.

The CUDA host gives an inkling2_loop checkpoint to this engine only
when two ranks are placed and the pack uses Small's tensor names. A
one-GPU run and any other Mini checkpoint open on cuda_native.zig.
The ready digest hashed the optional loop config as raw storage, so its
padding and an absent loop's leftover payload bytes reached the digest.
Every config value now goes in as fixed-width little-endian scalars.
tf-inkling2-engine greedy --virtual loads both ranks' weights on one GPU
and runs each rank's forward on its own stream, with the gathers done as
copies between the two engines. Its tokens and per-rank logits hashes
can then be compared byte for byte with a real two-rank run.
Each output's 64-term forget and gain dots now run as one fp32 fma chain
from zero, handed lane to lane, so the blend's bits before tanh match
main's gateUp. The contract checks the blend against a copy of main's
chain, with the old eight-chunk tree as a control.
Main's config parser now refuses head_dim, swa_head_dim and d_rel by
name before the kernels' limits are read, so the shape test checks
those three cases there and the others through shape.parse as before.
@ashhart

ashhart commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Thank you, ajensenwaud. The ascending 64-term FP32 gate order, canonical ready digest, routing boundaries, head-width refusals and comment cleanup are confirmed. The newer changes retain those fixes, and I found no copied-code blocker.

One implementation is still needed before the requested comparison can run. The current --virtual check starts two concurrent world-two engines; it is not the serial reference we discussed, and separate per-rank hashes are not full reconstructed logits. Please add the opt-in serial EXL3 split reference that preserves both ranks' partial computations, combines rank 0 then rank 1 at the same rounding points, and reconstructs the two padded vocabulary spans separately. It must leave ordinary one-rank routing and the real two-rank path unchanged.

On the integrated tree and the same pinned checkpoint, the remaining evidence is exact tokens and every reconstructed FP32 logit byte between that serial reference and real two-rank CUDA execution, with no tolerance. Please include one 1,048,544-token prompt plus 32 decoded tokens, four 131,040-token prompts plus 32 decoded tokens each, eager against graph, concurrent against solo, and the real image request with exact repeated tokens, stop and reasoning/answer splitting.

The rebase also needs to keep both sides of the two current conflicts: the expanded family registry together with the existing alias accounting, and checkpoint-sensitive routing together with the ordinary alias fallback.

This was a read-only review. I ran no builds, tests or device checks.

  • 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.

2 participants