A durable ledger makes lightweight local inference practical. Query years of records in the database, calculate the totals in SQL and send the model a compact evidence packet. The model's context can stay small while the financial history keeps growing.
A small local model can explain why a spending category changed if you give it a short, checked summary. Feeding it a year of bank statements wastes context and makes mistakes hard to trace. Start by asking it to describe two numbers that your own database has already calculated, and require an evidence reference for each claim.
Size the job before the model
A useful hardware trial compares a small text-capable model such as Gemma 3 1B with a larger local candidate such as its 4B variant. Quantisation, context length, parallel requests and CPU versus GPU placement all affect memory and latency. The weights' download size alone does not establish what fits in RAM. Try one concurrent request, a short prompt and a modest output limit. Use ollama ps while generating to inspect where the model is loaded. Model variants · Ollama local FAQ
Use a downloaded local model and an explicitly local endpoint. On a single host that is typically http://localhost:11434. Inside a container, localhost means that container, so use a private service address when the runner lives elsewhere. Disable cloud fallback in the application and test inference with outbound access blocked after provisioning weights.

Give the model an evidence packet
Suppose the database supplies g1: groceries, April, EUR 80 and g2: groceries, May, EUR 104, with both months marked complete. Add the computed change of EUR 24 and two contributing merchant groups. Ask for one sentence explaining the largest contribution and a list of evidence IDs. Leave out names, addresses and bank account numbers. If either period is incomplete, have application logic return a coverage message before invoking the model.
Ollama's chat API accepts a JSON Schema in format. Require an explanation string, an array of IDs drawn from the packet and a status such as ok or needs_review. Validate the returned JSON in your application. Reject an ID outside the supplied set. Render amounts from your own data fields so a plausible sentence cannot change the displayed total. Structured outputs
For a one-user service, keep the API bound to loopback where possible. If you put the model on another LAN host, restrict access to the reporting service. A browser extension, public tunnel or cloud model tag can change the data path even when the front end is local. Ollama cloud execution
Score each candidate on the same examples
| Case | Expected result | Reject the response if it… |
|---|---|---|
| Two complete months | Includes the supplied difference and valid IDs | Invents a cause such as inflation |
| Missing card account | Labels the report partial | Announces spend fell |
| Refund crosses month-end | Uses the ledger’s stated period rule | Silently moves the credit |
| Two identical amounts | Asks for identity or other evidence | Declares one row a duplicate |
Build an evaluation set that includes awkward answers
Include a duplicate-looking purchase, a refund after month-end, an internal transfer and a new merchant with no history. Include at least one case where no explanation is justified. Hold back some examples when tuning prompts. Record invalid JSON, invented causes, unsupported amounts, missed abstentions and whether the reader could follow the evidence link. A tidy JSON object can still contain an invented story.
Run identical examples with each candidate on the target machine. Measure first response after loading, warm response time and peak memory while the database is busy. If only a few explanations run overnight, a slower CPU model may be acceptable. If a dashboard blocks while generating, cache the checked report and serve it immediately.

Try the first local request with invented numbers
After installing Ollama and pulling the text model with ollama pull gemma3:1b, run ollama run gemma3:1b 'Groceries were EUR 80 then EUR 104. The ledger calculated an increase of EUR 24. Describe the change in one sentence without guessing its cause.' Confirm the selected model is installed locally. Compare the response with the same prompt on the 4B version. Record any claim about shopping habits as an error unless the input supports it.
Run your model comparison
Start with a deterministic report
Write the correct answer and its evidence IDs before prompting either candidate.
Change one variable
Keep the fixture, prompt and output schema fixed when changing model size. Record the local model version.
Exercise the fallback
Stop the runner. The totals and links must still load, with the prose omitted or marked unavailable.
What should the model be allowed to do?
For a first household deployment, give it no shell, arbitrary SQL or network search tool. Supply the few facts appropriate to the question through an application function. Treat merchant descriptions as untrusted text. A merchant called “ignore the previous instructions” should produce an ordinary review item. The smallest model that passes your own examples is a defensible choice even when another has a higher public benchmark.
Continue building with Build a Private Finance App With Claude Code or Codex and Find Subscription Price Increases With a Local LLM.
