Instructions to use litert-community/MiniCPM5-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MiniCPM5-1B 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
Update LlmMetadata for litert-lm 0.18.0: chat template with content parts, supports_thinking / supports_function_calling (weights unchanged)
This updates the metadata (LlmMetadata) of three files, in place so their URLs stay the same: minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm, minicpm_wi4b32_wi8_afp32.litertlm and MiniCPM5-1B_dynamic_wi8_afp32.litertlm (as in the earlier update, the two wi4b32 files come out 5.7 KB and 5.5 KB shorter than on main, because the packer does not write the zero padding after the last section). The metadata is now LiteRT-LM's official minicpm5 configuration, LlmMetadataProto.pbtext and chat_template.jinja from models/minicpm5 at 4a363c07, unchanged except that each file keeps its own max_num_tokens (table below). It replaces the update this PR carried before, which used the template at b5e34ab1 with a content macro and set the two capability flags. Every section other than LlmMetadata is byte-identical to the published files (the unpacked section files were compared).
litert-lm 0.18.0 hands the chat template each message's content as a list of parts (models/README.md, issue 3688), so with the published templates it renders the user turn of the wi4b32 files empty and prints the list into the dynamic_wi8 prompt as text. The files need litert-lm 0.18.0 or newer (tested on 0.18.0): 0.17.0 passes message content as a string and this template reads parts, so the user turn renders empty.
The template answers directly unless enable_thinking is true, which changes the default of the two wi4b32 files:
| file | thinking by default (before β after) | context tokens |
|---|---|---|
minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm |
the model decides β off | 1024 |
minicpm_wi4b32_wi8_afp32.litertlm |
the model decides β off | 1024 |
MiniCPM5-1B_dynamic_wi8_afp32.litertlm |
off β off | 4096 |
For the two wi4b32 files the configuration also sets the thought channel <think>\n / </think>, only the stop token ids 1 and 130073, and the model type minicpm5, so the runtime parses the model's <function name=β¦> tool calls; the dynamic_wi8 file already had these values. describe prints Supports Function Call NO / Supports Thinking NO; the tool-call, thinking and tool-result checks below ran with that.
The commands that produced minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm, with WORK set to an empty directory and OFF to one for the official files:
litert-lm() { uvx --from litert-lm==0.18.0 litert-lm "$@"; }
litert-lm --version
mkdir -p $OFF/minicpm5 $WORK/src $WORK/out
curl -fsSL -o $OFF/minicpm5/LlmMetadataProto.pbtext https://raw.githubusercontent.com/google-ai-edge/LiteRT-LM/4a363c0728d4461eaf05c4d87250ef3e90deb035/models/minicpm5/LlmMetadataProto.pbtext
curl -fsSL -o $OFF/minicpm5/chat_template.jinja https://raw.githubusercontent.com/google-ai-edge/LiteRT-LM/4a363c0728d4461eaf05c4d87250ef3e90deb035/models/minicpm5/chat_template.jinja
curl -fsSL -o $WORK/src/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm https://huggingface.co/litert-community/MiniCPM5-1B/resolve/f6a837aa9437aa389f0161f2a1a65c715ae1c17a/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm
shasum -a 256 $WORK/src/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm
litert-lm unpack $WORK/src/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm --output-dir $WORK/work
grep '^max_num_tokens' $WORK/work/LlmMetadataProto.pbtext
cp $OFF/minicpm5/LlmMetadataProto.pbtext $WORK/work/LlmMetadataProto.pbtext
perl -pi -e 's/^max_num_tokens: 4096$/max_num_tokens: 1024/' $WORK/work/LlmMetadataProto.pbtext
grep '^max_num_tokens' $WORK/work/LlmMetadataProto.pbtext
litert-lm pack $WORK/work --chat-template $OFF/minicpm5/chat_template.jinja --output $WORK/out/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm
litert-lm unpack $WORK/out/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm --output-dir $WORK/chk --chat-template $WORK/chk.jinja && diff $WORK/chk.jinja $OFF/minicpm5/chat_template.jinja
diff -r -x LlmMetadataProto.pbtext -x model.toml $WORK/work $WORK/chk
shasum -a 256 $WORK/out/minicpm_wi4b32_wi8_afp32_gpu_opt.litertlm
minicpm_wi4b32_wi8_afp32.litertlm came from the same commands with its own name, and MiniCPM5-1B_dynamic_wi8_afp32.litertlm from the same commands with its own name and without the perl line, since its max_num_tokens is already 4096.
Running the commands again gives a file whose sections match byte for byte while its sha256 differs: the packer writes a new uuid and creation timestamp into the container header (37 bytes in a test re-run).
Checks on litert-lm 0.18.0 (python API, CPU on a Mac, one process per check): each file answered a plain prompt, called a tool automatically and answered from its result, answered with thinking on (the reasoning on the thought channel) and off, ran two turns, and read a tool result from the tool message. With the system prompt "Reply in exactly one word." each file answered "Paris"; with "You are a pirate. End every reply with 'Arr'." each answered "The capital of France is Paris." (one run each; the system turn is in the rendered prompt). On a Galaxy S26, with the prebuilt litert_lm_advanced_main from gs://litert/binaries/latest (2026-09-18 build), each file answered "Paris" to a one-word question on the CPU and on the GPU, with every text-decoder subgraph on the GPU delegate (OpenCL).
The card gets one sentence under each file's bullet; if a new name suits the repo better, I will change the PR, and if a new export supersedes these files, I will close it.