r/LocalLLaMA • u/eesahe • 3d ago
Discussion Inkling 2 Mini on RTX 4090 ~200 tok/s with vLLM, FP8 + NVFP4 + its built-in drafter
Got Thinking Machines’ new Inkling 2 Mini running on a single RTX 4090 at about 190-220 tokens/s, up from ~117 out of the box. It needed a few small patches to vLLM, which doesn’t support 4090s for this model yet.
This is with NVFP4 experts (W4A16) + FP8 W8A16 attention/head/embeddings, FP8 KV.
This fits in 24 GB with a 35k context, and an initial quality metric on some sample prompts reported about a 0.4% loss in perplexity.
9
u/kryptkpr Llama 3 3d ago
Would love to see the sm89 patches
15
u/eesahe 3d ago
Sure, here is a patch packaged by Claude:
7 one-line changes on top of vLLM PR #69028 (vLLM nightly 0.34.0rc1.dev1103, torch 2.14.0+cu130, Triton 3.8.0). It edits installed packages in place, so recommended to use a dedicated venv.
import glob, os, sys, sysconfig SP = sys.argv[1] if len(sys.argv) > 1 else sysconfig.get_paths()["purelib"] CAP = "current_platform.is_device_capability_family(120)" SM89 = CAP + " or current_platform.is_device_capability(89)" EDITS = [ ("vllm/models/inkling2/quant_config.py", " return 90\n", " return 89\n"), # min capability ("vllm/models/inkling2/nvidia/ops/conv_mix.py", "if " + CAP + ":\n # Native conv/mix", "if " + SM89 + ":\n # Native conv/mix"), # portable conv/mix path, as on SM12x ("vllm/models/inkling2/nvidia/attention.py", "if " + CAP + ":\n supported +=", "if " + SM89 + ":\n supported +="), # fp8 KV cache ("vllm/models/inkling2/speculator_config.py", "if " + CAP + ":\n # The target's clipped", "if " + SM89 + ":\n # The target's clipped"), # DSpark draft KV stays bf16 ("triton/language/extra/cuda/gdc.py", '"griddepcontrol.wait; // dummy $0"', '"mov.u32 $0, 0;"'), ("triton/language/extra/cuda/gdc.py", '"griddepcontrol.launch_dependents; // dummy $0"', '"mov.u32 $0, 0;"'), ("triton/backends/nvidia/driver.py", "self.launch_pdl = metadata.launch_pdl", "self.launch_pdl = False"), ] # last three: no programmatic dependent launch (sm90+ PTX); kernels just run in stream order for rel, old, new in EDITS: p = (glob.glob(os.path.join(SP, rel)) or [os.path.join(SP, rel)])[0] s = open(p).read() if s.count(old) != 1: sys.exit(f"{rel}: no unique match (already patched or different version)") open(p, "w").write(s.replace(old, new)); print("patched", rel)That gets the stock checkpoint running at ~117 tok/s on a 4090. The jump to ~190-220 comes from FP8 attention/lm_head/embeddings with a small W8A16 Triton kernel, plus DSpark. That's a separate, bigger patch.
3
u/kryptkpr Llama 3 2d ago edited 2d ago
You rock, it works! slightly tweaked to keep changes inside vllm and leave Triton alone
Batching on 2x L40S looks decent
APIServer pid=442320) INFO 11-21 08:28:50 [loggers.py:347] Engine 000: Avg prompt throughput: 149.6 tokens/s, Avg generation throughput: 1732.0 tokens/s, Running: 63 reqs, Waiting: 1 reqs, Finished: 19 reqs, GPU KV cache usage: 21.1%
I see what you mean about the bare embeddings and lmhead a little FP8 would make the soup tastier
7
u/aarong691 3d ago
The drafter's acceptance rate would be interesting alongside tok/s, speculative decoding speed depends heavily on how often its guesses are accepted.
7
u/chris_0611 2d ago
35k context
aiii
1
u/Practical-Collar3063 2d ago
There has to be something wrong with OP's set up regarding KV cache.
KV cache memory requirement's scaling is theoritically half of qwen 27b
4
u/No-Library8065 2d ago
190 to 220 t/s on a 4090 is a big jump from 117. the 4090 patches are probably what most people here will want
3
u/Holiday_Point_603 2d ago
"fits with 35k context" is hilarious for a Model that size lol. But nice speeds!
1
u/Practical-Collar3063 2d ago
There has to be something wrong with OP's set up regarding KV cache.
KV cache memory requirement's scaling is theoritically half of qwen 27b
2
u/winky9827 2d ago edited 2d ago
This fits in 24 GB with a 35k context
Yeah this model is a big fail. The context VRAM requirement is absolutely bonkers for a 26b MoE model. Either the Inkling team was high, or they don't understand the target audience.
Edit: I was wrong. This model is awesome. Running on basalt with better performance, but there's a llama.cpp fix in the works too, I think.
0
u/Practical-Collar3063 2d ago
why would you discard completely a model based on some random redditor's number. he did not provide his exact set up and env variables. The theoretical scaling of inkling mini's kv cache is half of what Qwen 27b is. There is something wrong with OP's set up
0
u/LightBroom 2d ago edited 2d ago
No it's not, 24GB VRAM fits 64k q8_0 context with llama.cpp
At the same time llama.cpp reports much lower numbers so the reporting is probably probably broken
Edit:
There's large computer buffer being allocated and dependent on the -ub parameter. This is with ub at 512, on my desktop PC (7900XTX) and 32k context
I'll eventually try it on my main llm rig where I have much more VRAM available to see how much I can fit. But, it's slower than Qwen 27b on AMD so not sure if it's worth it yet. Llama.cpp crashes when compiled with HIP so I had to use Vulkan for this one.
| memory breakdown [MiB] | total free self model context compute unaccounted | | - Vulkan0 (RX 7900 XTX (RADV NAVI31)) | 24560 = 3031 + (20414 = 16330 + 678 + 3404) + 1114 | | - Host | 628 = 469 + 0 + 159 |This is with 64k context
| memory breakdown [MiB] | total free self model context compute unaccounted | | - Vulkan0 (RX 7900 XTX (RADV NAVI31)) | 24560 = 1322 + (22123 = 14263 + 1222 + 6636) + 1114 | | - Host | 2790 = 2535 + 0 + 255 |2
u/Practical-Collar3063 2d ago
No it's not
Inkling mini’s architecture having a theoretical scaling of half Qwen 27b’s KV cache is an actual verifiable fact.
Now what you are talking about is the implementation in llama.cpp, those new architecture tend to have bugs.
People are already reporting much better max context window on other engines: https://www.reddit.com/r/LocalLLaMA/comments/1y2b459/inkling_2_mini_on_2_rtx_3090_557k_context_vision/ This person report 177k token max context window on a single RTX 3090 and that is with the additional memory footprint of Dspark and BF16 KV Cache.
There seems to be unexplained memory overhead on llama.cpp at the moment for this model
0
u/LightBroom 2d ago
There seems to be unexplained memory overhead on llama.cpp at the moment for this model
Yeah, looks like maybe the KV cache has multiple copies per batch for the inner loops, who knows.
1
u/mesolimbic-bliss 3d ago
let the inference engine begin for Inkling-mini! by tomorrow we'll be getting 200 tps on 24gb vram
1
u/Poprouter 2d ago
those counters are handy for this. grab spec_decode_num_accepted_tokens_total and spec_decode_num_draft_tokens_total, then divide the first by the second. no separate run needed, the gain is in generation rather than prefill.
1
1
25
u/YetAnotherAnonymoose 3d ago
How did you even get 117 out of the box? In the prebuilt llama.cpp from Unsloth I only get 40-60t/s...