Skip to content

Repository files navigation

🐉 Roost

Grow your dragon by spending wisely. An offline, on-device budgeting game powered by Qualcomm Snapdragon NPU + Google LiteRT-LM.

Track 1: LLM Based Consumer Use Journeys Google AI Edge x Qualcomm Hackathon 2026

Earlier name: DragonBudget. The app, the package, and most code identifiers still use that name; Roost is the user-facing brand only.

📲 Download

⬇️ Download Roost v1.0 APK (106 MB)

Requires an Android device with a Snapdragon 8 Elite NPU (e.g. Galaxy S25 Ultra) for the on-device Gemma 4 model. After installing, push the model file:

adb push gemma-4-E2B-it.litertlm /sdcard/Android/data/com.example.dragonbudget/files/

The model file (~2.4 GB) is downloadable from HuggingFace. All other releases are listed here.


🛠️ Building from source

This repo deliberately does not ship the Qualcomm Snapdragon NPU native libraries — they're 80+ MB each and come from the Qualcomm QNN SDK. To build the APK locally:

  1. Install the Qualcomm QNN SDK and the LiteRT-LM AAR.
  2. Drop the following .so files into app/src/main/jniLibs/arm64-v8a/:
    • libLiteRt.so
    • libLiteRtDispatch_Qualcomm.so (must be patched — see below)
    • libLiteRtGpuAccelerator.so
    • libLiteRtOpenClAccelerator.so
    • libLiteRtTopKOpenClSampler.so, libLiteRtTopKWebGpuSampler.so, libLiteRtWebGpuAccelerator.so
    • libGemmaModelConstraintProvider.so
    • libQnnHtp.so, libQnnHtpPrepare.so, libQnnHtpV79Skel.so, libQnnHtpV79Stub.so, libQnnSystem.so
  3. The dispatch lib needs a one-time patchelf patch so it can find symbols from libLiteRt.so at dlopen time:
    brew install patchelf  # or apt install patchelf
    patchelf --add-needed libLiteRt.so app/src/main/jniLibs/arm64-v8a/libLiteRtDispatch_Qualcomm.so
  4. Download the Gemma 4 E2B universal LiteRT-LM model from HuggingFace and push it to the device:
    curl -L -o gemma-4-E2B-it.litertlm \
      "https://huggingface.co/litert-community/gemma-4-E2B-it-litert-lm/resolve/main/gemma-4-E2B-it.litertlm"
    adb push gemma-4-E2B-it.litertlm /sdcard/Android/data/com.example.dragonbudget/files/
  5. Build with JDK 17 (JAVA_HOME pointing to a real JDK, not a JRE):
    ./gradlew :app:assembleDebug
    adb install -r app/build/outputs/apk/debug/app-debug.apk

🎯 What is DragonBudget?

DragonBudget turns personal budgeting into a game. Users care for a virtual dragon called SnapDragon whose health, mood, and level directly reflect their spending habits. Log purchases, track budgets, and get personalized AI advice — all 100% offline on the Snapdragon 8 Elite NPU.

No cloud. No bank login. No tracking. Just you, your budget, and your dragon.


🔥 Core Features

Feature Description
Dragon Companion Visual health bar, XP, level, mood, and streak tracking
Purchase Logging Manual entry or AI-powered receipt scanning
Budget Tracking 8 categories with weekly limits and progress bars
Ask Dragon Natural language budgeting Q&A powered by on-device Gemma
Purchase History Full history with category filtering and spending totals
100% Offline All data stored locally via Room. Zero network calls.

🏗️ Architecture

┌─────────────────────────────────────────────────────┐
│                    Jetpack Compose UI                │
│  HomeScreen │ AddPurchase │ Budget │ AskDragon │ History │
├─────────────────────────────────────────────────────┤
│                    ViewModels (MVVM)                 │
├─────────────────────────────────────────────────────┤
│              DragonBudgetRepository                  │
├───────────────┬───────────────┬──────────────────────┤
│  Room Database│ DragonEngine  │   AI Engines          │
│  (SQLite)     │ (Deterministic│   LocalLLMEngine      │
│  - Purchases  │  health/XP    │   ReceiptVisionEngine │
│  - Budgets    │  mood logic)  │   PromptBuilder       │
│  - DragonState│               │                       │
│  - AIAdvice   │               │                       │
├───────────────┴───────────────┴──────────────────────┤
│           LiteRT-LM / Qualcomm QNN NPU              │
│  Gemma 4 E2B → Budget Advice Generation              │
│  FastVLM     → Receipt/Item Scan Understanding       │
│  EmbeddingGemma → Spending History Search (planned)  │
└─────────────────────────────────────────────────────┘

🤖 Model Stack

