Skip to content

v2.4.0

Latest

Choose a tag to compare

@dbcp1 dbcp1 released this 23 Nov 19:19

LiteRT Release Notes: Version 2.4.0

LiteRT Runtime

Performance and Memory

  • Mixture of Experts (MoE) on GPU and CPU: LiteRT now runs MoE models like Gemma 4 26B-A4B by executing only the active experts for each token. Sharing weights between prefill and decode and caching them on disk cuts repeat startup time from ~30–45s down to ~2s and saves over 11 GB of setup memory (and ~2.75 GB of RAM on CPU).
  • Faster hybrid LLMs: Added fused GPU kernels across Metal, WebGPU, and OpenCL for hybrid models like Qwen3.5 and LFM2.5. Combining ~20 small operations per layer into a single pass cuts GPU launches per token by 58% and speeds up generation by up to 35% on Metal, 23% on WebGPU, and 18% on Android.
  • Longer contexts with FlashAttention: Extended FlashAttention to WebGPU and Android OpenCL, allowing 32K-token prompts to run on mobile GPUs without running out of memory and saving up to 2.1 GB of RAM. Also improved Metal Flash-Decode for wider attention heads and large caches, speeding up Gemma 4 26B-A4B generation by ~15% at 32K and ~31% at 64K context.
  • Lower GPU memory usage: Removed unnecessary offset buffers for 4-bit weights, cutting peak memory by 15–17% and speeding up generation by ~5%. Also added zero-copy weight loading on Apple WebGPU and Android OpenCL, plus native 4-bit GPU tensor buffers.

Hardware Acceleration

  • Compile-Time Input Shape Refinement: Users can now override dynamic input shapes during AOT (apply_plugin_main) and on-device JIT (CompiledModel) compilation via new C, C++, and Kotlin/Java CompilerOptions APIs.
  • Externalized Weight Support in Compiler Plugins: Added support for externalized weight models across LoadModelFromFile, IsConstant, and LiteRtCompiledModelT::ApplyPluginsWithCaching (across file paths, WeightLoader, ScopedWeightSource, and weight_in_memory_map), freeing NPU-consumed external buffers after compilation.
  • Expected Dispatch Functions Hint: CompiledModel now passes expected dispatch function names from selected signatures through DispatchDelegate to LiteRtDispatchDeviceContextSetExpectedFunctions(), allowing backends to defer loading unselected subgraphs and weights.
  • Vendor NPU Backends & SDKs
    • Arm
      * Introduced a new GPU backend based on the Arm Vulkan ML API, offering experimental support for the Arm Mali G2-Ultra NX. Under the hood, the GPU driver(provided by ARM) can offload select graph nodes to an integer-based Neural Engine within the GPU.
    • Qualcomm
      * Added HTP init acceleration, load-time perf voting, and memory-budget controls.
      * Added channel-tile tuning to reduce weight-sharing performance regressions.
      * Added HTP DLBC activation and weight-compression controls.
      * Added op-name formatting control for QNN context binary size.
      * Added GQA transformations for both prefill and decode graphs.
      * Expanded QNN coverage for Vision, detection, Conv3D, and Bool8 models.
      * Expose JIT option and Graph priority options via Kotlin interface.
      * QAIRT SDK Upgrade: Upgraded the QAIRT SDK dependency to 2.51.1.261002.
  • ML Drift GPU delegate: Now leaves an EMBEDDING_LOOKUP with a non-constant float32 table on the CPU instead of crashing.

