RAG
RAG (Retrieval-Augmented Generation) answers questions by first retrieving relevant chunks from your documents, then generating an answer conditioned on them.
The pipeline:
- Chunk documents into overlapping pieces.
- Embed each chunk into a vector.
- Store vectors in a vector database.
- Retrieve the top-k chunks for a question.
- Generate an answer with the LLM, citing the chunks.
Why it exists: models cannot know your private data, and training/fine-tuning on it is expensive and slow. RAG gives up-to-date, private, citable grounding with a cheap, local stack.
Common failure modes: bad chunking, weak embeddings, or a model that ignores the context. Start with a minimal stack and evaluate on real questions.