Skip to content

inkling2 cuda: serve Mini from a stock EXL3 pack (stacked on #4841) - #4966

Draft
Maxrio9 wants to merge 21 commits into
ashhart:mainfrom
Maxrio9:inkling2-mini-exl3-pack
Draft

Maxrio9 wants to merge 21 commits into
ashhart:mainfrom
Maxrio9:inkling2-mini-exl3-pack

Conversation

@Maxrio9

@Maxrio9 Maxrio9 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Inkling 2 Mini on CUDA serves only the ModelOpt NVFP4/MXFP8 checkpoint today. With this PR it also serves text from a stock exllamav3 1.x EXL3 pack (mul1 codebook), on one GPU, using the EXL3 reader from #4841 and the core grouped expert kernels from #4127:

Checks on this head

  • Head commit: 2947678a4. Measurements ran on 2b5e21cb9; 2947678a4 only adds this PR's number to CHANGELOG.md.
  • Lean checker on main and on this head: 165 and 165, 0 new. tools/pr_check.py --base upstream/main: 0 errors.
  • Tests run:
    • zig build -Dfixed-cpu test-host --test-timeout 20m: 2554/2554 steps, 22709 passed, 146 skipped, 0 failed.
    • zig build test-cuda-host: 493/493 steps, 7575 passed, 37 skipped.
    • zig build test-inkling2-cuda-host: 62/62 passed.
    • zig fmt --check build.zig zig, git diff --check: clean.
    • zig build fatbins kernel-contract-fatbins -Dsm=120,121: 372/372 steps.
  • CI: not yet run on this head (fork PR, awaits approval).
  • Not run, and why: sm_121 (DGX Spark) serving on this rebased head; it was served from the same delta on an older main (see the fork branch below). No Metal or HIP change.

Receipt

  • Main against branch: NVFP4 checkpoint on main and on this branch, six alternating server starts; EXL3 only on the branch (main refuses the pack).

  • Boxes it reaches: one NVIDIA RTX PRO 4500 Blackwell 32 GB (sm_120). Compiled for sm_120 and sm_121.

  • New switch: none.

  • Environment: main 9a38b1f7b, branch 2b5e21cb9; Zig 0.17.0, nvcc 13.4.92, driver 615.78.08, Linux 7.2, x86_64, 32 GB RAM class. Checkpoints: thinkingmachines/Inkling-2-Mini at ed40e7da (NVFP4), and Maxrio/Inkling-2-Mini-exl3 branch 3.3bpw at b57f9b6c (EXL3, 3.3 bits per weight on average, mixed per-expert widths). Drafts off, --parallel 1, --context 8704, --prompt-cache-gib 0.

  • Paths and platforms: the Mini CUDA loader, admission and forward (cuda_native, loop_engine, loop_weights) for both formats. Ran sm_120; sm_121 compiled only on this head.

  • Exactness:

    • NVFP4: every one of the 6 starts (3 main, 3 branch) gave the same token hashes on both prompts as main's first start.
    • EXL3, bench_concurrent.py --levels 1,4 --alone --serial: 3/3 equal at one stream and 12/12 at four requests for both prompts. With one advertised stream the four requests queue, so the concurrent check is vacuous, as is the drafted check (drafts off).
    • EXL3 fidelity against an independent engine: 16 fixed prompts (one to two per category of a held-out mix, including one at 8,192 prompt tokens), 64 teacher-forced positions each, against ExLlamaV3's own greedy trajectories on the same pack: top-1 agrees at 1,015 of 1,024 positions (99.12%). All 9 differences are logged with both tokens.
    • Mixed-width grouped experts at Mini's shape (128 experts, top-8, widths 6/7/8 halves mixed per expert): bit-equal to the plain grouped traversal at 1, 17 and 512 rows; each planted width control is caught (SUMMARY Mini mixed-width EXL3: 3/3 shapes bit-equal, 3/3 planted controls caught).
  • Decode speed before and after, from tools/bench_openai.py --tokens 256 --reps 3 --temperatures 0, NVFP4, tok/s medians per start, in run order:

    Start Side fibonacci-raw gpu-chat-no-think
    1 main 26.88 26.96
    2 branch 25.97 26.17
    3 branch 26.04 26.22
    4 main 26.01 26.19
    5 main 26.03 26.18
    6 branch 26.06 26.14

    Main's first start was about 3% faster than every later start of either build; starts 2 to 6 agree within 0.4%. Means: main 26.31 / 26.44, branch 26.02 / 26.18.
    EXL3 on the branch: 69.78 and 69.65 tok/s (256 tokens, one stream), and 69.5 / 67.1 tok/s at one stream in bench_concurrent.py.

  • Prompt speed before and after: cold first request at 8,192 prompt tokens, tools/bench_cache.py --require-cold, 0 cached tokens. NVFP4 ttft_s main 15.65 / 15.69, branch 15.68 / 15.66 (alternating starts). EXL3 on the branch: 3.43 s.

  • Memory (/v1/memory peak): NVFP4 20,547,927,576 bytes on both builds; EXL3 14,861,091,864 bytes.

  • Licence of any new weights or drafter: n/a, no weights shipped. The EXL3 pack keeps the Apache-2.0 licence of the original model.

The full Mini EXL3 work this was split from (DSpark drafts, CUDA graphs, several streams on the shared forward from #4786) is on the fork branch https://github.com/Maxrio9/TensorFold/tree/inkling2-mini-exl3, with release builds at https://github.com/Maxrio9/TensorFold/releases/tag/inkling2-mini-exl3-v1. Those parts depend on open PRs (#4128, #4786, #4858) and are not part of this PR.

Thanks to @ajensenwaud for the EXL3 reader and grouped expert kernels this builds on, and to @jschmied for the Mini loop-gate split already on main.

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. (The new checks are GPU tools for a path that did not exist before; their planted controls fail as planted. Skipping without a GPU is not checked.)
  • 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. (Concurrent equals solo at queued four requests; drafted and resumed paths are not exercised for EXL3 here.)
  • No precision traded for speed. The EXL3 path uses main's EXL3 kernels and their sums unchanged; the NVFP4 bits are unchanged.
  • 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. (NVFP4 one stream as above; one stream is the widest admitted at these settings.)

ajensenwaud and others added 21 commits November 20, 2026 19:24
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.
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.
The Metal and residency builds give qwen27 its own core roots, which
lacked image_rows after the shared module moved into core.
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.
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.
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.
Load Mini's packed attention projections and routed experts on CUDA.
Validate projection widths against the pack metadata and size admission
from the text shards that the engine loads.
@Maxrio9
Maxrio9 force-pushed the inkling2-mini-exl3-pack branch from 2b5e21c to 2947678 Compare November 24, 2026 22:38

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