Model Source Role
Gemma 4 E2B litert-community/gemma-4-E2B-it-litert-lm Generates personalized budgeting advice via "Ask Dragon"
FastVLM 0.5B litert-community SM8750 Receipt scan → extracts merchant, amount, category
EmbeddingGemma litert-community (Planned) Vector search over spending history

Why This Architecture?

  • Rule-based engine controls the dragon. Gemma explains decisions but never controls financial logic. This ensures deterministic, reliable behavior.
  • AI inference is triggered only on user action (scan receipt or ask question). No continuous drain.
  • LiteRT-LM compiled models run on the Snapdragon 8 Elite NPU for maximum speed and energy efficiency.
  • Memory scheduling: Only one model is loaded at a time to stay within NPU memory limits.

🐉 Dragon Health Logic

Condition Effect
Purchase keeps category under 50% budget +5 XP
Category at 50–80% Mood → "Alert"
Category at 80–100% Health −5, Mood → "Worried"
Category exceeds 100% Health −15, Mood → "Tired"
3-day logging streak Health +10, XP +20
Every 100 XP Level up
Health Range Mood
≥ 85 🐉 Energized
60–84 🐲 Stable
35–59 ⚠️ Worried
< 35 😴 Exhausted

📂 Project Structure

app/src/main/java/com/example/dragonbudget/
├── AppContainer.kt          # Simple DI container
├── MainActivity.kt          # Compose entry point
├── data/
│   ├── Entities.kt          # Room entities + data classes
│   ├── Daos.kt              # Room DAOs
│   ├── DragonBudgetDatabase.kt
│   └── DragonBudgetRepository.kt
├── engine/
│   ├── DragonStateEngine.kt # Deterministic health/XP logic
│   ├── AIEngines.kt         # LLM + Vision interfaces + mocks
│   └── PromptBuilder.kt     # Gemma prompt templates
├── ui/
│   ├── Navigation.kt        # NavHost setup
│   ├── theme/Theme.kt       # Snapdragon-inspired dark theme
│   └── screens/
│       ├── HomeScreen.kt
│       ├── AddPurchaseScreen.kt
│       ├── BudgetScreen.kt
│       ├── AskDragonScreen.kt
│       └── HistoryScreen.kt
└── viewmodel/
    ├── HomeViewModel.kt
    ├── AddPurchaseViewModel.kt
    ├── BudgetViewModel.kt
    ├── AskDragonViewModel.kt
    └── HistoryViewModel.kt

🚀 Setup & Run

Prerequisites

  • Android Studio Ladybug or newer
  • JDK 11+
  • Qualcomm device with Snapdragon 8 Elite (for NPU inference)

Build

git clone <repo>
cd hackk
./gradlew assembleDebug

Run

Open in Android Studio → Select device → ▶ Run

(Optional) Push Gemma model for real AI

adb push gemma-4-E2B-it_qualcomm_sm8750.litertlm /sdcard/Download/

📊 Judging Criteria Fit

Criteria How DragonBudget Addresses It
Uses LiteRT / LiteRT-LM Gemma 4 via LiteRT-LM for advice; FastVLM for receipt scanning. Clean LocalLLMEngine interface with TODO-annotated LiteRtGemmaEngine placeholder.
Runs fully offline Room database, no INTERNET permission needed for core functionality. All AI inference on-device.
Uses provided HuggingFace models litert-community/gemma-4-E2B-it-litert-lm SM8750 variant
Resource utilization Rule-based engine handles 95% of logic; AI only fires on explicit user request. Single model loaded at a time.
Latency & performance NPU-accelerated. Rule-based dragon updates < 1ms.
Energy efficiency No background processing, no network polling, no always-on inference.
Easy to install and demo Standard Android Studio project. Mock engines work without model files.
Clear code & documentation MVVM + Repository + clean interfaces. This README.

🔧 LiteRT-LM Integration Points

The codebase is structured for easy model integration:

  1. AIEngines.ktLiteRtGemmaEngine class with TODO comments showing exact integration steps
  2. AIEngines.ktLiteRtVisionEngine class with TODO for FastVLM receipt scanning
  3. LiteRTLMManager.kt — Existing engine manager with NPU/GPU/CPU backend fallback
  4. PromptBuilder.kt — Production-ready prompt templates optimized for low TTFT

🛡️ Privacy

  • No cloud APIs. No Firebase. No Supabase. No OpenAI. No Anthropic.
  • No Plaid. No bank login. No online banking connections.
  • Financial data never leaves the device.
  • All AI inference runs locally on the Snapdragon NPU.

Built with ❤️ for the Google AI Edge x Qualcomm Hackathon 2026

About

roost x google x qualcomm -- deepak karani, sai pisupati, adhya maddukuri, tarun nagaraju

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages