# Deploy MiniCPM5-15B-A2.5B with LiteRT-LM (desktop / server) [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) is Google's on-device runtime for language models, built on [LiteRT](https://github.com/google-ai-edge/litert) (formerly TensorFlow Lite). A model is packed once into a `.litertlm` bundle, and the same file runs on the CPU and the GPU of desktops and servers, through a command-line tool, an OpenAI-compatible local server, and a Python package. Use this path when the target is a **desktop app, a laptop, or a CPU/GPU server without a dedicated inference stack**. MiniCPM5-15B-A2.5B is a Mixture-of-Experts model: 15 B parameters in total, ~2.5 B active per token. The bundles keep the **sparse MoE form** through LiteRT's `moe` custom op, which is what lets a 15 B model decode at 45–59 tokens per second on a laptop GPU. These files target machines with **16 GB of RAM or more**. Phones are not a target for these bundles (the smallest is 7.58 GB); to run this model on a phone, use the GGUF builds with the [iPhone app](minicpm5_on_ios.md). **Runtime requirement: `litert-lm` 0.20.0 or newer** (check with `litert-lm --version`). The bundles are hosted in [openbmb/MiniCPM5-15B-A2.5B-LiteRT](https://huggingface.co/openbmb/MiniCPM5-15B-A2.5B-LiteRT); that card carries the conversion recipe and the raw logs behind every number quoted here. ## TL;DR ```bash uv tool install litert-lm # 0.20.0 or newer; if an older version is installed, run: uv tool upgrade litert-lm # first run downloads the 8.28 GB mixed bundle (the recommended file) litert-lm run --from-huggingface-repo=openbmb/MiniCPM5-15B-A2.5B-LiteRT MiniCPM5-15B-A2.5B_mixed.litertlm \ --backend gpu --prompt "What is the capital of France?" ``` The file lands in `~/.litert-lm/cache/huggingface/openbmb/MiniCPM5-15B-A2.5B-LiteRT/`; later runs skip the download. Drop `--backend gpu` to run on the CPU (on the Mac, see the pitfalls). Sampling and the thinking switch work as usual: ```bash MODEL=~/.litert-lm/cache/huggingface/openbmb/MiniCPM5-15B-A2.5B-LiteRT/MiniCPM5-15B-A2.5B_mixed.litertlm litert-lm run "$MODEL" --backend gpu --thinking false --prompt "1+1=?" litert-lm run "$MODEL" --backend gpu --top-k 40 --top-p 0.95 --temperature 1.0 --prompt "1+1=?" ``` ## Pre-converted bundles | Model | File | Recipe | Size | Tested on | | --- | --- | --- | --- | --- | | MiniCPM5-15B-A2.5B | [`MiniCPM5-15B-A2.5B_mixed.litertlm`](https://huggingface.co/openbmb/MiniCPM5-15B-A2.5B-LiteRT/blob/main/MiniCPM5-15B-A2.5B_mixed.litertlm) | int8 dynamic on the non-expert linears; int4 weight-only experts through the `moe` custom op | 8.28 GB | CPU: x86, ARM · GPU: Apple silicon (Metal) | | MiniCPM5-15B-A2.5B | [`MiniCPM5-15B-A2.5B_int8.litertlm`](https://huggingface.co/openbmb/MiniCPM5-15B-A2.5B-LiteRT/blob/main/MiniCPM5-15B-A2.5B_int8.litertlm) | int8 dynamic weights and activations; experts through the `moe` custom op | 15.08 GB | CPU: x86, ARM · GPU: NVIDIA H800 (Vulkan) | | MiniCPM5-15B-A2.5B | [`MiniCPM5-15B-A2.5B_int4.litertlm`](https://huggingface.co/openbmb/MiniCPM5-15B-A2.5B-LiteRT/blob/main/MiniCPM5-15B-A2.5B_int4.litertlm) | int4 dynamic on the non-expert linears; int4 weight-only experts through the `moe` custom op | 7.58 GB | CPU: x86, ARM · GPU: Apple silicon (Metal) | Which file: **mixed is the default**. At half the size of int8 it fits a 16 GB Mac, and its int4 experts are weight-only (the MoE kernel dequantizes and computes in fp32), which makes it decode *faster* than the int8 file as well as smaller. **int8 is the file when quality is the priority**: it posts the lowest NLL of the three. **int4 is the file only when size and speed matter more than quality**. All three files embed the checkpoint's own chat template, so the thinking switches work unchanged, and all three carry a 4096-token context by default (`--max-num-tokens` to change it; larger caches load — the checkpoint supports up to 512 K positions). ## Memory requirements | File | Size | Practical minimum | | --- | --- | --- | | mixed | 8.28 GB | 16 GB machines (verified on a 16 GB Apple M5: 45 tok/s decode) | | int4 | 7.58 GB | 16 GB machines | | int8 | 15.08 GB | ≥32 GB; on a 16 GB machine the file exceeds what can be cached and decode collapses to page faults | ## Accuracy Mean negative log-likelihood (NLL) against a float32 HF Transformers run of the same checkpoint (mean NLL 1.414), at the default 4096-token context; lower is better. | File | x86 CPU | ARM CPU | Mac GPU (Metal) | H800 GPU (Vulkan) | | --- | --- | --- | --- | --- | | int8 | 1.351 | 1.427 | — | 1.603 | | mixed | 1.473 | 1.478 | 1.628 | — | | int4 | 4.269 | 4.583 | 4.848 | — | int8 is the most accurate, mixed stays close to it, and int4 is clearly degraded. ## Speed Measured with `litert-lm benchmark` 0.20.0: 256-token prefill / 256-token decode, 3 runs averaged, 1024-token KV cache, no compiled-model cache (`--cache no`). Apple M5 (16 GB): | File | Backend | Prefill | Decode | Time to first token | Init | | --- | --- | --- | --- | --- | --- | | mixed | GPU (Metal) | 430 tok/s | 45.5 tok/s | 0.63 s | 11.7 s | | int4 | GPU (Metal) | 476 tok/s | 58.9 tok/s | 0.56 s | 6.6 s | | int4 | CPU | 83.6 tok/s | 7.84 tok/s | 3.19 s | 2.0 s | The mixed file has no Mac CPU row (see the pitfalls). x86 server, CPU, 8 threads (a shared host): | File | Prefill | Decode | Time to first token | Init | | --- | --- | --- | --- | --- | | int8 | 54.2 tok/s | 3.91 tok/s | 5.0 s | 5.9 s | | mixed | 61.2 tok/s | 4.60 tok/s | 4.4 s | 7.3 s | | int4 | 65.7 tok/s | 4.78 tok/s | 4.1 s | 7.5 s | ARM server, CPU, 8 threads: | File | Prefill | Decode | Time to first token | Init | | --- | --- | --- | --- | --- | | int8 | 57.5 tok/s | 4.27 tok/s | 4.7 s | 3.6 s | | mixed | 63.8 tok/s | 4.38 tok/s | 4.2 s | 3.8 s | | int4 | 64.3 tok/s | 5.32 tok/s | 4.2 s | 7.5 s | Notes: - **int4 is the fastest file on every platform measured.** int4 and mixed share the same int4 weight-only experts; int4 is faster because its non-expert linears are int4 instead of int8. The int8 file is the slowest per token — its experts run int8 computation. - The GPU rows are Apple silicon (Metal). Other GPU stacks are untested for these bundles; on Vulkan only the int8 file's accuracy was verified (H800). - On Apple silicon the whole graph — prefill and decode — runs on the GPU in a single partition. ## Thinking The bundles embed the checkpoint's chat template and declare the reasoning as a `thought` channel, so the CLI prints it between `[thought]` and `[/thought]`; the answer text stays clean. A model this size reasons at length — the reasoning plus the answer can approach the 4096-token budget, so keep `--thinking-budget` below it (or raise `--max-num-tokens`), and on constrained hardware pass `--thinking false` for direct answers. The accuracy and speed numbers on this page were all measured with thinking off. ## OpenAI-compatible server `litert-lm serve` exposes every bundle in the local registry on `/v1/models` and `/v1/chat/completions` ([server guide](https://developers.google.com/edge/litert-lm/cli/openai_server)): ```bash litert-lm import --from-huggingface-repo=openbmb/MiniCPM5-15B-A2.5B-LiteRT MiniCPM5-15B-A2.5B_mixed.litertlm minicpm5-15b-a2.5b litert-lm serve --host 127.0.0.1 --port 9379 curl http://127.0.0.1:9379/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{"model": "minicpm5-15b-a2.5b", "messages": [{"role": "user", "content": "1+1=?"}], "reasoning_effort": "none"}' ``` `"reasoning_effort": "none"` gives a direct answer; any other value (`low` to `xhigh`) turns thinking on. `max_completion_tokens` caps the reply, `temperature`, `top_p`, `top_k` and `seed` are honored, and `"stream": true` streams. ## Common pitfalls - **Older `litert-lm` cannot load these bundles.** Before 0.20.0 the MoE kernels do not implement this model's `silu` expert activation; engine creation fails on CPU and GPU alike with `ERROR: moe node #N unsupported activation='silu'`. Upgrade with `uv tool upgrade litert-lm`. - **int8 on a 16 GB machine page-thrashes.** The 15.08 GB file cannot be fully cached; decode drops to hundredths of a token per second. Use mixed there and int8 on ≥32 GB machines. - **On the Mac, run mixed on the GPU.** The mixed file's int8-dynamic layers take a slow kernel path in the macOS CPU build — a 256-token CPU decode takes over ten minutes — while int4 decodes at 7.8 tok/s on the same machine. On Linux the mixed file is fine on the CPU (see Speed). - **On a 16 GB Mac, free memory before a GPU run.** The weight load needs room to evict cold pages; with the swap file already full, the same file can slow down by two orders of magnitude. - **First run per backend is slow**: the CPU run writes an XNNPACK weight cache beside the file and the GPU run compiles its kernels. - **Temperature without top-k does nothing**: `--temperature` and `--top-p` only take effect together with a `--top-k` above 1 (the CLI default is greedy). OpenBMB recommends `temperature 1.0` with `top_p 0.95`; pick a top-k above 1 to go with them — 40 is a common choice. - **Scripts**: the CLI reads stdin; when it runs from a script or a job with an open pipe on stdin, redirect it (`< /dev/null`) or it waits for end-of-input before generating. ## See also - [openbmb/MiniCPM5-15B-A2.5B-LiteRT](https://huggingface.co/openbmb/MiniCPM5-15B-A2.5B-LiteRT) — recipe, raw logs, `litertlm_manifest.json` - [Running MiniCPM5-15B-A2.5B on iPhone](minicpm5_on_ios.md) — this same model on phones, through the GGUF builds - [Tool usage & agentic integration](tool_usage.md) — the function-calling specification these bundles follow - [litert-community/MiniCPM5-2B](https://huggingface.co/litert-community/MiniCPM5-2B) and [litert-community/MiniCPM5-1B](https://huggingface.co/litert-community/MiniCPM5-1B) — phone-scale LiteRT bundles of the same family - LiteRT-LM guides: [CLI](https://developers.google.com/edge/litert-lm/cli), [OpenAI-compatible server](https://developers.google.com/edge/litert-lm/cli/openai_server), [CLI configuration](https://developers.google.com/edge/litert-lm/cli/configuration), [model management](https://developers.google.com/edge/litert-lm/cli/model_management), [Android](https://developers.google.com/edge/litert-lm/android), [Swift](https://developers.google.com/edge/litert-lm/swift), [Python](https://developers.google.com/edge/litert-lm/python)