Engineering

Building a Flutter on-device LLM app.

Architecture notes from maintaining PocketLLM Lite: isolating an archived inference SDK, adopting llama.cpp via llamadart, verifying multi-hundred-MB weights, and handling tight mobile RAM.

1. Surviving an upstream SDK archive

PocketLLM Lite initially shipped with Cactus Flutter 1.3, which was archived upstream in July 2026. Keeping Cactus isolated behind adapters (with telemetry disabled) allowed us to preserve support for existing Cactus bundles and Whisper transcription while moving active GGUF model execution onto llama.cpp through llamadart.

2. Split-ABI packaging without bloating 32-bit builds

Native shared libraries add tens of megabytes per CPU ABI. Shipping split APKs keeps each install focused:

  • arm64-v8a: includes both libllama.so and legacy libcactus.so.
  • x86_64: includes llama.cpp for desktop Android emulators and x86 hardware.
  • armeabi-v7a: omits native model runtimes entirely (~54 MB) and serves as a lightweight client for Ollama or OpenAI-compatible servers.

3. Pinned starter weights & RAM-aware context

Downloading 0.3–2.5 GB files over mobile connections fails regularly if you do not validate every byte. Starter models pin an exact byte size, SHA-256 digest, and upstream licence; partial files survive retries and mismatched hashes are rejected before registration.

At runtime, PocketLLM Lite profiles free RAM, CPU cores, and ABI to rank starter models conservatively, defaults on-device llama.cpp to a 4,096-token context, falls back to 2,048 tokens on tight memory, and automatically unloads weights on Android memory-pressure callbacks.

If you try it on your phone, open a GitHub issue or discussion with the model and device you ran — real hardware reports help everyone.

Sources

Ready when you are. Inspect the Flutter source.

MIT licensed, pinned CI toolchain, and automated privacy regression suites.

Latest v1.0.61Android 7.0+Install guide & all builds