talira

Alibaba's lightweight on-device inference engine for deep learning and LLMs

open sourceApache-2.0free

MNN is Alibaba's lightweight deep learning framework for running and training models on phones, PCs and embedded devices, used across Alibaba's apps. It converts TensorFlow, Caffe, ONNX and TorchScript models, runs them on ARM and x64 CPUs with hand-optimized assembly and on GPUs through Metal, OpenCL, Vulkan and CUDA (and Qualcomm Hexagon DSPs), with FP16, INT8 and INT4 quantization, in an Android core of about 800 KB. On top of it, MNN-LLM runs large language models locally (Qwen, DeepSeek and others) and MNN-Diffusion runs Stable Diffusion, with Python and C++ APIs and sample chat apps for Android and iOS.

Problems it solves

  • run an LLM on an Android phone offline
  • deploy an ONNX model on mobile with a small runtime
  • on-device inference engine for iOS and Android

Features

  • converts TensorFlow, Caffe, ONNX and TorchScript models
  • ARM and x64 CPU, Metal, OpenCL, Vulkan, CUDA and Hexagon backends
  • FP16, INT8 and INT4 quantization
  • MNN-LLM for on-device language models
  • MNN-Diffusion for Stable Diffusion
  • Python and C++ APIs

Alternatives

The same job

These do what MNN does.

  1. MLC LLM Universal LLM deployment engine that compiles models to run natively on GPUs, phones and browsers
  2. MediaPipe Google's framework and ready-made solutions for on-device machine learning
  3. LMDeploy LMDeploy is a toolkit for compressing, deploying, and serving LLMs.
  4. ncnn Tencent's neural network inference framework for phones, embedded devices and desktops.

Compare MNN with the top 3