DailyBudget, the Android budgeting app I'm building, has an "Ask" tab. You type or say a money question, in English or Hinglish ("kitna bacha hai?"), and it answers. It works with the phone in flight mode, because the app has no internet permission at all.
The rule that makes it work: the AI writes words, the app writes numbers. The model that runs on the phone is never allowed to put a single rupee amount in its answer.
Below is why, and what it took to make a 385 MB model useful.
Two layers, one answer
Every question goes through the app's own code first.
If it's an exact question ("how much is left today?", "what did I spend on petrol this month?"), a plain Kotlin class called Advisor answers it instantly from the transactions it already parsed from bank SMS. No model involved.
If it's a judgement question ("can I buy shoes this week?", "where am I going wrong?"), the app builds a fact sheet first: today's number, the cycle so far, the biggest spending categories and payees, and any notes the user saved with "remember …". The model gets those facts and writes advice.
The reply you see is two parts. The exact numbers come from Advisor, computed in integer paise. Under them is the model's advice in words.
Why the model can't write numbers
My first version used stock Qwen2.5-1.5B and let it write freely. It read the facts correctly most of the time and still put real numbers in the wrong places. One answer told the user they had "₹598 today" when ₹598 was how much they'd overspent across the whole cycle. The number existed in the facts, so checking each amount against the fact sheet didn't catch it.
So now a small filter, NumberGuard, drops any sentence from the model where it writes a ₹ amount or a percentage. The numbers on screen all come from code. The model only gets to say things like "you're over for this cycle, so wait for salary before the shoes, and the biggest leak is late-night food orders."
Fine-tuning a 0.5B model on a laptop
Stock models were bad at following that rule. I wrote a 40-question held-out exam that scores each answer the way the app would use it: no figures, English only, names the user's real top spending category or a real payee, honest about being over or under budget, says "wait" on purchase questions when over budget, and 15 to 90 words long. Stock Qwen2.5-1.5B passed every check on only 7.5% of questions. Stock 0.5B passed 5%.
So I trained a LoRA adapter on Qwen2.5-0.5B-Instruct:
- Data: 440 examples. The prompts were generated by the app's own fact-sheet code, so training saw exactly what the phone sends. The answers follow a written style spec: no digits, plain English, two to four sentences, name the real categories and payees, and say "wait for salary" when the user is over budget.
- Training: LoRA rank 16, alpha 32, all projection layers, 2 epochs, learning rate 2e-4. It ran on CPU in fp32 on an Intel Mac, because Apple's MPS backend gave wrong numerics.
- Export: converted with llama.cpp and quantised to Q4_K_M. The final file is 385 MB.
On the same exam the fine-tuned 0.5B passed 80% of questions, against 7.5% for the stock 1.5B. Answers that named the user's real top category or payee went from 25% to 98%. It's also about twice as fast as the 1.5B.
Running it on a mid-range phone
My test phone has a Snapdragon 695 and 5.5 GB of RAM. A few things mattered more than I expected:
- 2 threads beat 4 or 6. Prompt processing ran at 38 tokens/s on 2 threads against 27 on more, because the little cores drag the big ones down.
- No mmap. With memory-mapped weights, Android evicted pages mid-answer on this RAM-tight phone and generation fell to about 1 token/s. Loading the weights fully fixed it.
- Gates before loading. The model only loads on phones with at least 4 GB of RAM, and only if the model file is no bigger than 30% of that RAM. Otherwise the Ask tab still works, with exact answers only.
- Warm-up and cache reuse. Opening the tab loads the model and pre-reads the system prompt and facts, so a follow-up question only processes its own words.
llama.cpp is built into the app through CMake and a small JNI bridge, for arm64 only.
The offline part has a cost
The app can't download anything, so it can't download the model either. Right now you add the model file yourself through Android's file picker. That's clunky, and it's the price of being able to say the app never goes online. I haven't solved this one yet.
Voice works offline too, as long as the phone has an on-device speech recogniser: questions go to the phone's own recogniser and answers are read out by its text-to-speech engine.
What I'd tell anyone adding a small model to an app
Let code own every fact and every number, and give the model one narrow job. Then measure it with an exam that scores exactly that job. The 0.5B model knows less than the 1.5B one. It wins because it was trained for exactly one job.
If you've shipped an on-device model in an Android app: how do you get the model file onto people's phones?
How the advisor works in the app, with the exam numbers: dailybudget.dpdns.org/advisor
Top comments (11)
Really liked the NumberGuard idea — letting code own every number and giving the model one narrow job is such a clean split, and 80% on your held-out exam against 7.5% for the stock 1.5B says it works. We're in the same small-numbers boat over here, our podcast pulled 39 downloads in the last 7 days, so I know how much a careful little measurement like your 40-question exam matters.
Thanks! 39 downloads in a week is a real number to build from. A small number you measured beats a big one you guessed.
That's the bit I keep coming back to — 39 in a week isn't a vanity number, it's a week of actual people actually using it. Guessed numbers always sound bigger, but they don't tell you what to fix next.
Agreed. What's the one thing those 39 listeners told you to fix first? That's usually where a small number earns its keep.
Good question — honestly the feedback's still trickling in, the 39 downloads are only a week old. The thing I'm watching for is whatever comes up twice, that's usually the real fix rather than one person's pet peeve. What would you look at first if it were yours?
I'm still at the waitlist stage, so this is a guess rather than experience. With 39 I'd look at behaviour before opinions: how many came back for a second listen, and where the first one stopped. That shows up even when nobody writes back. Can your stats show repeat listens, or only downloads?
You're right — behaviour beats opinions at 39 downloads. Our podcast stats only show downloads, not repeat listens per person, so we use older episodes as a rough proxy: 57 of the 94 downloads in one week were from episodes older than Series 3, which suggests people are going back rather than just sampling the newest one. Still a blunt tool, though — where the first listen stops would tell us a lot more than the download count does.
57 of 94 coming from older episodes says more than I'd expect from download counts. Someone who goes back to an earlier series has probably decided they like the show. If your host shows downloads per episode per day, an old episode picking up right after a new one goes out would point the same way. Does it give you daily numbers, or only weekly totals?
It does give daily numbers per episode, so that's a check I can actually run — I hadn't looked at whether an old episode picks up right after a new one goes out. Good call, I'll watch for that pattern on the next release.
The split — "the AI writes words, the app writes numbers" — is the part I'd steal. My own app is fully offline too, so the NumberGuard idea really lands: a hallucinated rupee amount is exactly the kind of failure that would erode trust in a budgeting app. Two questions: with no internet permission, how are you planning to get the 385 MB file onto users' phones — bundled in the APK, or a file-picker import like the manual step you described? And did the 2-threads-beat-4 finding hold up on other devices, or is it specific to the Snapdragon 695's little cores?
Today it's the file picker, which is the clunky part. Bundling it would make the APK huge. If it goes on Google Play, an install-time asset pack would let the Play Store deliver the model during install, so the app itself still wouldn't need INTERNET. I haven't tested that route yet.
On threads: I've only measured the 695 so far. Big and little core layouts differ a lot between chips, so the thread count probably needs to be picked per device rather than hard-coded.