Skip to content
项目

dineshsoudagar/local-llms-on-android

在 GitHub 查看

关于

在 Android 上运行本地 LLM(Gemma 4、Qwen、Llama):离线私密聊天、照片和 PDF 问答、离线翻译,以及设备端图像生成。LiteRT、ONNX Runtime、GGUF。

设计与媒体

这些数字如何统计

实测星标增长

24小时
+2
7天
+9
15天
+28
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

🤖 Pocket LLM for Android (Local LLM Server, Offline & Private)

Turn your Android phone into a local LLM server for your home network, or chat privately on-device with text, images, PDFs, audio, and offline speech-to-text. On Google Play it also translates 27+ languages offline and creates images on the phone, no internet needed.

Google Play v1.7.6 Newly released on Google Play  ⬇️ Get it on Google Play

GitHub APK v1.7.0 Total APK downloads  ⬇️ Download APK

More apps from me

 Smart To Do · ⬇️ Get it on Google Play
  Speak, snap or type a reminder. Smart To-Do sets the date, time and repeat. Completely free, no ads.

 CloudTidy · ⬇️ Get it on Google Play
 Cleans up your Google Photos library and your phone gallery: finds duplicates, blurry shots and big videos, frees space in the cloud and on the phone, and you decide what goes.


📸 Preview

Translating a German photo to English in airplane mode
🌍 Offline translator, 27+ languages
Creating an oil-painting fox image on the phone in airplane mode
🪄 Create images offline

Pro tools on Google Play, recorded in airplane mode.

Pocket LLM loading a model and answering a chat message
Load a model and chat
Gemma 4 E2B describing a photo on the phone
Gemma 4 describes a photo
Switching accent colors, backgrounds and light or dark mode
Themes and accent colors

Waits are sped up in places.


🆚 GitHub vs Google Play

GitHub (v1.7.0) Google Play (v1.7.6)
💬 Offline chat with history ✅ ✅
🧠 Gemma 4, Qwen3, DeepSeek R1, own .litertlm ✅ ✅
📄 Documents, PDFs and images, with OCR and camera ✅ ✅
🎙️ Offline dictation and audio files ✅ ✅
📝 Context fitted to your phone, auto-compact ✅ ✅
🌐 LAN server, Web UI, OpenAI API ✅ ✅ free
🦙 GGUF models and Hugging Face import ❌ ✅ free
⭐ Pro, €2.99 once
🔎 Web search ❌ ⭐
🪄 Image tools: create, enhance, upscale, remove ❌ ⭐
🌍 Offline translator ❌ ⭐
🔜 Agent mode: tools, skills like deep research ❌ ⭐ soon

Pro costs €2.99, once. Free users of the Google Play version get 3 tries of the pro tools. Thank you for supporting an indie developer!

Feedback or ideas? Email me at [email protected].


🆕 New in v1.7.6 (Google Play)

  • 🌍 Translator: Speak into the From language, stop and translate, Sorani Kurdish, and use your own models (file or Hugging Face, LiteRT or GGUF). Any chat model can translate; untested models are marked.
  • 📊 Context: Change the length from the usage view; warnings only appear above what your phone can hold.
  • 🧭 Fewer dead ends: The app explains and offers a way forward instead of blocking.
  • ⚙️ Cleaner Settings and Model settings, plus stability fixes.

🆕 New in v1.7.0

