TIPSv2-g/14 image encoder for LiteRT

Standalone image encoder from Google TIPSv2-g/14, producing two global embeddings and spatial patch features. Text encoders and task heads are not included. 448 is the native resolution; 224 reduces computation and memory use.

Files

Resolution Format File Size (MiB)
224 FP32 fp32/224/model.tflite 4328.7
224 A16W8 a16w8/224/model.tflite 1105.7
224 A16W8 Qualcomm NPU a16w8/224/model_qualcomm.tflite 1105.7
448 FP32 fp32/448/model.tflite 4333.2
448 A16W8 a16w8/448/model.tflite 1110.2
448 A16W8 Qualcomm NPU a16w8/448/model_qualcomm.tflite 1110.2

Use FP32 as the floating baseline and for CPU inference. Portable A16W8 uses INT8 transformer FC weights and INT16 activation interfaces. It retains FLOAT32 public input/output, patch embedding, and LayerNorm fallback computation. A16W8 CPU execution can be slow.

model_qualcomm.tflite files are dedicated Qualcomm NPU compilation inputs with UINT16 activations. They require a compatible vendor compiler/runtime, contain no embedded vendor context, and do not support CPU fallback. Their Softmax outputs use zero point 0 and scale 1/32768.

The graphs omit redundant attention mask zero-adds and Qualcomm value transposes. On-device NPU and GPU performance measurements for these updated graphs are reported below; validation.json distinguishes structural checks from historical source-file evidence.

Usage

Signature: main. Input: pixel_values, FLOAT32 NCHW [1,3,S,S], with fixed S=224 or S=448. Convert to RGB, resize directly to the square with PIL bilinear interpolation, and divide by 255. Do not crop or apply ImageNet mean/std normalization.

Output Shape Meaning
cls_token [1,1536] Global token trained with web captions
secondary_cls_token [1,1536] Global token trained with synthetic captions
patch_features [1,256,1536] or [1,1024,1536] Spatial patch tokens

Outputs are post-LayerNorm and are not L2-normalized. Apply task-specific normalization outside the model. Zero-shot text/image applications also need the matching source text encoder.

pip install ai-edge-litert==2.3.0 numpy Pillow
python run_tipsv2_tflite.py --model fp32/224/model.tflite --image image.jpg --output features.npz --threads 4

The example uses CPU. Load models by filename to support external weight buffers, particularly for large FP32 files.

Quantization

A16W8 uses static TorchAO post-training quantization with 500 calibration images per resolution. LayerScale is folded into FP32 projection weights and biases before calibration. FC weights are symmetric INT8 per output channel, with INT64 biases and activation ranges adjusted for INT32 accumulation. See quantization.json for the recipe and calibration identities.

NPU performance

These are representative measurements from a retail device to give a rough sense of on-device runtime behavior, not a direct comparison between hardware platforms. All latency numbers were collected with LiteRT's compiled-model benchmark_model launched through adb shell on the connected device; they are not app-level measurements from an integrated Android application.

Warm batch-one inference latency, rounded to the nearest tenth of a millisecond. Each value is the median of three process means, with five warmup invocations and 30 measured invocations per process. All configurations are fully delegated in a single partition with no residual CPU operations (AOT compiled for NPU, and pre-warmed OpenCL program cache for GPU).

Resolution File Backend / precision SM-S937U (ms)
224 fp32/224/model.tflite LiteRT GPU (MLDrift OpenCL, FP16) 198.9
224 fp32/224/model.tflite Qualcomm NPU (HTP, FP16) 62.7
224 a16w8/224/model_qualcomm.tflite Qualcomm NPU (HTP, A16W8) 71.0
448 fp32/448/model.tflite LiteRT GPU (MLDrift OpenCL, FP16) 996.8
448 fp32/448/model.tflite Qualcomm NPU (HTP, FP16) 470.6
448 a16w8/448/model_qualcomm.tflite Qualcomm NPU (HTP, A16W8) 342.2

On SM-S937U, Qualcomm NPU execution is 2.1×–3.2Γ— faster than MLDrift OpenCL GPU (FP16) while using 3.5×–7.0Γ— less host memory (~1.1–2.3 GB RSS on NPU vs ~7.8–8.0 GB RSS on OpenCL GPU). At the native 448Γ—448 resolution (1,024 spatial tokens), A16W8 on NPU (342.2 ms) is 2.9Γ— faster than FP16 OpenCL GPU (996.8 ms) and 1.4Γ— faster than FP16 NPU (470.6 ms) while cutting memory footprint in half relative to FP16 NPU.

FP32 identifies the source model, which both Qualcomm HTP and MLDrift OpenCL relax to FP16 execution here; full FP32 math is omitted due to the model's 4.3 GiB weight footprint. model_qualcomm.tflite is the dedicated UINT16 compilation input corresponding to the portable a16w8 model.

Measurements use LiteRT's compiled-model benchmark with persistent buffers and deterministic random input (clFinish() synchronized per iteration on OpenCL GPU, with program-only shader caching and madvise release of shared source weight pages enabled). They exclude model initialization, shader/graph compilation, image preprocessing, file I/O and explicit host input/output buffer transfers.

The SM-S937U ran Android 16 with Qualcomm QNN/QAIRT 2.52 in burst performance mode (O3 optimization) for NPU and LiteRT's MLDrift OpenCL backend on Adreno for GPU. Power settings were not normalized, and energy consumption was not measured. These results apply to the listed device/compiler/runtime combinations and do not characterize JIT initialization latency.

Hardware benchmark disclosure: Results were measured by us on retail devices. These results are not affiliated with, sponsored by, endorsed by, or verified by Samsung, Qualcomm, Google, MLCommons, or Hugging Face. Results depend on device SKU, OS build, thermal state, battery mode, backend, model quantization, runtime version, and benchmark settings.

Source and license

Source revision: 3b894860ec66202924d6938cfc6c4a7b780e19e1. File hashes, operator counts and interfaces are in model_info.json. The original model and implementation are by Google, under Apache 2.0. See the TIPS repository, TIPSv2 paper, LICENSE and NOTICE.

Downloads last month
67
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for litert-community/TIPSv2-G14-LiteRT

Finetuned
(2)
this model

Paper for litert-community/TIPSv2-G14-LiteRT