Google Tensor SDK supports the following pre-compiled Small Language Models
(SLMs) on Tensor_G6 (Pixel 11) and Tensor_G5 (Pixel 10) chipsets.
Pre-compiled SLMs
The following table lists the pre-compiled models, their quantization, and links to download the pre-compiled LiteRT-LM bundles.
| Model | Quantization | LiteRT-LM Bundle |
|---|---|---|
| Gemma4 E2B | W8A8 or W2A8 | Download (Tensor_G5) | Download (Tensor_G6) |
| Gemma3 1B | W8A16 | Download (Tensor_G5) | Download (Tensor_G6) |
| Mobile Actions | W8A16 | Download (Tensor_G5) | Download (Tensor_G6) |
| Embedding Gemma V1 | Mixed Precision | Download (Tensor_G5) | Download (Tensor_G6) |
| Embedding Gemma V2 | Dynamic W4AFP32 or W8A8 | Download (Tensor_G5) | Download (Tensor_G6) |
Compile SLMs from fine-tuned checkpoints
In addition to the pre-compiled models, for Tensor_G6, you can export and compile the model from their finetuned checkpoints to create TPU compatible LiteRT-LM bundles for the following models:
Get access to the compiler
Sign up for the Google Tensor SDK Beta program to get access to the compiler. You can download it after your request is approved.
Extract the compiler
Run the following command to extract it and install dependencies:
export GOOGLE_TENSOR_SDK_BETA=/<path to your local>/compiler_tar_gz
pip install ai-edge-litert-sdk-google-tensor-nightly
pip install litert-torch-nightly
Run LiteRT-LM export
Run the following command to export and compile your model:
litert-torch export-hf \
--model='<model_id or fine_tuned_safe_tensor_dir>' \
--output_dir=/tmp/ \
--split_cache \
--externalize_embedder \
--prefill_lengths=128, \
--cache_length=1280 \
--quantization_recipe='<quantization_recipe>' \
--aot_backend=GOOGLE \
--aot_soc_model=Tensor_G6 \
--aot_compilation_config_dict='<google_tensor_compiler_config>'
Use the following configurations for each model:
Gemma4 E2B
Optimize your Gemma4-E2B export by selecting a Post-Training Quantization (PTQ) configuration that balances bundle size, decode latency, and model quality. Scaling weights down to 4-bit reduces memory footprint and improves decode speed, while keeping sensitive attention and MLP layers in 8-bit precision preserves accuracy.
Step 1: Choose a quantization configuration
Select the quantization recipe that best matches your device memory budget and task complexity:
| Configuration | TPU Bundle Size | Effective Bits | Details & Trade-offs |
|---|---|---|---|
| Baseline (QAT) | 2.74 GB | 2.82 | Default QAT baseline model. |
| Config 1: High Accuracy (8-bit Transformer) W8A16 — 4-bit Per-Layer Embeddings & Embedder |
4.20 GB | 8.00 | Quantizes transformer layers to 8-bit weights while keeping Per-Layer Embeddings (PLE) and embedder layers in 4-bit. Preserves highest accuracy with a larger bundle size.Config1 |
| Config 2: Smallest Size (Full 4-bit) W4A16 — 4-bit weights across all layers |
2.84 GB | 4.00 | Applies 4-bit min-max uniform quantization across all layers. Yields the smallest footprint, suitable for simpler tasks or domain-specific fine-tuned models.Config2 |
| Config 3: Balanced (Attention-Preserving Mixed 4/8-bit) W48A16 — 8-bit Attention (Q/K/V/O) & Per-Layer Projections, 4-bit elsewhere |
3.06 GB | 4.59 | Keeps Q, K, V, and O attention projections and per-layer projections in 8-bit precision and remaining layers in 4-bit, recovering substantial accuracy over full 4-bit.Config3 |
| Config 4: Complex Reasoning (Attention & MLP Mixed 4/8-bit) W48A16 — 8-bit Attention (Q/K/V/O), Per-Layer Projections & Common MLP, 4-bit elsewhere |
3.47 GB | 5.30 | Keeps Q, K, V, and O attention projections, per-layer projections, and Common MLP layers in 8-bit across prefill and decode stages. Recommended for complex reasoning on devices with higher memory capacity.Config4 |
Step 2: Customize mixed-precision rules (Optional)
If you are creating or modifying a W48A16 JSON recipe using min_max_uniform_quantize, configure the rules as follows:
- Set 4-bit defaults: Apply 4-bit symmetric, channel-wise quantization to
EMBEDDING_LOOKUPand standardFULLY_CONNECTEDoperations. - Apply 8-bit exceptions: Keep critical layers at 8-bit symmetric, channel-wise precision—specifically per-layer fully connected ops, QKVO projections (
[qkvo]_proj), and common MLP layers (Gemma4TextDecoderLayer_([0-9]|1[0-4])/*Gemma4TextMLP_mlp).
Step 3: Install required packages
Install the required export and bundle packaging dependencies:
pip install litert-torch
pip install transformers
pip install -U litert-lm-builder-nightlyStep 4: Export and compile the model
Download the compiler options file matching your target SoC and quantization configuration:
Run litert-torch export-hf with your selected recipe and compiler options path:
litert-torch export-hf \
--model=google/gemma-4-E2B-it \
--output_dir=/tmp/ \
--split_cache \
--externalize_embedder \
--prefill_lengths=128, \
--sliding_window_ring_buffer_size=512 \
--cache_lengths=640,1024,1536,4096 \
--quantization_recipe="<quantization_recipe>" \
--jinja_chat_template_override=litert-community/gemma-4-E2B-it-litert-lm \
--aot_backend=GOOGLE \
--aot_soc_model=Tensor_G6 \
--aot_compilation_config_dict='{"google_tensor_extra_options_path": "/path/to/compiler_options.pb"}'Step 5: Inject NPU ExecutorMetadata into the .litertlm bundle
After exporting, unpack the generated .litertlm archive to enable hardware-accelerated NPU execution settings:
-
Unpack the bundle:
BUNDLE=/path/to/model.litertlm UNPACK_DIR=$(mktemp -d) litert-lm-builder unpack --input "${BUNDLE}" --output_dir "${UNPACK_DIR}" -
Add NPU executor metadata: Open
${UNPACK_DIR}/ExecutorMetadataProto.pbtext(or create it if not present). Preserve any existingllm_executor_metadata { ... }block and appendllm_npu_executor_metadataat the end:llm_npu_executor_metadata { enable_neon_for_npu_greedy_sampling: true use_hw_masking_for_npu: true use_hw_cache_update_for_npu: true use_hw_ple_for_npu: true } -
Register the section in
model.toml(only if created in Step 2): If${UNPACK_DIR}/model.tomldoes not already includesection_type = "ExecutorMetadata", append:[[section]] section_type = "ExecutorMetadata" data_path = "ExecutorMetadataProto.pbtext" -
Repack, verify, and clean up:
litert-lm-builder toml --path "${UNPACK_DIR}/model.toml" output --path "${BUNDLE}.tmp" litert-lm-peek --litertlm_file "${BUNDLE}.tmp" | grep -B 6 -A 10 "llm_npu_executor_metadata" mv -f "${BUNDLE}.tmp" "${BUNDLE}" rm -rf "${UNPACK_DIR}"
Gemma3 1B
Download the compiler options from Huggingface.
- model_id =
"google/gemma-3-1b-it"or"/path/to/your/finetuned/safetensors/directory" - quantization_recipe =
"w8a16" - google_tensor_compiler_config =
'{"google_tensor_extra_options_path": "/path/to/Gemma3-1B-IT_Google_Tensor_G6.pb"}'
For more details, see export.py.
FunctionGemma
Step 1: Download the compiler options from Huggingface.
Step 2: Fine-tune your FunctionGemma model and save this SafeTensors checkpoint as a .safetensors file.
custom_quantization_recipe.json:Custom Quantization Recipe
[ { "regex": ".*", "operation": "EMBEDDING_LOOKUP", "algorithm_key": "min_max_uniform_quantize", "op_config": { "compute_precision": "INTEGER", "explicit_dequantize": false, "weight_tensor_config": { "num_bits": 8, "symmetric": true, "granularity": "CHANNELWISE" } } }, { "regex": ".*", "operation": "FULLY_CONNECTED", "algorithm_key": "min_max_uniform_quantize", "op_config": { "compute_precision": "FLOAT", "explicit_dequantize": true, "weight_tensor_config": { "num_bits": 8, "symmetric": true, "granularity": "CHANNELWISE" } } } ]
Step 4: Add the flag --keep_temporary_files to the litert-torch export-hf command to keep the intermediate exported TFLite model.
- fine_tuned_safe_tensor_dir =
"/path/to/your/finetuned/safetensors/directory" - quantization_recipe =
/path/to/custom_quantization_recipe.json - google_tensor_compiler_config =
'{"google_tensor_extra_options_path": "/path/to/functiongemma-270m-ft-mobile-actions_Google_Tensor_G6.pb"}'
After running the export command, save llm_metadata.pbtext and pass it to the following litert-lm builder command along with the exported tflite splits. This builds a LiteRT-LM bundle compatible with Google Tensor:
litert-lm-builder
system_metadata
--str model_name "functiongemma"
tflite_model
--path /path/to/model_quantized_aot_compiled.tflite
--model_type prefill_decode
tflite_model
--path /path/to/embedder_quantized.tflite
--model_type embedder
tflite_model
--path /path/to/auxiliary.tflite
--model_type aux
hf_tokenizer
--path /path/to/tokenizer.json
llm_metadata
--path /path/to/llm_metadata.pbtext
output
--path path/to/tpu_model.litertlm
Embedding Gemma
Use the compilation path for classical ML models. Refer to the usage example for more details.