Six ways to give an on-device AI model a business's facts, measured

Picture a small dental practice with its own iPhone app. It wants an assistant in that app that answers the questions the front desk hears all day: “When do you open on Monday?”, “How much is a filling?”. The wish list is short, and every item on it is strict:

  • It runs entirely on the phone, so it works offline and no patient’s question leaves the device.
  • It answers from the practice’s own facts, not from whatever the model half-remembers from the internet.
  • It starts answering quickly.
  • It says “I don’t have that information.” instead of making something up.
  • It is cheap to update when a price or an opening time changes.

The hard part is the model. Anything small enough to run on a phone knows a lot about the world in general and nothing about this practice. The model I used, Qwen3-1.7B, is about a 0.9 GB download. I asked it my 65 test questions with no help at all, and it got 3% of them right and invented an answer for 31%: a wrong price, a wrong time, stated with full confidence. So the knowledge has to come from somewhere, and every way of supplying it costs something: speed, storage, accuracy, or the time it takes to change a fact.

I wanted to choose the approach for a real app from measurements rather than opinions, so I built a small test bench, OnDeviceKnowledgeLab, that tries each realistic option under identical conditions.

The six options

They fall into two families. Either the model gets the facts as text to read every time it answers, or the model itself is changed so the facts end up inside it.

The text family:

  • Whole document in the prompt. The prompt is everything the model reads before it answers. Here the full fact document is pasted in front of every question, so the model reads all of it again each time and can’t say a word until it has finished.
  • Saved prompt cache. The model reads the document once, and its processed form of that reading is saved to a file (ML people call this the KV cache). Each question then only needs its own few words read.
  • Retrieval, usually called RAG. The document is cut into pieces, the few pieces that best match the question are found, and only those go into the prompt. The matching uses embeddings, lists of numbers that capture what a text means so that similar meanings get similar numbers. I used Apple’s built-in NLContextualEmbedding.
  • Tool lookup. The model gets a few functions, such as “get the price of a treatment” or “get the opening hours”. It writes a request, the app looks the exact value up in its own data and hands it back.

The family that changes the model:

  • A LoRA adapter. A small add-on (20 MB here) is trained on question-and-answer pairs made from the facts, so the model learns them.
  • Editing the weights. A model’s weights are the numbers it is made of. Research methods called ROME and AlphaEdit find where a fact is stored and overwrite those numbers directly, which produces a new copy of the model.

How the test bench is set up

The rule I cared about most was that nothing changes between runs except the approach.

  • One model: Qwen3-1.7B, compressed to 4 bits per number so it fits on a phone, running through Apple’s MLX library from Swift. Every approach gets the same instructions and the same settings, with randomness turned off, so asking again gives the same answer.
  • One made-up business: Lakeside Dental Studio, with 40 facts (opening hours, prices, staff, policies) in a single facts.json. Everything else is generated from that file: the fact document of about 1,200 tokens (a token is a piece of a word, the unit a model reads in), the questions, the LoRA training data and the weight-editing requests. Nothing generated is edited by hand, so a fact can’t quietly differ between two places.
  • One benchmark: every approach plugs into the same small interface and is scored by the same shared runner. No approach grades its own answers.
  • Two devices: a command-line tool on an M1 Pro MacBook Pro, and an iPhone app running the same library on an iPhone 17 Pro.

On the Mac, every approach ran three times from scratch, with every saved file deleted first, as after a fresh install. The three runs gave the same answer, word for word, to every question; only the timings moved, by a few percent.

What I measured

The 65 questions come in five kinds:

  • 30 direct questions, such as “How much is a filling?”
  • 19 reworded questions, which catch an approach that learned the wording of a fact rather than the fact itself
  • 8 questions the facts can’t answer, where the only right answer is “I don’t have that information.”
  • 4 follow-ups inside a conversation
  • 4 questions asked after a fact changed during the run

Each answer is scored as correct or not, and made-up answers are counted separately: an invented value, like a price the practice never set (the ML term is hallucination). For each approach I also measured the time until the first word appears (the delay a user actually feels), the extra storage, and the cost of a reinstall and of one changed fact.

