12
Scale and advanced RAG
Scaling up, choosing an architecture, agents and graphs.

Concept 12.1
Scaling, multi tenancy and enterprise architecture
What actually changes from 34 chunks to millions: exact search time grows linearly (30 ms at 100,000 vectors on a laptop), memory grows to gigabytes, and isolation between customers becomes the hard part.

Concept 12.2
Choosing an architecture: naive, advanced, agentic, graph
Four families of RAG design, from one vector search to agents and knowledge graphs. Start simple, measure, and climb only when a measured failure needs it. On our corpus, two simple steps did most of the work.

Concept 12.3
Agentic RAG and RAG as an MCP tool
Instead of one fixed search, a model decides what to look up, reads, and searches again. Exposing retrieval as an MCP tool lets any agent use it. When the loop helps, what it costs, and how to keep it safe.

Concept 12.4
GraphRAG, structured data and multimodal RAG
Not all knowledge is plain text. Relationships across documents, exact data in tables and databases, and images each need their own structure. When to use a graph, when to query data directly, and when chunks are enough.
Chapter 12 recap