Bug: text-only Qwen3.5/Qwen3.6 MoE models are auto-detected as VLM and fail without vision_config
Summary
ModelArchitectureProbe currently treats qwen3_5, qwen3.5, and qwen3_5_moe as unconditional vision model types.
This causes text-only Qwen3.5/Qwen3.6 checkpoints that use model_type: "qwen3_5_moe" to be routed through the VLM loader even when config.json contains no vision_config.
The result is a startup failure such as:
[SwiftLM] Auto-detected VLM config (qwen3_5_moe); enabling vision mode.
[SwiftLM] Loading VLM (vision-language model)...
Error: Failed to parse config.json ... Missing field 'vision_config'
Reproduction
Using current main:
.build/release/SwiftLM \
--model destynova002/Qwen3.6-35B-A3B-mixed-3-4bit-3.85bpw-mlx \
--port 5413 \
--ctx-size 14336 \
--mem-limit 8192 \
--max-tokens 1536 \
--parallel 1 \
--stream-experts \
--ssd-prefetch
The model is text-only and has no vision_config, but SwiftLM detects qwen3_5_moe as VLM.
Cause
Sources/MLXInferenceCore/ModelArchitectureProbe.swift includes:
"qwen3_5",
"qwen3.5",
"qwen3_5_moe",
inside knownVisionModelTypes.
Because supportsVision checks membership in this set, the model_type alone is sufficient to force VLM mode.
This is ambiguous in the same way already documented in the file for Gemma 4: the same architecture/model type can exist in both text-only and multimodal forms, so model_type alone should not force VLM routing.
Proposed fix
Remove the three Qwen3.5/Qwen3.6 entries from knownVisionModelTypes and rely on the existing vision-specific indicators:
vision_config
- known vision processor
image_processor_type
This preserves VLM detection for genuine multimodal checkpoints while allowing text-only Qwen3.5/Qwen3.6 MoE models to use the LLM loader.
Patch attached: swiftlm-qwen35-moe-vlm-detection.patch
Bug: text-only Qwen3.5/Qwen3.6 MoE models are auto-detected as VLM and fail without
vision_configSummary
ModelArchitectureProbecurrently treatsqwen3_5,qwen3.5, andqwen3_5_moeas unconditional vision model types.This causes text-only Qwen3.5/Qwen3.6 checkpoints that use
model_type: "qwen3_5_moe"to be routed through the VLM loader even whenconfig.jsoncontains novision_config.The result is a startup failure such as:
Reproduction
Using current
main:The model is text-only and has no
vision_config, but SwiftLM detectsqwen3_5_moeas VLM.Cause
Sources/MLXInferenceCore/ModelArchitectureProbe.swiftincludes:inside
knownVisionModelTypes.Because
supportsVisionchecks membership in this set, themodel_typealone is sufficient to force VLM mode.This is ambiguous in the same way already documented in the file for Gemma 4: the same architecture/model type can exist in both text-only and multimodal forms, so
model_typealone should not force VLM routing.Proposed fix
Remove the three Qwen3.5/Qwen3.6 entries from
knownVisionModelTypesand rely on the existing vision-specific indicators:vision_configimage_processor_typeThis preserves VLM detection for genuine multimodal checkpoints while allowing text-only Qwen3.5/Qwen3.6 MoE models to use the LLM loader.
Patch attached:
swiftlm-qwen35-moe-vlm-detection.patch