- Home
- AI PC & Hardware
- Chat With Your Documents Locally: RAG With Ollama
Chat With Your Documents Locally: RAG With Ollama
Yes, you can point a local AI at a folder of your own PDFs, notes and manuals and ask it questions, entirely on your own computer. The trick is called retrieval-augmented generation, RAG for short, and the simplest route today is Ollama for the models plus Open WebUI for the interface. It works well for “what does clause 7 of this lease say” and “where did I note the router password”; it works badly for “summarize my whole archive”, and understanding why saves hours of frustration.
If you have not set up the basics yet, start with our guide to running AI locally on your PC and the walkthrough for Open WebUI with Ollama, because we build on both here.
What RAG actually does (and why it is not “training”)
A common misunderstanding is that the AI “reads” your documents and learns them. It does not. A language model can only see what is in the prompt in front of it, and that prompt has a limited size. Your 300-page manual will not fit, so RAG works around it in three steps.
First, your files are cut into chunks, typically a few hundred words each. Second, an embedding model turns every chunk into a list of numbers that captures its meaning, and those are stored in a small database. Third, when you ask a question, your question is converted the same way, the database returns the chunks whose numbers sit closest to it, and only those chunks are pasted into the prompt next to your question. The chat model then answers from that handful of passages.
Once you see it this way, most failures explain themselves. If the right paragraph never gets retrieved, the model cannot answer, however clever it is. If it answers with confidence from the wrong paragraph, you get exactly the behaviour we describe in our piece on why chatbots make things up.
The setup, in plain terms
You need two models, not one. The chat model writes the answer; the embedding model does the searching. In Ollama that is two downloads. An 8B instruction model is a sensible chat model for a machine with 16 GB of RAM or a graphics card with 8 GB of VRAM, and nomic-embed-text is a small, popular embedding model that is only a few hundred megabytes. Multilingual embedding models such as bge-m3 exist too, and they are worth the extra size if your documents are in Italian, Spanish or a mix of languages, because an English-focused embedder retrieves noticeably worse on other languages.
In Open WebUI, create a Knowledge collection, drag your files in, and in the document settings choose your embedding model from Ollama instead of the default built-in one. Then start a chat, attach the collection, and ask. That is genuinely the whole workflow; the rest of this article is about making it work well. The menu names shift between versions, so lean on the current documentation if ours differ.
Three settings that decide whether it works
Chunk size and overlap. Small chunks, say 300 to 500 tokens, retrieve precise facts but lose context. Large ones keep context but dilute the match. For manuals, contracts and notes, a few hundred tokens with a modest overlap is a good starting point. If your answers are accurate but oddly incomplete, try bigger chunks; if they drift off-topic, go smaller.
How many chunks to retrieve. Pulling three to five chunks suits a small model. Pulling twenty sounds generous, but it floods the prompt, and smaller models tend to lose the thread in the middle of long contexts. More is not better.
The context window. This is the one that catches people out. Ollama runs models with a limited context window by default, and if the retrieved text is longer than that window, the beginning of your prompt, which can include the very passages you retrieved, is silently cut. If answers ignore documents you know were found, raise the context length in the model settings, and remember it costs extra memory.
| Symptom | Likely cause | Fix |
|---|---|---|
| “I can’t find that” for something in the file | PDF is a scan, or wrong chunks retrieved | OCR first; rephrase using the document’s own words |
| Right topic, missing detail | Chunks too small | Increase chunk size and overlap |
| Answer mixes two documents | Too many chunks retrieved | Retrieve fewer; split collections by topic |
| Ignores the retrieved text | Context window too small | Raise context length |
| Weak results in Italian or Spanish | English-only embedder | Switch to a multilingual embedding model |
What it is good at, and where we would not bother
RAG shines at lookup. Ask a precise question whose answer lives in one or two paragraphs and you will usually get it, with a pointer to the source passage you can verify. Typical wins: a household folder of appliance manuals and warranty papers, years of meeting notes, a student’s lecture PDFs, a freelancer’s contracts.
It is poor at anything global. “What are the main themes across these 80 reports?” needs the model to see everything at once, and retrieval by definition shows it only fragments. Tables are another weak spot, since chunking tends to slice a table into pieces that make no sense alone. And if you have ten files, honestly, you may be better off pasting the relevant one into a long-context chat and skipping the machinery.
These bars are our editorial rule of thumb from how the method works, not benchmark results.
Hardware: what you really need
Retrieval itself is cheap. The embedding step is a one-off cost per file and a modest machine handles it, just slowly on CPU if you add hundreds of documents at once. The thing that scales your experience is the chat model, so the usual rules apply: 16 GB of RAM is a floor, and a GPU with 8 GB or more of VRAM makes answers arrive quickly. Our guide to how much VRAM local models need covers the sizing, and if you are starting from scratch, a desktop built for local AI saves guesswork. Indexing a large library also needs disk space for the vector database, so keep an eye on your SSD capacity.
If you are shopping for storage, a fast NVMe drive helps indexing and model loading alike; you can browse NVMe SSDs on Amazon.
A sensible first test
Do not start with your whole archive. Pick one document you know intimately, ten pages of something you wrote or a manual you have struggled with, and ask five questions whose answers you already know, including one that is not in the document at all. A healthy setup answers the first four correctly and admits it does not know the fifth. If it invents an answer to the fifth, tighten your prompt with an instruction to answer only from the provided passages and say so otherwise. Once that behaviour is reliable, scale up.
The honest bottom line: local RAG is a genuinely useful private search assistant for specific questions, and a disappointing “second brain” if you expect it to understand your archive. If you are curious about the cloud trade-off, our comparison of local AI versus cloud AI lays it out. Start small, tune chunks before you buy hardware, and let the source citations keep the model honest.