Instructions to use litert-community/Gemma3-1B-IT-Tensor-NPU with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT-LM
How to use litert-community/Gemma3-1B-IT-Tensor-NPU 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/Gemma3-1B-IT-Tensor-NPU \ --prompt="Write me a poem"
- Notebooks
- Google Colab
- Kaggle
Gemma3-1B-IT β Google Tensor NPU (AOT, int4 per-channel + Hadamard)
Quantized, repackaged variants of
google/gemma-3-1b-itprecompiled (AOT) for the Google Tensor Edge TPU NPU across Pixel generations. Packaged as.litertlmbundles for LiteRT-LM. (This repo was previously namedGemma3-1B-IT-Tensor-G4-NPU.)
Community build β not an official Google release. Built and maintained by @xThr45hx; not affiliated with or endorsed by Google.
Variants
| SoC | Pixel | File | Status |
|---|---|---|---|
| Tensor G4 | Pixel 9 / 9 Pro / 9 Pro XL / 9 Pro Fold | Gemma3-1B-IT_int4hadamard_aot_ekv4096_G4.litertlm |
β VERIFIED on device |
| Tensor G3 | Pixel 8 / 8 Pro / 8a | Gemma3-1B-IT_int4hadamard_aot_ekv4096_G3.litertlm |
π‘ Same program as the verified G4 build; replies word-for-word identically to the G4 build on G4 hardware β awaiting a Pixel 8 report |
| Tensor G5 | Pixel 10 series | Gemma3-1B-IT_int4hadamard_aot_ekv4096_G5.litertlm |
β οΈ UNVERIFIED on hardware (compiled cleanly via Beta AOT, authentic buenos_b0 DGC0, awaiting Pixel 10 hardware) |
| Tensor G6 | Pixel 11 series | Gemma3-1B-IT_int4hadamard_aot_ekv4096_G6.litertlm | β Tested on physical Pixel 11 Pro XL (kodiak) β Fails inference warmup (\Failed to invoke the compiled model). Preview \santafe_a0\ AOT compile is incompatible with retail G6 silicon/firmware. Use the JIT / regular pipeline. |
Tensor G6 physical test result (Pixel 11 Pro XL, kodiak): Tested on physical Pixel 11 Pro XL (kodiak, Android 16, kernel 6.12.69). The AOT bundle compiled via the Beta SDK santafe_a0 target fails during engine creation warmup with: RET_CHECK failure (llm_litert_npu_compiled_model_executor.cc:434) result Inference warmup run for Text Decoder (prefill) failed. Failed to invoke the compiled model. The preview AOT microcode registers/ABIs do not match retail G6 silicon firmware. Tensor G6 users should use uncompiled JIT / regular pipeline models instead, which run smoothly and rapidly directly on the device NPU.
[!WARNING] Tensor G5 build is UNVERIFIED on physical hardware. Compiled cleanly using the LiteRT Beta SDK with LMS=True (bare) and full DarwiNN DGC0 RISC-V codegen (uenos_b0 for G5). Because physical Tensor G5 devices are not yet available, this build is provided as an experimental preview.
Tensor G3 is not yet confirmed on a Pixel 8. Strong evidence it works: the G3 and G4 compiles are the same program. They differ in only 19 bytes (a device-type tag and its hash), and the G3 bundle runs on a Pixel 9 (G4) and gives word-for-word identical replies to the G4 build. If you have a Pixel 8 / 8 Pro / 8a, please test it and comment on this repo (Community tab) with: device, whether it loads on the NPU, tokens/s, and a sample multi-sentence reply. That's what moves it to β .
Cross-generation DGC compatibility (tested on a Pixel 9 Pro XL / Tensor G4)
- G3 β G4: the G3 and G4 builds compile to the same program. They differ only in a device-type
field (
03vs04) in the embedded compiler options, plus its 8-byte hash. The G3 bundle loads and gives word-for-word identical replies to the G4 build on G4 hardware, so the G4 runtime does not enforce the tag. - G5 β G4: in an earlier test, a G5-compiled Gemma4-E2B loaded on G4 and its prefill executed on the G4 NPU, but decode did not. G5 compiles use dual-cluster optimizations that G4 hardware lacks, so newer-generation DGCs are only partly forward-loadable.
- Takeaway: use the build for your chip. G3 and G4 share a program; G5 and G6 need their own compiles.
All variants: 26-layer Gemma 3 1B-IT, 4096 context (embedded KV cache), prefill 128, embedded
tokenizer + chat template, .litertlm v1, ~875 MB, built from Google's QAT checkpoint
google/gemma-3-1b-it-qat-int4-unquantized.
This was, to our knowledge, the first publicly available int4 AOT Tensor-NPU build of Gemma 3 1B, at ~half the size of the int8 Tensor-NPU Gemma 3 1B bundles (e.g. the 1,678 MB G5 int8 build): 875 MB = 0.52Γ.
β οΈ How to run it β use Box, not stock Edge Gallery
These are precompiled DarwiNN DGCs. They need a compatible GoogleTensor dispatch runtime on the device. Stock Google AI Edge Gallery will not run them (its runtime/dispatch rejects them).
π Recommended: Box β ships the correct runtimes/dispatch libs.
Download the APK, put the .litertlm for your SoC on the phone, load it with the NPU backend.
| Surface | Support |
|---|---|
| Box (github.com/jegly/Box) | β recommended |
LiteRT-LM CLI (--backend=npu) |
β with a compatible dispatch runtime |
| Stock Google AI Edge Gallery | β wrong dispatch runtime |
| Use the file for your SoC only | a DGC compiled for one Tensor generation won't run on another |
| llama.cpp / GGUF, Web, iOS, desktop, non-Pixel | β .litertlm DGCs are Pixel-NPU-only |
Performance (Pixel 9 Pro XL, Tensor G4)
Measured 2026-09-10 on the G4 bundle:
| prefill | decode | prefill tok/s | decode tok/s |
|---|---|---|---|
| 128 | 64 | 608.83 | 15.93 |
| 512 | 128 | 659.22 | 16.17 |
| 1024 | 64 | 663.99 | 15.89 |
Prefill scales, decode is pinned (~16 tok/s, dispatch-bound): fastest option on the phone for prefill-heavy work (RAG, long context, summarization, classification).
The exact AOT recipe (reproducible)
Full step-by-step in AOT_RECIPE.md; executable version with guardrails in
recipe/gemma3_int4hr_recipe.py. In short:
- Source: QAT weights
google/gemma-3-1b-it-qat-int4-unquantized(not plain-it). - Export:
litert_torchexport_hfβsplit_cache=True,cache_length=4096,prefill_lengths=[128],externalize_embedder=True. Use the floatprefill_decode(model.tflite), not the default int8 copy export_hf also writes. - Quantize:
ai_edge_quantizerdynamic_wi4c_hr_afp32β int4 per-channel + Hadamard rotation, applied once. - Rank-2 FC surgery:
recipe/fc_rank2_surgery.py(seeRANK2_FC_SURGERY.md). Used for G4 and G3. - Compile:
aot_compile(target=[Tensor_Gx], google_tensor_enable_large_model_support=True)β LMS only, no sharding flag. - Toolchain:
ai_edge_litert 2.2.0+ the Google Tensor beta compiler (BuildID87ea807aβ¦).
Reproducibility check: a from-scratch rebuild with this recipe produces a compiled prefill_decode that is
bit-identical to the published G4 build (md5 f1102df2β¦), and gives word-for-word identical replies
on device.
Quantization notes
- Hadamard rotation is the coherence fix. Plain per-channel int4 is fluent-but-wrong; the same int4 + Hadamard is correct. Also what lets the 4096-context graph compile.
- int4 per-tensor compiles but word-salads (one scale over the 262k-vocab head).
- Blockwise int4 compiles but is incoherent on the NPU AOT path β per-channel is the NPU-legal path.
- Per-quant support is compiler-build-dependent; retest against your own compiler instead of trusting a table.
Files
| File | Purpose |
|---|---|
Gemma3-1B-IT_int4hadamard_aot_ekv4096_G4.litertlm |
Tensor G4 β β verified |
Gemma3-1B-IT_int4hadamard_aot_ekv4096_G3.litertlm |
Tensor G3 β π‘ same program as G4, awaiting Pixel 8 report |
Gemma3-1B-IT_int4hadamard_aot_ekv4096_G5.litertlm |
Tensor G5 β β οΈ unverified on hardware (buenos_b0) |
Gemma3-1B-IT_int4hadamard_aot_ekv4096_G6.litertlm |
Tensor G6 β β οΈ unverified on hardware (santafe_a0) |
AOT_RECIPE.md |
exact reproducible AOT recipe |
recipe/gemma3_int4hr_recipe.py |
executable recipe with toolchain/input guardrails |
recipe/fc_rank2_surgery.py |
rank-3 β rank-2 FC surgery |
RANK2_FC_SURGERY.md |
why the surgery is needed |
MANIFEST.md |
sizes + SHA-256 |
License & attribution
Base model Gemma 3 1B-IT Β© Google, under the Gemma Terms of Use. These quantized/repackaged derivatives inherit the Gemma license. Runtime: LiteRT-LM / LiteRT (Apache-2.0). Quantization, rank-2 FC surgery, per-channel int4 + Hadamard AOT compile, and Tensor NPU packaging by @xThr45hx. Not affiliated with or endorsed by Google.
- Downloads last month
- 689