LFM2.5-8B-A1B (mixture of experts) for Android: NPU and GPU, LiteRT-LM
LiquidAI/LFM2.5-8B-A1B, a mixture-of-experts model (8B parameters, 4 of 32 experts per token), packaged for LiteRT-LM in two bundles:
| File | Runs on | Context | Decode | Prompt speed | Size |
|---|---|---|---|---|---|
lfm25-8b-a1b_sm8450.litertlm |
NPU of the Snapdragon 8 Gen 1 (SM8450) | 4096 | ~6 tok/s | ~6 tok/s | 4.07 GB |
lfm25-8b-a1b-ctx8192_gpu.litertlm |
GPU or CPU, any arm64 phone with the RAM | 8192 | 6.3 tok/s (GPU), 3.7 tok/s (CPU) | 12.6 tok/s (GPU), 9.7 tok/s (CPU) | 3.99 GB |
Measured on a Samsung Galaxy S22 Ultra (SM-S908E), LiteRT-LM CLI on the big cores. Text only.
Thinking mode works: the model reasons in <think> … </think> and then answers.
Where to use it: AutoDroid Studio on Google Play, an Android app that runs both bundles (NPU and GPU) on the phone and serves them through an OpenAI-style endpoint. To run them from a shell instead, see "Running it".
What it is
- Weights: GPTQ int4 (per-channel), from the bf16 checkpoint. Embedding and lm_head are shared.
- 88 of the 704 experts are dropped, in both bundles: the full model is 4.27 GB of int4 weights, just over what the Snapdragon 8 Gen 1's DSP can map. The dropped ones are the 88 picked least often by the router over English text (Dolly-15k), 24–32 experts left per layer; they leave the router too, so the next one up takes the slot. They carried 1.44% of the router's picks overall (3.41% in the worst layer). An expert that matters mostly for code or other languages can look rare on that text.
- Every kept expert runs on every token and the router masks the ones not picked. Separate graphs per expert were measured and were at most 30% faster, for 600-odd graphs.
- One graph does prompt and decode, one token per call: there is no room for a second copy of the weights. So prompt speed equals decode speed on the NPU.
- The chat template is rewritten for LiteRT-LM's template engine (the model's own uses
.get()and{% generation %}, which it does not handle), with<|endoftext|>as an extra stop token.
The NPU bundle
Three QNN contexts of ~1.3 GB each (1,276 / 1,245 / 1,225 MB), one per process: a process on this chip can map about 1.85 GB of the DSP, so the bundle needs the multi-process dispatch library below. 16-bit activations and int4 weights, calibrated on a few prompts and text pieces. Compiled with QAIRT 2.50.0.260828 for Hexagon v69.
It takes nearly the whole DSP: another NPU model (or an image model) loaded beside it makes the load fail.
The GPU / CPU bundle
The same int4 weights as fully-connected layers (--static), every kept expert in the graph.
It asks the GPU for fp32 activations (prefer_activation_type=fp32 in the bundle): at the GPU
delegate's default fp16 the model outputs only newlines. The short-convolution state is reset on a
new conversation inside the graph (state × min(position, 1)): without that, LiteRT-LM's session
reset leaves it behind and the second chat on the same engine loops on </think>.
Measured (Galaxy S22 Ultra)
| NPU | GPU | CPU | |
|---|---|---|---|
| Decode | 6.0–6.1 tok/s | 6.3 tok/s | 3.66 tok/s |
| Prompt | 6.0 tok/s | 12.6 tok/s | 9.7 tok/s |
| Load | ~10–16 s | 25 s (CLI), 65–70 s in an app | 32 s |
| RAM | three processes, most of the DSP | ~4.7 GB | 3.8 GB cache file, mapped |
Inside an Android app (backgrounded, little cores feeding the work) the NPU bundle gave 4.4–4.9 tok/s and the GPU bundle ran three clean chats in a row.
Checks on the NPU bundle, greedy: a fact, 17 × 23 (391, correct), a French translation (correct after a long think), a ~600-token story (finished cleanly) all fine. A haiku request spent its 400 tokens counting syllables in the think block and never answered. A needle-in-a-haystack test on a 3,000-token prompt failed: it found one of two hidden codes and then listed unrelated lines until the 4096 context ran out. There is no benchmark suite behind this.
Running it
NPU (Snapdragon 8 Gen 1 only)
Besides the bundle you need:
- QAIRT 2.50 runtime (Qualcomm's, not included):
libQnnHtp.so,libQnnSystem.so,libQnnHtpV69Stub.so,libQnnHtpV69Skel.so. - A dispatch library that puts contexts in worker processes, with its worker: the stock
LiteRT dispatch library fails on the second context with
Failed to create QNN context: 1002. The patched library, the worker and their sources are in the Gemma 4 E4B repo'sruntime/; it has to come from the LiteRT commit your LiteRT-LM embeds. AutoDroid Studio has it built in. litert_lm_advanced_mainfrom LiteRT-LM, built for Android arm64.
cd /data/local/tmp/litert
export LD_LIBRARY_PATH=$PWD ADSP_LIBRARY_PATH=$PWD
export LITERT_QNN_PROCESS_BUDGET_MB=1500
taskset f0 ./litert_lm_advanced_main --backend=npu --model_path=$PWD/lfm25-8b-a1b_sm8450.litertlm \
--litert_dispatch_lib_dir=$PWD --use_session --async=false \
--max_num_tokens=4096 --input_prompt_file=$PWD/prompt.txt
Long NPU runs from a shell with the screen off: hold a wake lock. Without one the phone keeps trying to suspend, fails on the busy DSP, and after a few tries Samsung's kernel restarts the DSP in the middle of the run.
GPU or CPU
./litert_lm_advanced_main --backend=gpu --model_path=$PWD/lfm25-8b-a1b-ctx8192_gpu.litertlm \
--max_num_tokens=8192 --input_prompt_file=$PWD/prompt.txt
--backend=cpu runs the same file. Tested with LiteRT-LM 0.18.0 (the litertlm-android AAR) and
the CLI.
Prompt format
With --use_session the prompt file holds the rendered conversation:
<|startoftext|><|im_start|>user
What is the capital of France?<|im_end|>
<|im_start|>assistant
Through LiteRT-LM's Conversation API the template inside the bundle does this. Stop tokens:
<|im_end|>, <|endoftext|>.
Notes
- The NPU executor is greedy. Temperature, top-k and seed have no effect on that path.
- The GPU/CPU bundle was measured on the S22 Ultra only; the Snapdragon 888 was not tested.
- A sparse CPU build (all 704 experts, only the picked ones computed) was right on a PC but ran at 0.04 tok/s on the phone: each token touched ~900 MB of weights that no longer fit in the page cache. It is not published.
Limitations
- The NPU file is for the Snapdragon 8 Gen 1 (SM8450, Hexagon v69) only, and only with a dispatch library that places contexts in worker processes (above).
- Text only.
- 88 experts removed (above), int4 weights, 16-bit activations on the NPU: quality is below the full model, by an amount not measured. The checks above are a handful of prompts.
- Tool calling was not tested.
- Built on a PC with a custom pipeline; an unofficial community build, provided as is, with no warranty.
Files
| File | SHA-256 |
|---|---|
lfm25-8b-a1b_sm8450.litertlm |
6ec6040355c2dacdf000cc04e5666bc32d6f8fb5bbfd30744135a8be932fe972 |
lfm25-8b-a1b-ctx8192_gpu.litertlm |
743351b578f1f4045cfbd7e47cde8e9bc9c7916f53ed6a8f67fb947e92562063 |
The tokenizer, chat template and generation metadata are inside each .litertlm.
Licence and credits
The weights derive from LiquidAI/LFM2.5-8B-A1B and
are under the LFM Open License v1.0 (copy in LICENSE); read it before use, in
particular its terms on commercial use. Changes from the original: GPTQ int4 quantization, 88 of
704 experts removed, 16-bit activation quantization and compilation for the Hexagon NPU (NPU file),
a rewritten chat template and an in-graph state reset. Compiled with Google's
LiteRT / LiteRT-LM
tooling and Qualcomm AI Engine Direct. This is an unofficial community build, not affiliated with
Liquid AI, Google or Qualcomm.