Recipe · one DGX Spark · Zig engine
Inkling 2 Mini on one DGX Spark, with TensorFold's Zig engine.
Serve Thinking Machines' Inkling 2 Mini from a single DGX Spark, through an OpenAI-compatible API, with 8 requests at once at a full 262,144-token window each, image input, structured output and tool calling. It runs TensorFold's Zig engine, at Jürgen Schmied's Inkling 2 Mini CUDA engine, with 17 patches on top: DSpark drafts, an FP8 KV cache, native CUDA vision and Blackwell's FP4 and MXFP8 tensor cores for prefill. 48.3 tok/s for one request, 145.0 tok/s for eight at once, and 3,072.2 tok/s prefill on a 32K prompt. One command downloads the weights, builds the engine, starts the server and runs a smoke test.
Performance
Measured, not promised.
Measured with sparkDash on one DGX Spark (GB10, sm_121): 8 requests at once at 262,144 tokens each, FP8 KV, DSpark drafts, FP8 attention projections and the FP4/MXFP8 prefill tensor cores on.
Prefill
How fast a prompt is read, by prompt size, and the time to first token.
| Prompt | tok/s | First token |
|---|---|---|
| 4K | 3,497.1 | 1.34 s |
| 8K | 3,343.6 | 2.62 s |
| 16K | 3,252.5 | 5.21 s |
| 32K | 3,072.2 | 10.84 s |
| 64K | 2,749.6 | 24.01 s |
| 128K | 2,267.3 | 57.99 s |
Decode, prose
Temperature 0.7, thinking on, top-k 20, DSpark drafts: all requests together, per request, and the time to first token.
| Requests | Total tok/s | Per request | First token |
|---|---|---|---|
| 1 | 48.3 | 48.3 | 71 ms |
| 2 | 74.9 | 37.6 | 312 ms |
| 4 | 106.1 | 27.9 | 366 ms |
| 8 | 145.0 | 20.1 | 697 ms |
Code decodes a little faster: 56.1 tok/s for one request and 149.4 for eight at once, in the recipe's README.
Speed preview
What 48.3 tok/s feels like.
Sample text played at the measured speed, at about four characters a token: one request at 48.3 tok/s, or four at once at 27.9 tok/s each (106.1 combined). Switch between them in the window.
The model
A small looped MoE, as it was published.
Inkling 2 Mini has 26.4B parameters, 3.4B of them active (about 5.4B effective): a looped mixture of experts with 24 physical layers, the middle 12 run three times for 48 visits a token, 8 of 128 experts a layer, and 40 sliding 1,024-token attention visits plus 8 over the whole context. A 23-layer vision encoder (0.59 GiB) reads images. The NVIDIA ModelOpt checkpoint keeps the experts in NVFP4 (layers 0-19) and MXFP8 (20-23), and its bf16 MTP module is the DSpark drafter.
| Start with | What it serves |
|---|---|
./start.sh | Thinking Machines' Inkling-2-Mini at a pinned revision, downloaded automatically and SHA-256 verified |
RERISKED=1 ./start.sh | A local Inkling-2-Mini-Derisked folder: Blackfrost's derivative with most safety refusals removed. Never downloaded automatically; treat its output as untrusted data |
Blackfrost's own deployment kit ships only for vLLM. This recipe serves the derivative on TensorFold with the same behaviour: vLLM's reasoning_effort and reasoning field, the SHA-256 checks and the readiness gate.
The engine
Powered by TensorFold.
TensorFold, by Ash Hart, is an open-source engine that serves language models on Apple Silicon and NVIDIA GPUs through an OpenAI-compatible API. This recipe runs its Zig engine, tensorfold-native, at Jürgen Schmied's Inkling 2 Mini CUDA engine (PR #4441, commit dc2ca8a1), built in NVIDIA's PyTorch container for the Spark's sm_121.
Eight full windows
The weights take about 19.7 GiB, so the FP8 KV cache holds 8 streams of 262,144 tokens each, 2,097,152 active tokens in 44.5 GiB, with a prompt cache of up to 16 GiB on an idle Spark.
DSpark drafts
The checkpoint's own MTP module drafts tokens ahead on CUDA. Drafted replies match "draft": false ones token for token, which tools/exact.py checks.
Blackwell tensor cores
Prefill runs the experts on the GB10's native block-scaled FP4 and MXFP8 tensor cores, straight over TensorFold's packed weights, in 4,096-row prompt passes.
Prompts kept
A chat's next turn resumes from the prompt cache: 99.4% to 99.5% of each follow-up reused at 30K, with a warm prefill of 0.22 s.
On top of TensorFold
What the 17 patches do.
| Patches | What they do |
|---|---|
| 0001-0004 | Drafted verify windows with exact conv rollback and taps; the CUDA DSpark drafter (mtp.safetensors); --kv-cache fp8; Inkling 2's reply, reasoning and tool parser (ajensenwaud's PR #4124) |
| 0005-0009 | Kernel speedups, all exact: a tiled loop mix, batched DSpark holds, an FP8 draft head and layers, a 2-warp NVFP4 expert split, a certified lazy unembedding head, warp top-k, fused sliding prompt attention and multi-row projections |
| 0010-0012 | vLLM-compatible reasoning_effort and reasoning field; bf16 decode attention prefetch (cp.async); opt-in FP8 attention projections (TF_INKLING2_ATTN_FP8=1) |
| 0013 | Structured output (response_format, guided_*) and tool_choice (required or a named function) on CUDA, with grammar-masked draws and libtfgrammar.so built from the patched tree |
| 0014 | Exact speedups: 4,096-row prompt passes and a 64-entry CUDA graph cache for drafted and multi-row verify rounds |
| 0015 | Blackwell's native block-scaled tensor cores for the prefill experts (TF_INKLING2_PREFILL_TC=1): prompt activations quantized once a layer (38 MiB of scratch), FP4 for layers 0-19 and MXFP8 for 20-23, straight over TensorFold's packed weights |
| 0016 | Native CUDA vision (inkling2_vision): the image processor for PNG, JPEG and WebP with EXIF orientation, the 23-layer encoder with tensor-core attention, and image embeddings spliced into the prompt (--vision) |
| 0017 | Server fixes: the reply grammar is freed when a stream fails to start; an opt-in guard and logs for tool calls; up to 100 images a request; --dashboard-open |
Checked on this Spark
With the defaults and all 17 patches: greedy replies identical, token for token, drafted, with "draft": false and six at once; 99.4% to 99.5% prompt reuse over four follow-up turns; 16 context-boundary checks; a passphrase found in a 199,951-token prompt at 10%, 50% and 90% depth; structured output and tool_choice 10 of 10; and vision 17 of 17, including a corrupt image refused with HTTP 400.
The lossy defaults
On a 734-problem set (arithmetic, word problems, code tracing, logic, record lookups at 8K to 120K tokens), the model scored 732 of 734 both with the tensor-core prefill and without it. Its top-1 agreement with the exact path is 96.3%. KV_DTYPE=bf16, TF_INKLING2_ATTN_FP8=0 and TF_INKLING2_PREFILL_TC=0 serve exactly.
What you need
One Spark, and a little disk.
One DGX Spark
One NVIDIA DGX Spark, or another GB10 system with 128 GB of unified memory (aarch64).
Free memory
Loading takes about 25 GiB, and each stream holds its whole window from the start. start.sh stops before launching when there isn't enough free memory for the settings.
Docker
Docker with the NVIDIA Container Toolkit, and your user in the docker group.
Disk
About 40 GB under Docker's root for the image, plus about 20 GB for the checkpoint.
Quick start
One command, start to finish.
Clone and start
git clone https://github.com/MiaAI-Lab/Inkling-2-Mini-DGX-Spark-TensorFold.git
cd Inkling-2-Mini-DGX-Spark-TensorFold
./start.sh
The first run downloads thinkingmachines/Inkling-2-Mini (about 18.8 GB, resumable), builds the sm_121 image, verifies the checkpoint's SHA-256 once, starts the server on port 8888 and runs a smoke test. DRY_RUN=1 ./start.sh prints the docker run command and changes nothing.
Talk to it
Any OpenAI client works with base_url = "http://<spark>:8888/v1", and Messages-format clients with /v1/messages. The model reasons before it answers, so give replies enough max_tokens.
curl -s http://<spark>:8888/v1/chat/completions -H 'Content-Type: application/json' -d '{
"model": "Inkling-2-Mini",
"messages": [{"role": "user", "content": "Write a Python fibonacci function."}],
"max_tokens": 2000
}'
./start.sh restart # restart (checks the settings before stopping)
PARALLEL=4 ./start.sh restart # fewer streams, more prompt cache
./stop.sh # stop
docker logs -f inkling2-mini-tf # logs
Images, JSON and tools
It can see, and follow a schema.
- Images: PNG, JPEG and WebP as OpenAI-style
image_urldata URLs, 4 a request by default and up to 100 withVISION_MAX_IMAGES.VISION_URLS=1also allows http(s) URLs;VISION=0serves text only. An image that can't be decoded is an HTTP 400. - Structured output:
response_format(json_schema,json_object),guided_regexandguided_choice. - Tool calling:
tool_choiceauto,requiredor a named function.
Memory
How the 128 GB is spent.
| With the defaults | GiB |
|---|---|
| Weights (17.60 target + 1.54 DSpark + 0.59 vision), plus scratch | ~19.7 |
| Active KV: 8 streams at 262,144 tokens, 5.56 each | 44.5 |
| Engine total, before the prompt cache | ~59.7 |
| Prompt cache: what is left after the reserve, on an idle Spark | 16.0 |
| Reserve kept free | 9.0 |
Every stream reserves its full window at startup. The prompt cache shrinks when other containers share the memory.
Settings
The ones you might change.
Set these in the environment (PARALLEL=4 ./start.sh restart) or in .env next to start.sh; the environment wins. Every default is in the recipe's scripts/config.sh.
| Setting | Default | Meaning |
|---|---|---|
PORT | 8888 | Where the API listens |
PARALLEL | 8 | Requests served together; each gets a full CONTEXT window |
CONTEXT | 262144 | Prompt + reply window per stream, up to 1,048,576 |
KV_DTYPE | fp8 | bf16 is the exact cache |
DRAFTS | 1 | DSpark drafts; 0 turns them off |
VISION | 1 | The vision tower (about 0.59 GiB); 0 serves text only |
THINKING / REASONING_EFFORT | 1 / unset | Thinking on or off, and an optional default effort, from none to max |
MAX_TOKENS | 32768 | The reply budget when a request sets none |
TENSORFOLD_MEMORY_RESERVE_GIB | 9 | Memory kept free when the KV and prompt cache are sized |
TF_INKLING2_ATTN_FP8 | 1 | FP8 attention projections; 0 for exact bf16 |
TF_INKLING2_PREFILL_TC | 1 | The FP4/MXFP8 prefill tensor cores; 0 for exact bf16 |
RERISKED | 0 | 1 serves a local Inkling-2-Mini-Derisked folder |
The API
/v1/chat/completions, /v1/completions, /v1/responses, /v1/messages (Messages format), /v1/models, /tokenize, /detokenize, /health and /metrics, with the model Inkling-2-Mini. When all PARALLEL slots are busy, a new request is refused rather than queued.
Thinking
The model reasons even at reasoning_effort: "none", so give replies enough max_tokens. "chat_template_kwargs": {"reasoning_effort": "low"} adjusts it per request, and "draft": false turns drafting off for one.
Licenses
Free, with a few rules.
- The recipe is MIT. That covers the repository's scripts only.
- The weights are not part of it: Inkling 2 Mini is Apache-2.0 with Thinking Machines' Model Acceptable Use Policy, and Inkling-2-Mini-Derisked comes under its upstream terms and notices.
- The image
scripts/prepare.shbuilds is based on NVIDIA's PyTorch container, under the NVIDIA Software License Agreement and the Product-Specific Terms for NVIDIA AI Products. By running the image you accept them. It also carries the licenses of xgrammar, libjpeg-turbo and libwebp.
Credits
Built on the work of others.
- TensorFold and
tensorfold-nativeby Ash Hart and the TensorFold contributors - Jürgen Schmied (@jschmied): the Inkling 2 Mini CUDA engine this recipe builds on (#4441, #4640)
- @ajensenwaud: Inkling 2's kernels and reply parser (patch 0004, #4124-#4128), whose drafter kernels this recipe's drafter adapts
- @BlivionIaG, @sethforprivacy, @gilby and @akol1: Inkling 2 Mini on Metal, its DSpark drafter and fixes, and the plan for Mini on CUDA and Metal
- Basalt by @jesdga95: the Blackwell prefill and chunking ideas
- SvangenStudios (PR #28): the reply-grammar leak fix in patch 0017; @321sssrt-bit:
tools/context_boundary.py - Inkling 2 Mini by Thinking Machines; Inkling-2-Mini-Derisked by Blackfrost
- xgrammar by the MLC-AI team, libjpeg-turbo, libwebp, Zig by the Zig Software Foundation and its contributors, and NVIDIA CUDA
Patches 0001-0003 and 0005-0017 are mine; 0004 is ajensenwaud's. The scripts adapt those of my Qwen3.8 Flash Next recipe. The full list is in the recipe's CREDITS.md.
Run it on your DGX Spark.
Free and open, with every patch published.