Image-Text-to-Text
LiteRT-LM
LiteRT
litertlm
on-device
multimodal
vision-language
Mixture of Experts
Instructions to use litert-community/Inkling-2-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/Inkling-2-Mini 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=litert-community/Inkling-2-Mini \ --prompt="Write me a poem"
- LiteRT
How to use litert-community/Inkling-2-Mini 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 the LiteRT-LM conversion of Inkling-2-Mini (text and image input)
Browse files- .gitattributes +1 -0
- Inkling-2-Mini_int8.litertlm +3 -0
- LICENSE +202 -0
- README.md +114 -0
- litertlm_manifest.json +156 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Inkling-2-Mini_int8.litertlm filter=lfs diff=lfs merge=lfs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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: thinkingmachines/Inkling-2-Mini
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
library_name: litert-lm
|
| 6 |
+
pipeline_tag: image-text-to-text
|
| 7 |
+
tags:
|
| 8 |
+
- litert
|
| 9 |
+
- litert-lm
|
| 10 |
+
- litertlm
|
| 11 |
+
- on-device
|
| 12 |
+
- multimodal
|
| 13 |
+
- vision-language
|
| 14 |
+
- moe
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Inkling-2-Mini LiteRT-LM
|
| 18 |
+
|
| 19 |
+
This repository is a conversion of [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) to LiteRT-LM, for text and image input. On an Apple M4 Max with 128 GB, the one Mac it was tried on, a text-only benchmark with a 1,024-token prompt decoded 256 tokens at 7.05 tok/s on the GPU (WebGPU) and 3.36 tok/s on the CPU, with LiteRT-LM 0.19.2 (2026-11-22).
|
| 20 |
+
|
| 21 |
+
[LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM) is Google's runtime for running language models on your own device. Download the 27.74 GB file [`Inkling-2-Mini_int8.litertlm`](https://huggingface.co/litert-community/Inkling-2-Mini/blob/main/Inkling-2-Mini_int8.litertlm). Its first run on each backend writes caches next to it: the file and the caches of both backends take 80.67 GB of disk. Run these commands in its folder, from a fresh Python 3.13 virtual environment: they install the runtime, download a public photo, pad it to a square and ask about it on the GPU.
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
pip install litert-lm==0.19.2 pillow
|
| 25 |
+
curl -L -o cat.jpeg https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg
|
| 26 |
+
python3 -c "from PIL import Image, ImageOps; im = ImageOps.exif_transpose(Image.open('cat.jpeg')).convert('RGB'); s = max(im.size); sq = Image.new('RGB', (s, s)); sq.paste(im); sq.save('cat_square.png')"
|
| 27 |
+
litert-lm run Inkling-2-Mini_int8.litertlm --backend gpu --vision-backend gpu --attachment cat_square.png --prompt "Describe this picture."
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
On the CPU:
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
litert-lm run Inkling-2-Mini_int8.litertlm --backend cpu --vision-backend cpu --attachment cat_square.png --prompt "Describe this picture."
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
The GPU command printed its thought between `[thinking]` and `[/thinking]`, then this answer:
|
| 37 |
+
|
| 38 |
+
```text
|
| 39 |
+
<|message_model|><|content_text|>The photo shows a very fluffy, stocky cat-like animal—likely a Pallas’s cat/manul—walking across a snow-covered surface. Its thick fur is a mix of gray, tan, and brown with darker mottling, and a light dusting of frost or snow sits along its back. The animal has a rounded face, small rounded ears, dark stripes around the muzzle and eyes, and a somewhat grumpy expression. One front leg is reaching forward and slightly blurred, suggesting motion, while the other legs are planted on the snow.
|
| 40 |
+
|
| 41 |
+
In the background are vertical pale tree trunks, possibly birch, with dark markings and frost, plus a chain-link fence visible at the left edge. The lower part of the image is a solid black band.<|end_message|>
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
## When it does not work
|
| 45 |
+
|
| 46 |
+
- **Phones.** Not tried: the file is larger than the 12 GB of memory of a Galaxy S26.
|
| 47 |
+
- **Prompts over 4,096 tokens.** The context holds 4,096 tokens, and a picture takes 256 of them. Given a longer prompt, the CPU command above printed `An error occurred` on stdout and a Python traceback on stderr that ends with `RuntimeError: INVALID_ARGUMENT: Input token ids are too long. Exceeding the maximum number of tokens allowed: 7480 >= 4096`. It still exited with code 0, so the output is the only sign of the failure.
|
| 48 |
+
- **Pictures that are not square.** The runtime stretches every picture to 640 × 640 pixels without keeping its proportions, so a circle in a wide picture becomes an oval. Pad the picture to a square first, black at the right and bottom, as the `python3` command above does.
|
| 49 |
+
|
| 50 |
+
## First run
|
| 51 |
+
|
| 52 |
+
| | GPU (WebGPU) | CPU |
|
| 53 |
+
|---|---:|---:|
|
| 54 |
+
| Caches the commands above wrote | 25.90 GB | 27.03 GB |
|
| 55 |
+
| First run of the commands above, reply included | 102 s | 224 s |
|
| 56 |
+
| Engine creation in a first text-only run, writing the caches | 38.18 s | 22.44 s |
|
| 57 |
+
| Engine creation in later text-only runs, reading those caches | 3.252–3.513 s | 0.445–0.935 s |
|
| 58 |
+
|
| 59 |
+
## Performance
|
| 60 |
+
|
| 61 |
+
| Backend | Prefill (tok/s) | Decode (tok/s) | Time to first token |
|
| 62 |
+
|---|---:|---:|---:|
|
| 63 |
+
| GPU (WebGPU) | 80.75 | 7.05 | 12.82 s |
|
| 64 |
+
| CPU (XNNPACK, default threads) | 40.46 | 3.36 | 25.61 s |
|
| 65 |
+
|
| 66 |
+
Apple M4 Max (128 GB, macOS 27.0), LiteRT-LM 0.19.2 from PyPI, a 1,024-token text prompt and 256 generated tokens, the median of 3 processes, measured on 2026-11-22.
|
| 67 |
+
|
| 68 |
+
Speed is still being tuned (updates follow).
|
| 69 |
+
|
| 70 |
+
## Memory
|
| 71 |
+
|
| 72 |
+
| Peak memory footprint | GPU (WebGPU) | CPU |
|
| 73 |
+
|---|---:|---:|
|
| 74 |
+
| 1,024-token text prompt, 256 tokens out | about 11 GB | 9.15 GB |
|
| 75 |
+
| One picture and a short question | 16.54–16.60 GB | 4.76–4.86 GB |
|
| 76 |
+
|
| 77 |
+
## Accuracy
|
| 78 |
+
|
| 79 |
+
| Check | GPU (WebGPU) | CPU |
|
| 80 |
+
|---|---:|---:|
|
| 81 |
+
| 12 short text questions: answer correct | 12 / 12 | 12 / 12 |
|
| 82 |
+
| The same 12: every reply token less than 1.0 logit below the author's model's top token | 12 / 12 | 12 / 12 |
|
| 83 |
+
| 3 pictures: every reply token less than 1.0 logit below the author's model's top token | 3 / 3 | 3 / 3 |
|
| 84 |
+
| One of them, a receipt with 16 lines of text: found in the answer | 14 / 16 | 15 / 16 |
|
| 85 |
+
| 3-turn conversation: third answer correct | pass | pass |
|
| 86 |
+
|
| 87 |
+
The pictures went to the author's model as the same 640 × 640 pixels.
|
| 88 |
+
|
| 89 |
+
The author's model found all 16 from a different input: the picture at its own size, 768 image tokens instead of 256, at the lowest thinking effort.
|
| 90 |
+
|
| 91 |
+
None of the WebGPU runs above printed a `Validation error` message.
|
| 92 |
+
|
| 93 |
+
## Limitations
|
| 94 |
+
|
| 95 |
+
- After each complete reply, LiteRT-LM prefills the reply again into the KV cache, thought included, so the thought stays in the conversation and counts toward the 4,096 tokens. In a two-turn WebGPU conversation through the Python API, the context held 605 tokens after the first turn: the cat picture, its question and the reply, 184 of them the thought. On LiteRT-LM 0.19.2, the reply's stream in the Python API ended only after this prefill: 3.5–7.4 s after `<|end_message|>` arrived on the CPU and 6.6–8.6 s on WebGPU. Through the Python API, the thought arrives in a separate `thinking` channel.
|
| 96 |
+
- Start a new conversation after a message fails because it does not fit in the 4,096-token context. On LiteRT-LM 0.19.2, after such a failure, the next three messages in the same conversation, two of them short, all failed with `INTERNAL: Task failed with state: 7`, while a new conversation answered. This was measured once with another file, not with this one.
|
| 97 |
+
- The model's markers `<|message_model|>`, `<|content_text|>` and `<|end_message|>` come out as text, in the command's output and in the reply text of the Python API. Remove them in your app.
|
| 98 |
+
- On the CPU, the same greedy question can get a different reply in a new process. On WebGPU, the photo asked in two processes got the same reply both times.
|
| 99 |
+
- Create one Engine per conversation. This file keeps a running state for its short convolutions, and on LiteRT-LM 0.19.2 a new conversation on the same Engine can continue from the previous conversation's state ([LiteRT-LM#3165](https://github.com/google-ai-edge/LiteRT-LM/issues/3165)). This was not measured on this file.
|
| 100 |
+
- After the first turn of a conversation, LiteRT-LM can put a token of the conversation into the KV cache without its embedding, because in this file the text embedder is a model of its own and the decoder takes embeddings. Later answers can then differ from what the model answers to the same messages in one prompt. This was read in the source of LiteRT-LM 0.19.1 and measured with 0.18.1 on WeVisOne-VL-2B and Qwen2.5-Coder-1.5B-Instruct, not on this file. One question per conversation avoids it, as does a new conversation that starts with the earlier messages and the new question.
|
| 101 |
+
- Tool calls were not tried with this file.
|
| 102 |
+
|
| 103 |
+
## How it was made
|
| 104 |
+
|
| 105 |
+
- The file was converted from the author's revision `ed40e7da625f594fc9c4990f5f66be24873c22d7`, which stores the experts in NVFP4 and MXFP8 and the other weights in bf16.
|
| 106 |
+
- The file holds four models: the text embedder, the text decoder, the vision encoder and the vision adapter. The author's `mtp.safetensors` is not in it.
|
| 107 |
+
- It keeps int8 weights per output channel for the experts, the lm_head and most other linear layers, and fp32 weights for the routers, the attention-residual queries and two small integer-valued matrices. The text embedder's token table is int8, with one scale per row. The vision encoder and adapter keep fp32 weights.
|
| 108 |
+
- It declares fp32 activations for all four models.
|
| 109 |
+
- The tokenizer is the author's `tokenizer.json`, byte for byte.
|
| 110 |
+
- The file's chat template is the author's, with six edits for LiteRT-LM's template engine.
|
| 111 |
+
|
| 112 |
+
## License
|
| 113 |
+
|
| 114 |
+
Apache 2.0, the license of the author's model: [LICENSE](https://huggingface.co/litert-community/Inkling-2-Mini/blob/main/LICENSE). The author's [Model Acceptable Use Policy](https://thinkingmachines.ai/model-acceptable-use-policy/) covers modified versions like this one.
|
litertlm_manifest.json
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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model": "thinkingmachines/Inkling-2-Mini",
|
| 9 |
+
"architecture": "Inkling-2-Mini, a looped mixture-of-experts transformer: 24 decoder layers (hidden 2304) whose middle 12 run three times with shared weights (48 layer applications per token); each token goes to 8 of 128 experts; 20 sliding-window attention layers (1,024-token window) and 4 global ones; short convolutions (kernel 4). Images: a 23-layer vision transformer (patch 20) and an adapter into the decoder.",
|
| 10 |
+
"license": "apache-2.0",
|
| 11 |
+
"parameters_b": 26.4,
|
| 12 |
+
"stateful": true,
|
| 13 |
+
"context_length": 4096,
|
| 14 |
+
"capabilities": {
|
| 15 |
+
"vision": true,
|
| 16 |
+
"audio": false,
|
| 17 |
+
"thinking": {
|
| 18 |
+
"declared": true,
|
| 19 |
+
"channel": {
|
| 20 |
+
"start": "<|content_thinking|>",
|
| 21 |
+
"end": "<|end_message|>"
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"channels": [
|
| 25 |
+
{
|
| 26 |
+
"name": "thinking",
|
| 27 |
+
"start": "<|content_thinking|>",
|
| 28 |
+
"end": "<|end_message|>",
|
| 29 |
+
"is_reasoning": true
|
| 30 |
+
}
|
| 31 |
+
]
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
"variants": [
|
| 35 |
+
{
|
| 36 |
+
"file": "Inkling-2-Mini_int8.litertlm",
|
| 37 |
+
"size_bytes": 27741208576,
|
| 38 |
+
"sha256": "bb1dcd5b1f7616fc94b60965394352497f1941ae161f88ef662e3bd2c7620f3b",
|
| 39 |
+
"sections": [
|
| 40 |
+
{
|
| 41 |
+
"type": "LlmMetadataProto",
|
| 42 |
+
"size_bytes": 8111
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"type": "ExecutorMetadataProto",
|
| 46 |
+
"size_bytes": 20214
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"type": "HF_Tokenizer_Zlib",
|
| 50 |
+
"size_bytes": 3889485
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"type": "TFLiteModel",
|
| 54 |
+
"size_bytes": 2423480,
|
| 55 |
+
"model_type": "tf_lite_embedder"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"type": "TFLiteModel",
|
| 59 |
+
"size_bytes": 355126824,
|
| 60 |
+
"model_type": "tf_lite_prefill_decode"
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"type": "TFLiteModel",
|
| 64 |
+
"size_bytes": 6310488,
|
| 65 |
+
"model_type": "tf_lite_vision_encoder"
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"type": "TFLiteModel",
|
| 69 |
+
"size_bytes": 1536,
|
| 70 |
+
"model_type": "tf_lite_vision_adapter"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"type": "TFLiteWeights",
|
| 74 |
+
"size_bytes": 463159296,
|
| 75 |
+
"model_type": "tf_lite_embedder"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"type": "TFLiteWeights",
|
| 79 |
+
"size_bytes": 25642775552,
|
| 80 |
+
"model_type": "tf_lite_prefill_decode"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"type": "TFLiteWeights",
|
| 84 |
+
"size_bytes": 1162543104,
|
| 85 |
+
"model_type": "tf_lite_vision_encoder"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"type": "TFLiteWeights",
|
| 89 |
+
"size_bytes": 104857600,
|
| 90 |
+
"model_type": "tf_lite_vision_adapter"
|
| 91 |
+
}
|
| 92 |
+
],
|
| 93 |
+
"quantization": "Text embedder: the token table in int8, one scale per row. Text decoder: int8 weights per output channel for the experts, lm_head and most other linear layers; the routers, the attention-residual queries and two small integer-valued matrices stay fp32. Every linear layer of the decoder takes fp32 inputs and gives fp32 outputs, and neither text graph has a DEQUANTIZE op. Vision encoder and adapter fp32. All four model sections declare fp32 activations.",
|
| 94 |
+
"backends": [
|
| 95 |
+
"cpu",
|
| 96 |
+
"gpu"
|
| 97 |
+
],
|
| 98 |
+
"default_backend": "cpu",
|
| 99 |
+
"min_runtime_version": "0.19.2",
|
| 100 |
+
"recommended": [
|
| 101 |
+
{
|
| 102 |
+
"platform": "macos",
|
| 103 |
+
"backend": "gpu",
|
| 104 |
+
"reason": "Measured on one Mac (Apple M4 Max, 128 GB, macOS 27.0) with litert-lm 0.19.2 from PyPI, 1,024 prompt tokens and 256 generated tokens, the median of 3 processes: WebGPU decodes 7.048 tok/s and prefills 80.751 tok/s against the CPU's 3.360 and 40.457 (2.1x and 2.0x). On both backends every reply token of 12 text questions and 3 pictures was the author's model's top token or less than 1.0 logit below it."
|
| 105 |
+
}
|
| 106 |
+
],
|
| 107 |
+
"requirements": {
|
| 108 |
+
"platform_notes": [
|
| 109 |
+
"Checked on a Mac only (Apple M4 Max, 128 GB, macOS 27.0) with litert-lm 0.19.2 from PyPI, on the CPU (XNNPACK) and the GPU (WebGPU). Not run on phones: the file is 27,741,208,576 bytes, and a Galaxy S26 has 12 GB of RAM.",
|
| 110 |
+
"Pictures: the runtime stretches every picture to 640 x 640 pixels (256 image tokens) and does not keep the aspect ratio. Pad a picture to a square (black, at the right and bottom) before giving it.",
|
| 111 |
+
"Thinking: the file declares the thinking channel, and the chat template's default effort is 0.9. After a complete reply, the thought stays in the conversation's context and counts against its 4,096 tokens, with the prompt and the answer.",
|
| 112 |
+
"First run: the litert-lm command writes its caches next to the model file. After a first CPU run and then a first GPU run (one picture each), the folder held 3 CPU cache files (27,025,786,368 bytes) and 4 GPU cache files (25,902,324,184 bytes); the first CPU run took 224 s and the first GPU run 102 s, cache writes included. Python API runs of the same file, with the text decoder's caches already written, built the engine in 1.07 s (CPU) and 3.22 s (WebGPU) in each backend's first picture run, which also wrote the picture caches, and in 0.64-0.70 s (CPU) and 2.78-2.92 s (WebGPU) once those existed.",
|
| 113 |
+
"Context: 4,096 tokens. On the CPU, an input of 7,480 tokens (a picture and a long text) failed with `INVALID_ARGUMENT: Input token ids are too long`; `litert-lm run` printed `An error occurred` and exited with code 0."
|
| 114 |
+
]
|
| 115 |
+
},
|
| 116 |
+
"measured": [
|
| 117 |
+
{
|
| 118 |
+
"device": "Apple M4 Max (Mac16,9, 128 GB)",
|
| 119 |
+
"os": "macOS 27.0",
|
| 120 |
+
"backend": "cpu",
|
| 121 |
+
"runtime": "litert-lm 0.19.2 (PyPI), XNNPACK, the runtime's default thread count",
|
| 122 |
+
"prompt_tokens": 1024,
|
| 123 |
+
"decode_tokens": 256,
|
| 124 |
+
"prefill_tps": 40.457,
|
| 125 |
+
"decode_tps": 3.36,
|
| 126 |
+
"ttft_s": 25.61,
|
| 127 |
+
"max_num_tokens": 2048,
|
| 128 |
+
"cache": "disk",
|
| 129 |
+
"runs": 3,
|
| 130 |
+
"date": "2026-11-22",
|
| 131 |
+
"source": "litert_lm.Benchmark (the class the litert-lm benchmark command runs) on this file: 3 fresh processes, each 1 unscored warm-up run and 2 timed runs; the row is the median of the 3 process means, and every run prefilled exactly 1,024 tokens. The XNNPACK weight cache was read from disk (engine creation 0.445-0.935 s); peak footprint 9.15 GB (sampled with top)."
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"device": "Apple M4 Max (Mac16,9, 128 GB)",
|
| 135 |
+
"os": "macOS 27.0",
|
| 136 |
+
"backend": "gpu",
|
| 137 |
+
"runtime": "litert-lm 0.19.2 (PyPI), WebGPU (Apple M4 Max adapter, Metal backend), fp32 activations as the file declares",
|
| 138 |
+
"prompt_tokens": 1024,
|
| 139 |
+
"decode_tokens": 256,
|
| 140 |
+
"prefill_tps": 80.751,
|
| 141 |
+
"decode_tps": 7.048,
|
| 142 |
+
"ttft_s": 12.823,
|
| 143 |
+
"max_num_tokens": 2048,
|
| 144 |
+
"cache": "disk",
|
| 145 |
+
"runs": 3,
|
| 146 |
+
"date": "2026-11-22",
|
| 147 |
+
"source": "The same benchmark and counting on WebGPU. The GPU caches were read from disk (engine creation 3.252-3.513 s); peak footprint about 11 GB (sampled with top); 0 stderr lines with Validation error, Invalid CommandBuffer or Shape mismatch in the 3 processes."
|
| 148 |
+
}
|
| 149 |
+
],
|
| 150 |
+
"known_issues": [
|
| 151 |
+
"On the CPU, greedy replies can differ from one process to the next: a second run of each of 3 picture prompts (same file, prompt and settings) gave the same reply for one picture and other replies for two (from reply token 15 and from reply token 43). On WebGPU, one picture run in two processes gave the same reply both times."
|
| 152 |
+
],
|
| 153 |
+
"context_length": 4096
|
| 154 |
+
}
|
| 155 |
+
]
|
| 156 |
+
}
|