alibaba/MNN

MNN: A blazing-fast, lightweight inference engine battle-tested by Alibaba, powering high-performance on-device LLMs and Edge AI.

What it solves

MNN provides a highly efficient, lightweight deep learning framework designed to solve the challenge of deploying complex AI models on resource-constrained devices, such as mobile phones, IoT devices, and embedded systems, without sacrificing performance.

How it works

It functions as a universal inference and training engine that optimizes model execution through several mechanisms:

  • Hardware Acceleration: Uses optimized assembly code for ARM/x64 CPUs and leverages Metal, OpenCL, Vulkan, and CUDA for GPU acceleration.
  • Model Conversion: Includes a converter to transform models from TensorFlow, Caffe, ONNX, and Torchscripts into the MNN format while performing graph optimization.
  • Compression: Employs FP16 and Int8 quantization to reduce model size by 50-70%.
  • Specialized Runtimes: Includes MNN-LLM for local deployment of large language models (like Qwen and Llama) and MNN-Diffusion for stable diffusion models.

Who it’s for

  • Mobile and IoT Developers looking to integrate AI features (like image search or live broadcast effects) into apps.
  • ML Engineers who need to deploy models to edge devices with minimal dependencies.
  • Researchers interested in device-cloud collaborative machine learning.

Highlights

  • Extremely Lightweight: Core Android library size is approximately 800KB; iOS static library is about 12MB.
  • Broad Compatibility: Supports iOS 8.0+, Android 4.3+, and POSIX-compliant embedded devices.
  • Versatile Model Support: Handles CNN, RNN, GAN, and Transformer architectures.
  • Comprehensive Tooling: Provides a converter, a compression tool, a training module (MNN-Train), and a lightweight image processing library (MNN-CV).

Related

  • Project
  • Project
  • Project
  • Project
  • Project