feat: bump litertlm-android to 0.11.0 and add MTP toggle - #55
Merged
Conversation
- 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>
There was a problem hiding this comment.
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-androidto 0.11.0. - Add
useMtpForLlmGradle property →BuildConfig.USE_MTP_FOR_LLM→ applied via@OptIn(ExperimentalApi::class)inRagPipeline.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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
com.google.ai.edge.litertlm:litertlm-androidfrom0.10.2→0.11.0.useMtpForLlm(defaultfalse) that opts the runtime into LiteRT-LM's Multi-token Prediction / speculative decoding (ExperimentalFlags.enableSpeculativeDecoding).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.enable_speculative_decoding: true,tf_lite_mtp_draftersubgraph 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
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.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
flutter build apk— verify[BACKEND] *** LLM running on CPU ***in logcat.flutter build apk -PuseGpuForLlm=true— verify[BACKEND] *** LLM running on GPU ***.flutter build apk -PuseGpuForLlm=true -PuseMtpForLlm=true— verify[MTP] speculative decoding ENABLEDandtf_lite_mtp_drafterlines in logcat.kenya_vignettesthrough the eval harness against 0.11.0 before considering for production rollout.🤖 Generated with Claude Code