Skip to content

[Engine] Inkling-2-Mini support (looped MoE from Thinking Machines) #6442

Open

Description

@baptisterajaut

Area

[Engine]

What do you want to do?

Run thinkingmachines/Inkling-2-Mini in Strata. Released today under Apache-2.0, 26.4B total / 3.4B active: the same weight class as Qwen3.6-35B-A3B, which Strata already serves, but it lands well above it. Its card puts it slightly ahead of the dense Qwen3.8-27B, itself clearly ahead of Qwen3.6-27B and Qwen3.6-35B-A3B. On a 24 GB card it would seem a natural fit for Strata's expert offload: the Q8_0 GGUF alone is 27.8 GB, before any long context.

From its config.json, the architecture would need real engine work: 24 layers where layers 6 to 17 run three passes with shared weights (48 layer applications per token), MoE with 128 experts, top-8 and no shared expert, 20 sliding-window layers (1024) and 4 global ones (5, 11, 17, 23), logit and MLP softcaps, and an MTP block drafter shipped in mtp.safetensors. The loop would also change the expert cache economics: the routers of layers 6 to 17 run on each of the three passes, so keeping those experts resident first and streaming the outer layers seems like the better trade.

The official checkpoint is NVFP4 + MXFP8 (19.5 GB). GGUFs already exist from ggml-org (BF16, Q8_0, IQ4_NL) and unsloth (UD-IQ1_S to UD-Q8_K_XL), built against llama.cpp PR ggml-org/llama.cpp#32694, still open; the vLLM one is vllm-project/vllm#69028.

What do you do today instead?

Nothing yet, since neither llama.cpp nor vLLM support is merged. Happy to test a branch and report numbers on an RTX 3090 24 GB with 187 GB RAM (2x Xeon Gold 6252, two NUMA nodes), where we run Qwen3.8-Flash-Next Q6_K on 0.2.17 today.

Activity

  1. codeyumx commented on Nov 21, 2026

    @codeyumx

    Possible according to Claude

    ` - According to that issue, the work needed includes:

    • the loop (layers 6–17 run three times with shared weights)
    • 128-expert top-8 MoE with no shared expert
    • 20 sliding-window attention layers (window 1024) plus 4 global ones
    • softcaps
    • its own MTP drafter (mtp.safetensors)
    • Support elsewhere isn't merged yet either. The llama.cpp PR (Inkling 2 Mini ggml-org/llama.cpp#32694) and the vLLM PR
      ([Model] Add Inkling 2 Mini vllm-project/vllm#69028) are both open, even though GGUFs already exist from ggml-org and Unsloth.

    Why it fits Strata, unlike the 27B

    • Qwen 3.8 27B on Strata? #770 was closed because a dense 27B has to read every weight for every token, so moving weights off the GPU doesn't
      help.
    • Inkling is an MoE model: 26.4B total, 3.4B active, and 5.4B effective per token once you count the three loop
      passes. That's the same size class as Qwen3.6-35B-A3B (35B total, 3B active), which Strata already runs. Strata's
      approach of keeping the busiest experts on the GPU and running the rest from RAM applies here.
    • One difference: the experts in the looped middle layers get used up to three times per token. Strata would probably
      need to keep those on the GPU first and stream the outer layers' experts, as the issue suggests. That's a design
      change, not a reason it can't work.`
  2. baptisterajaut commented on Nov 21, 2026

    @baptisterajaut
    ContributorAuthor

    My claude has been on it for the night, opening PR soon

  3. merbanan commented on Nov 21, 2026

    @merbanan
    Contributor

    @baptisterajaut can you push a WIP branch? I want to test on Turing.

  4. baptisterajaut commented on Nov 21, 2026

    @baptisterajaut
    ContributorAuthor

    WIP branch: https://github.com/baptisterajaut/Strata/tree/feat/inkling2 (not PR-ready yet, see the last paragraph).

    It runs the official NVFP4 + MXFP8 checkpoint entirely on the 3090 (19.5 GB of weights, no offload yet) as a standalone engine, strata-ink2, checked against huggingface/transformers#51050 in fp32: KL 1.4e-12 on a 1600-token text through the decode path with an fp32 KV cache, 1.35e-7 with fp16-input tensor-core prefill, top-1 identical on every position. The KV cache now defaults to fp16 (KL 4.7e-8 with routing forced to the reference's); --kv i8 is Strata's int8 layout and --kv i8r adds the Walsh-Hadamard rotation, at KL 9.2e-5 and 1.7e-5 respectively.

    Decode runs at 90 tok/s on a short context, 80 after a 16k prompt and 60 after 60k. Prefill reaches 2400 tok/s over 60k tokens and sits at the card's 300 W limit. Decode does not: it is bound by the ~1200 kernel launches per token of the three-pass loop rather than by memory bandwidth.

    The model's tokenizer.json sets ignore_merges, which tools/strata_tokenizer.py now honors: 0 mismatches against HF over 1154 strings.

    Not there yet: expert offload to RAM (routing measured on a mixed corpus: an LRU over the expert budget would need 106 MB/token over PCIe with 8 GB of experts on the GPU, 21 MB with 12 GB), the mtp.safetensors drafter, which is DSpark-like (a block of 8 with a Markov RNN head), and the real server: the benchmarks went through a stop-gap OpenAI shim using the HF tokenizer.

  5. merbanan commented on Nov 21, 2026

    @merbanan
    Contributor

    @baptisterajaut thnx, "I'll" start working on this

  6. baptisterajaut commented on Nov 21, 2026

    @baptisterajaut
    ContributorAuthor

    Update on the WIP branch (https://github.com/baptisterajaut/Strata/tree/feat/inkling2), still not PR-ready.

    Expert offload to RAM is in, behind Strata's flag name: --vram-reserve-mib N leaves N MiB free and the experts get what remains, as a GPU-side LRU over every expert, misses copied from pinned RAM inside the decode graph. Output is bit-identical to the all-resident engine, checked with a fifth of the experts resident. With 12 GiB of VRAM in total, 8.5 GiB go to experts and decode runs at 57 tok/s over a 9.6k-token mixed corpus, 74 MB/token over PCIe. That replaces the "21 MB with 12 GB" of my last comment, which assumed 12 GB for the experts alone. A 512k context fits on the whole card: after a 16k prompt, decode at 56 tok/s with the i8r KV cache, 15 tok/s with f16 (3 GiB left for experts).

    The mtp.safetensors drafter runs too (--spec 1): the DSpark-style block of 8 with its Markov head, 8 tokens verified per pass, greedy or with exact speculative sampling. Greedy output matches plain decoding token for token on text continuations; on chat prompts the two drift apart after 180-340 tokens through router near-ties between the two numeric paths. Ablations on a coding chat prompt confirm the drafter: 2.99 tokens per verify, 1.95 without the Markov head, 1.10 without the context K/V. After a 16k prompt in greedy it decodes at 114 tok/s against 83. On chat at temperature 1.0 it gains nothing (2.2 tokens per verify) and an adaptive fallback keeps decode at 86 against 88 tok/s. An 8-token verify costs about 33 ms against 11 ms per plain token, mostly the ~40 distinct experts per layer it touches.

    Next: wiring the engine into the real Strata server, where cold experts can be computed on the CPU instead of crossing PCIe.

  7. cobra91 commented on Nov 21, 2026

    @cobra91
    Contributor

    Hey everyone!

    Sorry about that—we were so focused on getting this running that we jumped straight into the implementation and opened the PR without checking the open issues first! 😅

    Good news: end-to-end support for Inkling 2 is ready in #6506!

    Here is what's implemented and validated:

    • Looped MoE Engine: Full engine support for Thinking Machines Lab's Inkling 2 architecture (Inkling-2-Mini-UD-Q4_K_XL).
    • Dual-GPU Execution: Fully operational on mixed GPU setups (tested on RTX 5080 + RTX 4060 Ti at ~28–38 tok/s).
    • Native Reasoning: Streaming reasoning token handling with separate <thought> parsing and o200k tokenizer support.
    • Full Stack Validation: Tested and confirmed working across CLI, server, and the official Strata Desktop App.

    Feel free to test PR #6506 or share any feedback!

  8. seadra commented on Nov 21, 2026

    @seadra

    Not sure if it contains any useful/relevant bits, but RustingStrata added Inkling 2 Mini support a couple hours ago.

  9. baptisterajaut commented on Nov 21, 2026

    @baptisterajaut
    ContributorAuthor

    Not sure if it contains any useful/relevant bits, but RustingStrata added Inkling 2 Mini support a couple hours ago.

    I know I have a 3090 and not a 3060 but their support seems really cruder than my ongoing work. 220/35 on iq4_NL in a 12gb card seems rather sluggish especially on the prefill side.

  10. merbanan commented on Nov 21, 2026

    @merbanan
    Contributor

    1200 in PP on IQ3 now.

  11. baptisterajaut commented on Nov 22, 2026

    @baptisterajaut
    ContributorAuthor

    #6520 is out of draft and ready for review: the official checkpoint, offload down to 8 GB cards with CPU experts, a conversation cache for agents, pictures and a setup family.

  12. cobra91 commented on Nov 22, 2026

    @cobra91
    Contributor

    Update on #6506: we just pushed a major update addressing the sub-16 GB and mixed-quant GGUF ecosystem!

    For setups with 16 GB GPUs (RTX 4080 / 5080) and multi-GPU rigs, we focused on enabling a Zero-Offload All-Resident execution path to avoid CPU/PCIe transfer bottlenecks:

    1. Native Unsloth UD Support: Added dequantizers for \IQ2_XXS, \IQ2_XS, \IQ2_S, \IQ4_NL, and \Q4_K, along with heterogeneous layer size handling in \ik2.
    2. 100% Resident VRAM on 16 GB: Models like \Inkling-2-Mini-UD-IQ3_XXS\ (11.66 GB) fit entirely in VRAM (10.8 GiB total allocated with FP8 KV cache, leaving ~3.4 GiB free).
    3. Full CUDA Graph Fast-Path: Tokens take the resident CUDA graph path with 0 PCIe swaps, 0 CPU sync, and 0 cache misses during generation.
    4. Measured Benchmarks (RTX 5080 + Windows 11 / MSVC):
      • Single GPU 16 GB on \UD-IQ3_XXS\ (11.66 GB): 79.7 tok/s decode (greedy bit-exact \Paris.).
      • Dual-GPU (RTX 5080 + RTX 4060 Ti) on \UD-Q4_K_XL\ (17.6 GB): 80.7 tok/s decode via asynchronous Expert Parallelism (EP).
      • Speculative decoding: Native MTP drafter (\mtp.safetensors, 635 MB) achieving ~2.45 accepted tokens/step.
    5. Cross-Platform: Fully tested and compiling out of the box on Windows (MSVC / CUDA 13.4) as well as Linux.

    The two PRs are very complementary: #6520 offers CPU offloading on Linux for 8–12 GB cards running the official checkpoint, while #6506 unlocks full-speed All-Resident (>75–80 tok/s) on 16 GB cards and dual-GPU rigs with Unsloth UD GGUFs.

  13. wolffahrer commented on Nov 23, 2026

    @wolffahrer
    Contributor

    Measured Inkling-2-Mini SQ-20 (+ Vision) on 0.2.19 with strata-inkling 0.1.65 built from source, RTX 5090 Laptop 24 GB, Windows 11. Full report and raw data in #6906, the same evening's Qwen3.8-Flash-Next Q2_0 run on the same build in #6907.

    Numbers (greedy, 256 new tokens, engine timings):

    Prompt tokens Prompt tok/s Decode tok/s, DSpark on Decode, --draft off
    3,127 2,501 103.9 71.8
    24,301 1,515 80.4 59.4
    48,693 1,018 59.9 49.2

    Things that may help others on 24 GB cards:

    • Context: with the default KV the engine shrinks --max-context 131072 to 73,280 (Auto-sizing ... 2.94 GiB free VRAM), although inkling_fit.place() reports it as fitting. --kv fp8 keeps the full 131,072 at 11–23 % less decode up to 49K. --chunk 128 only moved the cap to 75,200 and halved prompt reading. --kv k8v8 crashed the engine on the first request here (0xC0000005).
    • Hidden thinking span: with reasoning_effort pinned to "none" the model still writes ~100–200 tokens of <|content_thinking|>, which the server drops. Small max_tokens give empty answers; tools/strata_bench.py (24/100-token caps) and needle_bench.py (40) fail because of it. With an 800-token cap the needle test found 6/6 at 34K and 67K.
    • "drafting": "off" in the run config does not disable DSpark (engine default auto); use --draft off in args. DSpark was worth 29–43 % decode with greedy decoding.
    • The whole model sits in VRAM: 15.3 GiB host RAM in use for the whole system during the run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions