Instructions to use luispoveda93/MiniCPM5-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use luispoveda93/MiniCPM5-1B with LiteRT-LM:
# LiteRT-LM runs on various platforms (Android, iOS, Windows, Linux, macOS, IoT, Web/WASM) # and supports many APIs (C++, Python, Kotlin, Swift, JavaScript, Flutter). # For platform-specific integration guides, please refer to the official developer website: # https://ai.google.dev/edge/litert-lm # To try LiteRT-LM, the easiest way is to use our CLI tool. # 1. Install the LiteRT-LM CLI tool: pip install -U litert-lm # 2. Download and run this model locally: # See: https://ai.google.dev/edge/litert-lm/cli # A single .litertlm file in the repo is picked automatically; otherwise the CLI asks which one to run # (or pass its name right after the repo id). litert-lm run \ --from-huggingface-repo=luispoveda93/MiniCPM5-1B \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
File size: 10,224 Bytes
05ec47d a64a6d5 05ec47d ff295db 05ec47d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | ---
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 `<think>` 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 `<s>`, stop tokens `[1, 130073]` (`</s>`, `<|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
<table><thead>
<tr>
<th>Category</th>
<th>Task</th>
<th>Metric</th>
<th>MiniCPM5-1B</th>
<th>Salamandra-2B</th>
</tr></thead>
<tbody>
<tr>
<td>Commonsense Reasoning</td>
<td>xstorycloze_es</td>
<td>acc</td>
<td>51.69</td>
<td>61.95</td>
</tr>
<tr>
<td rowspan="2">NLI</td>
<td>wnli_es</td>
<td>acc</td>
<td>43.66</td>
<td>49.30</td>
</tr>
<tr>
<td>xnli_es</td>
<td>acc</td>
<td>42.49</td>
<td>48.52</td>
</tr>
<tr>
<td>Paraphrasing</td>
<td>paws_es</td>
<td>acc</td>
<td><strong>57.30</strong></td>
<td>57.10</td>
</tr>
<tr>
<td>QA</td>
<td>xquad_es</td>
<td>f1<sup>β </sup></td>
<td>0.00</td>
<td>29.60</td>
</tr>
<tr>
<td>Translation</td>
<td>flores_es</td>
<td>bleu</td>
<td>0.00</td>
<td>15.92</td>
</tr>
</tbody>
</table>
<sup>β </sup> 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
<table><thead>
<tr>
<th>Category</th>
<th>Task</th>
<th>Metric</th>
<th>MiniCPM5-1B</th>
<th>Salamandra-2B</th>
</tr></thead>
<tbody>
<tr>
<td rowspan="2">Commonsense Reasoning</td>
<td>copa_ca</td>
<td>acc</td>
<td>50.80</td>
<td>71.00</td>
</tr>
<tr>
<td>xstorycloze_ca</td>
<td>acc</td>
<td>48.64</td>
<td>61.61</td>
</tr>
<tr>
<td rowspan="2">NLI</td>
<td>wnli_ca</td>
<td>acc</td>
<td>54.93</td>
<td>56.34</td>
</tr>
<tr>
<td>xnli_ca</td>
<td>acc</td>
<td>37.83</td>
<td>52.54</td>
</tr>
<tr>
<td rowspan="2">Paraphrasing</td>
<td>parafraseja</td>
<td>acc</td>
<td>56.75</td>
<td>64.48</td>
</tr>
<tr>
<td>paws_ca</td>
<td>acc</td>
<td>56.45</td>
<td>60.30</td>
</tr>
<tr>
<td rowspan="5">QA</td>
<td>arc_ca_easy</td>
<td>acc</td>
<td>28.87</td>
<td>52.15</td>
</tr>
<tr>
<td>arc_ca_challenge</td>
<td>acc</td>
<td>20.22</td>
<td>30.03</td>
</tr>
<tr>
<td>openbookqa_ca</td>
<td>acc</td>
<td>21.80</td>
<td>29.20</td>
</tr>
<tr>
<td>piqa_ca</td>
<td>acc</td>
<td>53.32</td>
<td>63.93</td>
</tr>
<tr>
<td>siqa_ca</td>
<td>acc</td>
<td>33.76</td>
<td>42.32</td>
</tr>
<tr>
<td>Translation</td>
<td>flores_ca</td>
<td>bleu</td>
<td>0.00</td>
<td>20.04</td>
</tr>
</tbody></table>
### Basque
<table><thead>
<tr>
<th>Category</th>
<th>Task</th>
<th>Metric</th>
<th>MiniCPM5-1B</th>
<th>Salamandra-2B</th>
</tr></thead>
<tbody>
<tr>
<td rowspan="2">Commonsense Reasoning</td>
<td>xcopa_eu</td>
<td>acc</td>
<td>48.20</td>
<td>55.20</td>
</tr>
<tr>
<td>xstorycloze_eu</td>
<td>acc</td>
<td>49.77</td>
<td>55.26</td>
</tr>
<tr>
<td rowspan="2">NLI</td>
<td>wnli_eu</td>
<td>acc</td>
<td><strong>52.11</strong></td>
<td>52.11</td>
</tr>
<tr>
<td>xnli_eu</td>
<td>acc</td>
<td>33.91</td>
<td>45.89</td>
</tr>
<tr>
<td rowspan="3">QA</td>
<td>eus_exams<sup>β‘</sup></td>
<td>acc</td>
<td>24.40</td>
<td>24.94</td>
</tr>
<tr>
<td>eus_proficiency</td>
<td>acc</td>
<td>24.28</td>
<td>25.15</td>
</tr>
<tr>
<td>eus_trivia</td>
<td>acc</td>
<td><strong>30.44</strong></td>
<td>27.35</td>
</tr>
<tr>
<td>Reading Comprehension</td>
<td>eus_reading</td>
<td>acc</td>
<td>25.85</td>
<td>28.69</td>
</tr>
<tr>
<td>Translation</td>
<td>flores_eu</td>
<td>bleu</td>
<td>0.00</td>
<td>7.93</td>
</tr>
</tbody></table>
<sup>β‘</sup> `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
<table><thead>
<tr>
<th>Category</th>
<th>Task</th>
<th>Metric</th>
<th>MiniCPM5-1B</th>
<th>Salamandra-2B</th>
</tr></thead>
<tbody>
<tr>
<td rowspan="2">Paraphrasing</td>
<td>parafrases_gl</td>
<td>acc</td>
<td>52.72</td>
<td>53.40</td>
</tr>
<tr>
<td>paws_gl</td>
<td>acc</td>
<td>53.95</td>
<td>56.85</td>
</tr>
<tr>
<td>QA</td>
<td>openbookqa_gl</td>
<td>acc</td>
<td>21.60</td>
<td>26.20</td>
</tr>
<tr>
<td>Translation</td>
<td>flores_gl</td>
<td>bleu</td>
<td>0.00</td>
<td>17.53</td>
</tr>
</tbody>
</table>
**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.
|