Instructions to use litert-community/MiniCPM5-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MiniCPM5-2B with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add known runtime issues: the second-turn stop token, the final mark before LiteRT-LM 0.17.0 and a preface with tools and no messages
Browse files
README.md
CHANGED
|
@@ -193,6 +193,14 @@ The two files come from two different conversion paths.
|
|
| 193 |
- 📦 GitHub: [OpenBMB/MiniCPM](https://github.com/OpenBMB/MiniCPM)
|
| 194 |
- 🛠️ LiteRT docs: [ai.google.dev/edge/litert](https://ai.google.dev/edge/litert) · runtime source: [github.com/google-ai-edge/litert](https://github.com/google-ai-edge/litert) / [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM)
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
---
|
| 197 |
|
| 198 |
## License
|
|
|
|
| 193 |
- 📦 GitHub: [OpenBMB/MiniCPM](https://github.com/OpenBMB/MiniCPM)
|
| 194 |
- 🛠️ LiteRT docs: [ai.google.dev/edge/litert](https://ai.google.dev/edge/litert) · runtime source: [github.com/google-ai-edge/litert](https://github.com/google-ai-edge/litert) / [LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM)
|
| 195 |
|
| 196 |
+
## Known runtime issues
|
| 197 |
+
|
| 198 |
+
With thinking off, from the second turn of a conversation on, LiteRT-LM puts the previous answer's stop token into the KV cache with a zero embedding, because `MiniCPM5-2B_int4.litertlm`, `minicpm_wi4c_wi8_afp32.litertlm` and `minicpm_wi8_afp32.litertlm` hold the embedding table in its own section and the decoder takes embeddings, so later answers in a conversation can differ from the answer the model gives to the same messages in one prompt (read in the source of LiteRT-LM 0.16.0 to 0.18.1; measured with 0.18.1 on WeVisOne-VL-2B and Qwen2.5-Coder-1.5B-Instruct, not on these files). With thinking on, the runtime rebuilds the cache from the re-rendered history at each turn, so the second turn is free of it when the conversation opens with a user message; the same source shows a zero embedding at another token from the third turn on (not measured). `MiniCPM5-2B_int8.litertlm` has no embedder section (the decoder looks the tokens up itself) and is not affected. One question per conversation avoids both, as does a new conversation that starts with the earlier messages and the new question.
|
| 199 |
+
|
| 200 |
+
On LiteRT-LM releases before 0.17.0 (read in the source of 0.10.1 to 0.16.1), an answer whose last punctuation mark is a token of its own, such as a `.` or `?` after a word, arrives without that mark: `minicpm_wi4c_wi8_afp32.litertlm` and `minicpm_wi8_afp32.litertlm` carry stop sequences of `<|im_end|>` and a newline with each of 13 characters in front (12 punctuation marks and a space), so the runtime holds the mark back to see whether `<|im_end|>` and a newline follow, the answer ends on `<|im_end|>` alone, and the held mark is never written. LiteRT-LM 0.17.0 and later write the held mark (`StopTokenStreamFilter` in `runtime/core/tasks.cc`, read in the source of 0.17.0 to 0.18.1). `MiniCPM5-2B_int4.litertlm` and `MiniCPM5-2B_int8.litertlm` do not carry these stop sequences. Not measured on these files: this follows from the runtime's source read with these files' stop list and tokenizer; the drop itself was seen with LiteRT-LM 0.16.1 on a Galaxy S26, on another bundle whose stop sequences have the same form.
|
| 201 |
+
|
| 202 |
+
From a conversation preface (the system message, initial messages, tools and extra context a conversation is created with) that has tools and no messages, LiteRT-LM renders the `MiniCPM5-2B_int4.litertlm` and `MiniCPM5-2B_int8.litertlm` files' chat templates with an empty message list, and the template reads `messages[0]` without checking that the list is non-empty, so the render fails with `Failed to apply template: undefined value`. This happens in two places: when the preface is prefilled at creation (`prefillPrefaceOnInit = true` in Kotlin, `prefillPrefaceOnInit: true` on the web, `SetPrefillPrefaceOnInit(true)` in C++; the default is false), where creating the conversation fails with that error, and in the preface render (`renderPrefaceIntoString()` in Kotlin and Swift, `RenderPrefaceIntoString()` in C++, `litert_lm_conversation_render_preface_to_string` in the C API). The same happens with extra context (such as `enable_thinking`) and no messages, and in the preface render with an empty preface (run in the runtime on one Qwen3 template; the other templates rendered with minijinja 2.14 and jinja2). Read in the source of LiteRT-LM 0.17.0, 0.18.1 and main; measured with LiteRT-LM 0.18.1 (the litert-lm package from PyPI) through its C API on these files' template texts. The default path, where the first message is rendered together with the preface, is not affected: the Python API and the CLI of 0.18.1 expose neither the flag nor the preface render, and Google AI Edge Gallery sets neither (its source as read on 2026-10-25). A system message or any initial message in the conversation config avoids it. `minicpm_wi4c_wi8_afp32.litertlm` and `minicpm_wi8_afp32.litertlm` fail every render with tools, on the default path and with a system message alike, because their template calls `tojson(ensure_ascii=False)` and LiteRT-LM's own `tojson` filter accepts no arguments (rendered with minijinja 2.14 and jinja2, not run in the runtime).
|
| 203 |
+
|
| 204 |
---
|
| 205 |
|
| 206 |
## License
|