# Inkling-2-Small on 4× DGX Spark with long-context tool-call fix (experimental)

Status: experimental. Measured: 2026-11-27 (page updated 2026-11-27). Web page: https://aidenle.com/recipes/inkling-2-small-tool-fix-sglang-4x-dgx-spark/
Image: `aidendle94/sparkrun-sglang-inkling2-gb10:experimental-1.10`

The Inkling-2-Small 4-bit KV cache recipe with a gated server-side hook that keeps tool-call and system-prompt rules active past 200K tokens. Model weights stay stock, short single-turn prompts are untouched, and turns 61–70 batching rises from 0% to 60%.

**Time:** One script; about 17 min to the first answer once the weights are on the nodes

**Result:** Stock Inkling-2-Small weights with 60% parallel tool-call batching at turns 61–70 (up from 0%), 24/24 coding tests passing, and a 1.41M-token 4-bit KV cache

## What you need

- Four DGX Spark nodes with nothing else on their GPUs, linked by a RoCE network
- ssh without a password from one node to the other three, and Docker usable without sudo
- About 130 GB free in the home directory of every node

## Overview

> **Warning: Experimental.**
>
> - Uses the same development image, 4-bit KV cache and hooks as [Inkling-2-Small with a 4-bit KV cache](https://aidenle.com/recipes/inkling-2-small-nvfp4-kv-sglang-4x-dgx-spark.md), with the same open problems.
> - Adds one opt-in request hook (`SYSTEM_REINFORCE=user`) for long-horizon system-prompt and tool-call adherence. Model weights are untouched.
> - Served on one four-node fleet since 2026-11-27.

This recipe serves [Inkling-2-Small](https://huggingface.co/thinkingmachines/Inkling-2-Small) on four DGX Spark nodes with stock weights, a 4-bit (NVFP4) KV cache of 1,409,000 tokens, and a server-side fix for long-session tool calling. On stock serving, 40 of the model's 48 layers only read the last 1,024 tokens, so system-prompt tool rules fade after the first turn.

A gated request hook repeats a short summary of the active system instructions at the end of long or multi-turn prompts without saving it to history. On a 70-turn repository coding benchmark, parallel tool-call batching at turns 61–70 rose from 0% to 60% and shell-lookup rule violations fell from 67 to 27, while short single-turn prompts stay bit-identical to stock.

> **Code.**
>
> Code and full technical notes (MIT): [github.com/aidendle94/sparkrun-recipes](https://github.com/aidendle94/sparkrun-recipes/tree/main/recipes/inkling-2-small/sglang-tool-fix). Weights, about 93 GB a node: [aidendle94/Inkling-2-Small-DGX-Spark](https://huggingface.co/aidendle94/Inkling-2-Small-DGX-Spark). Image: `aidendle94/sparkrun-sglang-inkling2-gb10:experimental-1.10`. The image and weights have their own licences.

## Build

### Run it

1. **Find each node's fabric address.** It is the address on the 200G port: `ip -br addr` lists it next to an interface named like `enp1s0f0np0`.
2. **Let the first node log in to the others.** On the first node, run `ssh-copy-id <address>` once for each of the other three.
3. **Let your user run Docker on every node.** Run `sudo usermod -aG docker $USER`, then log out and in again.
4. **Run the script on the first node.** It checks every node, pulls the image, downloads each node’s 93 GB of weights, starts the fleet with `SYSTEM_REINFORCE=user` enabled, verifies the hook loaded, and sends a first request. If a step fails, it says what to fix; run the same command again.

setup · the first node:

```bash
git clone https://github.com/aidendle94/sparkrun-recipes
cd sparkrun-recipes/recipes/inkling-2-small/sglang-tool-fix
./quickstart.sh <node-0> <node-1> <node-2> <node-3>   # your four fabric addresses, this node first

# Only the checks, nothing changed:
./quickstart.sh --check

# First request (port 8210 on the first node).
curl -s http://<first-node>:8210/v1/chat/completions -H 'content-type: application/json' \
  -d '{"model":"inkling-2-small","messages":[{"role":"user","content":"Is 91 prime?"}],"max_tokens":400}'
```

day to day:

```bash
./quickstart.sh --status                # serving? KV cache and system-reinforce status?
./quickstart.sh --stop                  # stop the fleet and its watchdog
launch/relaunch.sh                      # start or restart with the tool-call fix
SYSTEM_REINFORCE= launch/relaunch.sh    # disable the hook (stock serving)
KV_NVFP4= launch/relaunch.sh            # switch to the 8-bit (FP8) KV cache
```

## Performance

| 70-turn DSH-lite benchmark, 2026-11-27 | Stock serving | This recipe (SYSTEM_REINFORCE=user) |
|---|---|---|
| Batched turns (≥ 2 calls), turns 61–70 | 0.0% (1.00 calls/turn) | **60.0% (2.20 calls/turn)** |
| Batched turns (≥ 2 calls), turns 41–70 | 0.0% (1.00 calls/turn) | **66.7% (2.17 calls/turn)** |
| Batched turns (≥ 2 calls), all 70 turns | 0.0% (1.00 calls/turn) | **35.7% (1.60 calls/turn)** |
| Shell-lookup violations, all 70 turns (lower is better) | 67 | **27** |
| Shell-lookup violations, turns 31–70 (lower is better) | 39 | **3** |
| Maximum context reached | 118,858 tokens | 248,774 tokens |
| CJK characters cleaned across the repository | 2,887,682 | 2,891,826 |

Pi coding scaffold, temperature 1.0, high thinking effort, system-prompt-only batching policy, direct against port 8210 with no proxy.

| Coding regression check (ledger_service), 2026-11-27 | Stock serving | This recipe (SYSTEM_REINFORCE=user) |
|---|---|---|
| Unit tests passed | 24 / 24 | 24 / 24 |
| Turns to completion | 25 | 26 |
| Batchable turns, all turns | 78.3% (3.04 calls/turn) | 77.8% (3.89 calls/turn) |
| Batchable turns, turns 16–35 | 75.0% (3.00 calls/turn) | **83.3% (4.17 calls/turn)** |
| Shell-lookup violations (lower is better) | 2 | **1** |

Same fleet and Pi scaffold, temperature 1.0, high thinking effort. Model weights and short single-turn prompts are unchanged.

Measured: 2026-11-27, stock weights with SYSTEM_REINFORCE=user against stock serving on the same fleet

Experimental: the Inkling-2-Small 4-bit KV cache recipe with gated transient system-prompt reinforcement, measured at temperature 1.0 with high thinking effort.

| Measurement | Value | Note |
|---|---|---|
| Prefill · cold, 30K / 120K tokens | 3,248 / 2,840 tok/s | Same 4-bit KV cache and 8,192-token prefill chunks as the NVFP4 recipe |
| Decode · one stream, temperature 1.0 | 56.9 tok/s | Same stock weights and 4-bit KV cache; short single-turn prompts are untouched |
| Context | 524K tokens | Per request |
| KV pool | 1.41M tokens | 4-bit (NVFP4) KV cache, target and draft pools |
| Tool batching · turns 61–70 | 60.0 % | Up from 0.0% on stock serving (2.20 vs 1.00 calls/turn at 205K–249K tokens) |
| Tool batching · turns 41–70 | 66.7 % | Up from 0.0% on stock serving across the final 30 turns of DSH-lite |
| Shell-lookup violations | 27 / 3 all / T31–70 | Down from 67 / 39 on stock serving across 70 turns |
| Coding regression check | 24 / 24 tests | 83.3% batchable turns in turns 16–35 (4.17 calls/turn), 1 shell violation |

**DSH-lite 70-turn parallel tool batching by turn window** (% of turns with ≥ 2 parallel tool calls · higher is better)

|  | Stock serving | This recipe (SYSTEM_REINFORCE=user) |
|---|---|---|
| Turns 31–40 | 0 | 40 |
| Turns 41–50 | 0 | 70 |
| Turns 51–60 | 0 | 70 |
| Turns 61–70 (205K–249K tok) | 0 | 60 |

Pi coding scaffold, temperature 1.0, high thinking effort, system-prompt-only batching policy, direct on port 8210.

**Shell-lookup rule violations during the 70-turn DSH-lite run** (violations · lower is better)

|  | Stock serving | This recipe (SYSTEM_REINFORCE=user) |
|---|---|---|
| All 70 turns | 67 | 27 |
| Turns 31–70 | 39 | 3 |
| Turns 61–70 | 10 | 1 |

Dedicated read, grep, find and ls calls instead of shell lookup commands in bash.

## Notes

#### Client notes

- **Works on all three APIs:** the hook runs inside the Inkling message renderer, so `/v1/chat/completions`, `/v1/messages` and `/v1/responses` all use it.
- **Short single-turn prompts stay bit-identical:** the hook skips requests with no assistant turns and under 3,600 prompt characters, requests with no system message, and assistant prefills.
- **Prefix caching stays intact:** the reminder is transient and never stored in client history, so earlier turns still reuse the prefix cache.
- **Tuning the reminder:** set `SPARK_SYSTEM_REINFORCE_MAX_CHARS` (default `1200`) or `SPARK_SYSTEM_REINFORCE_MIN_CHARS` (default `3600`) in `NCCL_EXTRA`.

#### If the script stops

- **Cannot log in without a password:** run `ssh-copy-id <user>@<address>` from the first node.
- **Docker does not answer:** add the user to the `docker` group on that node and log in again.
- **No RDMA device:** the 200G port of that node is not set up for RoCE.
- **Not enough disk:** free about 130 GB in that node’s home directory.
- **Not an address of this node:** run the script on the node you list first.

#### Known problems

- **The open problems of the base recipe apply here too:** see [Inkling-2-Small on SGLang](https://aidenle.com/recipes/inkling-2-small-sglang-4x-dgx-spark.md).
- **Transient token cost:** active multi-turn requests add up to about 300 tokens of condensed system instructions at the end of the prompt on each turn.
- **Weight-only edits were not adopted:** lowering `log_scaling_n_floor` and scaling 33 global retrieval heads gave 0% batching on DSH-lite and dropped coding batching from 78.3% to 10.5%.
