--- license: apache-2.0 language: - en - zh base_model: - openbmb/MiniCPM5-1B base_model_relation: quantized library_name: litert-lm pipeline_tag: text-generation tags: - litert-lm - minicpm - minicpm5 - on-device - edge-ai --- # MiniCPM5-1B — LiteRT-LM (on-device) Main Model Card: [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) MiniCPM5-1B packaged in the `.litertlm` format so it runs fully **on-device** — Android, iOS, Desktop and IoT — with the [LiteRT-LM](https://ai.google.dev/edge/litert-lm) framework. No internet connection required at inference time. ## 👉 Not sure which file to pick? Download `MiniCPM5-1B.litertlm` That's the one and only file here, and it's meant to "just work". You don't need to understand quantization to use it. | File | What it is | Who it's for | | :--- | :--- | :--- | | **`MiniCPM5-1B.litertlm`** | The ready-to-run model (INT8, ~1.1 GB) | **Everyone — this is the default** | | `chat_template.jinja` | The chat format (auto-used by the runtime) | Advanced / reference | ## Try it in one command (Desktop) ```bash uv tool install litert-lm uvx litert-lm run --from-huggingface-repo=luispoveda93/MiniCPM5-1B MiniCPM5-1B.litertlm --prompt="What is the capital of France?" ``` ## Run it on your phone (Android) 1. Install the [Google AI Edge Gallery](https://play.google.com/store/apps/details?id=com.google.ai.edge.gallery) app. 2. Open **Model manager → “+” → Import from HF**, paste this repo's link, and download `MiniCPM5-1B.litertlm`. See the [Edge Gallery wiki](https://github.com/google-ai-edge/gallery/wiki) for details. ## About this model MiniCPM5-1B is a compact 1B decoder-only model from OpenBMB (standard `LlamaForCausalLM`), built for local assistants, coding agents, and tool use, with a hybrid `` chat mode and long-context support. | Item | Value | | :--- | :--- | | Parameters | 1,080,632,832 (~1B) | | Layers | 24 | | Attention (GQA) | 16 query heads / 2 KV heads | | Context length | 131,072 | | Quantization | INT8 dynamic-range (weights), FP32 activations | | Signatures | `prefill_128`, `prefill_512`, `decode` (KV-cache 1280) | ### Recommended sampling (from the source model card) | Mode | Params | Enable | | :--- | :--- | :--- | | **Think** | `temperature=0.9, top_p=0.95` | `enable_thinking=True` | | **No Think** | `temperature=0.7, top_p=0.95` | `enable_thinking=False` | ## How this was built (transparency) Converted from the BF16 source ([openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)) with Google AI Edge tooling: - **Re-authoring + TFLite conversion**: `ai-edge-torch` Generative API. MiniCPM5-1B maps onto the standard decoder-only building blocks (hidden 1536, 24 layers, GQA 16/2, head_dim 128, RMSNorm 1e-6, RoPE θ=5e6, untied `lm_head`, vocab 130560). - **Quantization**: INT8 dynamic-range weight-only. - **Packaging**: `litert-lm-builder`, native `minicpm5` runtime type, source Hugging Face tokenizer, start token ``, stop tokens `[1, 130073]` (``, `<|im_end|>`), `thought` reasoning channel, and an `ExecutorMetadata` section declaring all 48 KV-cache state buffers (required for on-device prefill). - **Verification**: the re-authored model was checked against the original `transformers` implementation — last-token logits matched with **cosine 1.0000**, identical argmax, 5/5 top-5 overlap; parameter count matches exactly. The packaged bundle was also run end-to-end with `litert-lm run` and generates correctly (reasoning channel parses as expected). > This is a personal community contribution, not an official OpenBMB or Google release. An INT4 (`wi4b32`) variant with a smaller footprint is available from the official [litert-community/MiniCPM5-1B](https://huggingface.co/litert-community/MiniCPM5-1B) repo. ## Community-Contributed Evaluation: Spanish, Catalan, Basque, Galician (0-shot) > **⚠️ Note:** This section is a **community addition** — it does **not** appear in the original [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) model card. It was benchmarked independently by this repo's maintainer and is provided as supplementary information, not an official OpenBMB result. To understand how this compact 1B EN/ZH-pretrained model performs on Spain's co-official languages, we ran the exact task selection published on the [Salamandra-2b-instruct model card](https://huggingface.co/BSC-LT/salamandra-2b-instruct) — a 2.25B model whose pretraining specifically oversampled these languages 2x — using the same [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness) task suite (SpanishBench, CatalanBench, BasqueBench, GalicianBench), 0-shot, chat template applied. Evaluation was run on the BF16 source model (`openbmb/MiniCPM5-1B`), not the on-device `.litertlm` build in this repo. The Salamandra-2B column is transcribed verbatim from its published card and was not re-run. ### Spanish
Category Task Metric MiniCPM5-1B Salamandra-2B
Commonsense Reasoning xstorycloze_es acc 51.69 61.95
NLI wnli_es acc 43.66 49.30
xnli_es acc 42.49 48.52
Paraphrasing paws_es acc 57.30 57.10
QA xquad_es f1† 0.00 29.60
Translation flores_es bleu 0.00 15.92
† Salamandra's card lists this task under metric "acc"; the installed `xquad_es` task only computes `f1`/`exact_match`, so `f1` is reported here for MiniCPM5-1B. ### Catalan
Category Task Metric MiniCPM5-1B Salamandra-2B
Commonsense Reasoning copa_ca acc 50.80 71.00
xstorycloze_ca acc 48.64 61.61
NLI wnli_ca acc 54.93 56.34
xnli_ca acc 37.83 52.54
Paraphrasing parafraseja acc 56.75 64.48
paws_ca acc 56.45 60.30
QA arc_ca_easy acc 28.87 52.15
arc_ca_challenge acc 20.22 30.03
openbookqa_ca acc 21.80 29.20
piqa_ca acc 53.32 63.93
siqa_ca acc 33.76 42.32
Translation flores_ca bleu 0.00 20.04
### Basque
Category Task Metric MiniCPM5-1B Salamandra-2B
Commonsense Reasoning xcopa_eu acc 48.20 55.20
xstorycloze_eu acc 49.77 55.26
NLI wnli_eu acc 52.11 52.11
xnli_eu acc 33.91 45.89
QA eus_exams‡ acc 24.40 24.94
eus_proficiency acc 24.28 25.15
eus_trivia acc 30.44 27.35
Reading Comprehension eus_reading acc 25.85 28.69
Translation flores_eu bleu 0.00 7.93
‡ `eus_exams` is a group of 29 exam sub-tasks; MiniCPM5-1B's score is the sample-count-weighted average across all sub-tasks. ### Galician
Category Task Metric MiniCPM5-1B Salamandra-2B
Paraphrasing parafrases_gl acc 52.72 53.40
paws_gl acc 53.95 56.85
QA openbookqa_gl acc 21.60 26.20
Translation flores_gl bleu 0.00 17.53
**Bold** values indicate MiniCPM5-1B matches or exceeds the Salamandra-2B-instruct published baseline despite the parameter and pretraining-data gap. MiniCPM5-1B has no targeted Spanish/Catalan/Basque/Galician pretraining data; the gaps on Basque and Galician (and all FLORES/BLEU translation tasks, which scored ≈0 across every language) are the expected result of that mismatch, not a defect in the on-device conversion. This comparison is offered as context for anyone considering MiniCPM5-1B for these languages — it is **not** a claim of official parity with Salamandra. ## License [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE), following the source model.