You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
On-device rewording/proofreading with Gemma 4 E2B via LiteRT-LM (incl. Pixel TPU)
#494
Problem
Rewording currently needs a cloud or self-hosted provider. For heavy dictation, even plain proofreading (punctuation, casing, typos) adds a round trip every time. Gboard's proofread button shows how fast this can run on-device.
Why not AICore / ML Kit GenAI: inference is blocked from an IME with BACKGROUND_USE_BLOCKED — tested in wasi-master/wmkeyboard#804 (Galaxy S25 Ultra, keyboard shown → blocked after 13 ms, before any inference). LiteRT-LM runs in the app's own process, so that rule doesn't apply.
Proposal
A "local" rewording provider, same pattern as the existing sherpa-onnx models:
model litert-community/gemma-4-E2B-it-litert-lm: gemma-4-E2B-it.litertlm (GPU/CPU, ~2.6 GB) or the SoC build gemma-4-E2B-it_Google_Tensor_G5.litertlm (Pixel 10 TPU)
TPU: Backend.NPU(nativeLibraryDir = context.applicationInfo.nativeLibraryDir) plus <uses-native-library android:required="false"> for libedgetpu_util.so, libedgetpu_tachyon.google.so, libedgetpu_client.google.so
reference implementation: AI Edge Gallery — Android/src/app/src/main/java/com/google/ai/edge/gallery/ui/llmchat/LlmChatModelHelper.kt and its AndroidManifest.xml
default prompt: proofread + punctuation only, no rewriting; optional "auto after every dictation"; personal dictionary words protected from being "corrected"
Untested: TPU inference from inside the IME process.
Happy to test on a Pixel 10 Pro (German). Gern auch auf Deutsch antworten.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem
Rewording currently needs a cloud or self-hosted provider. For heavy dictation, even plain proofreading (punctuation, casing, typos) adds a round trip every time. Gboard's proofread button shows how fast this can run on-device.
Why not AICore / ML Kit GenAI: inference is blocked from an IME with
BACKGROUND_USE_BLOCKED— tested in wasi-master/wmkeyboard#804 (Galaxy S25 Ultra, keyboard shown → blocked after 13 ms, before any inference). LiteRT-LM runs in the app's own process, so that rule doesn't apply.Proposal
A "local" rewording provider, same pattern as the existing sherpa-onnx models:
com.google.ai.edge.litertlm:litertlm-androidlitert-community/gemma-4-E2B-it-litert-lm:gemma-4-E2B-it.litertlm(GPU/CPU, ~2.6 GB) or the SoC buildgemma-4-E2B-it_Google_Tensor_G5.litertlm(Pixel 10 TPU)Backend.NPU(nativeLibraryDir = context.applicationInfo.nativeLibraryDir)plus<uses-native-library android:required="false">forlibedgetpu_util.so,libedgetpu_tachyon.google.so,libedgetpu_client.google.soAndroid/src/app/src/main/java/com/google/ai/edge/gallery/ui/llmchat/LlmChatModelHelper.ktand itsAndroidManifest.xmlUntested: TPU inference from inside the IME process.
Happy to test on a Pixel 10 Pro (German). Gern auch auf Deutsch antworten.
All reactions