Request it for the seed queue, or get it now with pf download assassinshadow/Gemma-4-E2B-it-text-SM8450-LiteRT-LM-NPU (CLI guide).
Use the QAT bundles (added 2026-10-09). They replace the first two builds, which stay in the repo and are described from "The first builds" down.
| File | Context | Decode | Prompt speed | Size |
|---|---|---|---|---|
gemma4-e2b-qat_sm8450.litertlm |
4096 | 23–25 tok/s | ~1,500 tok/s | 2.97 GB |
gemma4-e2b-qat-ctx32768_sm8450.litertlm |
32768 | ~16 tok/s | ~500 tok/s | 2.97 GB |
gemma4-e2b_sm8450.litertlm (first build) |
4096 | 15–20 tok/s | ~19 tok/s | 2.92 GB |
gemma4-e2b-ctx32768_sm8450.litertlm (first build) |
32768 | 10–12 tok/s | ~12 tok/s | 2.92 GB |
gemma4-e2b-qat-ctx32768-c22-mtp-multimodal_sm8350.litertlm (Snapdragon 888, text + image + audio) |
32768 | ~8.8 tok/s; 11–16 tok/s with its drafter | ~130 tok/s | 3.46 GB |
Measured on a Samsung Galaxy S22 Ultra (SM-S908E), LiteRT-LM CLI, big cores; the SM8350 file on a Galaxy S21 Ultra (SM-G998U1). The SM8450 files are compiled for the Hexagon NPU of the Snapdragon 8 Gen 1 (SM8450, Hexagon v69) only and are text only. The SM8350 file is for the Snapdragon 888 and also reads images and audio: see "The Snapdragon 888 (SM8350) file" below.
AutoDroid Studio is the Android app this model was built for and measured in. It runs these bundles on the NPU of a Snapdragon 8 Gen 1 phone, exactly as published here. "Running it" below is for people who want to drive it by hand.
Why use it:
adb, no environment variables. The app sets up
the Qualcomm runtime itself and finds and downloads models from Hugging Face in its own browser.Get AutoDroid Studio on Google Play
Different weights. Google's own LiteRT-LM bundle (litert-community/gemma-4-E2B-it-litert-lm) is quantization-aware trained: every linear layer has 2-, 4- or 8-bit weights between int8 activation grids, and those weights are not a rounding of google/gemma-4-E2B-it. The first builds here quantized the Hugging Face checkpoint after training. The QAT bundles carry Google's integer weights and grids exactly, with Google's embedders and SentencePiece tokenizer.
What that and the new graph layout buy (one 724-token generation from 33 °C; long prompt: 3.3K tokens at 4K, 12.4K at 32K; first-build prompt times worked out from their measured rate):
| First 4K | QAT 4K | First 32K | QAT 32K | |
|---|---|---|---|---|
| Decode | 19.4 tok/s | 23–25 | 12.3 | ~16 |
| Long prompt in | ~3 min | 2.2 s | ~17 min | 25 s |
| Time to first token, short prompt | ~2 s | 0.07 s | 2.0 s | 0.15 s |
| CPU while generating (busy-wait off) | 26% | 16% | 23% | 9% |
| Hottest SoC sensor at the end | 78–93 °C | 79 °C | 71–78 °C | 72 °C |
| Answers identical to Google's bundle, greedy (32 prompts) | not run | 12 | 7 | 12 |
How:
prefill_32: 32 prompt tokens per call. On the HTP a call costs about
the same for 1 token or 32.Checks: codes hidden at tokens ~1.8K and ~10.1K of a 12.4K-token prompt are returned exactly (32K bundle; a 3.3K-token version on the 4K one); a 1,939-token story stays coherent; on 32 prompts the answers match Google's own bundle word for word in 12 cases (first build: 7) and every differing answer read was a correct one. With one token per prefill call the count was 13–14: within this metric's noise, not shown to be only noise.
Running them is as described under "Running it", with these differences:
gemma4-e2b-qat_sm8450.litertlm / gemma4-e2b-qat-ctx32768_sm8450.litertlm.use_hw_masking_for_npu and
use_hw_cache_update_for_npu on): the executor then fills masks and caches itself for the
32-token prefill. With them off the bundle's own mask and cache-update graphs run (tested,
prompt speed ~1,000 tok/s).| File | SHA-256 |
|---|---|
gemma4-e2b-qat_sm8450.litertlm |
0947bf296e110f905037c7192d0c03ffa4fbf7bf7c26eb8f9e4a828ac9a43413 |
gemma4-e2b-qat-ctx32768_sm8450.litertlm |
6d2cd64400207a490916af02969c3764d5d6d4390fc752dabf067489bfc9874a |
gemma4-e2b-qat-ctx32768-c22-mtp-multimodal_sm8350.litertlm (added 2026-11-21) is the QAT 32K
model above, compiled for the Hexagon v68 of the Snapdragon 888 (SM8350) with QAIRT
2.50.0.260828. Same Google QAT weights; the text model is three QNN contexts (1,466 MB). It adds
two things the SM8450 files don't have:
Measured on a Galaxy S21 Ultra (SM-G998U1, 12 GB), LiteRT-LM CLI on the big cores, 32K window, 128 new tokens, two rounds:
| Story | Python function | After a 1,105-token prompt | |
|---|---|---|---|
| Drafter off | 8.7 tok/s | 8.9 tok/s | |
| Drafter on | 10.9 tok/s | 15.6–16.1 tok/s | 12.8–13.2 tok/s |
Short prompts go in at ~125–130 tok/s (32 tokens per call). Checks with the drafter on: simple arithmetic answered correctly; a picture of a red circle and a blue square described correctly; a spoken sentence transcribed word for word; a picture plus a recording in one prompt gave both the printed four-digit number and the sentence exactly.
Running it from a shell is as for the SM8450 files, with these differences:
libQnnHtpV68Stub.so and libQnnHtpV68Skel.so (from
lib/hexagon-v68/unsigned/) in place of the V69 pair. An older v68 runtime does not load the
context binaries.runtime/
and LITERT_QNN_PROCESS_BUDGET_MB=1500.--backend=npu --vision_backend=gpu --audio_backend=cpu --enable_speculative_decoding=true --max_num_tokens=32768. Put media in the prompt file as [image:/path/to.png] or
[audio:/path/to.wav] lines.| File | SHA-256 |
|---|---|
gemma4-e2b-qat-ctx32768-c22-mtp-multimodal_sm8350.litertlm |
4680ca9b4fee11f4712d4806c0e30cf378a21dd417a115c01ebc2263e6874db6 |
gemma4-e2b_sm8450.litertlm (4K context) and gemma4-e2b-ctx32768_sm8450.litertlm (32K context)
are google/gemma-4-E2B-it packaged for LiteRT-LM and compiled for the Hexagon NPU of the Snapdragon 8 Gen 1 (SM8450,
Hexagon v69): all 35 decoder layers and the lm_head run on the NPU, as 8 QNN contexts. Built for
and measured on a Samsung Galaxy S22 Ultra (SM-S908E).
Text only. The vision and audio towers are not included.
Google publishes LiteRT-LM bundles for SM8550, SM8650 and SM8750 only. A bundle for another Hexagon version gets
Failed to create QNN context: 1002, so this one had to be built. There is a sibling ExecuTorch build of the same model: assassinshadow/gemma-4-E2B-it-text-SM8450-ExecuTorch-QNN (about 10 tok/s, ~3 GB, needs its own patched runner).
| Files | gemma4-e2b_sm8450.litertlm (2.92 GB, 4K) and gemma4-e2b-ctx32768_sm8450.litertlm (2.92 GB, 32K) |
| Base model | google/gemma-4-E2B-it (text decoder) |
| Context | 4096 or 32768 tokens, shared by prompt and answer |
| On the NPU | 35 decoder layers + lm_head in 8 QNN contexts |
| Weights | 8-bit, with the lm_head and the 20 double-width MLPs (layers 15–34) in 4-bit; per-layer and token embeddings 4-bit |
| Activations / KV cache | 16-bit / 8-bit |
| Calibration | 16 prompts, 64 new tokens each |
| QNN SDK | QAIRT 2.50.0.260828 |
| LiteRT-LM | v0.17.1 |
| Decode | Prefill | |
|---|---|---|
gemma4-e2b_sm8450.litertlm (ctx 4096) |
15–20 tok/s | ~16–19 tok/s |
gemma4-e2b-ctx32768_sm8450.litertlm (ctx 32768) |
9.6–13 tok/s | ~12.5 tok/s |
Which one? The 32K bundle is slower even for short chats: every decode step reads the whole 32K global cache, filled or not. Pick it only when a conversation really needs more than 4K tokens. Prompts go in one token per call (see "Why one graph"), so a 12K-token prompt takes ~16 minutes and a full 31.7K-token one ~42; the context pays off for conversations that grow over time, where the KV cache is kept between turns.
CLI eval (6 prompts: a fact, arithmetic, a haiku, a two-sentence explanation, a list, a translation), greedy, raw prompt: 6 of 6 correct for both bundles. Through an Android app's OpenAI-style endpoint both answered single- and multi-turn chats and 800+ token generations.
Long context (32K bundle), needle in a haystack: four codes hidden at tokens ~1.4K, ~12.4K, ~20.2K and ~29.9K of a 31,736-token prompt were all returned exactly (and two codes in a 12.4K-token prompt), so retrieval works across the whole window.
| File | SHA-256 |
|---|---|
gemma4-e2b_sm8450.litertlm |
7872f34175f2a35895d1adb313578cbe04e6542d29c1b587ce343ad5b47223d9 |
gemma4-e2b-ctx32768_sm8450.litertlm |
e48f1886b42b504f9c2f35983a1ce5cd080820441caced8bb506bfceca55a6cc |
The tokenizer, chat template and generation metadata are inside the .litertlm; there is nothing
else to download. Not included: the Qualcomm runtime libraries and the LiteRT dispatch library
(see "Running it").
You need three things besides the bundle. None are included: they are Qualcomm's or Google's to distribute, and the LiteRT ones must match each other.
lib/aarch64-android/ and lib/hexagon-v69/unsigned/:
libQnnHtp.so, libQnnSystem.so, libQnnHtpV69Stub.so, libQnnHtpV69Skel.so. The context
binaries inside the bundle were compiled with 2.50.0.260828, and the runtime has to be 2.50
too; the stock 2.39 libraries fail with "Qnn System library version 1.5.0 is mismatched".libLiteRtDispatch_Qualcomm.so built from the LiteRT commit your LiteRT-LM embeds
(LiteRT-LM v0.17.1 -> LiteRT 9fe5be4). LiteRT 2.2.0's dispatch library crashes
LiteRT-LM v0.17.1 when a model is unloaded.litert_lm_main / litert_lm_advanced_main from LiteRT-LM
v0.17.1, built for Android arm64.Put everything in one folder on the phone, then:
cd /data/local/tmp/litert
export LD_LIBRARY_PATH=$PWD ADSP_LIBRARY_PATH=$PWD
./litert_lm_advanced_main --backend=npu --model_path=$PWD/gemma4-e2b_sm8450.litertlm \
--litert_dispatch_lib_dir=$PWD --use_session --async=false \
--max_num_tokens=2048 --input_prompt_file=$PWD/prompt.txt
For the 32K bundle use its file name and up to --max_num_tokens=32768.
prompt.txt holds the fully rendered conversation (--use_session takes raw text):
<|turn>user
What is the capital of France?<turn|>
<|turn>model
For thinking mode add the base model's system turn first: <|turn>system\n<|think|>\n<turn|>\n.
The reply is <|channel>thought\n…<channel|>answer<turn|>.
Notes:
fastrpc_mmap failed, "Failed to create QNN context: 1002"). Reloading the same
model is fine. Restart the process to switch models.taskset f0 (big cores) from a shell.Exported with litert-torch (single signature, decoder kept in float with 4-bit embedders), calibrated on 16 prompts, quantized to static int16 activations / int8 weights / int8 K and V (the model has no massive activations: residual max ~2400, so the plain recipe is enough), split into 8 QNN contexts and compiled with the Qualcomm AOT plugin for SM8450.
Two Gemma-specific fixes:
DYNAMIC_UPDATE_SLICE per K/V cache) because
the Android API runs it instead of the C++ path.sliding_window_ring_buffer_size=512 they keep 512 slots, so the KV
cache at 32K is ~104 MB instead of ~302 MB; the cache update writes them at position mod 512.
The ring-buffer graph has its own calibration (16 prompts, like the 4K one).QNN weight sharing between a prefill graph and a decode graph needs Hexagon v73 or newer. On v69 a
two-graph bundle holds every weight twice, and one process can map only about 1.85 GB on this
phone's cDSP. So the bundle has a single decode graph that also serves as prefill_1.
Each of these was reproduced on the phone and the export/quantizer avoids it:
CONV_2D path mishandles INT4 filters (axis not remapped, filter
unpacked twice); 4-bit 1x1 convs are emitted as FULLY_CONNECTED._sm8450 files run on the Snapdragon 8 Gen 1 (Hexagon v69) only, the
_sm8350 file on the Snapdragon 888 (Hexagon v68) only; other chips answer "Failed to create QNN
context: 1002".The model weights derive from google/gemma-4-E2B-it and are under the same licence (apache-2.0). Compiled with Google's LiteRT / LiteRT-LM tooling and Qualcomm AI Engine Direct. This is an unofficial community build, not affiliated with the authors of the base model, Google or Qualcomm.
Have the files? Publish a torrent.
Publish a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo assassinshadow/Gemma-4-E2B-it-text-SM8450-LiteRT-LM-NPU ./model-foldergoogle/gemma-4-E2B-it