NativeLab dark mode

NativeLab Android Client

PhonoLab.

Run local LLMs on your Android phone. Chat with models, attach documents and images, get RAG-powered answers, and expose a LAN API server - all on-device, all private, all free forever.

On-deviceno cloud, no account
AGPL v3free forever
llama.cppvia JNI fork+execve
API serverOpenAI + Anthropic

Features

A full LLM workstation in your pocket.

PhonoLab is not a thin wrapper around an API. It runs the full llama.cpp inference stack on your device with a polished native Android UI.

๐Ÿ’ฌ

Chat UI

ChatGPT-style interface with sidebar, session history, auto-titles, date grouping, search, and math rendering via KaTeX.

Material 3KaTeX
๐Ÿ“„

Document RAG

Attach PDF, text, or DOCX files. Text is extracted, chunked with sliding window overlap, and relevant chunks are injected into your prompt.

RAG1500-char chunks
๐Ÿ–ผ๏ธ

Vision Models

Attach images from your gallery. Auto-detects vision models and pairs mmproj files. Supports Llama 3.2 Vision, LLaVA, and more.

multimodalauto-detect
๐ŸŒ

LAN API Server

Expose an OpenAI and Anthropic compatible API on your local network. SSE streaming, separate local/LAN API keys, configurable port.

OpenAIAnthropic
๐Ÿ“ฆ

Model Catalog

Built-in catalog of small models optimized for mobile: SmolLM2 360M, Qwen 0.5B, Llama 3.2 1B, Qwen 1.5B, TinyLlama 1.1B.

resumableauto-quant
๐Ÿ›ก๏ธ

Crash-Proof

17-layer error handling. JNI guards, lifecycle-safe UI updates, thread-safe date formatting, JSON parsing safety, body size limits.

17 layersrestart dialog

Architecture

How it works under the hood.

PhonoLab bundles llama-server as a native binary in the APK. At install time, Android extracts it to nativeLibraryDir. At runtime, JNI fork+execve starts the server - no W^X violations, no root needed.

โ”Œโ”€ PhonoLabApp โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ store, sessionManager, modelManager, runtime โ”‚ โ”‚ showError(fatal) ยท safeRunState() ยท crash handler โ”‚ โ”œโ”€ MainActivity (ChatFragment.Host) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Toolbar + DrawerLayout ยท Fragments ยท Session sidebar โ”‚ โ”œโ”€ ChatFragment โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ ChatAdapter ยท Attachments ยท RAG ยท Model picker โ”‚ โ”œโ”€ LlamaRuntime โ†’ LlamaCppManager โ†’ JNI runner.cpp โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ load() ยท generate() ยท abort() ยท nativeLoaded guard โ”‚ โ”œโ”€ PhonoLabApiServer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ OpenAI + Anthropic ยท SSE ยท 1MB limit ยท 4-thread pool โ”‚ โ”œโ”€ nativeLibraryDir/ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ libllama_server.so (bundled binary) โ”‚ โ”‚ librunner.so (JNI fork+execve wrapper) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Ecosystem

NativeLab + PhonoLab. Same vision, different screens.

NativeLab runs on desktop (Linux, macOS, Windows). PhonoLab runs on Android. Both are local-first, privacy-first, and free forever under AGPL v3.

NativeLab (Desktop)
PhonoLab (Android)

PyQt6 GUI + Terminal CLI

Desktop workbench with visual pipeline builder, Labs, MCP, integrations.

Material 3 Android UI

Chat, attachments, RAG, model catalog, LAN API server.

llama.cpp CLI / server

Subprocess wrapper, optional HF Transformers backend, Ollama bridge.

llama-server via JNI

Bundled binary, fork+execve, no W^X issues, vision model support.

Visual Pipeline Builder

20+ node types, AI Builder, save/load JSON, native graph helpers.

Document RAG

PDF/text/DOCX extraction, sliding window chunking, keyword retrieval.

Python 3.10+

pip install nativelab, cross-platform.

Android 5.0+ (API 21)

APK install, arm64-v8a + armeabi-v7a.

AGPL v3

Free and open source forever.

AGPL v3

Free and open source forever.

Reliability

17 layers of error handling.

Every external call - JNI, network, file I/O, JSON parsing - is guarded. Fatal errors show a restart dialog. Non-fatal errors show a red banner that auto-dismisses. The app never crashes silently.

JNI Guards

nativeLoaded flag. All native calls check the flag first. UnsatisfiedLinkError caught gracefully.

Lifecycle Safety

runOnUi{} checks isAdded before touching views. Worker executors shut down in onDestroyView.

Thread Safety

ThreadLocal date formatters. @Volatile abort flag. Socket write guards for client disconnects.

Data Safety

optJSONObject() instead of getJSONObject(). Session logs capped at 500. renameTo() copy+delete fallback.

Get started

Build and run in 3 steps.

Open the Android project in Android Studio, or build from the command line. The APK bundles everything you need.

Clone the repo
$ git clone https://github.com/7ZoneSystems/NativeLab.git
$ cd NativeLab/PhonoLab/android
Download llama.cpp binaries
$ ./setup_binaries.sh
Build and install
$ ./gradlew assembleDebug
$ adb install app/build/outputs/apk/debug/app-debug.apk

License

Free and open source. Forever.

Both NativeLab and PhonoLab are licensed under the GNU Affero General Public License v3. You can use, modify, and distribute them freely. If you run a modified version as a service, you must share the source code.

AGPL v3

Full copyleft license. Guarantees the software and all derivatives remain free and open source. See the LICENSE file.

Dependencies

llama.cpp (MIT) ยท AndroidX (Apache 2.0) ยท Material 3 (Apache 2.0) ยท KaTeX (MIT). No proprietary dependencies.