Guides · 5 min read

Chat with your own documents (local RAG)

How retrieval works, which models do the embedding, the settings that matter, and the apps that do it for you.

A model only knows what it was trained on, plus whatever fits in its context. To ask questions about your own files, you do not retrain anything. You use retrieval-augmented generation (RAG): find the passages that matter, then give them to the model with your question.

How it works

  1. Split your documents into chunks of a few paragraphs.
  2. Embed each chunk: an embedding model turns its meaning into a list of numbers.
  3. Store those vectors in a small database.
  4. Retrieve: embed your question the same way and pull the chunks whose vectors are closest.
  5. Generate: the chat model reads those chunks and your question, and answers from them.

Two models are involved. A small embedding model (a few hundred megabytes) handles steps 2 and 4, and your chat model handles step 5. Embeddings are specific to a model: if you switch embedding models you must re-embed everything.

Apps that do it for you

AnythingLLM is a desktop app with separate workspaces and visible sources. Open WebUI adds document chat to Ollama or any local API. Khoj searches your notes. For your own pipelines, embedding servers such as Text Embeddings Inference and libraries such as Sentence Transformers run the embedding model.

Settings and mistakes that matter

Models tagged RAG are the ones that stick closest to the supplied text. Your documents stay on your computer throughout (privacy).

Estimates come from published hardware specs and our open formulas, not from running the model on your machine. Real speed varies with runtime, drivers and settings. Numbers marked “Measured” come from a linked benchmark.