MiniCPM-V-4.7-1B-MNN
MNN-format conversion of openbmb/MiniCPM-V-4.7-1B. 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 compact 1B-class dense variant.
This overview summarizes the original model card. Refer to it for training details, upstream evaluations and intended uses.
| Property | Value |
|---|---|
| Language backbone | Qwen3.5 dense |
| 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:
379f120c2ff3588e6e06559ec6b9ec15cc05114e, 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 |
2.48 | Language graph |
llm.mnn.weight |
403.63 | Language weights, including tied embeddings when configured |
embeddings_bf16.bin |
484.56 | BF16 input embeddings |
visual.mnn |
0.47 | Vision graph |
visual.mnn.weight |
563.71 | 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-1B-MNN --local-dir ./MiniCPM-V-4.7-1B-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-1B \
--export mnn --hqq --quant_bit 4 --quant_block 64 --scale_bit 16 \
--mnnconvert /path/to/MNN/build/MNNConvert \
--dst_path ./MiniCPM-V-4.7-1B-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-1B-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-1B-MNN/config-test.json ./prompts.txt 128
./build/llm_bench -m ./MiniCPM-V-4.7-1B-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 and Python prefill/first-decode parity passed. Single-image, sliced-image and multi-image token IDs and Canvas positions were checked against the original processor. Android PJZ110 passed 11 ARM CPU/OpenCL checks, including vision and language at Low precision; standard llm_demo text/image generation passed on both. Metal text/image correctness and GPU execution were verified on an M4 Mac mini.
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.
Measured text performance
Low precision, HQQ4 language weights, thread_num=4 (Wide tuning for OpenCL), one warmup excluded, three measured repetitions and no mmap. These are different devices, not a controlled backend comparison.
| Device / backend | pp512 (token/s) | tg128 (token/s) | pp512+tg128: prefill / decode (token/s) |
|---|---|---|---|
| M4 Mac mini, 16 GB / Metal | 2581.3 ± 1.2 | 188.6 ± 0.2 | 2576.4 / 185.2 |
| Snapdragon 8 Elite, Adreno 830 / OpenCL | 1104.4 ± 9.6 | 76.6 ± 0.1 | 1099.0 / 76.1 |
For 2048-token prefill followed by 128 decode tokens, Metal measured 2650.3 / 178.1 token/s and OpenCL measured 1033.2 / 75.5 token/s. Results are specific to the recorded snapshot and devices.
Measured image performance
Ordinary Llm::response calls with async=false, greedy generation to EOS, one warmup excluded and three measured repetitions. TTFT is timed from the response call until the first streamed text; it includes image preprocessing, vision encoding and language prefill. Both language and vision use the stated GPU backend with Low precision and thread_num=4 (Wide tuning on OpenCL).
| Device / backend | Image / views | TTFT (ms) | Total response (ms) | Generated tokens |
|---|---|---|---|---|
| M4 Mac mini / Metal | 480×360 cat / 1 global view | 299.6 | 391.9 | 18 |
| M4 Mac mini / Metal | 1500×1000 elephant / 1 global + 8 detail views | 2441.3 | 2512.2 | 14 |
| Snapdragon 8 Elite / OpenCL | 480×360 cat / 1 global view | 929.7 | 1215.7 | 18 |
| Snapdragon 8 Elite / OpenCL | 1500×1000 elephant / 1 global + 8 detail views | 7254.4 | 7605.5 | 21 |
The captions correctly identify the cat, elephant and white bird. Greedy captions and their lengths differ across backends, so the total-response times include different amounts of decoding. These are functional/performance checks, not a model-quality evaluation.
On the Android phone, the first encounter with the sliced-image shapes took approximately 396 seconds with Wide tuning, including compilation/tuning. Later runs completed normally. Allow the first run to finish and retain the cache; measure warmed inference separately from startup. The table uses a clean build with diagnostic logging removed.
License and attribution
Original model and weights: OpenBMB, Apache-2.0. See the complete LICENSE and original model card.
- Downloads last month
- 235
Model tree for taobao-mnn/MiniCPM-V-4.7-1B-MNN
Base model
openbmb/MiniCPM-V-4.7-1B