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
Card and manifest: plainer and more exact wording
#9
by mlboydaisuke - opened
- README.md +11 -11
- litertlm_manifest.json +22 -22
README.md
CHANGED
|
@@ -102,14 +102,14 @@ Both files start from the same default, because both carry the LiteRT-LM models/
|
|
| 102 |
For both files:
|
| 103 |
|
| 104 |
- **Give a reasoning run a generous output budget (≥ 2048 tokens; 4096 for math).** Truncated mid-thought it produces no final answer at all.
|
| 105 |
-
- Both
|
| 106 |
-
- `enable_thinking` set via `ThinkingConfig` or the conversation's extra context reaches either template: `false` switches to direct answers (two- to nine-token replies on the
|
| 107 |
-
- Sampling: OpenBMB recommends `temperature 1.0, top_p 0.95`; the
|
| 108 |
- Prompt format is ChatML (`<|im_start|>role\n…<|im_end|>\n`), 4096-token KV budget. Prefill signatures: int4 six (1024, 256, 64, 16, 4, 1); int8 one (128 — a longer prompt is prefilled in 128-token chunks).
|
| 109 |
|
| 110 |
## Correctness
|
| 111 |
|
| 112 |
-
On an 8-question
|
| 113 |
|
| 114 |
**GSM8K** (first 100 test questions, greedy, 0-shot chain-of-thought prompt, **thinking off** — the protocol OpenBMB's own MiniCPM5 cards use, max 2048 new tokens, identical prompt and extraction on every row):
|
| 115 |
|
|
@@ -120,13 +120,13 @@ On an 8-question sanity gate (Apple M4 Max, greedy, CPU and GPU) the int4 file,
|
|
| 120 |
| int4, CPU | 86 % |
|
| 121 |
| int4, GPU (WebGPU on Metal) | 87 % |
|
| 122 |
|
| 123 |
-
int8
|
| 124 |
|
| 125 |
**Thinking mode is where int4 shows its damage.** On ten GSM8K questions with thinking on and a 3584-token budget, the bf16 model closes its reasoning on 9/10 with ~3,000-character chains, and int8 closes **10/10 with ~3,900-character chains (10/10 correct; GPU, WebGPU on Metal, runtime-default fp16 activations)**, while **int4 closes 0/10 on CPU** (median ~13,700 characters — it keeps re-checking and runs into the budget; the answer is usually right inside the thought text but never gets emitted). On the GPU (WebGPU on Metal) with the runtime's default fp16 activations the same int4 file happened to close 10/10 with ~8,000-character chains, but that is fp16 rounding steering the trajectory, not a property to rely on. If your use needs the reasoning to finish, use int8 or turn thinking off on int4.
|
| 126 |
|
| 127 |
On a **Galaxy S26 (SM-S942Q, Snapdragon SM8850, Adreno)** both files generate correctly on GPU and CPU; on the GPU with **full OpenCL delegation — every node of every prefill and decode signature, zero rejected ops** (int4: 1873/1873 on the 1024- to 4-token prefills, 1664/1664 on the 1-token prefill, 1692/1692 on decode; int8: 1836/1836 on the 128-token prefill, 1655/1655 on decode) — and the runtime separates the reasoning on-device (`[thought] … [/thought]`, then the answer).
|
| 128 |
|
| 129 |
-
On an **iPhone 17 Pro** the int4 file, with its earlier metadata, passed the same 8-question
|
| 130 |
|
| 131 |
Multi-turn: in a three-turn conversation (introduce a name and a city, an arithmetic question, then "which city do I live in?") the int8 file recalls the city with thinking unset, off and on (litert-lm 0.18.0). At the default (no thinking), a two-turn exchange ("My name is Kenji." / "What is my name?") does not get the name back: on litert-lm 0.18.0 the int4 file calls itself Kenji. With thinking on (0.18.0, 300-token thinking budget), its second reply begins "Hello! You're named Kenji." The int8 file, at its default on 0.18.0, answers the second turn without the name.
|
| 132 |
|
|
@@ -143,7 +143,7 @@ Both runs answered "Paris" to a one-word question, and on the GPU every text-dec
|
|
| 143 |
|
| 144 |
The measurements below were taken before the int4 file's metadata update, with the same weights; the int8 file has not changed.
|
| 145 |
|
| 146 |
-
`litert-lm benchmark` (litert-lm 0.17.0), Apple M4 Max, `-p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024`, quiet machine, serialized, ≥300 s rest before each GPU reading; each backend confirmed to generate real text before its number was recorded; all four rows from one
|
| 147 |
|
| 148 |
| File | Backend | Prefill (256) | Decode | TTFT | Init |
|
| 149 |
|---|---|---|---|---|---|
|
|
@@ -177,10 +177,10 @@ The two files come from two different conversion paths.
|
|
| 177 |
|
| 178 |
**int4 — a blockwise recipe with two pieces of handling** (reproduction: [hf-to-litertlm](https://github.com/john-rocky/hf-to-litertlm), `bash scripts/reproduce_llm.sh minicpm5-2b`; litert-torch 0.9.3 / litert-converter 0.4.0 / ai-edge-quantizer 0.9.0 / litert-lm-builder 0.16.1):
|
| 179 |
|
| 180 |
-
- The metadata is LiteRT-LM's official models/minicpm5 configuration at commit 4a363c07 (`LlmMetadataProto.pbtext` and `chat_template.jinja`, the template as last changed in 801acdef), put in place by
|
| 181 |
- **Start token `<s>`** is correct for this family: the template writes no BOS of its own and the engine prepends the metadata start token, so the model sees exactly one `<s>` as it does upstream. Stops are the token ids of `</s>` (1) and `<|im_end|>` (130073).
|
| 182 |
- **int4 needed a zero-scale fix.** Decoder layer 0's MLP contains 13 dead rows (every weight below 3e-23); blockwise quantization emits a zero scale for each of their blocks, which the CPU (XNNPACK) path refuses to load (`unsupported scale value (0.000000) … for INT4 tensor`) while the GPU path silently accepts. The scales were replaced in place by a tiny positive epsilon — 3,328 bytes of a 1.55 GB file.
|
| 183 |
-
- The 130560×2048 input-embedding table
|
| 184 |
|
| 185 |
## Machine-readable manifest
|
| 186 |
|
|
@@ -197,7 +197,7 @@ The two files come from two different conversion paths.
|
|
| 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
|
| 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 |
|
|
@@ -209,7 +209,7 @@ Since LiteRT-LM 0.18.0 the chat template gets `message.content` as typed parts;
|
|
| 209 |
|
| 210 |
Released under the **Apache-2.0 License**, consistent with the upstream [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B).
|
| 211 |
|
| 212 |
-
**Changes from the original work** (for the two recommended files): weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described above; in the int4 file, 13 dead weight rows' quantization scales set to an epsilon (measured inert: GSM8K 87 with the identical miss list on a copy whose payload under those scales is zeroed); tokenizer and chat template repackaged into the `.litertlm`
|
| 213 |
|
| 214 |
## Citation
|
| 215 |
|
|
|
|
| 102 |
For both files:
|
| 103 |
|
| 104 |
- **Give a reasoning run a generous output budget (≥ 2048 tokens; 4096 for math).** Truncated mid-thought it produces no final answer at all.
|
| 105 |
+
- Both files declare the thought channel (`<think>\n` / `</think>`), so the streamed text contains only the answer, and runtimes that expose ThinkingConfig can cap or read the reasoning separately.
|
| 106 |
+
- `enable_thinking` set via `ThinkingConfig` or the conversation's extra context reaches either template: `false` switches to direct answers (two- to nine-token replies on the 8-question test, ~10× faster turns, and the GSM8K numbers below); `true` pre-fills the think opener explicitly. On the CLI: `--thinking true|false` / `--thinking-budget N`.
|
| 107 |
+
- Sampling: OpenBMB recommends `temperature 1.0, top_p 0.95`; the Mac 8-question and GSM8K tests below use greedy decoding.
|
| 108 |
- Prompt format is ChatML (`<|im_start|>role\n…<|im_end|>\n`), 4096-token KV budget. Prefill signatures: int4 six (1024, 256, 64, 16, 4, 1); int8 one (128 — a longer prompt is prefilled in 128-token chunks).
|
| 109 |
|
| 110 |
## Correctness
|
| 111 |
|
| 112 |
+
On an 8-question test (Apple M4 Max, greedy, CPU and GPU) the int4 file, on litert-lm 0.18.0, scores 6/8 at its default (direct answers) on both backends. With thinking on it scores 7/8 on CPU and 8/8 on GPU (WebGPU on Metal: every text-decoder node delegated, the two embedder graphs on CPU). The int8 file scores 6/8 at its default (direct answers) and 8/8 with thinking on, on both backends. At its default on litert-lm 0.18.0 the int4 file misses two questions on both backends ("opposite of hot" → "Cool.", the rhyme line → "Blues."). The two thinking-off misses are the bf16 PyTorch model's own: it scores 8/8 with thinking on or left to the model and 6/8 with thinking forced off ("opposite of hot" → "Cool.", the rhyme line → "Green."), so read any thinking-off result against that, not against 8/8.
|
| 113 |
|
| 114 |
**GSM8K** (first 100 test questions, greedy, 0-shot chain-of-thought prompt, **thinking off** — the protocol OpenBMB's own MiniCPM5 cards use, max 2048 new tokens, identical prompt and extraction on every row):
|
| 115 |
|
|
|
|
| 120 |
| int4, CPU | 86 % |
|
| 121 |
| int4, GPU (WebGPU on Metal) | 87 % |
|
| 122 |
|
| 123 |
+
int8 matches the bf16 model: 93 vs 92 is inside one standard error at n=100 (about ±3 points), and six of its seven misses are the bf16 model's own; the seventh (question 8) is a derivation that runs to the 2048-token budget mid-calculation on the GPU, so the extracted number is wrong, while the CPU run on the same file answers it in 2,204 characters. int4 costs about five points on this 42-layer model; the GPU's default fp16 activations cost nothing measurable in no-think mode.
|
| 124 |
|
| 125 |
**Thinking mode is where int4 shows its damage.** On ten GSM8K questions with thinking on and a 3584-token budget, the bf16 model closes its reasoning on 9/10 with ~3,000-character chains, and int8 closes **10/10 with ~3,900-character chains (10/10 correct; GPU, WebGPU on Metal, runtime-default fp16 activations)**, while **int4 closes 0/10 on CPU** (median ~13,700 characters — it keeps re-checking and runs into the budget; the answer is usually right inside the thought text but never gets emitted). On the GPU (WebGPU on Metal) with the runtime's default fp16 activations the same int4 file happened to close 10/10 with ~8,000-character chains, but that is fp16 rounding steering the trajectory, not a property to rely on. If your use needs the reasoning to finish, use int8 or turn thinking off on int4.
|
| 126 |
|
| 127 |
On a **Galaxy S26 (SM-S942Q, Snapdragon SM8850, Adreno)** both files generate correctly on GPU and CPU; on the GPU with **full OpenCL delegation — every node of every prefill and decode signature, zero rejected ops** (int4: 1873/1873 on the 1024- to 4-token prefills, 1664/1664 on the 1-token prefill, 1692/1692 on decode; int8: 1836/1836 on the 128-token prefill, 1655/1655 on decode) — and the runtime separates the reasoning on-device (`[thought] … [/thought]`, then the answer).
|
| 128 |
|
| 129 |
+
On an **iPhone 17 Pro** the int4 file, with its earlier metadata, passed the same 8-question test on both backends (on-device byte count verified against the source file): **Metal GPU 7/8** (init 5.7 s) and **CPU 7/8** (init 2.2 s); the one miss on each backend was the rhyme line inside the 8-question composite prompt, answered "green" — the same answer the bf16 model gives with thinking off, so a prompt-format artifact rather than conversion damage.
|
| 130 |
|
| 131 |
Multi-turn: in a three-turn conversation (introduce a name and a city, an arithmetic question, then "which city do I live in?") the int8 file recalls the city with thinking unset, off and on (litert-lm 0.18.0). At the default (no thinking), a two-turn exchange ("My name is Kenji." / "What is my name?") does not get the name back: on litert-lm 0.18.0 the int4 file calls itself Kenji. With thinking on (0.18.0, 300-token thinking budget), its second reply begins "Hello! You're named Kenji." The int8 file, at its default on 0.18.0, answers the second turn without the name.
|
| 132 |
|
|
|
|
| 143 |
|
| 144 |
The measurements below were taken before the int4 file's metadata update, with the same weights; the int8 file has not changed.
|
| 145 |
|
| 146 |
+
`litert-lm benchmark` (litert-lm 0.17.0), Apple M4 Max, `-p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024`, quiet machine, serialized, ≥300 s rest before each GPU reading; each backend confirmed to generate real text before its number was recorded; all four rows from one series of runs (2026-09-13):
|
| 147 |
|
| 148 |
| File | Backend | Prefill (256) | Decode | TTFT | Init |
|
| 149 |
|---|---|---|---|---|---|
|
|
|
|
| 177 |
|
| 178 |
**int4 — a blockwise recipe with two pieces of handling** (reproduction: [hf-to-litertlm](https://github.com/john-rocky/hf-to-litertlm), `bash scripts/reproduce_llm.sh minicpm5-2b`; litert-torch 0.9.3 / litert-converter 0.4.0 / ai-edge-quantizer 0.9.0 / litert-lm-builder 0.16.1):
|
| 179 |
|
| 180 |
+
- The metadata is LiteRT-LM's official models/minicpm5 configuration at commit 4a363c07 (`LlmMetadataProto.pbtext` and `chat_template.jinja`, the template as last changed in 801acdef), put in place by `scripts/repack_official_metadata.sh` in hf-to-litertlm (see its REPRODUCE.md). `llm_model_type` is minicpm5, so the runtime parses the model's tool calls, and the `thought` channel is declared as `<think>\n` / `</think>`. The configuration sets neither capability flag: `describe` prints Supports Function Call NO and Supports Thinking NO for both files, and the tool-call, thinking and tool-result checks ran with that (litert-lm 0.18.0).
|
| 181 |
- **Start token `<s>`** is correct for this family: the template writes no BOS of its own and the engine prepends the metadata start token, so the model sees exactly one `<s>` as it does upstream. Stops are the token ids of `</s>` (1) and `<|im_end|>` (130073).
|
| 182 |
- **int4 needed a zero-scale fix.** Decoder layer 0's MLP contains 13 dead rows (every weight below 3e-23); blockwise quantization emits a zero scale for each of their blocks, which the CPU (XNNPACK) path refuses to load (`unsupported scale value (0.000000) … for INT4 tensor`) while the GPU path silently accepts. The scales were replaced in place by a tiny positive epsilon — 3,328 bytes of a 1.55 GB file.
|
| 183 |
+
- The 130560×2048 input-embedding table is int8; linears are blockwise-32 int4 with OCTAV clipping; GPU activations at the runtime default (fp16).
|
| 184 |
|
| 185 |
## Machine-readable manifest
|
| 186 |
|
|
|
|
| 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 model file 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 |
|
|
|
|
| 209 |
|
| 210 |
Released under the **Apache-2.0 License**, consistent with the upstream [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B).
|
| 211 |
|
| 212 |
+
**Changes from the original work** (for the two recommended files): weights converted from safetensors bf16 to LiteRT flatbuffers and quantized as described above; in the int4 file, 13 dead weight rows' quantization scales set to an epsilon (measured inert: GSM8K 87 with the identical miss list on a copy whose payload under those scales is zeroed); tokenizer and chat template repackaged into the `.litertlm` file with runtime metadata (thought channel, stop tokens; both files carry the LiteRT-LM models/minicpm5 template instead of the checkpoint's). No fine-tuning.
|
| 213 |
|
| 214 |
## Citation
|
| 215 |
|
litertlm_manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"manifest_schema": "0.1.3",
|
| 3 |
"repo": "litert-community/MiniCPM5-2B",
|
| 4 |
-
"generated": "2026-11-
|
| 5 |
"generator": "make_manifest.py",
|
| 6 |
"model": {
|
| 7 |
"display_name": "MiniCPM5-2B",
|
|
@@ -55,7 +55,7 @@
|
|
| 55 |
"model_type": "tf_lite_embedder"
|
| 56 |
}
|
| 57 |
],
|
| 58 |
-
"quantization": "blockwise-32 int4 + OCTAV on linears, int8 embedding
|
| 59 |
"backends": [
|
| 60 |
"cpu",
|
| 61 |
"gpu"
|
|
@@ -66,17 +66,17 @@
|
|
| 66 |
"platform": "android",
|
| 67 |
"device_class": "flagship",
|
| 68 |
"backend": "gpu",
|
| 69 |
-
"reason": "measured on one Galaxy S26 with one binary (2026-09-08, 205-token prompt, 2 runs per backend, cooled below 42 C before each run): gpu prefill 400.7-411.1 tok/s vs cpu 39.0-72.0, TTFT 0.56 s vs 2.9-5.3 s, decode 16.1-18.6 vs 15.6-15.8 tok/s (a modest 1.0-1.2x), peak VmHWM 1.13-1.14 GB vs 1.96-2.12 GB; full LITERT_CL delegation (every node of every subgraph: 1873/1873 on the multi-token prefills, 1664/1664 on prefill_1, 1692/1692 on decode) and the
|
| 70 |
},
|
| 71 |
{
|
| 72 |
"platform": "macos",
|
| 73 |
"backend": "gpu",
|
| 74 |
-
"reason": "Apple M4 Max, litert-lm 0.17.0 benchmark -p 256 -d 256 --runs 3 --cache no,
|
| 75 |
},
|
| 76 |
{
|
| 77 |
"platform": "ios",
|
| 78 |
"backend": "gpu",
|
| 79 |
-
"reason": "iPhone 17 Pro, 8-question on-device
|
| 80 |
}
|
| 81 |
],
|
| 82 |
"requirements": {
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"Requires litert-lm >= 0.18.0 (the template reads message content as a list of parts; on 0.17.x and older the user turn renders empty); measured on 0.18.0",
|
| 86 |
"Hybrid-reasoning model: with no ThinkingConfig it answers directly (the template's default); enable_thinking=true (ThinkingConfig or conversation extra_context) turns the reasoning on; with thinking on, budget max output tokens >= 2048 (4096 for math)",
|
| 87 |
"Thinking-mode caveat measured on this file: on GSM8K-class questions its reasoning chains run ~4x longer than int8's and do not close inside 3584 tokens on the CPU reference (0/10 closed; int8 9/10, bf16 9/10). Use int8 when the reasoning must complete, or turn thinking off",
|
| 88 |
-
"iPhone 17 Pro: passes the on-device
|
| 89 |
"The 13 all-zero MLP rows in decoder layer 0 make raw blockwise-int4 exports fail to load on XNNPACK (scale 0); this file carries the epsilon fix"
|
| 90 |
]
|
| 91 |
},
|
|
@@ -105,7 +105,7 @@
|
|
| 105 |
"cache": "no",
|
| 106 |
"runs": 3,
|
| 107 |
"date": "2026-09-13",
|
| 108 |
-
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, quiet machine, CPU
|
| 109 |
},
|
| 110 |
{
|
| 111 |
"device": "Apple M4 Max",
|
|
@@ -122,7 +122,7 @@
|
|
| 122 |
"cache": "no",
|
| 123 |
"runs": 3,
|
| 124 |
"date": "2026-09-13",
|
| 125 |
-
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, >=300 s rest before the GPU
|
| 126 |
},
|
| 127 |
{
|
| 128 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
|
@@ -172,7 +172,7 @@
|
|
| 172 |
"cache": "no",
|
| 173 |
"runs": 2,
|
| 174 |
"date": "2026-09-08",
|
| 175 |
-
"source": "205-token prompt with --benchmark, 2 runs (engine init 11.2 / 13.1 s), device cooled below 42 C before each run; GPU
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
|
@@ -192,7 +192,7 @@
|
|
| 192 |
}
|
| 193 |
],
|
| 194 |
"known_issues": [
|
| 195 |
-
"Thinking mode: reasoning chains are ~4x longer than int8/bf16 on GSM8K-class questions and frequently hit a 3584-token budget without emitting the answer (CPU reference 0/10 closed; the Metal GPU's default fp16 activations happen to close 22/30). Quantization damage of int4 on this 42-layer model, not a runtime bug
|
| 196 |
],
|
| 197 |
"context_length": 4096
|
| 198 |
},
|
|
@@ -230,22 +230,22 @@
|
|
| 230 |
"platform": "android",
|
| 231 |
"device_class": "flagship",
|
| 232 |
"backend": "gpu",
|
| 233 |
-
"reason": "measured on one Galaxy S26 with one binary (2026-09-13, v0.16.0 release
|
| 234 |
},
|
| 235 |
{
|
| 236 |
"platform": "macos",
|
| 237 |
"backend": "gpu",
|
| 238 |
-
"reason": "Apple M4 Max, litert-lm 0.17.0 benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024,
|
| 239 |
}
|
| 240 |
],
|
| 241 |
"requirements": {
|
| 242 |
"peak_ram_mb": 3065,
|
| 243 |
"platform_notes": [
|
| 244 |
-
"Requires litert-lm >= 0.16 (thought channel + ThinkingConfig); measured on 0.17.0 (Mac) and on the v0.16.0 release
|
| 245 |
"Template = the LiteRT-LM models/minicpm5 canonical chat_template.jinja: with nothing set the model answers directly (enable_thinking defaults to false); enable_thinking=true via ThinkingConfig or the conversation's extra_context turns the reasoning on - budget max output tokens >= 2048 (4096 for math) for a thinking run",
|
| 246 |
"One prefill signature (128 tokens); a longer prompt is prefilled in 128-token chunks. KV budget 4096 (max_num_tokens); the command's cache_length 32771 is the runtime's magic number and the cache is sized to 4096 at load",
|
| 247 |
"iOS: the 2.54 GB main weight section is above what a default-entitlement app maps in one piece; the com.apple.developer.kernel.increased-memory-limit entitlement lifts that limit (not checked with this file)",
|
| 248 |
-
"GSM8K (thinking off, n=100, greedy, max 2048 tokens): 93 on the Mac GPU vs bf16 92 -
|
| 249 |
]
|
| 250 |
},
|
| 251 |
"measured": [
|
|
@@ -264,7 +264,7 @@
|
|
| 264 |
"cache": "no",
|
| 265 |
"runs": 3,
|
| 266 |
"date": "2026-09-13",
|
| 267 |
-
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, quiet machine, CPU
|
| 268 |
},
|
| 269 |
{
|
| 270 |
"device": "Apple M4 Max",
|
|
@@ -281,12 +281,12 @@
|
|
| 281 |
"cache": "no",
|
| 282 |
"runs": 3,
|
| 283 |
"date": "2026-09-13",
|
| 284 |
-
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, >=300 s rest before the GPU
|
| 285 |
},
|
| 286 |
{
|
| 287 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
| 288 |
"backend": "gpu",
|
| 289 |
-
"runtime": "litert_lm_advanced_main v0.16.0
|
| 290 |
"prompt_tokens": 207,
|
| 291 |
"decode_tokens": 182,
|
| 292 |
"prefill_tps": "541.5-549.2",
|
|
@@ -294,15 +294,15 @@
|
|
| 294 |
"ttft_s": "0.42-0.43",
|
| 295 |
"load_s": 6.43,
|
| 296 |
"peak_memory_mb": 820,
|
| 297 |
-
"cache": "
|
| 298 |
"runs": 2,
|
| 299 |
"date": "2026-09-13",
|
| 300 |
-
"source": "205-token prompt with --benchmark, 2 runs (engine init 6.43 / 5.59 s), SKIN 37.9 C and scaling_max_freq == cpuinfo_max_freq checked before each run, 180 s rest between
|
| 301 |
},
|
| 302 |
{
|
| 303 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
| 304 |
"backend": "cpu",
|
| 305 |
-
"runtime": "litert_lm_advanced_main v0.16.0
|
| 306 |
"prompt_tokens": 207,
|
| 307 |
"decode_tokens": 169,
|
| 308 |
"prefill_tps": "92.6-131.7",
|
|
@@ -310,10 +310,10 @@
|
|
| 310 |
"ttft_s": "1.64-2.29",
|
| 311 |
"load_s": 3.56,
|
| 312 |
"peak_memory_mb": 3065,
|
| 313 |
-
"cache": "
|
| 314 |
"runs": 2,
|
| 315 |
"date": "2026-09-13",
|
| 316 |
-
"source": "same-device CPU control: identical binary, prompt file and flags, only --backend differs; 205-token prompt with --benchmark, 2 runs (engine init 3.56 / 4.25 s), SKIN 37.9 C and no CPU frequency cap before each run, 180 s rest between
|
| 317 |
}
|
| 318 |
],
|
| 319 |
"known_issues": [
|
|
|
|
| 1 |
{
|
| 2 |
"manifest_schema": "0.1.3",
|
| 3 |
"repo": "litert-community/MiniCPM5-2B",
|
| 4 |
+
"generated": "2026-11-18",
|
| 5 |
"generator": "make_manifest.py",
|
| 6 |
"model": {
|
| 7 |
"display_name": "MiniCPM5-2B",
|
|
|
|
| 55 |
"model_type": "tf_lite_embedder"
|
| 56 |
}
|
| 57 |
],
|
| 58 |
+
"quantization": "blockwise-32 int4 + OCTAV on linears, int8 embedding; 1,664 all-zero-block scales (13 dead layer-0 MLP rows) set to an epsilon in place after export; GPU activations at the runtime default (fp16)",
|
| 59 |
"backends": [
|
| 60 |
"cpu",
|
| 61 |
"gpu"
|
|
|
|
| 66 |
"platform": "android",
|
| 67 |
"device_class": "flagship",
|
| 68 |
"backend": "gpu",
|
| 69 |
+
"reason": "measured on one Galaxy S26 with one binary (2026-09-08, 205-token prompt, 2 runs per backend, cooled below 42 C before each run): gpu prefill 400.7-411.1 tok/s vs cpu 39.0-72.0, TTFT 0.56 s vs 2.9-5.3 s, decode 16.1-18.6 vs 15.6-15.8 tok/s (a modest 1.0-1.2x), peak VmHWM 1.13-1.14 GB vs 1.96-2.12 GB; full LITERT_CL delegation (every node of every subgraph: 1873/1873 on the multi-token prefills, 1664/1664 on prefill_1, 1692/1692 on decode) and the answer to the capital-of-France question verified through the thought channel. The gpu wins on time-to-first-token and memory; decode is close to a wash"
|
| 70 |
},
|
| 71 |
{
|
| 72 |
"platform": "macos",
|
| 73 |
"backend": "gpu",
|
| 74 |
+
"reason": "Apple M4 Max, litert-lm 0.17.0 benchmark -p 256 -d 256 --runs 3 --cache no, each backend confirmed to generate real text first: gpu 1836 tok/s prefill / 93.0 tok/s decode vs cpu 148 / 31.4 (2026-09-13; the 2026-09-08 readings were 1699 / 92.8 vs 149 / 31.1)"
|
| 75 |
},
|
| 76 |
{
|
| 77 |
"platform": "ios",
|
| 78 |
"backend": "gpu",
|
| 79 |
+
"reason": "iPhone 17 Pro, 8-question on-device test at a 2048-token budget: Metal gpu 7/8 (init 5.7 s) and cpu 7/8 (init 2.2 s), both completed; the one miss on each backend is the rhyme line of the composite prompt, which the bf16 model also misses with thinking off. No speed rows were taken on the phone"
|
| 80 |
}
|
| 81 |
],
|
| 82 |
"requirements": {
|
|
|
|
| 85 |
"Requires litert-lm >= 0.18.0 (the template reads message content as a list of parts; on 0.17.x and older the user turn renders empty); measured on 0.18.0",
|
| 86 |
"Hybrid-reasoning model: with no ThinkingConfig it answers directly (the template's default); enable_thinking=true (ThinkingConfig or conversation extra_context) turns the reasoning on; with thinking on, budget max output tokens >= 2048 (4096 for math)",
|
| 87 |
"Thinking-mode caveat measured on this file: on GSM8K-class questions its reasoning chains run ~4x longer than int8's and do not close inside 3584 tokens on the CPU reference (0/10 closed; int8 9/10, bf16 9/10). Use int8 when the reasoning must complete, or turn thinking off",
|
| 88 |
+
"iPhone 17 Pro: passes the on-device test on gpu and cpu (init 5.7 s / 2.2 s); the int8 file's 2.54 GB main section needs the com.apple.developer.kernel.increased-memory-limit entitlement on iOS (not checked with that file)",
|
| 89 |
"The 13 all-zero MLP rows in decoder layer 0 make raw blockwise-int4 exports fail to load on XNNPACK (scale 0); this file carries the epsilon fix"
|
| 90 |
]
|
| 91 |
},
|
|
|
|
| 105 |
"cache": "no",
|
| 106 |
"runs": 3,
|
| 107 |
"date": "2026-09-13",
|
| 108 |
+
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, quiet machine, CPU measurements first, backend confirmed to generate real text first (same series of runs as the int8 rows; the 2026-09-08 reading was 148.9 / 31.12)"
|
| 109 |
},
|
| 110 |
{
|
| 111 |
"device": "Apple M4 Max",
|
|
|
|
| 122 |
"cache": "no",
|
| 123 |
"runs": 3,
|
| 124 |
"date": "2026-09-13",
|
| 125 |
+
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, >=300 s rest before the GPU measurement, backend confirmed to generate real text first (same series of runs as the int8 rows; the 2026-09-08 reading was 1699 / 92.79)"
|
| 126 |
},
|
| 127 |
{
|
| 128 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
|
|
|
| 172 |
"cache": "no",
|
| 173 |
"runs": 2,
|
| 174 |
"date": "2026-09-08",
|
| 175 |
+
"source": "205-token prompt with --benchmark, 2 runs (engine init 11.2 / 13.1 s), device cooled below 42 C before each run; GPU check: full LITERT_CL delegation (every node of every subgraph: 1873/1873 on the multi-token prefills, 1664/1664 on prefill_1, 1692/1692 on decode), generation verified on the capital-of-France question; the cpu row of the same date is the same-device control"
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
|
|
|
| 192 |
}
|
| 193 |
],
|
| 194 |
"known_issues": [
|
| 195 |
+
"Thinking mode: reasoning chains are ~4x longer than int8/bf16 on GSM8K-class questions and frequently hit a 3584-token budget without emitting the answer (CPU reference 0/10 closed; the Metal GPU's default fp16 activations happen to close 22/30). Quantization damage of int4 on this 42-layer model, not a runtime bug"
|
| 196 |
],
|
| 197 |
"context_length": 4096
|
| 198 |
},
|
|
|
|
| 230 |
"platform": "android",
|
| 231 |
"device_class": "flagship",
|
| 232 |
"backend": "gpu",
|
| 233 |
+
"reason": "measured on one Galaxy S26 with one binary (2026-09-13, litert_lm_advanced_main from the v0.16.0 release, 205-token prompt with --benchmark, 2 runs per backend, SKIN 37.9 C and no CPU frequency cap before every run): gpu prefill 541.5-549.2 tok/s vs cpu 92.6-131.7, TTFT 0.42-0.43 s vs 1.64-2.29 s, decode 22.4-22.6 vs 15.1-18.2 tok/s (1.2-1.5x), peak VmHWM 814-820 MB vs 2,938-3,065 MB; full LITERT_CL delegation (1836/1836 prefill_128, 1655/1655 decode) and the answer to the capital-of-France question verified on both backends (also 8 of 8 short questions answered correctly on the GPU through the litertlm-android 0.17.0 AAR)"
|
| 234 |
},
|
| 235 |
{
|
| 236 |
"platform": "macos",
|
| 237 |
"backend": "gpu",
|
| 238 |
+
"reason": "Apple M4 Max, litert-lm 0.17.0 benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, each backend confirmed to generate real text first: gpu 2084 tok/s prefill / 124.2 tok/s decode vs cpu 175 / 37.1"
|
| 239 |
}
|
| 240 |
],
|
| 241 |
"requirements": {
|
| 242 |
"peak_ram_mb": 3065,
|
| 243 |
"platform_notes": [
|
| 244 |
+
"Requires litert-lm >= 0.16 (thought channel + ThinkingConfig); measured on 0.17.0 (Mac) and on the v0.16.0 release's litert_lm_advanced_main (Galaxy S26)",
|
| 245 |
"Template = the LiteRT-LM models/minicpm5 canonical chat_template.jinja: with nothing set the model answers directly (enable_thinking defaults to false); enable_thinking=true via ThinkingConfig or the conversation's extra_context turns the reasoning on - budget max output tokens >= 2048 (4096 for math) for a thinking run",
|
| 246 |
"One prefill signature (128 tokens); a longer prompt is prefilled in 128-token chunks. KV budget 4096 (max_num_tokens); the command's cache_length 32771 is the runtime's magic number and the cache is sized to 4096 at load",
|
| 247 |
"iOS: the 2.54 GB main weight section is above what a default-entitlement app maps in one piece; the com.apple.developer.kernel.increased-memory-limit entitlement lifts that limit (not checked with this file)",
|
| 248 |
+
"GSM8K (thinking off, n=100, greedy, max 2048 tokens): 93 on the Mac GPU vs bf16 92 - no measurable difference (inside one standard error at n=100); six of its seven misses are the bf16 model's own. 8-question test: 6/8 at the no-think default (= the bf16 model's own thinking-off score) and 8/8 with thinking on, on both backends; thinking-on 10-question GSM8K subset: 10/10 chains close, 10/10 correct (Mac GPU, fp16-default activations)"
|
| 249 |
]
|
| 250 |
},
|
| 251 |
"measured": [
|
|
|
|
| 264 |
"cache": "no",
|
| 265 |
"runs": 3,
|
| 266 |
"date": "2026-09-13",
|
| 267 |
+
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, quiet machine, CPU measurements first, backend confirmed to generate real text first"
|
| 268 |
},
|
| 269 |
{
|
| 270 |
"device": "Apple M4 Max",
|
|
|
|
| 281 |
"cache": "no",
|
| 282 |
"runs": 3,
|
| 283 |
"date": "2026-09-13",
|
| 284 |
+
"source": "litert-lm benchmark -p 256 -d 256 --runs 3 --cache no --max-num-tokens 1024, >=300 s rest before the GPU measurement, backend confirmed to generate real text first"
|
| 285 |
},
|
| 286 |
{
|
| 287 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
| 288 |
"backend": "gpu",
|
| 289 |
+
"runtime": "litert_lm_advanced_main v0.16.0, LiteRT CL delegate",
|
| 290 |
"prompt_tokens": 207,
|
| 291 |
"decode_tokens": 182,
|
| 292 |
"prefill_tps": "541.5-549.2",
|
|
|
|
| 294 |
"ttft_s": "0.42-0.43",
|
| 295 |
"load_s": 6.43,
|
| 296 |
"peak_memory_mb": 820,
|
| 297 |
+
"cache": "the binary's default (no cache flag; the run on the capital-of-France question came first, as on the 2026-09-08 rows)",
|
| 298 |
"runs": 2,
|
| 299 |
"date": "2026-09-13",
|
| 300 |
+
"source": "205-token prompt with --benchmark, 2 runs (engine init 6.43 / 5.59 s), SKIN 37.9 C and scaling_max_freq == cpuinfo_max_freq checked before each run, 180 s rest between runs; GPU check: full LITERT_CL delegation (1836/1836 prefill_128, 1655/1655 decode), generation verified on the capital-of-France question (The capital of France is Paris.); the cpu row of the same date is the same-device control"
|
| 301 |
},
|
| 302 |
{
|
| 303 |
"device": "Galaxy S26 (SM-S942Q, Qualcomm SM8850, Adreno)",
|
| 304 |
"backend": "cpu",
|
| 305 |
+
"runtime": "litert_lm_advanced_main v0.16.0 (XNNPACK CPU)",
|
| 306 |
"prompt_tokens": 207,
|
| 307 |
"decode_tokens": 169,
|
| 308 |
"prefill_tps": "92.6-131.7",
|
|
|
|
| 310 |
"ttft_s": "1.64-2.29",
|
| 311 |
"load_s": 3.56,
|
| 312 |
"peak_memory_mb": 3065,
|
| 313 |
+
"cache": "the binary's default (no cache flag; the run on the capital-of-France question came first, as on the 2026-09-08 rows)",
|
| 314 |
"runs": 2,
|
| 315 |
"date": "2026-09-13",
|
| 316 |
+
"source": "same-device CPU control: identical binary, prompt file and flags, only --backend differs; 205-token prompt with --benchmark, 2 runs (engine init 3.56 / 4.25 s), SKIN 37.9 C and no CPU frequency cap before each run, 180 s rest between runs; the CPU answers the capital-of-France question with The capital of France is Paris. (XNNPACK 1577/1836 prefill_128 + 1392/1655 decode, the rest on the interpreter)"
|
| 317 |
}
|
| 318 |
],
|
| 319 |
"known_issues": [
|