Changes since v1.6.0:

  • 🎨 New look: New logo, drawer, model sheet and one Settings page; light, dark or system mode, six accent colors and six backgrounds.
  • 📝 Auto-compact: When a chat gets long, older messages are summarized instead of dropped.
  • 📊 Context use: A ring in the chat shows how full the context is.
  • 🧠 Context fitted to your phone: The context size is capped by your phone's memory and learns from native crashes.
  • 🔢 Better token estimate: Fixes overflows on long inputs (#34).
  • 🛡️ Load crashes: Caught, with a message that explains why the model failed to load (#14, #15).
  • 🔆 Long tasks: The screen stays on while a long reply or attachment job runs.
  • 🌐 LAN server: Updated, fixes #31 to #34. Free here, and free on Google Play from the next update.
  • ⚡ Performance and stability fixes.

⬇️ Download the v1.7.0 APK · All releases


✨ Features

Chat and privacy

  • 📱 Local inference: Run models on your phone with ONNX or LiteRT, offline after installation.
  • 💬 Chat: Stream replies, keep multi-turn history, render Markdown, and copy responses.
  • 🗂️ History: Reopen or delete saved conversations in the Android app or browser.
  • 🎨 Appearance: Choose light, dark or system mode, six accent colors, six backgrounds, and the chat text size.
  • 🔐 Privacy: Keep inference and chat data on your phone, with no telemetry.

Models and settings

  • 🧠 Built-in models: Choose Qwen2.5, Qwen3, DeepSeek R1 Distill Qwen, or Gemma 4.
  • 📦 Model management: Download, switch, and delete models inside the app.
  • 🧩 Custom models (beta): Import your own .litertlm model from device storage; native image and audio availability depend on the model and device backend.
  • 💭 Thinking mode: Toggle reasoning on supported Qwen3 and Gemma models.
  • 🎛️ Instructions: Edit model instructions or choose a prompt preset.
  • ⚙️ Context length: Set each LiteRT model's context size to balance history and memory use.
  • 🛡️ Recovery: Validate model files and recover from interrupted loading without losing saved chats.

Files and voice

  • 🎙️ Dictation: Turn recordings into editable text with offline multilingual Whisper, including German.
  • 🔊 Audio: Use native audio understanding on compatible Gemma or imported models, or Whisper transcription when native audio is unavailable.
  • 📄 Documents: Attach text files and PDFs, including scanned PDFs read with OCR.
  • 🔎 Retrieval: Ask document questions with BM25 or summarize source chunks within the context budget.
  • 📎 References: Keep document, page, or timestamp references with the owning chat.
  • ⏳ Progress: Track or cancel long document extraction and audio transcription jobs.
  • 🖼️ Images: Extract text with OCR or send images directly to compatible Gemma or imported models.
  • 📷 Camera: Capture, retake, crop, review, and send photos.

LAN and integrations

  • 🌐 LAN server: Serve the phone's selected model to devices on the same private network.
  • 🏠 Local AI home server: Use built-in or compatible imported LiteRT models as a shared inference endpoint for scheduled jobs and monitoring workflows.
  • 💻 Web UI: Chat in a PC browser, upload PDFs or images, and save conversations on the phone.
  • 🔌 OpenAI-compatible API: Connect compatible clients through model and chat-completion endpoints.
  • 🛠️ Agent tools: Return native tool calls from supported LiteRT models for harnesses such as OpenCode to execute.

LAN server demo

Pocket LLM Android LAN Server dialog showing the browser URL, API URL, and red Stop server button
Start the server on your phone
Pocket LLM LAN browser chat demonstration
Use the model from your browser · View demo GIF

📦 Download APK - v1.7.0

One APK for all phones.

➡️ Download APK

Models are not bundled inside the APK. After installation, choose and download the models you want directly on device.

You can download multiple models, switch between them inside the app, and delete unused downloaded models later to free storage.

Available chat models

  • Gemma 4 E4B LiteRT - Best for flagship mobiles
  • Gemma 4 E2B LiteRT - Best for decent to mid-range mobiles
  • DeepSeek R1 Distill Qwen 1.5B LiteRT - Optional reasoning model for high-RAM mobiles
  • Qwen3 0.6B LiteRT - Best for low-end mobiles
  • Qwen3 0.6B Q4F16 ONNX - Good for low to mid-range mobiles
  • Qwen2.5 0.5B ONNX - Best for mid to high-end mobiles, full precision

Use your own model (beta)

  • Open the model sheet, tap Import file and choose a local .litertlm file.
  • The app copies the file into private storage and adds it to the model picker.
  • The app detects declared inputs and attempts native image and audio support when available. The ready message reports availability on the current device/backend; declared support is not a compatibility guarantee.
  • Text chat is required. Images can use OCR or Native image input when available; audio uses native input when available or optional Whisper transcription otherwise.
  • Video input, generated audio, and custom thinking controls are not enabled. See the custom-model beta guide for details and device checks.
  • Custom models do not expose native tool calling through the LAN API.
  • Custom-model compatibility is experimental; larger models or contexts may fail to load or crash.

Image input support

  • OCR mode - Extract text from images
  • Native image input - Send images directly to compatible Gemma or imported models
  • Camera capture - Take a photo, retake, crop, review, and send it as input

Note: internet is required only for downloading models. Chat, OCR, image input, camera workflows, and inference remain fully on-device after the required models are installed.

Document and audio attachments

  • Text: Attach UTF-8 or UTF-16 text files up to 16 MiB.
  • PDFs: Attach embedded-text or scanned PDFs up to 64 MiB and 500 pages in the Android app.
  • PDF OCR: Extract embedded text first and use on-device OCR only for pages that need it.
  • Questions: Use lightweight BM25 to select relevant passages that fit the model context.
  • Summaries: Process all source chunks for summaries and ordered transformations.
  • References: Prompt answers to retain page, section, or timestamp markers.
  • Audio files: Attach Android-decodable audio up to 512 MiB and two hours, or record audio in-app.
  • Native audio: Use compatible Gemma or imported models for native audio understanding, with overlapping segments for longer recordings. Imported models use segments of at most 10 seconds.
  • Whisper fallback: When native audio is unavailable, transcribe with multilingual Whisper tiny int8 after a separate download of about 100 MB.
  • Dictation: Tap the microphone, record, transcribe, and edit the recognized text before sending.
  • Attachment limits: Keep one active document or audio source per Android chat; do not mix it with images in one send.
  • Storage: Detaching keeps the source data; deleting its chat removes it from private app storage.
  • Progress: Long extraction and transcription jobs show progress and can be cancelled.

LAN API and Web UI

  1. Pick a model, open LAN Server in the Android app, enter a password of at least eight characters, and tap Save password.
  2. Tap Start server (it loads the selected model), then open the displayed /ui URL on a computer on the same Wi-Fi or LAN.
  3. For API clients, use http://PHONE_IP:8080/v1 and the same password.

Browser Web UI

  • Save, reopen, and delete browser conversations stored privately on the phone.
  • Upload PDFs or images; direct images require a compatible model.
  • Switch light/dark themes; use Enter to send and Shift+Enter for a new line.
  • Stop the LAN server before changing the model or password.

📖 Client setup and examples: Python, HTTP scripts, PowerShell, OpenCode, Open WebUI, and automation.

Context-length setting

LiteRT models expose a context-length field in the Android app's model settings. This is a device-memory trade-off: a larger context can require substantially more native and GPU memory. Since v1.7.0 the app caps the context by your phone's memory and lowers the cap after a native crash, so a too-large value is not kept.

  • Recommended tested baseline: 8K tokens.
  • Limited manual testing: 10K to 15K worked on the tested device, but this is not broad device validation.
  • Configurable maximum: Qwen LiteRT models allow up to 40K and Gemma LiteRT models up to 128K. Those values are configuration ceilings, not guarantees that a phone can initialize or run safely at that size.

The app warns above 8K. A native LiteRT-LM crash was observed with Gemma 4 E2B at 20K on a tested device, consistent with high-context memory pressure. Keep the context near 8K unless you have tested the selected model on your own device.

🧠 Backend Support

This app supports ONNX-based Qwen models and LiteRT-based Qwen 3 and Gemma 4 models.

Backend overview

  • ONNX backend: supports Qwen2.5 and Qwen3
  • LiteRT backend: supports Qwen3, DeepSeek R1 Distill Qwen, Gemma 4, and imported .litertlm models (beta), with native image/audio input when available

Thinking Mode

  • Qwen3 and Gemma 4 support Thinking Mode
  • The toggle is shown only for models that support it

🚀 Why LiteRT

LiteRT is a strong fit for fast local Android chat because:

  • It is designed for high-performance on-device LLM deployment
  • It supports hardware acceleration, including GPU and NPU acceleration on supported devices
  • It helps reduce startup and generation latency for local chat workloads
  • It expands the range of practical Android model builds beyond a single backend path
  • It fits well with a privacy-first app design focused on fully offline usage

Note: model capability and performance still depend on the specific model build and the hardware of the target Android device.


⚙️ Requirements

  • An Android phone with 4 GB or more RAM for the smaller models
  • More RAM for larger models such as Gemma 4 E2B and Gemma 4 E4B
  • Internet only to download models inside the app
  • To build from source: Android Studio and a real phone (emulators are mainly useful for UI checks)

Safe model loading and recovery

Before a model is loaded, Pocket LLM checks available storage and validates the downloaded files. Memory estimates are advisory only: they do not block loading or require confirmation because device memory reports cannot reliably predict LiteRT backend compatibility. The app automatically attempts initialization with the available backend fallbacks.

The app records when initialization starts and clears that record only after the model is ready. If initialization fails or the app stops during loading, the same model is not retried automatically on the next launch. A recovery prompt lets you choose another model, delete the failed files, retry manually, or continue without a loaded model. Saved chat history is kept independently and is not deleted by model-load recovery.


🚀 How to Build & Run

  1. Clone this repository.

  2. Install the latest Android Studio.

  3. Open the Android project folder in Android Studio:

    pocket_llm_src/
    
  4. Build and install the app on your Android device.

  5. Launch the app.

  6. On first launch, choose a model from the built-in model picker.

  7. Download the selected model directly inside the app.

  8. Start chatting locally on device


🔗 Also Check Out

local-document-intelligence A privacy-first offline document intelligence system with persistent local RAG, hybrid retrieval, and source-grounded answers.


📄 License Notice

Gemma 4

Gemma 4 is provided by Google under the Apache License 2.0. Google's Gemma documentation also states that Gemma models are provided with open weights and support responsible commercial use.

Qwen models

Qwen model files follow the upstream Qwen license terms.
Please review the original model license before redistribution or commercial use.

探索相关项目

加载中…