Skip to content

feat(inkling2): map Inkling 2 Mini and bridge to the next turn - #225

Merged
hallerite merged 6 commits into
mainfrom
feat/inkling-2-mini
Nov 25, 2026
Merged

hallerite merged 6 commits into
mainfrom
feat/inkling-2-mini

Conversation

@aniravich

@aniravich aniravich commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What this does

The inkling-2 renderer from #222 (it turns chat messages into token ids) now covers Inkling 2 Mini by name. For each later turn it keeps the earlier tokens and appends only the new messages, instead of rebuilding from text. A rebuild gave other tokens than the stored ones in 130 of 202 stored conversations.

Where it fits

This was found while adding Inkling 2 Mini to prime-rl, and it stands alone.

The Inkling 2 Mini stack: PrimeIntellect-ai/prime-rl#4723, PrimeIntellect-ai/prime-rl#4724, PrimeIntellect-ai/prime-rl#4725, PrimeIntellect-ai/prime-rl#4726, PrimeIntellect-ai/prime-rl#4727, PrimeIntellect-ai/prime-rl#4732.

prime-rl uses this change only once its pin of the renderers library is moved, which none of these pull requests does.

What changes

  • MODEL_RENDERER_MAP maps thinkingmachines/Inkling-2-Mini to inkling-2; the Mini has Inkling 2 Small's tokenizer.
  • New bridge_to_next_turn: appends the chat template's tokens for each new user or tool message.
  • It returns None, and the caller rebuilds from text, for a cut-off reply, an unnamed tool result or another role.

How to try it

# The tests of both models. They download the two tokenizers from the Hugging Face Hub; no access token is needed.
uv sync --locked
uv run pytest tests/test_inkling2.py tests/test_parity.py -m "model and not multimodal" -k "Inkling-2 or inkling2"

How we know it works

  • We replayed 482 episodes stored by one 300-step RL run on 517 terminal tasks. This branch's bridge returned exactly the stored next prompt in all 10,180 turns.
  • Tests with both models' tokenizers: 546 passed.

Limits

  • A reply cut off by the token limit inside a tool call still fails the next request (1.5% of episode attempts in that run).
  • A new user message and Inkling 2 Small are covered by tests only.

🤖 Generated with Claude Code

Note

Add Inkling 2 Mini renderer support and bridge-to-next-turn

  • Maps the exact checkpoint thinkingmachines/Inkling-2-Mini to the inkling-2 renderer in MODEL_RENDERER_MAP and pins its test revision
  • Rewrites template rendering in Inkling2Renderer._apply to mark template-emitted token spellings with a lone-surrogate boundary marker, so special-token spellings inside ordinary message text encode as ordinary text
  • Adds Inkling2Renderer.bridge_to_next_turn, which appends rendered user/tool messages after a completion that ends at a sampling stop or a complete final tool call, preserving the prior prompt and sampled completion IDs. It returns None for empty tails, incomplete completions, unnamed tool messages, and tails with other roles
  • Adds reference parity tests against the published tml_renderers renderer for prompts, supervised token weights, literal delimiters, and sampled turns, running against both Inkling 2 Small and Mini checkpoints
  • Behavioral Change: Inkling2Renderer now reports all effective thinking retention; content attribution in _text_content_mask uses the new ordinary-text encoding

Changes since #225 opened

  • Renamed the install step label in the model job of the test GitHub Actions workflow to refer to the Inkling renderers instead of the Inkling 2 renderer. [0e3289c]
  • Renamed the text encoder in the Inkling renderer and configured it to split special-token strings [f570f36]
  • Removed prefill-specific handling from the Inkling reference parity tests [f570f36]

Macroscope summarized 6f57718.

aniravich and others added 2 commits November 23, 2026 23:29
`thinkingmachines/Inkling-2-Mini` has the same `tokenizer.json` as
Inkling 2 Small, and its chat template renders the same tokens: it
only adds transformers' generation markers around assistant messages.
So it takes the same renderer.

The parity catalog and the Inkling 2 tests now cover both checkpoints
at pinned revisions, and the config table lists the renderer.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`Inkling2Renderer.bridge_to_next_turn` extends a stop-terminated
sampled turn with the template's own span for every new user or tool
message, so the sampled tokens stay exactly as the model produced them
(a full re-render canonicalises a tool call's JSON). The template
renders each message independently of its neighbours, which is what
makes the extension equal to a full render.

It declines, so the caller re-renders, when the extension cannot be
proven equal: a truncated turn (the template would add a close), an
unnamed tool result (its name comes from the issuing assistant, which
the new messages omit), or any other role.

The renderer also declares `effective_thinking_retention = "all"`: the
template keeps every historical reasoning block.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 25, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Approved at f570f36

Macroscope's review found this PR approvable — Adds Inkling 2 Mini support and guarded next-turn bridging, while treating literal delimiters as ordinary content. The model-specific scope and reference-parity coverage leave no obvious material risk requiring human judgment.

Notes:

  • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 25, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 25, 2026
hallerite
hallerite previously approved these changes Nov 25, 2026
@hallerite
hallerite dismissed stale reviews from macroscopeapp[bot] and themself via 0e3289c November 25, 2026 14:53
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Nov 25, 2026
@hallerite
hallerite merged commit bc3b9a2 into main Nov 25, 2026
18 checks passed
@hallerite
hallerite deleted the feat/inkling-2-mini branch November 25, 2026 15:17
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