mnn
C methods for MNN Package
What it is and what it does
MNN is a production-grade deep learning framework designed for efficient on-device inference and training. It abstracts away the complexity of deploying neural networks across heterogeneous hardware—CPUs (ARM, x86/x64), GPUs (Metal, OpenCL, Vulkan, CUDA), and NPUs (CoreML, HIAI, NNAPI)—while keeping binary size small (12MB on iOS, 800KB on Android core). The framework supports model conversion from TensorFlow, Caffe, ONNX, and TorchScript, and includes graph optimization, quantization (FP16, Int8), and a lightweight image processing library. It powers inference in over 30 Alibaba applications across live broadcast, video capture, search, and recommendation systems.
Developers use MNN to deploy trained models locally on mobile phones, IoT devices, and edge servers without cloud dependencies. The Python API provides a high-level interface for inference, training, and image processing without requiring C++ knowledge. MNN also includes specialized runtimes: MNN-LLM for large language models (supporting Qianwen, Baichuan, LLAMA) and MNN-Diffusion for stable diffusion models, both designed to run entirely on-device.
Use it for:
- Deploy trained deep learning models to iOS and Android apps for real-time inference without cloud calls.
- Run large language models (Qianwen, Baichuan, LLAMA) locally on mobile devices and edge servers.
- Optimize and quantize neural networks to reduce model size by 50–70% for memory-constrained devices.
- Build computer vision pipelines (image classification, object detection) on embedded IoT devices.
- Generate images using stable diffusion models entirely on-device without external APIs.
- Accelerate inference on Qualcomm Hexagon DSPs using the new Hexagon backend for power-efficient processing.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
MNN is a lightweight deep learning inference and training framework that runs neural network models efficiently on mobile devices, embedded systems, and servers with support for multiple hardware backends including CPU, GPU, and NPU.
Yes. MNN is a mature, actively maintained framework (latest release 23 days old, 15881 GitHub stars) with permissive BSD-3 licensing and zero known vulnerabilities. It solves a real problem—efficient on-device neural network inference—with proven production use across 30+ Alibaba applications. The single numpy dependency and broad platform support (Python 3.8–3.14, macOS/Linux/Windows) make installation straightforward. Install if you need to deploy models to mobile, embedded, or resource-constrained environments.
Install
mnn on PyPI
pip
pip install mnnuv
uv add mnnpoetry
poetry add mnnInstalling mnn
Before you install
Medium install friction due to precompiled wheels for multiple Python versions (3.8–3.14) and platforms (macOS, Linux, Windows). Active maintenance with a recent release (23 days old) and strong repository activity (15881 stars, last commit 2026-08-14). Single runtime dependency on numpy keeps the footprint lean.
License in practice
BSD-3 permissive license allows commercial and private use with minimal restrictions, making it suitable for proprietary applications and production deployments.
Quickstart
import mnn
import numpy as np
# Load and run inference on a model
interpreter = mnn.Interpreter('model.mnn')
session = interpreter.createSession()
output = interpreter.runSession(session)
Requires a pre-converted MNN model file (.mnn format); models must be converted from TensorFlow, Caffe, ONNX, or TorchScript using MNN-Converter before inference.
Verify before relying
- Specific performance benchmarks comparing MNN to TensorFlow Lite, PyTorch Mobile, and TVM on representative models.
- Quantization support details for FP16, BF16, and Int8 across all supported architectures and backends.
- Availability and maturity of the Hexagon backend (released 2026-07-22) on real Qualcomm devices.
- Python API coverage for training workflows versus inference-only capabilities.
Package facts
| License | BSD-3 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 210,401/month — #9,493 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mnn-3.6.1-cp310-cp310-macosx_11_0_arm64.whl; mnn-3.6.1-cp310-cp310-macosx_11_0_x86_64.whl; mnn-3.6.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; mnn-3.6.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; mnn-3.6.1-cp310-cp310-win_amd64.whl; mnn-3.6.1-cp311-cp311-macosx_11_0_arm64.whl; mnn-3.6.1-cp311-cp311-macosx_11_0_x86_64.whl; mnn-3.6.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; mnn-3.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; mnn-3.6.1-cp311-cp311-win_amd64.whl; mnn-3.6.1-cp312-cp312-macosx_11_0_arm64.whl; mnn-3.6.1-cp312-cp312-macosx_11_0_x86_64.whl; mnn-3.6.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; mnn-3.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; mnn-3.6.1-cp312-cp312-win_amd64.whl; mnn-3.6.1-cp313-cp313-macosx_11_0_arm64.whl; mnn-3.6.1-cp313-cp313-macosx_11_0_x86_64.whl; mnn-3.6.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; mnn-3.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; mnn-3.6.1-cp313-cp313-win_amd64.whl
Keywords: MNN, Engine
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
ncnnncnn is a neural network inference framework…
permissive · top 15,000 on PyPI
tflite-runtimeTensorFlow Lite runtime enables on-device…
permissive · top 15,000 on PyPI
ai-edge-litertai-edge-litert runs machine learning models on…
permissive · top 15,000 on PyPI
ai-edge-litert-nightlyLiteRT is a runtime for running trained machine…
permissive · top 15,000 on PyPI
executorchExecuTorch exports and runs PyTorch models on…
permissive · top 15,000 on PyPI
mediapipeMediaPipe provides pre-built machine learning…
permissive · top 5,000 on PyPI
netronNetron is a viewer for neural network and…
permissive · top 15,000 on PyPI
nvidia-cudnn-cu13Provides cuDNN runtime libraries for…
unclear · top 1,000 on PyPI
tensorflowTensorFlow is an open-source machine learning…
permissive · top 5,000 on PyPI
onnxslimOnnxSlim reduces the size and operator count of…
permissive · top 5,000 on PyPI