MiniCPM-V-4.7-35B-A3B-MNN
MNN-format conversion of openbmb/MiniCPM-V-4.7-35B-A3B. Model developer: OpenBMB.
Model overview
MiniCPM-V 4.7 is OpenBMB's multimodal model family for efficient local inference. The original models combine single-image, multi-image and video understanding with early visual-token compression inside the vision encoder. This reduces computation in later encoder layers; the upstream architecture supports 4x and 16x compression to trade visual detail against inference cost. This is the 35B-total, approximately 3B-active MoE variant, selecting a subset of language experts per token.
This overview summarizes the original model card. Refer to it for training details, upstream evaluations and intended uses.
| Property | Value |
|---|---|
| Language backbone | Qwen3.5 MoE; 256 routed experts, top-8 |
| Vision | Patch-14 ViT, early window merger, final MLP merger |
| This export | 16x visual compression, up to 9 image slices |
| Inputs / outputs | Text and images / text |
MNN conversion
Language linear weights: HQQ4, block 64, FP16 scales. Input embeddings: BF16. Vision weights: HQQ8, block 128, with per-channel quantization where the input channels are not divisible by 128.
- Public converter/runtime baseline: MNN 3.6.1, commit d662ce36175956038cfd6ed13f84cb3343a287d2.
- Source checkpoint:
896c2d454672476a7b45dcc5e3f0c700a0218577, the Hugging Face Git revision used for the source weights. - Export environment: Transformers 5.18.0, PyTorch 2.13.0, ONNX 1.16.0, HQQ 0.2.8.post1.
- Export options are saved in export_args.json; source provenance and runtime-file SHA256 checksums are in conversion.json.
- MiniCPM-V 4.7 adapter source snapshot:
584f2fe333bc1ad221becb75f25ad6fddfe52918. The public baseline alone predates this adapter. Use an exporter/runtime containing this adaptation; follow MNN issue #5015 for upstream availability.
Files
| File | Size (MiB) | Purpose |
|---|---|---|
llm.mnn | 8.19 | Language graph |
llm.mnn.weight | 18321.51 | Language weights, including tied embeddings when configured |
embeddings_bf16.bin | 969.31 | BF16 input embeddings |
visual.mnn | 0.47 | Vision graph |
visual.mnn.weight | 568.50 | Vision weights |
tokenizer.mtok | 7.00 | MNN tokenizer |
Sizes describe storage, not peak RAM or GPU allocation. Keep graphs, weights, tokenizer and both config files together.
Download
hf download taobao-mnn/MiniCPM-V-4.7-35B-A3B-MNN --local-dir ./MiniCPM-V-4.7-35B-A3B-MNN
If your environment uses the mirror, set HF_ENDPOINT=https://hf-mirror.com first.
Build and convert
Use an MNN source tree with IndexedLinear support and the MiniCPM-V 4.7 adapter noted above. From its root:
cmake -S . -B build -DMNN_BUILD_LLM=ON -DMNN_LOW_MEMORY=ON \
-DMNN_BUILD_CONVERTER=ON -DMNN_BUILD_LLM_OMNI=ON -DMNN_BUILD_OPENCV=ON -DMNN_IMGCODECS=ON
cmake --build build --target llm_demo llm_bench MNNConvert -j4
For Metal add -DMNN_METAL=ON; for Android OpenCL use the Android NDK toolchain and -DMNN_OPENCL=ON. Use matching backend-enabled binaries.
Download the original checkpoint at the recorded revision, install the exporter's dependencies, then run from transformers/llm/export:
python llmexport.py \
--path /path/to/original/MiniCPM-V-4.7-35B-A3B \
--export mnn --hqq --quant_bit 4 --quant_block 64 --scale_bit 16 \
--mnnconvert /path/to/MNN/build/MNNConvert \
--dst_path ./MiniCPM-V-4.7-35B-A3B-MNN
Inference and tests
Create a greedy test config inside the downloaded model directory:
import json
from pathlib import Path
model = Path('./MiniCPM-V-4.7-35B-A3B-MNN')
config = json.loads((model / 'config.json').read_text())
config.update(backend_type='cpu', precision='low', thread_num=4,
sampler_type='greedy', temperature=0.0, top_k=1)
config['mllm'] = dict(backend_type='cpu', precision='low', thread_num=4, memory='low')
(model / 'config-test.json').write_text(json.dumps(config, indent=2))
For a GPU build set backend_type to metal or opencl in both the top-level config and mllm. OpenCL managers in the same executor share a backend runtime; use matching GPU mode flags in both configs. Put each prompt on a separate line in prompts.txt:
请用一句话介绍北京。
<img>/absolute/path/cat.jpg</img>请用一句话描述图中的动物。
./build/llm_demo ./MiniCPM-V-4.7-35B-A3B-MNN/config-test.json ./prompts.txt 128
./build/llm_bench -m ./MiniCPM-V-4.7-35B-A3B-MNN/config-test.json \
-a cpu -c 2 -t 4 -p 0 -n 0 -pg 512,128 -rep 3 -load false
Use -a metal or -a opencl for the corresponding GPU build. -pg 512,128 measures prefill followed by decode using the same KV cache, reporting the speeds separately. -p 512 -n 128 instead measures independent prefill-only and decode-only workloads. Text benchmarks exclude image encoding.
Validation
Linux CPU text/image generation passed. FP32 prefill/first-decode parity was checked for layers 0, 3 and 39 with maximum error below 2e-6. The graph has 80 IndexedLinear operations, 256 linears each, including 40 fused gate/up projections. Android, Metal and OpenCL performance has not been measured for this 35B export.
The MNN adapter is validated for images, including slicing and multiple images. Video has not been validated. Upstream capabilities describe the original model; these functional checks are not a quality benchmark for the quantized MNN files.
License and attribution
Original model and weights: OpenBMB, Apache-2.0. See the complete LICENSE and original model card.