Blogs
Builder

Local RAG

GitHub
completed · September 2026

Main Aim

Build a RAG system that answers from a dedicated knowledge base. The point is not another chatbot. It is to understand why retrieval still matters when models already offer very large context windows.

A wide window does not replace retrieval. Real systems still hold large, changing, private, and domain-specific knowledge. Pulling only the relevant pieces can improve accuracy, cost, freshness, security, and grounding. This project is how I learn that in practice.

Built following the Build Your Own ChatGPT RAG series by Coding Adda (docs). Special thanks to Aditya Trivedi for the help along the way.

LocalRAG logical overview: build the brain, then ask a question

Retrieval-augmented generation (RAG) has two moves: build the brain, then ask a question. The goal is not another generic chatbot. It is a system that answers from a dedicated knowledge base: notes, docs, and domain text that the model was never trained on.

A wide context window does not replace retrieval. Real systems still hold large, changing, private, and domain-specific knowledge. Pulling only the relevant pieces can improve accuracy, cost, freshness, security, and grounding. LocalRAG is how that idea is learned in practice.

Embeddings

Each chunk is turned into a vector that captures semantic meaning. Similar ideas land near each other in that space, even when the wording differs, which is what makes “find passages about X” work without exact keyword matches.

Chunking

Long markdown is split into overlapping passages so each piece is small enough to embed and retrieve without drowning the model in noise. Chunks keep enough surrounding context to stay meaningful on their own.

Retrieval

At question time the system searches the store for the most relevant chunks. LocalRAG blends semantic (vector) and lexical (keyword) signals so both paraphrase and precise terms can surface the right evidence.

Grounding

Retrieved passages are handed to the model as trusted context. The answer is expected to stay faithful to that material, not invent facts outside the knowledge base, and citations can point back to the source files.

Conversation history

Sessions persist so follow-ups stay coherent. Prior turns shape how new questions are interpreted without re-sending the entire knowledge base every time.