RAG Architecture Whiteboard

Private knowledge becomes cited answers through two flows

The indexing flow prepares searchable knowledge before users ask questions. The runtime flow retrieves evidence for each query, builds a grounded prompt, and returns an answer with citations.

Indexing Flow Runtime Flow Evaluation Loop
Sources
Chunks
Vectors
Vector DB
Context
Cited Answer

Production Architecture

How a real RAG system is wired

Source metadata travels end-to-end for filtering, permissions, and citations.
Indexing flow
PDFDOCXWebsiteDatabaseCode Repo
Loaders
extract text + metadata
Clean + Chunk
recursive / semantic / code-aware
Embeddings
vectors + dimensions
Vector DB
ChromaDB / FAISS / Qdrant
Runtime flow
User asks
"Can I submit late?"
Query Embedding
Hybrid Search
vector + keyword
Filter + Rerank
permission, page, score
Prompt Builder
context + citations
LLM Answer
with sources
Visual 1. Chunking Choices
Policy.pdf
Chunk A Chunk B: late submission penalty Chunk C
FixedRecursiveSemanticCode-aware
Visual 2. Vector Search
Q

Chunks near the query vector are semantically similar, even when wording is different.

Visual 3. Retrieval Ranking
Policy.pdf p.496%
FAQ.md78%
Syllabus.pdf p.261%

Reranking chooses the evidence most likely to answer the actual question.

User Query Can I submit an assignment two days late?
Retrieved Chunks
  1. Policy.pdf p.4 Late submissions lose 10% per day for up to three days.
  2. Syllabus.pdf p.2 Assignments are due by 11:59 PM on the due date.
  3. FAQ.md Extensions require faculty approval before the deadline.
Grounded Answer

Yes, but the assignment will lose 20% because the policy states a 10% penalty per day for up to three days. If you need an exception, request faculty approval before the deadline.

Policy.pdf p.4FAQ.md

Evaluation Loop

Production RAG is measured, not guessed

Debug retrieval first, then generation. If the right context is missing, the model cannot answer faithfully.

Retrieval Precision82%
Context Relevance76%
Answer Faithfulness91%
Hallucination Risk18%
Retrieval Recall@KDid we retrieve the needed source?

If the correct policy is not in the top chunks, generation cannot be reliable.

GroundednessIs every claim supported?

Claims should map back to retrieved chunks and citations.

Citation QualityAre sources correct?

Wrong page or source citations are a serious RAG failure.

FreshnessIs the index current?

Outdated embeddings can retrieve old rules after documents change.