Skip to content

Inkling 2: a thought budget and a max-tokens cap, both off by default - #2806

Merged
jonathan308 merged 5 commits into
ink-engine/inkling-mtp-fixesfrom
fix/inkling2-limits-dev
Dec 2, 2026
Merged

jonathan308 merged 5 commits into
ink-engine/inkling-mtp-fixesfrom
fix/inkling2-limits-dev

Conversation

@jonathan308

@jonathan308 jonathan308 commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator
  • Adds DARKBLOOM_INKLING_THOUGHT_BUDGET (caps how long an Inkling 2 request may think; the answer is then capped at 8,192 tokens) and DARKBLOOM_INKLING_MAX_TOKENS_CAP (lowers max_tokens when a request asks for more or names none), logs both keys at startup, documents them, and counts the new field in the profile wire test.
  • With both unset, behaviour is unchanged.
  • The four limits commits are the candidate's own, unchanged. The wire-test fix is cherry-picked from e457a3a. All of them shipped in the 0.10.20 candidate without a dev PR.
  • Stacked on Provider 0.10.20 candidate, with the Inkling 2 MTP fixes #2794's branch; it is retargeted to dev after Provider 0.10.20 candidate, with the Inkling 2 MTP fixes #2794 merges.

Part of landing the 0.10.20 release content on dev before the release is cut, as the release review on #2800 asked.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…_THOUGHT_BUDGET)

A Mac that sets DARKBLOOM_INKLING_THOUGHT_BUDGET to a positive number of
tokens caps how long an Inkling 2 row may think. At the budget the provider
ends the thought through the loop guard's existing exit (the inklingThought
markers and LoopExitThinkingContinuation), and the model writes its answer,
capped at 8,192 tokens. A request's reasoning.max_tokens may only lower the
budget. The budget covers the row's first thought (a whole thought inside
one delta is the named exception); the count is per delta, so a row stops at
the budget or at most one delta later.

Unset, 0, off or anything that is not a positive number keeps today's
behaviour exactly. Never with logprobs, for a pair's request, or for
constrained, forced-tool or JSON outputs; one Mac's text path only. It never
uses the engine's per-request reasoning budget, so drafting stays on. A loop
in the thought still takes the exit only where DARKBLOOM_LOOP_EXIT_THINKING
lists the family. A budget stop has its own telemetry operation,
engine_v2_thought_budget. LaunchAgent passes the key through.

Tests: InklingThoughtBudgetTests (11).
…_MAX_TOKENS_CAP)

A Mac that sets DARKBLOOM_INKLING_MAX_TOKENS_CAP to a positive number of
tokens, C, lowers an Inkling 2 request's engine max_tokens to C when the
request asks for more or names none. On a segmented KV pool a row prepays
its prompt plus max_tokens, so a 65,536-token request then prepays its
prompt plus C, and more of them fit beside the rows already running.

This changes the contract for such a request: a row that would run past C
ends there with finish_reason length. Pair it with the thought budget as
C >= B + 8,192 plus a margin, so a row the budget stopped is never cut.

Unset, 0, off or anything that is not a positive number keeps today's
behaviour exactly; other models and a pair's requests are untouched. It
applies on the text and media paths. A request that applied the cap records
it on its profile (max_tokens_cap). LaunchAgent passes the key through.

Tests: InklingMaxTokensCapTests (11).
When DARKBLOOM_INKLING_THOUGHT_BUDGET or DARKBLOOM_INKLING_MAX_TOKENS_CAP
is set, darkbloom start logs one line per key on the config logger, once
per process, beside the retired-knob warnings and before the serving-mode
split, so the local server and the coordinator modes both say it. It also
echoes each line to stderr, unbuffered, as it echoes those warnings:

- a set key, by its name and the number it set: info, "info: KEY=N";
- a value that is not a positive whole number, by the key's name only:
  warning, "warning: KEY: invalid, ignored".

The raw value is never logged. With neither key set, nothing new is logged.
The unified log keeps the lines private, as it does every config line.

Tests: InklingThoughtBudgetTests (12), InklingMaxTokensCapTests (12).
Document DARKBLOOM_INKLING_THOUGHT_BUDGET and DARKBLOOM_INKLING_MAX_TOKENS_CAP
in the configuration reference, beside the other Inkling 2 keys: the values
each accepts, the default (off), where each is read, what it does, the
startup line it logs, and that the LaunchAgent forwards it. The pairing rule
for the two values (C at least the budget plus 8,192 and a margin) is stated
with the cap.

Add a changelog fragment for both keys, so the next release preparation
renders them into CHANGELOG.md with the other entries.

Docs only: no source or test file changes.
The Inkling 2 max-tokens cap added one stored property to the per-request
profile, max_tokens_cap: an optional count, absent unless the cap applied.
The test that guards the profile's wire shape counts its stored properties,
so that a new field is a deliberate change, and checks that none of them is
a String. The new field is a count, so only the expected total moves, from
60 to 61, with the comment's tally of counts and flags from 26 to 27.

Test-only, one test: no source file changes.

Tests: ProtocolTests (profilerWireObjectsHaveNoStringStoredProperties).

(cherry picked from commit e457a3a)
@jonathan308 jonathan308 added the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 1, 2026
@vercel

vercel Bot commented Dec 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference-landing Ready Ready Preview Dec 1, 2026 9:26pm UTC
darkbloom-status Ready Ready Preview Dec 1, 2026 9:26pm UTC
eigen-homepages-darkbloom Ready Ready Preview Dec 1, 2026 9:26pm UTC

Request Review

@github-actions github-actions Bot removed the run-ci Trigger one-shot PR CI run (auto-removed when run starts) label Dec 1, 2026

@davidtai davidtai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by David, with one request. CI is green. Both keys are off by default, so nothing changes on DevNet. The docs and changelog match. Merge order for the stack: this PR first, then #2807, #2811 and #2821. Then retarget #2824 to ink-engine/inkling-mtp-fixes. #2794 merges into dev last.

  1. Low, MultiModelBatchSchedulerEngine.swift:1308: no test drives the scheduler path where only the budget builds the thought exit. InklingThoughtBudget.current (InklingThoughtBudget.swift:34) is a static let, so no test can set it. Add a seam and one wiring test: an Inkling request with the budget set stops its thought, and the continuation answers.

@jonathan308
jonathan308 merged commit a9a12f0 into ink-engine/inkling-mtp-fixes Dec 2, 2026
30 checks passed

This branch was successfully deployed

3 active deployments
Preview – eigen-homepages-darkbloom — c6bc30e8 Deployed Dec 1, 2026 by vercel[bot]
Preview – d-inference-landing — c6bc30e8 Deployed Dec 1, 2026 by vercel[bot]
Preview – darkbloom-status — c6bc30e8 Deployed Dec 1, 2026 by vercel[bot]
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