APIs & Platform support

  • Swift Package: Launched https://github.com/google-ai-edge/LiteRT-Swift, a lightweight repository for adding the LiteRT Swift package to iOS and macOS apps with Swift Package Manager.
  • C++ SDK & Unified Prebuilts (litert_prebuilts.zip): Bundled litert_cc_sdk/ directly inside the unified prebuilt archive at https://storage.googleapis.com/litert/binaries/latest/litert_prebuilts.zip (with nightly builds also retaining a 60-day rolling archive history on GCS), alongside prebuilt runtime libraries (libLiteRt.*), GPU accelerators (libLiteRtClGlAccelerator.so, libLiteRtWebGpuAccelerator.{so,dll}, libLiteRtMetalAccelerator.dylib), vendor NPU compiler/dispatch plugins, and CLI tools (apply_plugin_main, analyze_model_main, benchmark_model, run_model, gpu_numerics_check, npu_numerics_check, culprit_finder_main) across Android (arm64, arm32, x86_64), Linux (x86_64, arm64, aarch64-oe-linux-gcc11.2), Windows (x86_64, arm64), macOS (arm64), and iOS (arm64, sim_arm64). The included litert_cc_sdk/ provides LiteRT C/C++ headers, wrapper sources, CMake presets (including new windows-arm64 and windows-x64 presets for MSVC and clang-cl with automatic .lib import-library generation), sample apps (run_model_simple, dump_model_simple), and a bundled litert-cc-sdk-prebuilt-onboarding skill (documented in litert_cc_sdk/README.md) to guide coding agents through CMake integration and GPU/NPU deployment.
  • Windows ARM64 Wheels, Prebuilts & Qualcomm NPU Support: Cross-compiled ai-edge-litert wheels (Python 3.11–3.14) and litert_prebuilts_windows_arm64.zip are now built with Bazel and MSVC, packaging libLiteRt.dll, libLiteRtWebGpuAccelerator.dll, LiteRtCompilerPlugin_Qualcomm.dll, LiteRtDispatch_Qualcomm.dll, and CLI tools (apply_plugin_main, benchmark_model, run_model, analyze_model_main, gpu_numerics_check, npu_numerics_check), alongside Windows ARM64 support in ai-edge-litert-sdk-qualcomm (>= 2.4.0).
  • Linux aarch64 On-Device Qualcomm NPU Support: The linux_aarch64 ai-edge-litert wheel now ships the Qualcomm compiler plugin, dispatch library, and apply_plugin_main, and ai-edge-litert-sdk-qualcomm automatically discovers glibc-matched QNN host libraries and Hexagon skel directories on Qualcomm Linux aarch64 devices.
  • Versioned Vendor C ABIs (Breaking for Out-of-Tree Backends): Migrated both the LiteRT Dispatch C ABI and Compiler Plugin C ABI to versioned interface tables (LiteRtDispatchQueryInterface, LiteRtCompilerPluginQueryInterface, LiteRtAbiHeader), narrowed shared library exports, and published an out-of-tree backend guide (BUILD_YOUR_OWN_BACKEND.md).
  • Last Inference Duration API (C, C++, Kotlin/Java): Restored TFLite's Interpreter.getLastNativeInferenceDurationNanoseconds() parity via LiteRtGetCompiledModelLastInferenceDuration (C), CompiledModel::LastInferenceDurationNanoseconds() (C++), and CompiledModel.lastNativeInferenceDurationNanoseconds / getLastNativeInferenceDurationNanoseconds() (Kotlin/Java).
  • Python 3.10 support is deprecated. Python 3.10 reached upstream end-of-life on 2026-10-01 (PEP 619). Importing ai_edge_litert on Python 3.10 now emits a FutureWarning. 2.4.0 is the last release that supports Python 3.10. The next release (2.5.0) will require Python ≥ 3.11 and will no longer publish cp310 wheels. If you are on Python 3.10, upgrade to 3.11 or newer, or pin ai-edge-litert==2.4.*.
  • TensorFlow-Free Builds (Bazel & CMake): The default LiteRT OSS Bazel build no longer fetches the TensorFlow repository and uses lightweight shim repositories instead. Building with real TensorFlow (needed for the converter and a few tests) is still available via --config=with_tensorflow (LITERT_WITH_TENSORFLOW=1). The CMake build no longer clones TensorFlow at configure time; it downloads only the few header-only files the runtime needs and fetches TensorFlow only for benchmark_model and kernel tests. Breaking: the use_local_tf bazelrc config and the USE_LOCAL_TF / TF_LOCAL_SOURCE_PATH variables were removed.
  • Minimal CPU Runtime Builds & Selective Op Registration: Added the --//litert/build_common:cpu_backend={xnnpack,builtin,selective} build flag, replacing the TFLite-specific --define=tflite_with_xnnpack=false (still accepted). cpu_backend=selective drops XNNPACK and all unused built-in kernels, linking only the ops your model uses. Passing models = ["my_model.tflite"] to litert_cc_binary, litert_cc_test, or litert_cc_library extracts and registers the required ops automatically at build time; litert::tflite_support::SetOpResolver remains available for explicit control. On Linux ARM32, a minimal CompiledModel binary shrinks from 5.45 MB (default) to 2.18 MB (cpu_only + selective). See the new MINIMAL_BUILD.md guide for all options and measured sizes.