Local RAG on a Phone: Chat With Documents Without a Server
Retrieval-augmented generation does not need a cloud backend. How local RAG works on a phone, what it takes to ship it, and where its limits are.

Chat with your documents has become one of the most useful things an AI app can do. Point a model at your notes, manuals, contracts or research, ask a question in plain language, and get an answer grounded in your own material instead of a confident guess from training data. Until recently, that pattern almost always meant uploading your files to a server. It does not have to. Retrieval-augmented generation — RAG — runs on a phone, entirely offline, and for personal document collections it is often the better way to build it.
This article explains how local RAG works, what it takes to ship it in a real app, and where its honest limits are.
What RAG actually is
A language model on its own can only answer from what it learned in training. That training has a cutoff date, it does not include your files, and it does not know your company's procedures, your lecture notes, or the manual for the machine in front of you. RAG fixes that by adding a retrieval step before generation:
- Index your documents. The app splits each document into short passages, called chunks, and converts each chunk into a vector — a list of numbers that captures what the passage means. This is done by a small embedding model, which is itself a neural network, just a much smaller one than the chat model.
- Search at question time. When you ask a question, the app converts the question into a vector the same way and finds the chunks whose vectors are closest to it. Closeness in vector space means closeness in meaning, so a question about "warranty terms" finds the warranty paragraph even if it uses different words.
- Generate with the evidence in the prompt. The retrieved passages are pasted into the chat model's prompt alongside your question. The model now answers from your documents, and it can quote or cite them, instead of improvising.
Nothing in that pipeline requires a server. The embedding model, the vector index and the chat model are all just software and data. If they fit on a phone, the whole thing runs on a phone.
Why run RAG on the device
The obvious reason is privacy. Documents are the most sensitive thing most people own: medical notes, legal contracts, financial records, unpublished writing, company internals. Uploading them to a cloud service means trusting that service's retention policy, its security practices and every subcontractor in its chain. Local RAG removes the question entirely. The files never leave the device, so there is no upload to intercept, no server copy to leak and no retention policy to read. That is not a promise in a privacy policy — it is a property of the architecture.
The second reason is availability. A server-side RAG feature stops working the moment the connection does. On-device RAG works on a plane, in a rural clinic, in a warehouse with thick walls, or in any of the places where a phone has no signal but the user still needs an answer. For field work, travel and other no-signal environments, that is the difference between a feature and a dead button.
The third reason is cost structure. A cloud RAG feature bills you per query: embedding calls, vector database hosting, model tokens, egress. Every user, every question, adds to the bill, forever. A local RAG feature costs the developer the work of shipping it and the user the storage space of the models. After that, each question is effectively free. For apps with many users asking many questions, that changes the economics of the whole product.
The pieces you need
A working local RAG system has four parts, and each one has to be chosen with phone constraints in mind.
A document pipeline. Before anything can be searched, documents have to become clean text. PDFs need text extraction; scanned pages need OCR, which is itself an on-device model; markdown and plain text are the easy case. The quality of this step decides the quality of everything after it. Garbage text in means garbage chunks out, and no retrieval trick recovers a passage that was mangled at extraction time. Keep the pipeline simple, test it on the messy real documents your users actually have, and surface failures honestly instead of silently indexing nothing.
Chunking. Long documents have to be cut into pieces small enough for the embedding model and the prompt. The usual approach is chunks of a few hundred words with some overlap between neighbours, so a passage that straddles a boundary is not lost. Chunking is also where most real-world RAG quality is won or lost: chunks that respect the document's structure — paragraphs, headings, list items — retrieve far better than chunks cut at arbitrary character counts. A manual with clear sections is a good RAG citizen; a wall of unformatted text is not.
An embedding model and a vector store. The embedding model turns text into vectors, and the vector store keeps those vectors searchable. On a phone, both need to be small and fast. Embedding models are typically far smaller than chat models, so they are the easy part. The vector store can be a lightweight on-device database or even a simple file of vectors with a nearest-neighbour search, which is fast enough for personal collections of thousands of chunks. You do not need a distributed vector database for a single user's documents. You need one that starts quickly, survives app restarts and does not eat the battery while idle.
A chat model with a long-enough context. The retrieved passages go into the prompt, so the chat model needs a context window large enough to hold them plus the question plus room for the answer. This is one of the real constraints on phones: a small model with a short context window can only use a few retrieved passages, so retrieval quality matters more, not less. Pick the number of passages to retrieve based on what the model can actually use, and say so in the product: retrieving twenty passages for a model that can only read five is wasteful and slow.
What local RAG is genuinely good at
Personal collections are the sweet spot. A few hundred pages of notes, a shelf of manuals, a folder of contracts, a research library, a set of lecture notes. These are collections one person owns, reads and revisits, and the questions are specific: "What does section 4 say about refunds?", "Which of my notes mention this drug's side effects?", "Summarise the maintenance schedule from this manual."
It is also good at material that can never be uploaded: anything under a non-disclosure agreement, anything medical or legal, anything a company policy forbids sending to a third-party service. For those documents, local RAG is not merely the private option — it is often the only option that complies with the rules.
And it is good at repeated use. Once a collection is indexed, asking the tenth question costs no more than the first. The index is built once, stored on the device, and reused for every query. That makes local RAG a natural fit for apps people return to daily, like a study companion, a field manual, or a personal knowledge base.
Where the limits are
Honesty requires naming what local RAG does not do well.
Scale. A phone is not a data centre. A personal collection of thousands of chunks is fine; a corpus of millions of documents is not. Retrieval slows down, the index grows, and the model cannot read enough of the corpus to answer broad questions. If the collection needs to be shared across a team, updated constantly by many people, or searched by dozens of users at once, a server-side system is the right tool.
Freshness. An on-device index is a snapshot. If the source documents change, the index has to be rebuilt or updated on the device, and that costs time and battery. For documents that change hourly, local RAG will always lag. For documents that change weekly or monthly, a background re-index is a solved problem.
Model capability. A small on-device model is not as capable as the largest cloud models. It can summarise, extract, compare and answer grounded questions very well — but it will struggle with the hardest reasoning tasks, and it is more likely to misread a retrieved passage than a frontier model would. The mitigation is to keep the task grounded: short answers, direct quotes from the retrieved text, and a clear display of the source passages so the user can check the answer themselves. Showing sources is not a nice extra in local RAG; it is the feature that makes the answers trustworthy.
The model still matters. RAG does not turn a weak model into a strong one. It gives a good model better material. Choosing the right on-device model — one with a context window big enough for the retrieved passages, and enough capability to follow instructions about using them — is as important as the retrieval itself.
How to tell if an app's "chat with documents" is really local
If privacy is the reason you want local RAG, verify the claim before trusting it with sensitive files. A genuinely local implementation has tells:
- It works in airplane mode. Turn the network off and ask a question about a document. If it answers, the retrieval and generation are on the device.
- It does not ask you to upload anything. An upload step, a "syncing your documents" spinner, or an account requirement are all signs that a server is involved.
- It processes documents on the device, and the first indexing run takes a visible amount of time and battery. Instant indexing of a large library usually means the work happened somewhere else.
These checks take a minute, and they are worth doing before handing an app your most sensitive files. "Zero data sent" is a claim about architecture, and architecture can be tested.
Building it: a practical order of work
For a team shipping local RAG for the first time, the order that works is to start with retrieval quality, not model quality. A mediocre model with excellent retrieval beats an excellent model with poor retrieval, because the model can only answer from what it is given. Get chunking and ranking right on real documents first, with a simple test set of questions and expected passages, and only then tune the model and the prompt.
Then set the defaults conservatively: retrieve a small number of passages, show them to the user, keep answers short and sourced. Users trust a RAG feature that shows its work and says "I could not find that in your documents" over one that always produces a fluent answer, even when the documents say nothing.
The bottom line
Local RAG takes the most useful pattern in applied AI — grounding answers in your own documents — and removes the server from it. The documents stay on the device, the search happens on the device, and the answers are generated on the device. The trade-offs are real: smaller collections, snapshot freshness, and smaller models than the cloud offers. But for personal collections and sensitive material, those trade-offs buy something a cloud service cannot offer at any price: a chat-with-documents feature where the documents physically cannot leave your phone.
LLM Hub Studio builds on-device AI apps, including apps that run models entirely on the phone with no accounts and no tracking. If you are building an app that needs to work with private documents, or you want an AI feature that works with no signal, that is the kind of problem we work on. You can reach the studio at timmy@llmhub.com.au.
Questions
What is RAG, and why would you run it on a phone?
Retrieval-augmented generation, or RAG, means giving a language model access to your own documents before it answers: the app searches your files for the most relevant passages and includes them in the prompt, so answers are grounded in your material instead of the model's training data. Running it on a phone means the documents, the search index and the model all stay on the device, so private files never travel to a server and the feature works with no signal.
Do I need an internet connection to chat with my documents locally?
No. Once the app and its models are on the phone, local RAG works entirely offline: document processing, embedding, retrieval and generation all happen on the device. That is the whole point of the pattern — your notes, manuals and contracts are searchable and answerable on a plane, in a basement, or anywhere else with no signal.
What kinds of documents work with local RAG?
Plain text, PDFs, markdown notes, manuals, contracts, meeting notes, research papers and anything else that can be turned into text. The practical limit is not the format but the size and quality of the text: clean, well-structured documents retrieve far better than scanned images with no text layer, and a focused collection of a few hundred pages usually outperforms a giant pile of unrelated files.
How much storage does a local RAG index use on a phone?
It depends on how much text you index and which embedding model you use, but a rough rule of thumb is that the vector index is a modest multiple of the size of the text itself. A few hundred pages of documents typically produce an index of tens of megabytes, which is small next to the model files themselves. The model is the heavy part of the download; the index is comparatively light.
Is local RAG more private than uploading documents to a cloud AI service?
Yes, in the sense that matters most: with local RAG your documents never leave the device, so there is no upload, no server copy, no third-party retention policy and no network traffic to intercept. A cloud service can promise the same in its privacy policy, but a promise is not the same as an architecture where the data physically cannot leave the phone.
When is local RAG the wrong choice?
When the document collection is enormous, changes constantly, or needs to be shared and searched by a whole team at once, a server-side system is usually the better fit. Local RAG shines for personal collections, single-device use and sensitive material; it is not a replacement for a shared enterprise knowledge base that dozens of people query at the same time.
LLM Hub 

