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.

Get the free recipe

Install with an AI agent

Install this model

Paste this into an AI coding agent that can run commands on the machine that will serve the model (the head node, for a Spark cluster), such as Claude Code or Codex. It reads the recipe, adapts it to your setup, starts the server and checks that it works.


        
DGX Spark in bold black letters inside a looping line on a dotted white background with violet light, with Thinking Machines at the top and Inkling-2-Mini at the bottom

Performance

Measured, not promised.

One request48.3tok/s, prose
Eight at once145.0tok/s combined
Prefill3,072.2tok/s, 32K prompt
Context262Kper request, 8 at once

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.

Prompttok/sFirst token
4K3,497.11.34 s
8K3,343.62.62 s
16K3,252.55.21 s
32K3,072.210.84 s
64K2,749.624.01 s
128K2,267.357.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.

RequestsTotal tok/sPer requestFirst token
148.348.371 ms
274.937.6312 ms
4106.127.9366 ms
8145.020.1697 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.

TensorFold Zig · Inkling-2-Mini · 1× DGX Spark
48.3 tok/sSample text, played at the measured speed

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 withWhat it serves
./start.shThinking Machines' Inkling-2-Mini at a pinned revision, downloaded automatically and SHA-256 verified
RERISKED=1 ./start.shA 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.

PatchesWhat they do
0001-0004Drafted 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-0009Kernel 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-0012vLLM-compatible reasoning_effort and reasoning field; bf16 decode attention prefetch (cp.async); opt-in FP8 attention projections (TF_INKLING2_ATTN_FP8=1)
0013Structured 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
0014Exact speedups: 4,096-row prompt passes and a 64-entry CUDA graph cache for drafted and multi-row verify rounds
0015Blackwell'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
0016Native 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)
0017Server 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.

1

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.

2

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_url data URLs, 4 a request by default and up to 100 with VISION_MAX_IMAGES. VISION_URLS=1 also allows http(s) URLs; VISION=0 serves text only. An image that can't be decoded is an HTTP 400.
  • Structured output: response_format (json_schema, json_object), guided_regex and guided_choice.
  • Tool calling: tool_choice auto, required or a named function.

Memory

How the 128 GB is spent.

With the defaultsGiB
Weights (17.60 target + 1.54 DSpark + 0.59 vision), plus scratch~19.7
Active KV: 8 streams at 262,144 tokens, 5.56 each44.5
Engine total, before the prompt cache~59.7
Prompt cache: what is left after the reserve, on an idle Spark16.0
Reserve kept free9.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.

SettingDefaultMeaning
PORT8888Where the API listens
PARALLEL8Requests served together; each gets a full CONTEXT window
CONTEXT262144Prompt + reply window per stream, up to 1,048,576
KV_DTYPEfp8bf16 is the exact cache
DRAFTS1DSpark drafts; 0 turns them off
VISION1The vision tower (about 0.59 GiB); 0 serves text only
THINKING / REASONING_EFFORT1 / unsetThinking on or off, and an optional default effort, from none to max
MAX_TOKENS32768The reply budget when a request sets none
TENSORFOLD_MEMORY_RESERVE_GIB9Memory kept free when the KV and prompt cache are sized
TF_INKLING2_ATTN_FP81FP8 attention projections; 0 for exact bf16
TF_INKLING2_PREFILL_TC1The FP4/MXFP8 prefill tensor cores; 0 for exact bf16
RERISKED01 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.sh builds 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.

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.