Render past tool calls with the empty header this model writes

#7
Thinking Machines Lab org

TML-d24-varloop-research writes its tool calls with an empty message header:

<|message_model|><|content_invoke_tool_json|>{"name":"bash","args":{...}}<|end_message|>

The chat template, and SGLang's built-in Inkling 2 renderer, render every past tool call with the tool's name in that header (<|message_model|>bash<|content_invoke_tool_json|>), as Inkling-2-Mini writes it. Once earlier tool calls are in the conversation, the model often copies the name into its next header and then writes the call as plain text without <|content_invoke_tool_json|>, so the response comes back with no tool call. Turns with no tool call were about 11% in a multi-turn coding agent.

This PR:

  • config.json: adds "tool_call_author_name_mode": "independent" to text_config, so serving stacks know which header the checkpoint writes.
  • chat_template.jinja: the tool-call header carries the assistant message's own name (empty when it has none) instead of the tool's name. Nothing else in the template changes.

SGLang support: https://github.com/zcnrex/sglang/pull/5 adds --inkling2-tool-call-author-name-mode and reads its default from this config.json field. It has landed into the upstream Inkling 2 PR, https://github.com/sgl-project/sglang/pull/51926. With the latest version of that PR, the model works with no extra flags. transformers / apply_chat_template users get the fix from the updated template.

With both changes, turns with no tool call went to 0 in the same agent setup, through SGLang's renderer and through the chat template.

aurick changed pull request status to merged

Sign up or log in to comment