Instructions to use litert-community/SmolLM2-360M-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/SmolLM2-360M-Instruct 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 litert-lm run \ --from-huggingface-repo=litert-community/SmolLM2-360M-Instruct \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
Add measured performance section (M4 Max)
#2
by mlboydaisuke - opened
README.md
CHANGED
|
@@ -1,32 +1,56 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
|
| 4 |
-
pipeline_tag: text-generation
|
| 5 |
-
library_name: litert-lm
|
| 6 |
-
tags:
|
| 7 |
-
- chat
|
| 8 |
-
- litert-lm
|
| 9 |
-
- smollm
|
| 10 |
-
- on-device
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# litert-community/SmolLM2-360M-Instruct
|
| 14 |
-
|
| 15 |
-
This model provides a variant of
|
| 16 |
-
[HuggingFaceTB/SmolLM2-360M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct) that is ready for
|
| 17 |
-
deployment on Android using the
|
| 18 |
-
[LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM).
|
| 19 |
-
|
| 20 |
-
## Use the model
|
| 21 |
-
|
| 22 |
-
### Android
|
| 23 |
-
|
| 24 |
-
#### Edge Gallery App
|
| 25 |
-
* Download or build the [app](https://github.com/google-ai-edge/gallery?tab=readme-ov-file#-get-started-in-minutes) from GitHub.
|
| 26 |
-
|
| 27 |
-
* Install the [app](https://play.google.com/store/apps/details?id=com.google.ai.edge.gallery&pli=1) from Google Play.
|
| 28 |
-
|
| 29 |
-
* Follow the instructions in the app.
|
| 30 |
-
|
| 31 |
-
To build the demo app from source, please follow the [instructions](https://github.com/google-ai-edge/gallery/blob/main/README.md)
|
| 32 |
-
from the GitHub repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: HuggingFaceTB/SmolLM2-360M-Instruct
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
library_name: litert-lm
|
| 6 |
+
tags:
|
| 7 |
+
- chat
|
| 8 |
+
- litert-lm
|
| 9 |
+
- smollm
|
| 10 |
+
- on-device
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# litert-community/SmolLM2-360M-Instruct
|
| 14 |
+
|
| 15 |
+
This model provides a variant of
|
| 16 |
+
[HuggingFaceTB/SmolLM2-360M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct) that is ready for
|
| 17 |
+
deployment on Android using the
|
| 18 |
+
[LiteRT-LM](https://github.com/google-ai-edge/LiteRT-LM).
|
| 19 |
+
|
| 20 |
+
## Use the model
|
| 21 |
+
|
| 22 |
+
### Android
|
| 23 |
+
|
| 24 |
+
#### Edge Gallery App
|
| 25 |
+
* Download or build the [app](https://github.com/google-ai-edge/gallery?tab=readme-ov-file#-get-started-in-minutes) from GitHub.
|
| 26 |
+
|
| 27 |
+
* Install the [app](https://play.google.com/store/apps/details?id=com.google.ai.edge.gallery&pli=1) from Google Play.
|
| 28 |
+
|
| 29 |
+
* Follow the instructions in the app.
|
| 30 |
+
|
| 31 |
+
To build the demo app from source, please follow the [instructions](https://github.com/google-ai-edge/gallery/blob/main/README.md)
|
| 32 |
+
from the GitHub repository.
|
| 33 |
+
|
| 34 |
+
## Performance (measured)
|
| 35 |
+
|
| 36 |
+
### Apple M4 Max
|
| 37 |
+
|
| 38 |
+
Measured with the LiteRT-LM CLI: `litert-lm benchmark -p 256 -d 256 --runs 3 --cache no`
|
| 39 |
+
(litert-lm 0.15.0) on an idle Apple M4 Max (macOS); 256 prefill / 256 decode tokens, 3 iterations
|
| 40 |
+
averaged by the tool. A desktop reference point β phone-side figures vary by SoC and backend.
|
| 41 |
+
|
| 42 |
+
| Backend | Prefill (tokens/s) | Decode (tokens/s) | Time-to-first-token (s) |
|
| 43 |
+
|---|---|---|---|
|
| 44 |
+
| CPU | 588 | 37.3 | 0.63 |
|
| 45 |
+
| GPU | 2,773 | 133.6 | 0.11 |
|
| 46 |
+
|
| 47 |
+
### Galaxy S26 β GPU vs CPU (litert-lm 0.16.0)
|
| 48 |
+
|
| 49 |
+
Measured on a physical Samsung Galaxy S26 (SM-S942Q, Snapdragon 8 Elite Gen 5 / SM8850, Android 16) with `litert_lm_advanced_main` from the litert-lm v0.16.0 release; the GPU backend is OpenCL (`LITERT_CL`). One fixed 205-token prompt text (206 tokens under this tokenizer), `--benchmark`. GPU: two runs back-to-back; CPU: three runs spread across device thermal states (skin temperature up to 41.9 Β°C recorded on the warmest) β small-model CPU speed on a phone moves a lot with temperature, and the CPU range below is that, not noise. Peak RSS is the process VmHWM. Before quoting, the same file was run on each backend with a real prompt: both produced a correct text answer.
|
| 50 |
+
|
| 51 |
+
| Backend | Prefill (206 tok) | Decode | Time-to-first-token | Peak RSS |
|
| 52 |
+
|---|---|---|---|---|
|
| 53 |
+
| **GPU (OpenCL)** | **540β541 tok/s** | **31.5β36.0 tok/s** | **0.41 s** | **546 MB** |
|
| 54 |
+
| CPU (XNNPACK) | 118β211 tok/s | 12.7β19.5 tok/s | 1.03β1.82 s | 1409 MB |
|
| 55 |
+
|
| 56 |
+
The GPU takes the whole graph (decode 1362/1362, prefill 1491/1491 ops on `LITERT_CL`) and wins across the board on this bundle: prefill β₯2.6Γ at any temperature, decode 1.6β2.8Γ, time-to-first-token 2.5β4.4Γ, and peak RSS 2.6Γ lower.
|