Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: lfm1.0
|
| 4 |
+
license_link: https://huggingface.co/LiquidAI/LFM2.5-230M/blob/main/LICENSE
|
| 5 |
+
base_model: LiquidAI/LFM2.5-230M
|
| 6 |
+
tags:
|
| 7 |
+
- qualcomm
|
| 8 |
+
- hexagon
|
| 9 |
+
- npu
|
| 10 |
+
- qnn
|
| 11 |
+
- qhexrt
|
| 12 |
+
- on-device
|
| 13 |
+
- lfm2
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# LFM2.5-230M — Hexagon NPU (QHexRT) bundle
|
| 20 |
+
|
| 21 |
+
[LiquidAI/LFM2.5-230M](https://huggingface.co/LiquidAI/LFM2.5-230M) compiled to run on the **Qualcomm Hexagon
|
| 22 |
+
v79 NPU** (Snapdragon 8 Elite / SM8750, e.g. Galaxy S25) via the **[QHexRT](https://github.com/RunanywhereAI/QHexRT)**
|
| 23 |
+
runtime. Pure on-device inference — **no Python in the hot path.**
|
| 24 |
+
|
| 25 |
+
14-layer hybrid model (6 GQA-attention + 8 short-conv), hidden 1024, vocab 65536, tied lm-head. Runs **W8
|
| 26 |
+
weight-only** (int8 weights, fp16 activations) with **GQA-native decode** + **batched prefill** + an
|
| 27 |
+
**on-NPU lm-head**. Greedy output matches the HF model exactly (`"The capital of France is"` → `" Paris."`).
|
| 28 |
+
|
| 29 |
+
## Measured (Samsung S25, Hexagon v79)
|
| 30 |
+
|
| 31 |
+
| config | decode | prefill | peak RAM |
|
| 32 |
+
|---|---|---|---|
|
| 33 |
+
| **MAXCTX 512** (`lfm2-5-230m.json`) | **164 tok/s** (6.1 ms/tok) | batched, ~17k tok/s (≤512 prompt) | ~430 MB |
|
| 34 |
+
| **MAXCTX 2048** (`lfm2-5-230m-2048.json`) | **127 tok/s** (7.9 ms/tok) | **~8,950 tok/s** (2k-token prompt in 227 ms) | ~440 MB |
|
| 35 |
+
|
| 36 |
+
For reference, LiquidAI's published **S25 CPU (int4)** numbers on 2k input are **prefill 1158 / decode 213
|
| 37 |
+
tok/s** — this NPU bundle does prefill **~7.7× faster**, at far lower power. (Decode is W8 here: 4-bit weights
|
| 38 |
+
are blocked by the v79 HTP toolchain, so W8 is the floor; the NPU still wins prefill and frees the CPU.)
|
| 39 |
+
|
| 40 |
+
## Contents (`v79/`)
|
| 41 |
+
|
| 42 |
+
| file | what |
|
| 43 |
+
|---|---|
|
| 44 |
+
| `lfm230_dec_512_w8.bin` / `lfm230_dec_2048_w8.bin` | W8 GQA-native decode (MAXCTX 512 / 2048) |
|
| 45 |
+
| `lfm230_pf_512_w8.bin` / `lfm230_pf_2048_w8.bin` | W8 batched prefill (PN 512 / 2048) |
|
| 46 |
+
| `lfm230_lmh_w8.bin` | W8 tied lm-head `hidden[1,1024]→logits[1,65536]` on-NPU |
|
| 47 |
+
| `lfm_embed_f16.bin` | tied embedding table (host token→hidden lookup) |
|
| 48 |
+
| `tokenizer.json` | the LFM2.5 tokenizer |
|
| 49 |
+
| `lfm2-5-230m.json` / `lfm2-5-230m-2048.json` | QHexRT manifests (512 / 2048; declare the 14-layer `attn_idx`/`conv_idx` schedule) |
|
| 50 |
+
|
| 51 |
+
## Run
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
hf download runanywhere/lfm2_5_230m_HNPU --local-dir lfm2_5_230m_HNPU
|
| 55 |
+
adb push lfm2_5_230m_HNPU/v79 /data/local/tmp/lfm230 # PowerShell + native paths on Windows
|
| 56 |
+
adb shell "cd /data/local/tmp/lfm230 && LD_LIBRARY_PATH=. \
|
| 57 |
+
./qhx_generate lfm2-5-230m-2048.json libQnnHtp.so libQnnSystem.so . 64 'The capital of France is'"
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
(One-time: stage the QAIRT v79 runtime libs + the `qhx_generate` tool into the same dir — see the QHexRT
|
| 61 |
+
deploy docs.) Arch-pinned to **v79**; a v79 binary will not load on other Hexagon arches.
|