The results

Mac times are the median of the three runs.

ApproachCorrectMade upFirst word (Mac / iPhone)One fact changeExtra storage
No knowledge (for comparison)3%31%0.13 s / 0.11 s——
Whole document in the prompt95%0%1.7 s / 1.1 snothing to rebuild—
Saved prompt cache95%0%0.09 s / 0.16 sabout 0.5 s136 MB
Retrieval (RAG)71%0%0.53 s / 0.33 sabout 0.04 s40 KB
Tool lookup43%3%0.89 s / 0.57 snothing to rebuild—
LoRA adapter83%14%0.13 s / 0.18 sabout 19 min of training20 MB
Edited weights¹3–8%0–25%0.10–0.13 s (Mac)16–22 min and a new model1–3.5 GB

¹ Eight variants of ROME and AlphaEdit, on 61 questions, because an edited model can’t take a fact change during a run.

The prompt cache gives the same answers as pasting the whole document (64 of 65 are word for word identical, and the 65th is reworded but still correct), while starting as fast as the model with no knowledge at all. Pasting the document is 7 to 19 times slower to start.

Why the others lost

Retrieval never made anything up, but its search step missed whole topics. For 14 questions about opening hours, it never once found the passage with the hours. When the right passage did arrive, the model used it well, so the weak part was the search, not the model.

Tool lookup failed in a way I didn’t expect. When the model called a tool, the tool’s result held the answer every time. But on 29 of the 57 questions the facts could answer, the model called no tool at all and mostly just refused. The tools work; a 1.7B model deciding to use them is the weak link.

The LoRA adapter got 97% of direct questions right but only 68% of reworded ones, and invented 9 answers, six of them on reworded questions about opening hours. Every fact change means training again, about 19 minutes on the Mac. Training on the iPhone crashed the phone, so training on a phone is untested and the app ships adapters trained on the Mac.

Edited weights did no better than the untouched model (3–8% against 3%). The edits only take effect when a prompt names the business the way the edit sentence did (“Lakeside Dental Studio is open from…”), and a real chat question never does. Each change costs 16–22 minutes of offline work plus shipping a new model of 1 GB or more, and in the 4-bit format a phone needs, some edited models also lost general knowledge the original had.

The recommendation

Let the model read the fact document once, save that reading as a 16-bit prompt cache, and reuse it for every question. The text stays the source of truth; the cache is built from it on the device. It matches the whole document’s 95% with nothing made up, starts in 88 ms on the Mac and 156 ms on the iPhone, takes in a changed fact in about half a second, and rebuilds after a reinstall in 1.2 s on the iPhone. The price is 136 MB of storage.

That holds under a few conditions:

  • The document stays short. The cache costs about 115 KB per token for this model, so a 5,000-token document would need roughly 570 MB (an estimate, not measured). Saving it at 8 bits halves the size to 72 MB, but in my run that version invented one price, so I’d keep 16 bits wherever exact values matter.
  • The cache belongs to one model and one runtime. It should be labelled with both, plus a fingerprint of the document, and rebuilt when any of them changes.
  • The app checks exact values itself instead of trusting the model to call a tool.
  • It needs testing again on the phones the app will really run on. All my phone numbers come from one iPhone 17 Pro, and I didn’t measure older phones, loading the cache after a reboot, or peak memory.
  • No weight-based methods for facts. An adapter that only shapes tone or format, trained offline and shipped with the app, is still an option.

What I take away from it

For a small model, giving it notes to read beat giving it new memories by a wide margin, which matches the research I read before starting. The one surprise was tool lookup: I expected the model to pick the wrong tool sometimes, and instead it often didn’t pick one at all.

The limits are real: one made-up business, one model, one phone, and only eight questions that test whether the model admits it doesn’t know. But the gap between the saved prompt cache and everything that trains facts into the model was wide enough that I’m comfortable building the real app around it, and measuring again on the phones it will actually run on.