Design Patternsintermediate15 min · 10 steps
AI Design Patterns
A catalog of reusable patterns for RAG, agents, optimization, reliability and cost: what each looks like, and when it earns its complexity.
requestdatatool callsignalresponseheavy workerror
How it worksStep 1 of 10
RAG: start naive, graduate to advanced
Naive RAG: embed the query, search vectors, stuff the top-k into the prompt, generate. Good for MVPs and simple Q&A, but it has no reranking or query rewriting and can retrieve irrelevant chunks.
Advanced RAG adds stages: rewrite the query, run hybrid search (50 vector + 50 BM25 results), fuse with reciprocal rank fusion, rerank the top 20, and generate from the best 5. The guide's rule of thumb: reranking costs 100–200 ms and buys a 10–15% precision gain, which is worth it in production.
What changed
- +Naive pipeline
- +Advanced pipeline with rewrite, hybrid search and rerank
Lesson 1 of 2 in Design Patterns