Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Go Completely Offline: Build a Privacy-First Personal Finance Assistant with LiteRT and Gemma 4

Description and use

The app runs entirely offline in the browser: transaction data is stored in IndexedDB, the Gemma 4 model is cached in Cache Storage, and LiteRT LM Web API provides fast, private responses without token costs.

Problem

Users want a personal finance assistant that can analyze sensitive transaction data, detect anomalies, and suggest budgeting without exposing data to external servers or incurring token costs.

Outcome

The application achieves 100 % offline, privacy‑first personal finance assistance with zero token costs, by caching a 2 GB Gemma 4 model in the browser and performing all inference locally.

Workflow

  • 1. Install dependencies: @litert-lm/core, tailwindcss, jsonrepair, dexie, angular-eslint, husky, lint-staged, serve, @commitlint/cli
  • 2. Cache Gemma 4 weights (~2 GB) in the browser’s Cache Storage using AiModelCacheService and FileProxyCache
  • 3. Lazily initialize a single LiteRT LM engine instance via GemmaEngineService
  • 4. Store user expenses in IndexedDB
  • 5. Precompute arithmetic grounding (monthly, daily totals, category breakdown) and supply to the engine as ground truth
  • 6. Manage conversation: reset after three turns, keep last two queries in client‑side memory, re‑prime model on reset with grounding data
  • 7. Stream responses with WebGPU speed and display insights in the Angular UI

Evidence

The demo has a download button for users to download the Gemma 4 E2B model that is around 2GB.

Source

After a successful download, go to Application > Storage > Usage to verify that the model occupies 2GB in storage.

Source

  • Record date: 2026-09-07T19:59:27.165Z