The Problem
Developers need an on‑device multimodal LLM that can ingest image, video, audio and text while producing simultaneous speech and text output. Existing open‑source MLLMs either lack full‑duplex streaming or require heavyweight servers, making real‑time phone deployment impractical.
What This Does
MiniCPM‑o ships four self‑contained projects:
- eval_mm – evaluation toolkit (
eval_mm/vlmevalkit/) with dataset loaders, metric helpers and a CLI (eval_mm/vlmevalkit/run.py). - web_demos – a browser‑based demo (
web_demos/minicpm‑o_2.6/web_server/) that runs the model through a WebRTC‑enabled UI. - omnilmm – core model utilities (
omnilmm/model/,omnilmm/conversation.py) that expose inference APIs. - finetune – scripts for further model fine‑tuning (
finetune/).
Common code lives in Python (118 files) and the front‑end uses Vue/React with pnpm as the package manager. Docker is used for the demo server.
How It Is Wired
Execution starts at eval_mm/vlmevalkit/run.py:main. The main function (reaches 317 functions) parses CLI args, builds a prompt via eval_mm/vlmevalkit/vlmeval/smp/file.py::build_prompt, loads a dataset (eval_mm/vlmevalkit/vlmeval/dataset/...), and calls evaluate.
Key call chain (high blast‑radius nodes are bold):
main → evaluate → load (x117) → build_prompt (x114) → dump (x92) → track_progress_rich (x24)
load reads files from disk; build_prompt constructs model input; dump writes results; track_progress_rich prints progress via Rich.
evaluate also invokes model.generate (28 calls) which lives in omnilmm/model/utils.py. This is the only place that contacts the inference backend (CPU/GPU or ONNX runtime).
Web demo starts with web_demos/minicpm‑o_2.6/web_server/src/apis/index.js, which imports omnilmm/model/utils.py through a Python‑backed HTTP endpoint defined in web_demos/.../index.html. The Dockerfile builds a container that installs pnpm dependencies (pnpm install) and the Python environment (pip install -r requirements.txt).
Circular import warning: eval_mm/vlmevalkit/vlmeval/dataset/__init__.py participates in a 7‑module cycle, raising the risk of import‑time side effects when refactoring.
Hub modules – eval_mm/vlmevalkit/vlmeval/smp/__init__.py is imported by 57 other modules; changes here propagate widely.
External effects – 50 functions perform filesystem I/O, 3 launch subprocesses, 28 call the model for inference, and 1 performs a cryptographic operation. The only outbound network call is in eval_mm/vlmevalkit/vlmeval/api/base.py when contacting a remote service for content checking.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/MiniCPM-o
cd MiniCPM-o
# Install Python deps (base environment)
pip install -r requirements.txt # includes eval_mm, finetune, omnilmm
# Run an evaluation (example VQA)
python -m eval_mm.vlmevalkit.run \
--dataset vqa --model MiniCPM-o-4.5 \
--output results.json
To launch the web demo locally:
# Install front‑end deps
cd web_demos/minicpm-o_2.6/web_server
pnpm install
# Build and run the Docker image
docker build -t minicpm-o-demo .
docker run -p 8080:80 minicpm-o-demo
Configuration – The demo and evaluation scripts read environment variables from .env files (eval_mm/vlmevalkit/.env, web_demos/.../.env.*). Replace placeholder keys (e.g., OPENAI_API_KEY) with your own credentials or remove the files after creating .env.example.
Real‑World Use
A mobile app can embed the ONNX‑exported MiniCPM‑o model, stream video/audio to a backend running omnilmm/model/utils.py, and receive simultaneous transcription and response audio. The evaluation toolkit can be used to benchmark the on‑device model against VQA, OCR, and speech benchmarks before deployment.
Code Health & Issues
Critical – Rotate and remove committed credentials in eval_mm/vlmevalkit/.env.
High – No test suite; add tests for each public entry point. High – No CI workflow; add GitHub Actions to build and test. High – Deployable Dockerfile lacks a build gate; add a CI step that builds the image. High – Remove committed .env files and replace with .env.example.
Medium – Enable Dependabot for Python, npm, and Docker manifests. Medium – Pin Docker base images by digest. Medium – Add a pre‑commit secret‑scan hook. Medium – Move large binary assets (e.g., assets/minicpmv4_5/MiniCPM-V 4.5-8.26.mp4) to Git LFS or external storage.
Low – Add repository convention files (.editorconfig, .gitattributes, formatter config).
Additional static findings: 25 files with deep nesting (max indentation 6), 7 import cycles, 6 “open without context manager”, 13 broad exception handlers, duplicated 6‑line code blocks across 68 files, and two oversized modules (>1 400 lines). These are documented in the measured analysis and should be prioritized for refactoring.
The Bottom Line
MiniCPM‑o provides a functional on‑device multimodal LLM with full‑duplex streaming, backed by a concrete evaluation suite and a ready‑to‑run web demo. The codebase is functional but suffers from missing tests, CI, and several maintainability hotspots (import cycles, large modules, duplicated code). It is suitable for research or prototype integration, but production teams should first address the critical credential leak and add automated testing and CI pipelines.