feat(cpu): add Qwen3.5 4B multimodal support - #698
Conversation
📝 WalkthroughWalkthroughThe PR adds Qwen3.5 4B multimodal configuration and quantization files. It extends checkpoint and runtime validation for 0.8B and 4B variants, adds test coverage, and documents 4B multimodal conversion and execution. ChangesQwen3.5 4B multimodal support
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mllm/models/qwen3_5/configuration_qwen3_5.hpp (1)
313-362: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winDocument the public multimodal predicate APIs.
Line 330 adds
hasOfficialQwen35_4BTextGeometrywithout an API comment. The predicate comments in this range also omit required parameter and return details. Add consistent Doxygen comments for each public predicate, including itsconfigparameter, boolean return condition, and error behavior.As per coding guidelines, public APIs, classes, and functions must have clear docstrings or comments explaining purpose, parameters, returns, and errors.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@mllm/models/qwen3_5/configuration_qwen3_5.hpp` around lines 313 - 362, Add consistent Doxygen documentation to hasOfficialQwen35_4BTextGeometry, isOfficialQwen35_08BMultimodalRuntimeConfig, isOfficialQwen35_08BRuntimeConfig, isOfficialQwen35_4BTextRuntimeConfig, isOfficialQwen35_4BMultimodalRuntimeConfig, isOfficialQwen35_4BRuntimeConfig, and isOfficialQwen35MultimodalRuntimeConfig. Each comment must state the predicate’s purpose, describe the config parameter, define when it returns true, and document that evaluation does not report or throw errors.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@mllm/models/qwen3_5/configuration_qwen3_5.hpp`:
- Around line 313-362: Add consistent Doxygen documentation to
hasOfficialQwen35_4BTextGeometry, isOfficialQwen35_08BMultimodalRuntimeConfig,
isOfficialQwen35_08BRuntimeConfig, isOfficialQwen35_4BTextRuntimeConfig,
isOfficialQwen35_4BMultimodalRuntimeConfig, isOfficialQwen35_4BRuntimeConfig,
and isOfficialQwen35MultimodalRuntimeConfig. Each comment must state the
predicate’s purpose, describe the config parameter, define when it returns true,
and document that evaluation does not report or throw errors.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 7da02a2c-9e92-4828-9778-6ecfb8b01bbf
📒 Files selected for processing (7)
examples/qwen3_5/README.mdexamples/qwen3_5/config_4B_multimodal_w4a32_kai.jsonexamples/qwen3_5/quant_cfg_4B_multimodal_w4a32_kai.jsonexamples/qwen3_5/test_validators.pyexamples/qwen3_5/validate_checkpoint.pymllm/models/qwen3_5/configuration_qwen3_5.hpptests/cpu/Qwen35ConfigTest.cpp
What this PR does
Extends the existing Qwen3.5-4B text runtime to the image, ordered multi-image,
and bounded short-video CPU path already supported by Qwen3.5-0.8B:
--image_path, and optional local MP4 useEnd-to-end demos
Single image
Prompt
Qwen3.5-4B Multimodal on OnePlus 13T
Ordered multi-image
Prompt
Qwen3.5-4B Multimodal on OnePlus 13T
Bounded short video
Prompt
Qwen3.5-4B Multimodal on OnePlus 13T
The auxiliary Pixel 9 Pro XL produced byte-identical token-ID records for all
three cases.
Review guide
configuration_qwen3_5.hppvalidate_checkpoint.py,test_validators.pyconfig_4B_multimodal_w4a32_kai.json,quant_cfg_4B_multimodal_w4a32_kai.jsonQwen35ConfigTest.cpp,README.mdCurrent-head validation
Candidate HEAD:
55e59c30dbecb524467ae42514a24b8bdc2f232aValidated local commit:
3439b8bd8e0a3f96b314ad92fd71c7003a42da82Identical source tree:
1d8e8e93064724f22f82579073b5abd54809ecc0Merged-main base:
b9b46ae416514ec7b516f36b44be7d8e28b79cebgit diff --check, clang-format dry-run, and both runtime/quant JSON parses passedFull validation details
Qwen/Qwen3.5-4B@851bf6e8...2b38d8bb...fd12552d...; explicitenable_thinking=false[1,14,20]; multi[1,14,20]+[1,22,46]; video[4,8,12][0,2,4,6,9,11,13,15]; patches[384,1536]The H20, Android, and phone rows are retained from the sealed pre-merge 4B
candidate. They validate the exact 4B model/config/conversion contract and the
three product workloads, but are not described as exact-head closure after the
#697 squash/refactor. Exact-head device replay remains a Draft-PR follow-up.
How to convert and run
Use
config_4B_multimodal_w4a32_kai.jsonwith the existing Qwen3.5 runner.Repeat
--image_pathfor ordered images, or use--video_pathin adecoder-enabled build.
Known limits
Builds on the bounded Qwen3.5-0.8B video support in #697.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation