Skip to content

Inkling 2: budget forcing and streamed tool-call arguments (follow-up to #401) - #404

Merged
AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/budget-forcing-20261122
Nov 23, 2026
Merged

AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/budget-forcing-20261122

Conversation

@data-angel

Copy link
Copy Markdown
Contributor

Follow-up to #401, as agreed there: the two commits that came after its verified head e6a8a0420. This branch is
e6a8a0420 plus fed29ccdc and d1b138e67, so until #401 merges the diff here shows #401's commits too.

What

Budget forcing (fed29ccdc)

Inkling loops in its reasoning at high effort (its model card says so; vLLM's image loops on the same prompts). The
scheduler's thinking budget, THINK_LOOP watchdog and forced think-end never applied: <|end_message|> closes every
block, so Inkling had no scheduler think boundary. Now the scheduler gets its markers through
SchedLimits::message_open (<|message_model|>): a header followed by <|content_thinking|> opens the reasoning block
(recorded, not consumed; the turn rewrite reads every marker), any other first block means the answer began, and only
the reasoning block's <|end_message|> closes it. Over budget or on a watchdog fire, the existing injector closes it with
<|end_message|> at a sentence boundary (the DFlash forced accept unchanged) and the model opens its answer block.
Under the mode the post-close mask keeps <|end_message|> open (it bars a second reasoning block only after an engine
close), the mid-word defer is off, and greedy thinking rows keep the GPU argmax. MODEL.toml: max_thinking_budget = 8192
(effort 2K/4K/8K/16K/32K), watchdog on, spec_think = true.

Measured on one GB10 (Spark weights, DSpark, temperature 0): of 150 MMLU-Pro questions at high effort, 30 were still
reasoning at 8,192 tokens and 22 of those at 32,768 (vLLM's image: 21 of the same 30 at 8,192; 14 at temperature 1.0).
With budget forcing, same 30, 32,768 tokens: correct 5 -> 18, never answered 22 -> 1 (the engine closed 20 replies; 11
loops became correct answers, 7 wrong, 1 correct answer became wrong). At low effort nothing changes (126 vs 125 of 150).
Receipts: Enntity/sparkinkling results/2026-11-22-reasoning-loops.

Streamed tool-call arguments (d1b138e67)

  • Tool-call arguments stream: once a tool block reads {"name":NAME,"args":, inkling_turn.rs opens the Hermes
    envelope and passes the argument tokens through as they arrive (a < re-encoded as \u003c), so the tool parser's
    JSON path streams function.arguments; a block of any other shape is rewritten whole at its close. With the tool
    guard on, the guard still holds a call's deltas until the whole call passes, as for every other model.

Changes outside the Inkling files

  • Scheduler: SchedLimits::message_open and the block mode above (other models unchanged; promote_completed_prefills
    and build_active_seq_from_prefill take SchedLimits); a new [behavior] spec_think field (default false) ORed into
    the DFlash spec-think opt-in.

These touch the shared scheduler (think state, the post-close mask, the greedy fast path, prefill phases) behind
SchedLimits::message_open, which only Inkling sets.

Test plan

  • Scheduler tests for the block mode (reasoning opens only after a header and the think start, a close outside the
    reasoning is never a stray, the forced close and the post-close mask); spark-server bin suite passes apart from
    the three tests that need a .git directory
  • inkling_turn tests feed the rewrite token by token through StreamingToolDetector: arguments arrive before
    the close and, for compact call JSON, the bytes equal the whole-call rewrite's; spark-server bin suite passes
    apart from the three tests that need a .git directory
  • GB10: on the SparkInkling image built at fed29ccdc, task probe 30/30 arithmetic and 10/10 tool calls in both
    modes and the 30 looping MMLU-Pro questions above; streamed arguments on the image built one commit after
    d1b138e67 (63-75 argument chunks with the tool guard off, valid JSON; whole with the guard on)
  • The Inkling gate and the Qwen3.8-27B no-regression check (lp_dump, greedy C1/C8 with thinking on): running on
    the maintainers' side against d1b138e67

Authorship

AI-authored: Claude (Opus 5.5 and Fable 5.2) in Claude Code, directed and reviewed by a human; no hand-written code.

CLA

  • I have read and agree to the Contributor License Agreement.

🤖 Generated with Claude Code

data-angel and others added 2 commits November 22, 2026 11:48
Inkling 2 loops in its thinking at high effort, and the engine's thinking
budget, THINK_LOOP watchdog and forced think-end never applied: its
`<|end_message|>` closes every block, so the scheduler had no think
boundary at all.

The scheduler now gets Inkling's markers (think end `<|end_message|>`,
think start `<|content_thinking|>`) plus the block opener
`<|message_model|>` as `SchedLimits::message_open`, which switches the
think state to blocks for this model only:

- a turn starts between blocks (the first block may be the answer);
- `<|message_model|><|content_thinking|>` opens the turn's reasoning,
  recorded, not consumed (InklingTurn reads every marker), with the
  request's budget (the server ceiling when thinking is off);
- any other first block means the answer began; an `<|end_message|>`
  outside the reasoning is never a stray;
- the post-close mask keeps `<|end_message|>` open and bars a second
  reasoning block only after an engine close; the mid-word defer is off;
- the forced injector and the DFlash forced accept close with
  `<|end_message|>` unchanged; greedy thinking rows keep the GPU argmax
  (nothing in the pipeline acts there until the close is armed).

MODEL.toml: max_thinking_budget 8192 (effort 2K/4K/8K/16K/32K),
think-loop watchdog on, A4 floor 0, eos_ends_thinking (an end token ends
the turn as before), and a new `[behavior] spec_think` field so Inkling
keeps speculating through its reasoning. No new ATLAS_* names (1139).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A tool block's body was held whole and rewritten into a Hermes envelope
at its close, so a client saw a call's arguments only once the call had
finished. Once the body reads {"name":NAME,"args":, the envelope now
opens and the argument tokens pass through as they arrive; the tool
parser's JSON path streams them on. A < is re-encoded as \u003c, as the
whole-call rewrite does, and a body of any other shape is still rewritten
whole at its close. For compact call JSON the bytes are the same as the
whole-call rewrite's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AzeezIsh

Copy link
Copy Markdown
Contributor

Closing and reopening to re-run CI against current main. The earlier runs were computed against the pre-#401-merge main, so their file-size failures were #401's unsplit files.

@AzeezIsh AzeezIsh closed this Nov 23, 2026
@AzeezIsh AzeezIsh reopened this Nov 23, 2026
@AzeezIsh

Copy link
Copy Markdown
Contributor

GB10 gate of #404 at d1b138e67 (sparky job 186): merge-ready (cc @data-angel)

Native fresh-worktree builds: inkling c80b75fd, qwen3.8-27b bbb86af5, main 7e068375e qwen 7e3254f0. Same arms, flags and env as job 175 on e6a8a0420.

check 175 (e6a8a0420) 186 (d1b138e67)
Strict serial: tools / arith / needle 14/14 · 40/40 · 9/12 14/14 · 39/40 · 12/12
Strict serial: C1 vs C8 greedy, cross-contamination, cache hit == cold 8/8 · 8/8 · 6/6 8/8 · 8/8 · 6/6
Strict serial: decode C1 / aggregate C8 35.7 / 107.6 35.7 / 107.9
Spark + DSpark + adaptive: tools / arith / needle 14/14 · 40/40 · 12/12 14/14 · 40/40 · 12/12
Spark: decode prose / code / json 55.6 / 58.9 / 54.7 58.4 / 57.2 / 56.2
Spark: aggregate C1 / C8, ~41K prefill 54.5 / 123.0, 3,333–3,367 54.3 / 121.1, 3,336–3,371
Spark: poisoning gate (collapsed), agentic ×10 0 · 10/10 5.04 s/turn 0 · 10/10 4.82 s/turn
Spark: ST-995 80.00 / 80.34 (job 165, db19431be) 79.90 / 80.21 (run-1795422706984004792)
Strict + DSpark (MIN 1.2): tools / needle / cache hit / agentic 14/14 · 11/12 · 6/6 · 10/10 6.50 s/turn 14/14 · 11/12 · 6/6 · 10/10 7.23 s/turn
Qwen3.8-27B vs main (shared scheduler) — lp_dump max|Δ| 0.0000 over 26,912 tokens; greedy C1 8/8 and C8 8/8 identical
ERROR / panic 0 0

Static checks: fmt and clippy -D warnings are clean. The full spark-server suite passes 3,391, with 1 failure: closure_attestation::the_baked_attestation_reproduces_from_the_tree. It fails identically on main at a subset ATLAS_TARGET_MODEL, so it's environmental. Env names: 1,139, the same as main.

CI on the current merge ref: the workspace jobs (fmt, clippy, cargo test, ≤500 LoC) pass. Env budget, PR benchmark gate and cargo deny are red on main too.

AMD. These strix-hip checks ran on main + #404 plus a strix-hip MODEL.toml that mirrors this PR's [behavior] hunk. That mirror goes in as a small follow-up after this merges.

  • Start script: --check exits 0 in both modes on framework.
  • task_probe: 30/30 math and 10/10 tools.
  • Greedy at reasoning none: 8/8 identical to main's binary.
  • Your looping MMLU-Pro prompts at high effort: two are bit-identical to main. The third, i=20, hits finish=length at 32,768 tokens with no answer on main; with budget forcing it ends with finish=stop at 16,595 tokens and Answer: C, which is correct.
  • DevLab runner: agentic ×10 passes 10/10.

@AzeezIsh
AzeezIsh merged commit 686c13d into Atlas-Inf:main Nov 23, 2026
46 of 54 checks passed
AzeezIsh added a commit that referenced this pull request Nov 23, 2026
's [behavior])

strix-hip: Inkling 2 Mini budget forcing on AMD (mirror #404's [behavior])
data-angel added a commit to Enntity/atlas that referenced this pull request Nov 23, 2026
…split, Atlas-Inf#403, Atlas-Inf#404, Atlas-Inf#406, Atlas-Inf#410) into the images follow-up

Two conflicts, both from the split of 401: layers/inkling2/mod.rs declares
owner_runs and proj, and inkling2_proj_gemv joins the PDL list in its new
file pdl_inkling2.rs. The tree equals this branch's five commits replayed
onto main.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
data-angel added a commit to Enntity/atlas that referenced this pull request Nov 25, 2026
Brings the branch up to main (76 commits: Inkling 2 Mini Atlas-Inf#401/Atlas-Inf#404/Atlas-Inf#410,
Atlas-Inf#332 and the rest). Nine conflicts, each two additions in the same place,
resolved as unions: the config parser imports and the dispatch list,
kv_only_prefix_cache_is_safe (deepseek_v41 and inkling2_loop both false),
the factory loaders and its supported-model list, the aux-state model list,
the PDL module doc, the tokenizer modules, tool_call_ids_in_template
(main's matches! for Inkling, this branch's `!= ChatEncoding::Jinja`, since
ChatEncoding is now Jinja | Deepseek(dialect)), and tool_defaults.toml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants