In short
- Problem
- Can a finance app understand your money without ever being told what it is — no account linking, no server, no upload?
- Constraint
- Zero bytes out. A phone rather than a datacentre, and a model that weighs about a gigabyte.
- Decided
- Rules first, model second. Stub the engine in phase 0 before it existed. Keep the native boundary small. Constrain generation, then check it against the source. The model suggests; the person decides. Measure the model, then narrow its job. Test on real data, and make every statement check itself.
- Rejected
- Building the LLM layer first because it is the interesting part — an ordering that would have made every other phase wait on it. And looking up fund prices one holding at a time, which would have told a server what you own.
- Hardest
- Making a phone-sized model useful. Asked to read every part of a question, it got 2 of 24 unusual questions right; given one narrow job, the app got 12 of 20 it had never seen, and 16 of 20 on each of two later sets. Then real data showed the parsers I had trusted were reading almost nothing.
- Outcome
- A full personal-finance app across fifteen build phases — spending, budgets, cards, investments, net worth, tax estimates and plain-English questions — all on the phone. The release build is verified and a Play submission is drafted; it is not yet published, and there is no usage to report beyond my own.
Question
Can an app understand your money without ever being told what it is?
India's financial life is UPI-heavy and SMS-native. A person's transaction history is scattered across bank SMS alerts — each bank with its own template and its own registered sender-ID conventions — UPI app notifications, PDF statements from banks and card issuers, and the occasional CSV export from a net-banking portal.
Every tool that stitches that together asks for the same thing in return: upload it all to our servers. And a transaction history is a startlingly complete portrait of a person — where they go, what they eat, who they pay, when they are struggling. It is a granularity most people would not hand to a stranger, and do, because the alternative is a spreadsheet.
So the question is not whether the categorisation can be done. It is whether it can be done without the data moving — whether the intelligence can come to the data instead of the data going to the intelligence.
Constraint
Zero bytes out. A phone, not a datacentre. And a model that weighs about a gigabyte.
The privacy rule is absolute rather than aspirational, and stating it that way removes every convenient option at once: no server-side parsing, no cloud model call, no analytics on transaction content, no "we only send anonymised data." Nothing leaves. That is the whole specification, and everything downstream is a consequence of it.
What remains has to run on a mid-range Android phone that is also running everything else its owner cares about. A resident model of roughly a gigabyte competing for that memory is a real risk rather than a theoretical one, and battery is a budget nobody approved.
The constraint is also the strategy. A privacy claim backed by architecture is verifiable in a way a privacy policy is not, and it is meaningfully harder to copy — matching it means solving on-device inference under mobile hardware limits, not calling a different API.
Decision
Eighteen decisions. The early ones are about what to build before the interesting part; the later ones about keeping the numbers honest.
Decision 01
Rules first. The model is the fallback, not the feature.
The parsing pipeline is a deterministic-first cascade. Layer one is regex and rule-based extraction handling the majority of cases — known SMS templates from major Indian banks, known statement table layouts — deterministically, fast, at zero inference cost and zero battery impact. Layer two is the on-device model, invoked only for the formats the rules cannot confidently parse, and for merchant-name normalisation where fuzzy semantic judgment genuinely helps.
I wrote “the majority of cases” long before I had checked it, and on real messages it was not yet true. Decision 16 is what happened when I checked.
This avoids a false choice. Handling every format perfectly with rules is unrealistic given how much SMS templates and statement layouts vary across dozens of Indian banks and card issuers. Routing everything through the model is unrealistic given what mobile inference costs in time and battery. The cascade takes the cheap path for the common case and reserves the expensive one for the tail.
Traded away: a single code path. Two parsing strategies means two sets of failure modes and a confidence threshold that has to be tuned rather than assumed.
Decision 02
Stub the engine in Phase 0, before it exists
An abstract engine interface, with a fake stub implementation, was defined in the very first phase — before any model work at all.
The effect is that the UI, the database layer, every parsing pipeline and the whole test suite could be built, run and tested without the real gigabyte model ever being downloaded or loaded. In a phased build where the inference subsystem lands late, defining that seam first is the difference between a project that progresses and one gated on its hardest problem.
Rejected: building the LLM layer first because it is the interesting part. That ordering would have made every other phase wait on the one with the most unknowns.
Decision 03
Keep the native surface small
The model is small and quantised, and it is downloaded on first run rather than bundled so the install stays a reasonable size. The native runtime it runs on is pinned to a specific release rather than tracking its main branch, so the native build stays reproducible and auditable.
Between that runtime and the app sits a hand-written bridge exposing a deliberately minimal API. Keeping that surface small and stable isolates the app from the runtime's internal churn, and makes the native boundary — the place where a mistake becomes a crash rather than an exception — small enough to reason about and test exhaustively.
Inference runs off the UI thread, so a slow or stalled generation never freezes the app. And the interface is deliberately runtime-agnostic: a different on-device runtime can be swapped in behind the same seam without the change rippling outward.
15 more decisions inside Continue the Arth case study Decisions 04–18 · pipeline · what it does · phase history · about 2,900 words Show all 15 remaining decisions ↓ Hide the full record ↑
Decision 04
Constrain the generation, then validate it anyway
Model output is forced into valid JSON matching the app's schema using a grammar at generation time — the model cannot emit malformed structure because the grammar will not let it.
And then a schema-validation pass runs afterwards regardless. That is belt and braces, and it is deliberate: a grammar constrains shape, not sense, and model output that is about to be written into someone's financial record is not data I am willing to trust on one guarantee.
Decision 05
Give the memory back when the model is idle
An idle-unload policy releases the model from memory when it is not actively being used. On a RAM-constrained Android device, a gigabyte held resident because the user might ask another question is a gigabyte taken from everything else they are doing — and the fastest way to have a finance app uninstalled is to make the phone feel slow.
Decision 06
Converge PDF onto the CSV pipeline instead of building a second one
PDF import handles password-protected statements and detects scanned, image-only PDFs that need different treatment from text-layer ones. Then it reconstructs the page layout into a grid — and feeds that grid into the same header-mapping and row-parsing components the CSV and Excel pipeline already used, unchanged.
Building a parallel PDF-specific parser would have been the obvious route and would have doubled the surface where the two paths could quietly disagree about the same statement. Instead a cross-format consistency test asserts that the PDF-derived and CSV-derived versions of the same transaction agree.
That test deliberately asserts on every field deduplication relies on, rather than the easier, more obvious surface fields of date and amount. The fields that matter are the ones a duplicate would hide behind.
This one did not survive contact with real statements. On two real PDFs the grid read zero rows: one table header drawn without text, another centred over wide columns. Phase 13 added the second parser I had refused to build, a line-by-line reader that takes over whenever it reads more rows than the grid. The convergence that still holds is further down: every source ends in the same ledger.
Decision 07
Keep the date out of the duplicate check
Transactions arriving from different sources are deduplicated on what identifies the payment itself — and for transactions carrying a strong bank reference, the date is deliberately left out.
This was discovered, not designed. An SMS alert and a statement row describing the same real-world payment can disagree on transaction date versus posting date. A date-sensitive check would have silently created duplicate records for a meaningful fraction of transactions — silently being the operative word, because nothing would have errored and the totals would simply have been wrong.
It is the kind of rule that looks arbitrary in a diff and obvious in a bug report, which is exactly why it has tests around it.
Decision 08
Score the header row rather than assume it
Net-banking exports do not agree on where a table starts. So CSV and Excel import detects the header by scoring candidate rows instead of assuming a fixed position — and where the source data is ambiguous about whether a row is a credit or a debit, a direction-inferred flag surfaces in the import preview so the user can check the inference before it is committed to the database.
Showing an inference as an inference is the honest version of automation. The alternative silently books a refund as a purchase and lets the user find it in a monthly total.
Decision 09
Audit dependency health as a first-class criterion
Maintenance activity, licence and single-maintainer risk are reviewed before a package is adopted, not after it fails. Two real problems were caught and replaced mid-build because of it.
SMS access moved off a package flagged as a maintenance risk and onto a small native bridge of my own — which also made room to normalise the registered sender IDs Indian banks send from, so an SMS can be reliably mapped back to its bank.
Database encryption moved off a fork flagged as poorly maintained and single-maintainer, onto an actively maintained encrypted store. For a security-sensitive dependency in an app whose entire promise is custody, a single-maintainer fork is a structural risk, not a convenience trade.
Document handling was likewise chosen after auditing alternatives, on licensing and active maintenance. Encryption keys live in the platform's hardware-backed key storage rather than in application code or plain preferences.
Decision 10
Open every phase with a review block, not with code
Each phase begins with a design review and issue-fixing block before implementation starts, on the theory that design problems are cheapest at the moment they are noticed and most expensive once something is built on top of them.
It works. The dependency problems in Decision 09 were caught this way. So was a diagnosability gap in how the model loads — a silent failure from memory pressure or a corrupt file would have produced no clear signal — named before user-facing features sat on top of it rather than after.
The same habit of measuring rather than assuming later caught a subtler bug at the native boundary: the model's load settings were being handed over in the wrong form, which gave it a random working size and, now and then, a crash. It surfaced only because the real model was run and measured, not assumed to work.
Decision 11
The model suggests; the person decides
The open question was how the model gets invoked when the rules cannot read something: inline, blocking the interface while it runs; on demand; or in the background. Those are three genuinely different products.
It became background, while the app is open. The model's readings queue up and never block a screen, and none of them reaches the ledger until the person has reviewed it. Anything the model reads is a suggestion; anything the app estimates, such as tax, is labelled an estimate. Since Phase 14 the same work can also run with the app closed, off by default: new messages are read as they arrive, with a check every six hours for any missed, and model work runs only while the phone is charging and idle.
Traded away: speed of the first impression. A reading the person confirms is slower than one booked silently, and that friction is the point.
Decision 12
Check every model field against the source text
Before a reading even reaches review, every field the model returns has to be found in the original message — the amount, the reference, the merchant. A field that cannot be anchored to its source is rejected rather than shown.
A small model will occasionally produce a plausible number that was never there. This is the check that catches it, in code, instead of hoping the person spots it in a review queue. It is the same reasoning as Decision 04, one step later: a grammar fixes the shape, and the anchor check fixes the facts.
Decision 13
Keep the numbers honest before making them clever
Money moving between your own accounts is not spending, so transfers are paired and set aside before any total is calculated. Refunds reduce their category instead of counting as income. Stale data and estimates are flagged as what they are.
A data check-up then points at what is missing or doubled — a statement gap, a month with no data, cash counted twice, an untracked card — each with a way to fix it. A finance app's first job is a total the person can trust; insight built on a wrong total is worse than none.
Decision 14
Download the whole list, never ask about one fund
Prices are the one thing a phone cannot work out alone. Arth fetches them only if the person opts in, and then fetches the whole public price list rather than looking up what they hold: the daily fund list, and since Phase 14 the BSE’s daily file of about 5,000 shares and ETFs, which gives the previous close and not a live price. The request reveals nothing about what they own; the matching happens on the phone.
With the one-time model download, those two lists are the app's entire network surface, and each is disclosed where the person turns it on. The NSE’s file was the other candidate; it is zipped and wants a browser’s user agent, so I left it out.
Rejected: per-fund lookups. They are smaller and faster, and they tell a server exactly what you own.
Decision 15
Measure the model, then narrow its job
Ask lets a person type a question in plain English — how much went on food last month, what is due in the next two weeks — and every number in the answer is calculated by the app, with the same rules as everything else on screen. The model's only job is to work out what an unusually worded question is asking.
That narrowing came from measuring, not intuition. Asked to read every part of a question, the on-device model got 2 of 24 unusual questions right. With the rules reading the dates, merchants and categories and the model choosing only the kind of question, the app got 12 of 20 questions it had never seen: 5 of 5 where the rules could read the question alone and 7 of 15 where the model had to help. Two further sets, each written before it was run, scored 16 of 20. The answer card always shows how the question was read, so a misreading is visible rather than quietly wrong.
Traded away: the demo-friendly version where the model answers everything. It would look more impressive and be wrong far more often.
Decision 16
Test on real data, because the fixtures were lying
By Phase 12 every test passed, and the tests had been written from what I assumed bank messages looked like. Phase 13 ran the parsers on one real inbox and two real statements. For several banks the SMS parser read nothing at all, for others the scan never fetched the messages in the first place, and the PDF import read zero rows. Two of the golden tests I had relied on had a bug baked into their expected answers.
About 45 new templates later, only a few dozen messages in that inbox go unread, and I checked each kind of skipped message against real samples. Real data stays on the machine, and fixtures keep the real layout with made-up names and amounts.
Traded away: the comfort of a green suite. And the coverage is still one person’s inbox: other banks are unchecked, investment statements are still synthetic, and card spends in a foreign currency are skipped because the rupee amount only appears on the statement.
Decision 17
Make every statement check itself
A statement prints its own answers: opening balance, closing balance, total debits and credits, and how many of each. So the app now reads those printed totals separately and compares them with the rows it parsed, to the rupee and to the exact count, then says whether the statement adds up and which figure doesn’t. On the two real PDFs that went from zero rows to every printed total matching.
Rejected: a summary paragraph written by the on-device model. I tried it. It opened with filler, misstated facts, and looped when its grammar banned digits, so code writes that overview now.
Decision 18
Score the models before changing one, and count the noise
I scored four models of a gigabyte or less on the same held-out sets. Qwen3 1.7B beat the shipping Gemma 3 1B at reading bank messages, with 57 of 62 checked against the source against 52–53, and direction read correctly 57–58 times against 46–47. On Ask it scored 13, 17 and 18 against 12, 17 and 17. With run-to-run noise of ±1, the SMS gain is real and the Ask gain isn’t.
The same discipline applied to my own fix. A new parser rule took one Ask set from 16 to 18 of 20, but only the parser’s share of that counts, because one model answer flipped with no change to the model.
Traded away: a clean ending. All of this ran on a desktop, and Qwen3 carries about a quarter more weights. No phone has been timed for speed, memory or battery, so the main branch still ships Gemma. A branch that switches without that timing is open and unmerged.
The pipeline
Every source in, one ledger out.
| Source | Notable handling |
|---|---|
| Transaction SMS | Bank sender IDs normalised; the same extractors shared across the cascade |
| CSV / Excel | Header row found by scoring; an inferred credit or debit is shown for review before import |
| PDF statements | A statement's password typed once and tried automatically after that; scanned statements detected; read as a grid or line by line, whichever reads more rows; printed totals checked against the rows parsed |
| Investment statements | Fund and demat holdings with their full transaction history; the same fund reported by two statements counted once |
| Manual entries | Cash, and the assets and loans no statement covers |
Every source converges on the same normalised record — date, amount, direction, bank, reference number, merchant — and then through the same deduplication. All of it on the device.
The asymmetry the product has to live with
Android SMS read access needs a runtime permission, and store policy around SMS-reading applications requires a narrowly scoped, user-facing justification — transaction alert parsing only, on-device, never transmitted. iOS has no equivalent capability at all.
That is not a gap to be closed; it is a structural difference. The iOS import experience is shaped toward PDF and CSV import and manual entry, and the product designs around that rather than papering over it with a feature that cannot exist. An iOS build would take exactly that shape, though it has not been set up.
On regulation: RBI guidance on financial data handling and the DPDP Act are the backdrop. On-device processing simplifies that posture considerably — there is no server-side storage or transmission to reason about. It does not eliminate the work. Permission scoping, on-device retention and user data-deletion controls all still have to be designed deliberately rather than assumed fine because they happen locally.
What it does
Fifteen phases later, a complete picture of a person's money, on the phone.
Insights. Income, spend and savings rate each month; category and merchant breakdowns that drill down to the transactions behind every number; subscriptions and EMIs found in repeating payments; unusual charges, new payees and possible duplicates; a month-end outlook; and a financial-year review with a full income statement.
Planning. Budgets with pace hints and rollover; credit cards with bills, due dates and utilisation read from their statements; savings goals with the monthly saving they need; a calendar of upcoming payments; and reminders that keep amounts off a locked screen. New-transaction alerts are optional and hidden on a secure lock screen.
Investments and net worth. Mutual funds and shares from investment statements, with gains and annualised returns per holding; net worth across accounts, investments, other assets and loans; asset allocation against targets; a retirement plan built on real spending; and loans with their full schedule and a prepayment calculator.
Tax, as estimates. Capital gains by financial year under current Indian rules, how much gain can still be booked tax-free this year, and a draft of the return's assets-and-liabilities schedule — each labelled an estimate, with what it does not cover stated.
Ask and Sheets. Questions in plain English, answered by the app's own maths; and a calculator notepad that knows your numbers.
Security. An encrypted ledger with its key in the phone's hardware-backed storage; an app lock with biometrics and a blank preview in the app switcher; and backups sealed with the person's own passphrase, written where they choose and never uploaded. The phone's own cloud backup is switched off, because it would have restored the ledger without the key that opens it. Data can be exported to Excel or CSV, and because that file isn’t encrypted the app warns before saving it, and neutralises any cell that could run as a spreadsheet formula.
Phase history
Each phase opened with a review and closed with something testable.
| Phase | Built |
|---|---|
| 0 — Foundations | Encrypted schema, domain models, the engine interface with its stub, and SMS golden tests as the parsing correctness baseline |
| 1 — SMS parsing | The rules library, native SMS access, sender normalisation, the deterministic-first cascade |
| 2 — CSV / Excel | Statement import, header detection, cross-source deduplication, inferred-direction review |
| 3 — PDF | Password handling, scanned-PDF detection, layout reconstruction feeding the existing pipeline unchanged, cross-format consistency test |
| 4 — Native inference | The on-device runtime and its bridge, off-thread generation with constrained output, validation, idle unload |
| 5 — Hybrid AI | The background queue while the app is open, anchor checks, the review queue, and a resumable scan of SMS history |
| 6 — Insights | Totals with transfers paired, charts, recurring payments, unusual charges, the month-end outlook |
| 7 — Budgets and search | Budgets, the financial-year view, search with bulk re-categorising |
| 8 — Getting it all in | Saved statement passwords and multi-file import, credit cards, cash entries, goals, the data check-up |
| 9 — Investments | Investment statements, returns, net worth, opt-in public fund prices |
| 10 — Tax and planning | Capital gains and tax harvesting, loans, asset allocation, retirement, the assets-and-liabilities draft |
| 11 — Security and tools | App lock, encrypted backup, upcoming payments, reminders, Sheets |
| Release hardening | The release build run end to end on an emulator; seven platform defects found and fixed |
| 12 — Ask | Questions in plain English, answered by the app's own maths, with the model narrowed after measuring it |
| 13 — Real data | Parsers measured on one real inbox and two real statements; about 45 SMS templates, the line-by-line PDF reader, statement summaries checked against printed totals, card statements linked to SMS |
| 14 — No real data needed | Release signing, opt-in background refresh, share and ETF prices from the BSE’s daily file, a second held-out Ask set |
| 15 — Ready for others | SMS read on arrival with optional alerts, Excel and CSV export, a third Ask set, a runtime upgrade and four models scored, the Play submission pack |
Five SMS golden tests in Phase 0 are the smallest artifact here and among the most load-bearing. A golden test written before the parser means every subsequent change to the regex cascade has to justify itself against a fixed expectation rather than against whatever the parser happened to produce last week. Their weakness is the one Decision 16 exposed: a golden test is only as true as the format it was written from. There are 62 golden messages now, many of them taken from real formats.
Outcome
- 0Bytes of financial data transmitted
- 15Build phases
- 4Ways money gets in, one ledger
- 550+Automated tests
- 3Optional downloads, none about you
The database is encrypted at rest as well as never transmitted, with its keys held in the platform's hardware-backed storage rather than in the app.
The parsing pipelines, the database layer, the UI and the test suite were all built and exercised against a stubbed engine before the real model was ever loaded — which is the clearest evidence that Decision 02 was worth making early.
There is no usage to report beyond my own. The release build has been run end to end on an emulator and installed on my own phone, and it is not yet published. A Play submission is drafted, and the signing path is built, but the upload key, the permanent application ID, the screenshots, the SMS demo video and the Play questionnaires are still to do. It also still needs field-testing with statements from more banks, and timing on real phones: every speed and accuracy figure here comes from a desktop or an emulator.
A privacy policy is a promise. An architecture is a constraint. Only one of them survives a change of management.
flutter · dart · kotlin · on-device language model · native bridge · encrypted local storage