Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog.d/qwen38-mtp-forced-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Qwen3.8 forced tool calls

- The embedded-MTP Qwen3.8-27B build now advertises `tool_choice` `required`
and named-function support, like the original build it replaced, and forced
calls accept the catalog's default `qwen3_5` parser instead of failing with
an invalid request.
7 changes: 6 additions & 1 deletion docs/architecture/inference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Provider inference engine

> Last updated: 2026-10-20
> Last updated: 2026-10-21

How a chat-completion request is served inside the `darkbloom` provider
process: one in-process engine (`mlx-swift-lm`
Expand Down Expand Up @@ -712,6 +712,11 @@ Resolution happens before submit so a bad parser name never orphans a request.

`.kimiK2` and `.minimaxM2` exist but are selectable only explicitly.

Required/named `tool_choice` on a Qwen 3.5-family checkpoint accepts its
inferred `.qwen35` parser or `.xmlFunction`. Both concrete Qwen3.8-27B builds,
including the embedded-MTP one, advertise forced tools
(`ToolChoiceEnforcementPolicy.swift`).

### Chat-template render check

The Qwen 3.5, 3.6 and 3.8 and Ternary Bonsai 2 templates (`qwen3_5`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ enum ToolChoiceEnforcementPolicy {
case structuredPostValidation
}

static let qwen38ConstrainedModelID = "EigenLabs/Qwen3.8-27B-4bit"

/// Per-model wire capability, never inferred from a caller's model label.
/// Other families retain their existing media/grammar behavior until their
/// complete forced-choice and tool-result-media paths are qualified.
Expand Down Expand Up @@ -74,7 +72,7 @@ enum ToolChoiceEnforcementPolicy {
if nativeStructuredTarget(context) {
return true
}
return model.id == qwen38ConstrainedModelID
return ModelRuntimeRequirements.qwen38ConcreteModelIDs.contains(model.id)
&& Qwen35TemplateFix.applies(to: context)
}

Expand Down Expand Up @@ -150,7 +148,7 @@ enum ToolChoiceEnforcementPolicy {
return
}
let nativeQwen = type == "qwen4_exp" || type == "qwen4_exp_text"
|| type == "prism_hadamard_qwen35"
|| type == "prism_hadamard_qwen35" || type?.hasPrefix("qwen3_5") == true
let framedFormat: ToolCallFormat = nativeQwen ? .qwen35 : .nemotron
guard format == .xmlFunction || format == framedFormat else {
throw MultiModelBatchSchedulerEngineError.invalidToolPayload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct NativeModelToolChoiceTests {
}

@Test func nativeQwenParserAcceptanceDoesNotBroadenOtherFamilies() throws {
for type in ["qwen4_exp", "qwen4_exp_text"] {
for type in ["qwen4_exp", "qwen4_exp_text", "qwen3_5"] {
let context = ChatTemplateFixContext(modelId: "owned-flash-next", modelType: type)
for mode: ToolConstraintMode in [.required, .named("add")] {
let strategy = try ToolChoiceEnforcementPolicy.forcedStrategy(mode: mode, modelContext: context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ struct NativeToolCapabilityAdvertisementTests {
private var legacyModels: [ModelInfo] {
[model("gemma-4-qualified", "gemma4_text",
template: Gemma4ToolConstraintContract.pinnedTemplateSHA256),
model("EigenLabs/Qwen3.8-27B-4bit", "qwen3_5")]
model("EigenLabs/Qwen3.8-27B-4bit", "qwen3_5"),
model("EigenLabs/Qwen3.8-27B-4bit-mtp", "qwen3_5")]
}

private var unsupportedModels: [ModelInfo] {
Expand Down
Loading