Skip to content

feat: bump litertlm-android to 0.11.0 and add MTP toggle - #55

Merged
nmrenyi merged 1 commit into
mainfrom
chore/litertlm-0.11.0-validate
May 14, 2026
Merged

feat: bump litertlm-android to 0.11.0 and add MTP toggle#55
nmrenyi merged 1 commit into
mainfrom
chore/litertlm-0.11.0-validate

Conversation

@nmrenyi

@nmrenyi nmrenyi commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bumps com.google.ai.edge.litertlm:litertlm-android from 0.10.20.11.0.
  • Adds a new Gradle property useMtpForLlm (default false) that opts the runtime into LiteRT-LM's Multi-token Prediction / speculative decoding (ExperimentalFlags.enableSpeculativeDecoding).
  • Documents the smoke-test result for both changes in the README and inline near the new Gradle flag.

Supersedes #54 (same dependency bump, with extra wiring and the smoke-test write-up).

Smoke-test results (OPPO Snapdragon 8 Elite, 2026-05-14)

LiteRT-LM 0.11.0 was tested locally with useGpuForLlm=true. Same model file (gemma-4-E4B-it.litertlm), same RAG bundle.

Config TTFT Decode rate
0.10.2 CPU (README baseline) 11.7 s 13.8 tok/s
0.11.0 GPU, no MTP ~1–2 s ~12–14 tok/s
0.11.0 GPU, MTP on ~1–2 s ~10–12 tok/s (slower)
  • 0.11.0 on GPU gives a ~7× TTFT win — the main payoff of this PR.
  • MTP / speculative decoding was honoured at the native layer (enable_speculative_decoding: true, tf_lite_mtp_drafter subgraph loaded — confirmed in logcat) but produced a ~10–20% decode slowdown, 3/3 samples. Most likely cause: low drafter acceptance rate on long retrieved-context prompts + constrained medical prose. Off by default; re-test before re-enabling.

Risk notes

  • API surface used in RagPipeline.kt (Engine, EngineConfig, ConversationConfig, Backend, SamplerConfig, Message, Contents) is source-compatible between 0.10.2 and 0.11.0 — verified via the v0.10.2…v0.11.0 commit log; the Kotlin API additions (filterChannelContentFromKvCache, file capability inspection, prefer_activation_type) are all additive.
  • Per CLAUDE.md's eval-gated deployment rule, this is a smoke test, not a full eval. Full clinical eval still pending before any decision to flip GPU on by default in production.

Test plan

  • Build APK (CPU default): flutter build apk — verify [BACKEND] *** LLM running on CPU *** in logcat.
  • Build APK (GPU): flutter build apk -PuseGpuForLlm=true — verify [BACKEND] *** LLM running on GPU ***.
  • Build APK (GPU + MTP): flutter build apk -PuseGpuForLlm=true -PuseMtpForLlm=true — verify [MTP] speculative decoding ENABLED and tf_lite_mtp_drafter lines in logcat.
  • Run a slice of kenya_vignettes through the eval harness against 0.11.0 before considering for production rollout.

🤖 Generated with Claude Code

- Bump com.google.ai.edge.litertlm:litertlm-android 0.10.2 → 0.11.0.
- Add useMtpForLlm Gradle property wired to BuildConfig.USE_MTP_FOR_LLM;
  when on, sets ExperimentalFlags.enableSpeculativeDecoding before engine
  init. Default off.
- Smoke-test on OPPO Snapdragon 8 Elite + GPU (2026-05-14): 0.11.0 cuts
  TTFT ~11.7s → ~1–2s. MTP on the same device produced a ~10–20% decode
  slowdown rather than the vendor's claimed >2×, 3/3 samples; drafter
  acceptance is likely poor for our long retrieved-context prompts +
  constrained medical prose. Off by default; re-test before re-enabling.
- README: drop stale "GPU blocked" sentence; record the new GPU TTFT and
  the MTP finding alongside the existing CPU baseline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 14, 2026 01:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Bumps the on-device LLM runtime litertlm-android from 0.10.2 to 0.11.0 and exposes a new compile-time Gradle flag useMtpForLlm that toggles LiteRT-LM's experimental Multi-token Prediction / speculative decoding via ExperimentalFlags.enableSpeculativeDecoding. README and inline Gradle comments document the smoke-test results (GPU TTFT win, MTP regression on long RAG prompts).

Changes:

  • Upgrade com.google.ai.edge.litertlm:litertlm-android to 0.11.0.
  • Add useMtpForLlm Gradle property → BuildConfig.USE_MTP_FOR_LLM → applied via @OptIn(ExperimentalApi::class) in RagPipeline.kt.
  • Update README and Gradle comments with smoke-test results and re-test guidance.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
app/android/app/build.gradle.kts Bumps litertlm-android dependency and wires new useMtpForLlm Gradle property into BuildConfig.USE_MTP_FOR_LLM.
app/android/app/src/main/kotlin/com/example/app/RagPipeline.kt Reads BuildConfig.USE_MTP_FOR_LLM and sets ExperimentalFlags.enableSpeculativeDecoding before engine init; opts into experimental API.
README.md Updates benchmark notes — removes the "GPU blocked" sentence and documents 0.11.0 GPU TTFT win and MTP smoke-test regression.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nmrenyi
nmrenyi merged commit 7e7071a into main May 14, 2026
6 checks passed
@nmrenyi
nmrenyi deleted the chore/litertlm-0.11.0-validate branch May 14, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants