MiniMax-M3 Native Tool-Call Parser#2008
Merged
Merged
Conversation
Contributor
Author
|
the short story of this PR, Minimax M3 was very unreliable with tool calls. Initially I thought it was the model, that is why I switched to GLM-5.2. However I thought surely Minimax M3 Q6 should not be worse the smaller Qwen 27B, 35B. After asking and pushing codex, eventually I understood that the PR $1963 last week was problematic. Sorry breaking change, codex insisted on keeping the template but I think that is confusing having a template that is not really used most of the time. |
firecoperana
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds native MiniMax-M3 chat-template parsing support for tool calls and reasoning extraction.
MiniMax-M3 uses its own namespace token and XML-like function-call format:
The previous PR #1963 used a MiniMax-M2-style
<parameter name="...">format. That was parser-friendly, but it did not match the native MiniMax-M3 template and caused fragile downstream behavior with clients expecting native M3 output.Changes
common/chat.cpp.<mm:think>...</mm:think>intoreasoning_content.tool_calls.models/templates/MiniMax-M3.jinjaoverride, which used the old M2-style compatibility wrapper.Validation
common/chat.cppandtests/test-chat-template.cppagainst two existing compile databases.contentwas emptyreasoning_contentcontained hidden reasoningtool_callscontained a structured function call with JSON argumentsNotes
This intentionally relies on the native MiniMax-M3 chat template, normally embedded in the GGUF metadata. No external
--chat-template-fileoverride is required when the model already carries the native template.This is a breaking cleanup for the old PR #1963 MiniMax-M3 template override. That file preserved a MiniMax-M2-style
<parameter name="...">wrapper and should not be kept now that native M3 tool parsing is supported directly.The parser handles MiniMax-M3 generation prompts that already end with
<mm:think>, so generated reasoning is still extracted intoreasoning_contentinstead of leaking into visiblecontent.