Inkling 2 Mini on vLLM Day-0 Support for Looped Model

TL;DR

  • Looped layers: Inkling 2 Mini runs its middle 12 layers three times per token with shared weights, each pass maintaining its own KV cache and reading gated messages from the previous pass.
  • Model specs: 26 B total parameters, 3.5 B active parameters, up to 1 M token context, multimodal MoE with NVFP4 experts (MXFP8 in the last 4 layers) and a native DSpark speculator.
  • vLLM integration: Day‑0 support on NVIDIA Blackwell, Hopper and DGX Spark; per‑pass caches are handled as regular cache layers, and message reads and controllers are fused for speed.
  • RL serving: Compatible with SkyRL for reinforcement‑learning workloads.
  • Variable‑loop checkpoint: The research checkpoint TML-d24-varloop-research lets users choose the number of passes and whether passes share a KV cache.

Model Architecture: The Loop

Inkling 2 Mini divides its 24 transformer layers into three logical sections:

  • Prelude (layers 0‑5): Executes once.
  • Loop core (layers 6‑17): Executes three passes with shared weights. Each pass starts from the prelude output and receives messages from the previous pass.
  • Coda (layers 18‑23): Executes once after the final core pass.

Each core pass reads a distinct message at every sub‑layer input (query, key, value, and MLP). A rank‑64 controller merges the message with the input using a gated‑forget/gain formulation:

h   = W_down · [rms(input), rms(message)]
out = (1 − tanh(W_forget · h)) · input + tanh(W_gain · h) · message

With 12 core layers and four inputs per layer, a later pass processes 48 messages per token. Every pass maintains its own KV and convolution‑state caches, resulting in 48 KV caches for the model.

The DSpark draft operates inside the loop, reading hidden states at four points (once in the prelude and once in each of the second and third passes, plus the final output).

All layers reuse Inkling 2 Small’s components: block‑attention residuals, relative‑bias attention with gating, short convolutions, and 128 routed experts (top‑8) in NVFP4 (layers 0‑19) and MXFP8 (layers 20‑23). Image inputs are processed by a 23‑layer ViT encoder identical to Inkling 2 Small’s.


Serving Inkling 2 Mini in vLLM

Per‑Pass Cache Management

vLLM registers each additional core pass as a separate attention layer, giving each its own KV and conv‑state caches. The existing cache‑manager and prefix‑caching logic handle these caches without modification.

Fused Message Reads and Controllers

A naïve implementation would launch four separate message‑read kernels and four controller kernels per core layer. vLLM instead:

  1. Reads all four messages for a layer in a single attention‑residual kernel.
  2. Stacks controller weights so the down‑ and gain/forget projections execute as batched GEMMs.
  3. Computes RMS normalizations in one Triton kernel.
  4. Merges messages with the sub‑layer’s RMSNorm in a fused FP32 kernel (no FMA contraction), matching the reference implementation.

Fused Sub‑Layer Kernels

For Inkling 2 Small, vLLM already fused each sub‑layer’s all‑reduce, short convolution, residual update, attention‑residual mix, and RMSNorm into one kernel. vLLM extended these kernels to hidden size 2,304, added a mode that returns the FP32 mix before RMSNorm (required for later passes to merge messages), and applied them at all tensor‑parallel sizes. When TP > 1, small batches also fuse the all‑reduce over NVLink multicast.


Variable‑Loop Research Checkpoint

Thinking Machines released TML-d24-varloop-research, a checkpoint that can run with a configurable number of core passes. vLLM exposes two runtime options via --hf-overrides:

  • loop_num_passes: Number of core passes (minimum 1, default 3). Fewer passes reduce latency; more passes improve quality. DSpark requires the default three passes because its draft reads are fixed.
  • loop_share_cache: When true, all passes share a single KV cache, overwriting keys/values each pass. Convolution‑state caches remain per‑pass.

Both options are rejected for the fixed‑loop checkpoint (Inkling 2 Mini).

Performance Impact (TP1, 4K context, forward‑only)

Passes Decode step, batch 1 Decode step, batch 32 KV cache capacity
1 1.51 ms 3.81 ms 352 K tokens
2 2.67 ms 5.92 ms 233 K tokens
3 3.85 ms 8.11 ms 175 K tokens
3, shared KV cache 3.86 ms 8.10 ms 194 K tokens

Sharing the KV cache saves less memory than dropping a pass because per‑pass conv‑state caches remain.


Accuracy Evaluation

vLLM preserves the reference implementation’s numerics: identical data types, NVFP4/MXFP8 activation quantization, and FP32 message merges. The only difference is reduction order, which is negligible. On a fixed prompt, hidden states after each of the 48 layer visits differ by roughly the same amount as the variance between FlashAttention‑4 and PyTorch attention paths. MoE outputs match bit‑for‑bit when inputs are identical.

End‑to‑end evaluations include:

  • Needle‑in‑a‑haystack retrieval up to 1 M tokens.
  • MMMU‑Pro and HLE benchmarks using inkling-verify.
  • GSM8K with DSpark enabled. All tests confirm that vLLM’s serving matches the reference model’s accuracy.

Getting Started

A Docker image with Inkling 2 Mini support is available as vllm/vllm-openai:inkling-2-mini. Example commands:

# Serve Inkling 2 Mini
docker run --gpus all --ipc=host -p 8000:8000 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \
  vllm/vllm-openai:inkling-2-mini thinkingmachines/Inkling-2-Mini \
  --reasoning-parser inkling --tool-call-parser inkling --enable-auto-tool-choice \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"probabilistic"}'

# Serve variable‑loop checkpoint with 2 passes sharing KV cache
docker run --gpus all --ipc=host -p 8000:8000 \
  -v ~/.cache/huggingface:/root/.cache/huggingface \
  vllm/vllm-openai:inkling-2-mini thinkingmachines/TML-d24-varloop-research \
  --reasoning-parser inkling --tool-call-parser inkling --enable-auto-tool-choice \
  --hf-overrides '{"text_config": {"loop_num_passes": 2, "loop_share_cache": true}}'

Acknowledgements

The integration benefited from close collaboration with the Thinking Machines and NVIDIA teams.

Sources