Local RAG

A fully local RAG (Retrieval-Augmented Generation) pipeline does the embedding, the indexing, and the generation on hardware you control. No data leaves your machines. Useful for privacy-sensitive workloads, on-prem deployments, edge / offline scenarios, or just learning the mechanics without API bills.

In 2026, this is a practical option. The quality is competitive (not frontier) and the operational footprint is manageable.

What "local" buys you

What it doesn't buy:

The minimum stack

Three components:

  1. Embedding model — locally hosted; embeds queries and document chunks.
  2. Vector store — local index of chunk embeddings.
  3. LLM — locally hosted; generates the answer from retrieved chunks.

Plus retrieval orchestration (the glue), chunking pipeline, optional reranker.

Component choices

Embedding model

Options (all local-friendly):

For most use cases: BGE-base or BGE-large is the safe default. Run via sentence-transformers library. CPU-friendly.

Vector store

For most local deployments: pgvector or Qdrant.

LLM

See OpenSourceLLMs for the full landscape. For RAG specifically:

Options:

For laptop deployment: 7B at int4 quantisation. For workstation: 13B-30B. For dedicated GPU: anything up to 70B int4 fits on an H100.

Reranker

Hardware sizing

Laptop (16-32 GB RAM, modest GPU or none)

Suitable for: personal knowledge base; offline assistant; experimentation.

Workstation (64 GB RAM, RTX 4090 or equivalent)

Suitable for: small team's internal RAG; production for low-volume use.

Dedicated server (A100/H100, 128+ GB system RAM)

Suitable for: production workloads, hundreds of users.

A concrete recipe

For a "chat with your documents" application:

1. Ingestion
   - Parse documents (text, PDF, HTML)
   - Chunk: 256-512 tokens with 10-20% overlap, on semantic boundaries
   - Embed each chunk via BGE-large
   - Insert into pgvector with metadata (document_id, page, etc.)

2. Indexing
   - HNSW index on embedding column
   - Optional: tsvector for BM25
   - GIN index on metadata for filters

3. Retrieval
   - Query → embed via BGE-large
   - Top-50 by cosine
   - Optional: BM25 top-50; RRF combine
   - Optional: rerank top-50 → top-10 via BGE-reranker
   - Select top 5-10 chunks to feed LLM

4. Generation
   - System prompt + retrieved chunks + user query
   - LLM (Qwen 2.5 14B or similar) at int4 via vLLM
   - Stream response

5. Citation
   - Track which chunks were retrieved
   - LLM cites by source label
   - UI shows expandable citations

This is the standard pattern. A weekend's work to a functional prototype; weeks to a polished product.

Where local RAG falls short

For most internal-knowledge / customer-support / document-search use cases, local RAG is competitive. For a frontier-quality consumer assistant, commercial models still win.

Failure modes specific to local

Pragmatic configuration

For a team starting in 2026:

embedder: BAAI/bge-large-en-v1.5
embed_dim: 1024
chunk_size: 384 tokens
chunk_overlap: 64 tokens
vector_store: pgvector with HNSW (m=16, ef_construction=200)
hybrid: true (BM25 via paradedb or tsvector + RRF)
reranker: BAAI/bge-reranker-large (top-50 → top-10)
llm: Qwen2.5-14B-Instruct at int4 via vLLM
serving: vLLM on a single H100; or llama.cpp on Apple M-series workstation
context: top 5 chunks + system prompt + query, ~3-4k tokens

This stack runs comfortably on a single workstation; serves a small team.

Further reading