PageSourceSearch

https://myengineeringpath.dev/genai-engineer/rag/

html myengineeringpath.dev collected 2026-10-07 04:10:19 UTC 271,436 bytes, 622 lines download raw bytes

1<!DOCTYPE html><html lang="en" dir="ltr" data-theme="dark" data-has-toc data-has-sidebar class="astro-bguv2lll"> <head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>RAG Architecture Diagram — Production RAG Systems | MyEngineeringPath</title><link rel="canonical" href="https://myengineeringpath.dev/genai-engineer/rag/"/><link rel="sitemap" href="/sitemap-index.xml"/>
1<script>document.documentElement.setAttribute('data-theme','dark');</script>
1<link rel="preload" href="/fonts/inter-var-latin.woff2" as="font" type="font/woff2" crossorigin="true"/><link rel="preload" href="/fonts/jetbrains-mono-var-latin.woff2" as="font" type="font/woff2" crossorigin="true"/><link rel="icon" type="image/svg+xml" href="/logo.svg"/><link rel="icon" type="image/png" sizes="48x48" href="/favicon-48.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16.png"/><link rel="apple-touch-icon" href="/apple-touch-icon.png"/><link rel="preconnect" href="https://assets.lemonsqueezy.com" crossorigin="true"/><link rel="preconnect" href="https://app.lemonsqueezy.com" crossorigin="true"/><link rel="dns-prefetch" href="https://assets.lemonsqueezy.com"/><link rel="dns-prefetch" href="https://app.lemonsqueezy.com"/>
1<script src="https://assets.lemonsqueezy.com/lemon.js" defer></script>
1<script>(function(){var r=false;function t(){var p=window.location.pathname;if(p.indexOf("/study-tracker")===0)return"/study-tracker/thank-you/";if(p.indexOf("/bundle")===0)return"/bundle/thank-you/";return"/interview-guide/thank-you/"}function h(){if(r)return;r=true;try{window.LemonSqueezy&&window.LemonSqueezy.Url.Close()}catch(e){}window.location.href=t()}function i(){if(typeof window.createLemonSqueezy==="function")window.createLemonSqueezy();if(window.LemonSqueezy&&window.LemonSqueezy.Setup){window.LemonSqueezy.Setup({eventHandler:function(e){if(e.event==="Checkout.Success")h()}})}else{setTimeout(i,250)}}if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",i)}else{i()}window.addEventListener("message",function(e){if(typeof e.data==="string"){try{var d=JSON.parse(e.data);if(d.event==="Checkout.Success")h()}catch(x){}}else if(e.data&&e.data.event==="Checkout.Success"){h()}})})();</script>
1<script>document.addEventListener("click",function(e){var btn=e.target.closest(".lemonsqueezy-button");if(!btn)return;if(window.LemonSqueezy&&window.LemonSqueezy.Url)return;var href=btn.getAttribute("href");if(!href||href==="#")return;e.preventDefault();var tries=0;var iv=setInterval(function(){if(window.LemonSqueezy&&window.LemonSqueezy.Url){clearInterval(iv);window.LemonSqueezy.Url.Open(href)}else if(++tries>=50){clearInterval(iv);window.location.href=href}},100)});</script>
1<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"MyEngineeringPath","url":"https://myengineeringpath.dev","logo":{"@type":"ImageObject","url":"https://myengineeringpath.dev/logo.webp"},"description":"Free GenAI Engineer career guide — roadmap, interview questions, salary, and tools. Written by senior engineers.","sameAs":["https://github.com/mohitsaxenacs/","https://linkedin.com/in/mohitsaxena21"]}</script>
1<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"https://myengineeringpath.dev","name":"MyEngineeringPath","description":"Free GenAI Engineer career guide — roadmap, interview questions, salary, and tools."}</script>
1<script>
2						document.addEventListener('DOMContentLoaded', () => {
3							const bar = document.createElement('div');
4							bar.id = 'reading-progress';
5							bar.setAttribute('aria-hidden', 'true');
6							document.body.prepend(bar);
7							const update = () => {
8								const total = document.documentElement.scrollHeight - window.innerHeight;
9								bar.style.width = total > 0 ? Math.min((window.scrollY / total) * 100, 100) + '%' : '0%';
10							};
11							window.addEventListener('scroll', update, { passive: true });
12						});
13					</script>
13<script>
14					(function(){
15						var btn;
16						function init(){
17							btn=document.createElement('button');
18							btn.id='scroll-to-top';
19							btn.setAttribute('aria-label','Scroll to top');
20							btn.innerHTML='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"/></svg>';
21							document.body.appendChild(btn);
22							btn.addEventListener('click',function(){window.scrollTo({top:0,behavior:'smooth'})});
23							window.addEventListener('scroll',toggle,{passive:true});
24						}
25						function toggle(){
26							if(!btn)return;
27							btn.classList.toggle('visible',window.scrollY>500);
28						}
29						if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init)}else{init()}
30					})();
31				</script>
31<script>(function(c,l,a,r,i,t,y){c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y)})(window,document,"clarity","script","voa7qt15yb");</script>
31<script>
32									(function(){
33										var id='G-X2NYFJ1V0C';
34										window.addEventListener('load',function(){
35											setTimeout(function(){
36												var s=document.createElement('script');
37												s.src='https://www.googletagmanager.com/gtag/js?id='+id;
38												s.async=true;
39												document.head.appendChild(s);
40												s.onload=function(){
41													window.dataLayer=window.dataLayer||[];
42													function gtag(){dataLayer.push(arguments);}
43													window.gtag=gtag;
44													gtag('js',new Date());
45													var p=window.location.pathname;
46													var cg=p.indexOf('/genai-engineer')===0?'GenAI Engineer':p.indexOf('/tools/')===0?'Tools':p.indexOf('/programming/')===0?'Programming':/^\/(interview-guide|study-tracker|bundle|agent-builder-kit|franchise-kit|interview-simulator|langgraph-cookbook|mcp-masterclass|rag-course)/.test(p)?'Products':'Other';
47													gtag('config',id,{anonymize_ip:true,content_group:cg});
48												};
49											},100);
50										});
51									})();
52								</script>
52<script>(function(){if(window.location.hostname!=="myengineeringpath.dev")return;function ga4(e,p){if(typeof gtag==="function")gtag("event",e,p)}window.addEventListener("newsletter:subscribed",function(e){ga4("newsletter_signup",{source:(e.detail&&e.detail.source)||"unknown",page_path:window.location.pathname})});document.addEventListener("click",function(e){var btn=e.target.closest(".lemonsqueezy-button");if(btn){var burl=btn.getAttribute("href")||"";var product=burl.indexOf("study-tracker")>-1?"study-tracker":burl.indexOf("bundle")>-1?"bundle":"interview-guide";ga4("cta_click",{product:product,button_text:(btn.textContent||"").trim().substring(0,100),button_url:burl,page_path:window.location.pathname});return}var link=e.target.closest('a[href^="http"]');if(link){var href=link.getAttribute("href")||"";if(href.indexOf("myengineeringpath.dev")===-1){ga4("outbound_link_click",{link_url:href.substring(0,500),link_text:(link.textContent||"").trim().substring(0,100),page_path:window.location.pathname})}}});var milestones=[25,50,75,90];var fired={};function setupScrollDepth(){var sentinels=[];milestones.forEach(function(pct){var el=document.createElement("div");el.setAttribute("aria-hidden","true");el.style.cssText="position:absolute;left:0;width:1px;height:1px;pointer-events:none;";el.dataset.scrollDepth=String(pct);document.body.appendChild(el);sentinels.push(el)});function positionSentinels(){var dh=document.documentElement.scrollHeight;sentinels.forEach(function(el){var p=parseInt(el.dataset.scrollDepth,10);el.style.top=Math.round((p/100)*dh)+"px"})}positionSentinels();var observer=new IntersectionObserver(function(entries){entries.forEach(function(entry){if(!entry.isIntersecting)return;var p=entry.target.dataset.scrollDepth;if(fired[p])return;fired[p]=true;ga4("scroll_depth",{depth_threshold:parseInt(p,10),page_path:window.location.pathname})})},{threshold:0});sentinels.forEach(function(el){observer.observe(el)});var lastH=document.documentElement.scrollHeight;var rc=setInterval(function(){var h=document.documentElement.scrollHeight;if(h!==lastH){lastH=h;positionSentinels()}},3000);window.addEventListener("pagehide",function(){clearInterval(rc);observer.disconnect()})}if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",setupScrollDepth)}else{setupScrollDepth()}})();</script>
52<script type="application/ld+json">{"@context":"https://schema.org","@type":"Article","headline":"RAG Architecture Diagram \u2014 Production RAG Systems","description":"Build production RAG systems with architecture diagrams: chunking, hybrid search, reranking, RAGAS evaluation, and failure modes.","image":"https://myengineeringpath.dev/og/genai-engineer/rag.png","author":{"@type":"Person","name":"Mohit Saxena","url":"https://linkedin.com/in/mohitsaxena21","sameAs":["https://linkedin.com/in/mohitsaxena21","https://github.com/mohitsaxenacs"],"jobTitle":"Senior Software Engineer","knowsAbout":["Generative AI","Large Language Models","RAG","AI Agents","Prompt Engineering","System Design"]},"publisher":{"@type":"Organization","name":"MyEngineeringPath","logo":{"@type":"ImageObject","url":"https://myengineeringpath.dev/logo.webp"}},"dateModified":"2026-03-20","mainEntityOfPage":{"@type":"WebPage","@id":"https://myengineeringpath.dev/genai-engineer/rag/"}}
53</script>
53<script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://myengineeringpath.dev/"},{"@type":"ListItem","position":2,"name":"GenAI Engineer","item":"https://myengineeringpath.dev/genai-engineer/"},{"@type":"ListItem","position":3,"name":"RAG Architecture Diagram \u2014 Production RAG Systems","item":"https://myengineeringpath.dev/genai-engineer/rag/"}]}
54</script>
54<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is RAG (Retrieval-Augmented Generation)?","acceptedAnswer":{"@type":"Answer","text":"RAG is an architecture pattern where relevant documents are retrieved from a knowledge base at query time and injected into the LLM prompt before generating a response. It solves the knowledge currency problem — LLMs have a training cutoff and cannot access private data — without requiring expensive model retraining. RAG provides grounding, meaning the LLM's answer is traceable back to specific source documents."}},{"@type":"Question","name":"What is the best chunking strategy for RAG?","acceptedAnswer":{"@type":"Answer","text":"Start with semantic chunking (split on paragraph boundaries, max 512 tokens) for most use cases. Move to hierarchical chunking (small child chunks for precise retrieval, large parent chunks for rich LLM context) when retrieval precision matters. Use agentic chunking only for high-value corpora where the cost of one LLM call per document during indexing is justified. Fixed-size chunking works for quick prototypes but splits context arbitrarily."}},{"@type":"Question","name":"How does hybrid search improve RAG quality?","acceptedA
54nswer":{"@type":"Answer","text":"Hybrid search combines vector similarity search (semantic meaning) with traditional keyword search (BM25 for exact term matching). Vector search handles semantic meaning while keyword search handles technical terms, product names, and IDs. Results are merged using reciprocal rank fusion. Hybrid search outperforms pure vector search in most production RAG systems because it covers both semantic understanding and precise keyword matching."}},{"@type":"Question","name":"What are common RAG failure modes in production?","acceptedAnswer":{"@type":"Answer","text":"Common production RAG failures include poor retrieval recall (the right document exists but is not retrieved due to query-document language mismatch), poor context precision (retrieval returns noise that confuses the LLM), multi-hop question failures (questions requiring cross-document comparison), heterogeneous document quality, and latency at scale. Most RAG engineering is about fixing these production failures systematically."}},{"@type":"Question","name":"How do you evaluate a RAG system?","acceptedA
54nswer":{"@type":"Answer","text":"RAG systems are evaluated using the RAGAS framework which measures four key metrics: context precision (are retrieved chunks relevant?), context recall (are all relevant chunks retrieved?), faithfulness (does the answer stay grounded in the retrieved context?), and answer relevancy (does the answer address the original question?). These metrics can be computed automatically using LLM-as-judge evaluation."}},{"@type":"Question","name":"When should you use RAG vs fine-tuning?","acceptedAnswer":{"@type":"Answer","text":"Use RAG when you need to query private or frequently updated knowledge bases, when you need source citations for grounding, or when the information changes too often for retraining. Use fine-tuning when you need to change the model's behavior, tone, or output format rather than adding new knowledge. RAG adds external knowledge at query time without retraining, while fine-tuning bakes knowledge and behavior into model weights."}},{"@type":"Question","name":"What are the components of a RAG pipeline?","acceptedA
54nswer":{"@type":"Answer","text":"A RAG pipeline has two main parts: an offline indexing pipeline and an online retrieval pipeline. The indexing pipeline loads documents, chunks them into retrievable units, embeds chunks into vectors, and stores them in a vector database. The retrieval pipeline embeds the user query, performs vector search (optionally with hybrid BM25), reranks results, assembles the prompt with retrieved context, and generates an LLM response."}},{"@type":"Question","name":"What is the difference between naive RAG and advanced RAG?","acceptedAnswer":{"@type":"Answer","text":"Naive RAG uses fixed-size chunking, single-vector search, and stuffs top-k results into the prompt without reranking. Advanced RAG uses semantic or hierarchical chunking, hybrid search combining BM25 and vector retrieval, cross-encoder reranking for precise relevance ordering, and context compression to reduce noise. Advanced RAG also adds RAGAS evaluation pipelines for continuous quality measurement."}},{"@type":"Question","name":"Can RAG work with long context models?","acceptedA
54nswer":{"@type":"Answer","text":"Yes, but RAG and long context windows solve different problems. Long context models can process entire documents but costs scale linearly with token count and LLMs underweight information in the middle of long contexts (the lost-in-the-middle problem). RAG narrows the corpus to only the most relevant chunks, keeping costs bounded and placing high-relevance content where the LLM attends to it best. Many production systems combine both approaches."}},{"@type":"Question","name":"How do you handle large documents in RAG?","acceptedAnswer":{"@type":"Answer","text":"Large documents require a chunking strategy that preserves context boundaries. Hierarchical chunking works best: create small child chunks (256 tokens) for precise retrieval and link them to larger parent chunks (1024 tokens) for rich LLM context. For dynamic corpora where documents change frequently, use incremental indexing with document-level versioning rather than full re-indexing, detecting changes via hash comparison or last-modified timestamps."}}]}
55</script>
55<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/><meta name="generator" content="Astro v5.17.1"/><meta name="generator" content="Starlight v0.37.6"/><meta property="og:title" content="RAG Architecture Diagram — Production RAG Systems"/><meta property="og:type" content="article"/><meta property="og:url" content="https://myengineeringpath.dev/genai-engineer/rag/"/><meta property="og:locale" content="en"/><meta property="og:description" content="Build production RAG systems with architecture diagrams: chunking, hybrid search, reranking, RAGAS evaluation, and failure modes."/><meta property="og:site_name" content="MyEngineeringPath"/><meta name="description" content="Build production RAG systems with architecture diagrams: chunking, hybrid search, reranking, RAGAS evaluation, and failure modes."/><meta property="og:image" content="https://myengineeringpath.dev/og/genai-engineer/rag.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:image" content="https://myengineeringpath.dev/og/genai-engineer/rag.png"/>
55<script>
56	window.StarlightThemeProvider = (() => {
57		const storedTheme =
58			typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');
59		const theme =
60			storedTheme ||
61			(window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
62		document.documentElement.dataset.theme = theme === 'light' ? 'light' : 'dark';
63		return {
64			updatePickers(theme = storedTheme || 'auto') {
65				document.querySelectorAll('starlight-theme-select').forEach((picker) => {
66					const select = picker.querySelector('select');
67					if (select) select.value = theme;
68					/** @type {HTMLTemplateElement | null} */
69					const tmpl = document.querySelector(`#theme-icons`);
70					const newIcon = tmpl && tmpl.content.querySelector('.' + theme);
71					if (newIcon) {
72						const oldIcon = picker.querySelector('svg.label-icon');
73						if (oldIcon) {
74							oldIcon.replaceChildren(...newIcon.cloneNode(true).childNodes);
75						}
76					}
77				});
78			},
79		};
80	})();
81</script>
81<template id="theme-icons"><svg aria-hidden="true" class="light astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M5 12a1 1 0 0 0-1-1H3a1 1 0 0 0 0 2h1a1 1 0 0 0 1-1Zm.64 5-.71.71a1 1 0 0 0 0 1.41 1 1 0 0 0 1.41 0l.71-.71A1 1 0 0 0 5.64 17ZM12 5a1 1 0 0 0 1-1V3a1 1 0 0 0-2 0v1a1 1 0 0 0 1 1Zm5.66 2.34a1 1 0 0 0 .7-.29l.71-.71a1 1 0 1 0-1.41-1.41l-.66.71a1 1 0 0 0 0 1.41 1 1 0 0 0 .66.29Zm-12-.29a1 1 0 0 0 1.41 0 1 1 0 0 0 0-1.41l-.71-.71a1.004 1.004 0 1 0-1.43 1.41l.73.71ZM21 11h-1a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2Zm-2.64 6A1 1 0 0 0 17 18.36l.71.71a1 1 0 0 0 1.41 0 1 1 0 0 0 0-1.41l-.76-.66ZM12 6.5a5.5 5.5 0 1 0 5.5 5.5A5.51 5.51 0 0 0 12 6.5Zm0 9a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7Zm0 3.5a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-1a1 1 0 0 0-1-1Z"/></svg><svg aria-hidden="true" class="dark astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21.64 13a1 1 0 0 0-1.05-.14 8.049 8.049 0 0 1-3.37.73 8.15 8.15 0 0 1-8.14-8.1 8.59 8.59 0 0 1 .25-2A1 1 0 0 0 8 2.36a10.14 10.14 0 1 0 14 11.69 1 1 0 0 0-.36-1.05Zm-9.5 6.69A8.14 8.14 0 0 1 7.08 5.22v.27a10.15 10.15 0 0 0 10.14 10.14 9.784 9.784 0 0 0 2.1-.22 8.11 8.11 0 0 1-7.18 4.32v-.04Z"/></svg><svg aria-hidden="true" class="auto astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21 14h-1V7a3 3 0 0 0-3-3H7a3 3 0 0 0-3 3v7H3a1 1 0 0 0-1 1v2a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-2a1 1 0 0 0-1-1ZM6 7a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v7H6V7Zm14 10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1h16v1Z"/></svg></template><link rel="stylesheet" href="/_astro/print.DNXP8c50.css" media="print"><link rel="stylesheet" href="/_astro/index.DIh-idty.css">
82<link rel="stylesheet" href="/_astro/index.CKnBuwnw.css">
82<script type="module" src="/_astro/page.B1D-nYk3.js"></script>
82<style>.nf-row:where(.astro-vkuhopjv){display:flex;gap:8px}.nf-input:where(.astro-vkuhopjv){flex:1;background:var(--bg-primary);border:1px solid var(--border);border-radius:8px;color:var(--text-primary);font-size:.9375rem;font-family:inherit;outline:none;transition:border-color .2s ease,box-shadow .2s ease}.nf-input:where(.astro-vkuhopjv)::placeholder{color:var(--text-muted)}.nf-input:where(.astro-vkuhopjv):focus{border-color:var(--accent-ai);box-shadow:0 0 0 3px #00d9ff1a}.nf-status:where(.astro-vkuhopjv){font-size:.8125rem;margin:6px 0 0;line-height:1.4;min-height:1.4em}.nf-success:where(.astro-vkuhopjv){color:var(--color-success)}.nf-error:where(.astro-vkuhopjv){color:var(--color-error)}.nf-consent:where(.astro-vkuhopjv){font-size:.75rem;color:var(--text-muted);margin:6px 0 0}.nf-consent:where(.astro-vkuhopjv) a{color:var(--text-secondary);text-decoration:underline;text-underline-offset:2px}.nf-inline:where(.astro-vkuhopjv) .nf-input:where(.astro-vkuhopjv){padding:10px 16px}.nf-inline:where(.astro-vkuhopjv) .nf-btn:where(.astro-vkuhopjv){padding:10px 24px;background:var(--gradient-ai);color:var(--on-gradient);font-weight:700;font-size:.875rem;font-family:inherit;border:none;border-radius:8px;cursor:pointer;white-space:nowrap;transition:all .2s ease}.nf-inline:where(.astro-vkuhopjv) .nf-btn:where(.astro-vkuhopjv):hover{box-shadow:0 0 20px #00d9ff66}.nf-inline:where(.astro-vkuhopjv) .nf-btn:where(.astro-vkuhopjv):disabled{opacity:.6;cursor:not-allowed}.nf-standalone:where(.astro-vkuhopjv){max-width:480px;margin:0 auto}.nf-standalone:where(.astro-vkuhopjv) .nf-input:where(.astro-vkuhopjv){padding:14px 18px;background:var(--bg-card);border-radius:10px;font-size:1rem}.nf-standalone:where(.astro-vkuhopjv) .nf-btn:where(.astro-vkuhopjv){font-size:.9375rem;white-space:nowrap}.nf-standalone:where(.astro-vkuhopjv) .nf-btn:where(.astro-vkuhopjv):disabled{opacity:.6;cursor:not-allowed}.nf-standalone:where(.astro-vkuhopjv) .nf-status:where(.astro-vkuhopjv){font-size:.875rem;margin:10px 0 0}.nf-standalone:where(.astro-vkuhopjv) .nf-consent:where(.astro-vkuhopjv){margin:10px 0 0}.sr-only:where(.astro-vkuhopjv){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}@media(max-width:768px){.nf-row:where(.astro-vkuhopjv){flex-direction:column}}
83</style><style>.product-cta:where(.astro-vvp4kzz7){border-radius:12px;margin:32px 0}.product-cta-inline:where(.astro-vvp4kzz7){background:#8b5cf60f;border:1px solid rgba(139,92,246,.15);padding:20px 24px}.product-cta-banner:where(.astro-vvp4kzz7){background:linear-gradient(135deg,#00d9ff0f,#8b5cf60f);border:1px solid rgba(0,217,255,.15);padding:24px 28px}.product-cta-content:where(.astro-vvp4kzz7){display:flex;align-items:center;gap:16px}.product-cta-icon:where(.astro-vvp4kzz7){width:40px;height:40px;border-radius:10px;background:#8b5cf61f;color:var(--accent-purple-light);display:flex;align-items:center;justify-content:center;flex-shrink:0}.product-cta-text:where(.astro-vvp4kzz7){flex:1;min-width:0}.product-cta-text:where(.astro-vvp4kzz7) strong:where(.astro-vvp4kzz7){display:block;font-size:.9375rem;font-weight:700;color:var(--text-primary);margin-bottom:2px}.product-cta-text:where(.astro-vvp4kzz7) p:where(.astro-vvp4kzz7){font-size:.8125rem;color:var(--text-secondary);line-height:1.5;margin:0}.product-cta-btn:where(.astro-vvp4kzz7){display:inline-flex;align-items:center;gap:8px;padding:14px 28px;background:var(--gradient-ai);color:var(--on-gradient);font-weight:800;font-size:1rem;border-radius:10px;text-decoration:none;white-space:nowrap;transition:all .3s ease;flex-shrink:0;box-shadow:0 0 20px #00d9ff4d}.product-cta-btn:where(.astro-vvp4kzz7):hover{transform:translateY(-2px);box-shadow:0 0 30px #00d9ff80}@media(max-width:640px){.product-cta-content:where(.astro-vvp4kzz7){flex-direction:column;align-items:flex-start;gap:12px}.product-cta-btn:where(.astro-vvp4kzz7){width:100%;justify-content:center}}
84</style><style>.inline-newsletter:where(.astro-reoi52vd){background:#00d9ff08;border:1px solid rgba(0,217,255,.08);border-radius:12px;padding:20px 24px;margin:32px 0}.inline-newsletter-header:where(.astro-reoi52vd){display:flex;align-items:flex-start;gap:12px;margin-bottom:14px}.inline-newsletter-icon:where(.astro-reoi52vd){width:36px;height:36px;border-radius:8px;background:#00d9ff14;color:var(--accent-ai);display:flex;align-items:center;justify-content:center;flex-shrink:0}.inline-newsletter-text:where(.astro-reoi52vd){flex:1;min-width:0}.inline-newsletter-text:where(.astro-reoi52vd) strong:where(.astro-reoi52vd){display:block;font-size:.875rem;font-weight:600;color:var(--text-primary);margin-bottom:2px}.inline-newsletter-text:where(.astro-reoi52vd) p:where(.astro-reoi52vd){font-size:.8125rem;color:var(--text-secondary);line-height:1.5;margin:0}.inline-newsletter-link:where(.astro-reoi52vd){display:inline-block;margin-top:10px;font-size:.75rem;color:var(--text-muted);text-decoration:none;transition:color .2s ease}.inline-newsletter-link:where(.astro-reoi52vd):hover{color:var(--accent-ai)}
85</style><style>.doc-faq:where(.astro-2uhganid){margin-top:2rem}.doc-faq-list:where(.astro-2uhganid){display:flex;flex-direction:column;gap:8px}.faq-item:where(.astro-2uhganid){background:#ffffff05;border:1px solid var(--sl-color-hairline);border-radius:12px;overflow:hidden;transition:border-color .2s ease}.faq-item:where(.astro-2uhganid):hover{border-color:#00d9ff26}.faq-item:where(.astro-2uhganid)[open]{border-color:#00d9ff33}.faq-question:where(.astro-2uhganid){display:flex;justify-content:space-between;align-items:center;gap:16px;padding:20px 24px;
85cursor:pointer;list-style:none;font-size:.9375rem;font-weight:600;color:var(--sl-color-white);transition:color .2s ease}.faq-question:where(.astro-2uhganid)::-webkit-details-marker{display:none}.faq-question:where(.astro-2uhganid)::marker{content:""}.faq-chevron:where(.astro-2uhganid){flex-shrink:0;color:var(--sl-color-gray-3);transition:transform .2s ease}.faq-item:where(.astro-2uhganid)[open] .faq-chevron:where(.astro-2uhganid){transform:rotate(180deg);color:var(--sl-color-accent)}.faq-answer:where(.astro-2uhganid){padding:0 24px 20px;animation:faq-reveal .25s ease-out}.faq-answer:where(.astro-2uhganid) p:where(.astro-2uhganid){font-size:.9375rem;color:var(--sl-color-gray-2);line-height:1.7;margin:0}.faq-answer:where(.astro-2uhganid) a:where(.astro-2uhganid){color:var(--sl-color-text-accent);text-decoration:underline;text-decoration-color:#00d9ff66;text-underline-offset:2px}.faq-answer:where(.astro-2uhganid) a:where(.astro-2uhganid):hover{text-decoration-color:var(--sl-color-text-accent)}@keyframes faq-reveal{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media(max-width:640px){.faq-question:where(.astro-2uhganid){padding:16px 20px;font-size:.875rem}.faq-answer:where(.astro-2uhganid){padding:0 20px 16px}}
86</style></head> <body class="astro-bguv2lll"> <a href="#_top" class="astro-7q3lir66">Skip to content</a>  <div class="page sl-flex astro-vrdttmbt"> <header class="header astro-vrdttmbt"><div class="header astro-kmkmnagf"> <div class="title-wrapper sl-flex astro-kmkmnagf"> <a href="/" class="site-title sl-flex astro-m46x6ez3">  <img class="astro-m46x6ez3" alt src="/_astro/logo.DJiBLKxi.webp" width="32" height="32">  <span class="astro-m46x6ez3" translate="no"> MyEngineeringPath </span> </a>  </div> <div class="sl-flex print:hidden astro-kmkmnagf"> <site-search class="astro-kmkmnagf astro-v37mnknz" data-translations="{&#34;placeholder&#34;:&#34;Search&#34;}"> <button data-open-modal disabled aria-label="Search" aria-keyshortcuts="Control+K" class="astro-v37mnknz"> <svg aria-hidden="true" class="astro-v37mnknz astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M21.71 20.29 18 16.61A9 9 0 1 0 16.61 18l3.68 3.68a.999.999 0 0 0 1.42 0 1 1 0 0 0 0-1.39ZM11 18a7 7 0 1 1 0-14 7 7 0 0 1 0 14Z"/></svg> <span class="sl-hidden md:sl-block astro-v37mnknz" aria-hidden="true">Search</span> <kbd class="sl-hidden md:sl-flex astro-v37mnknz" style="display: none;"> <kbd class="astro-v37mnknz">Ctrl</kbd><kbd class="astro-v37mnknz">K</kbd> </kbd> </button> <dialog style="padding:0" aria-label="Search" class="astro-v37mnknz"> <div class="dialog-frame sl-flex astro-v37mnknz">  <button data-close-modal class="sl-flex md:sl-hidden astro-v37mnknz"> Cancel </button> <div class="search-container astro-v37mnknz"> <div id="starlight__search" class="astro-v37mnknz"></div> </div> </div> </dialog> </site-search>  
86<script>
87	(() => {
88		const openBtn = document.querySelector('button[data-open-modal]');
89		const shortcut = openBtn?.querySelector('kbd');
90		if (!openBtn || !(shortcut instanceof HTMLElement)) return;
91		const platformKey = shortcut.querySelector('kbd');
92		if (platformKey && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)) {
93			platformKey.textContent = '⌘';
94			openBtn.setAttribute('aria-keyshortcuts', 'Meta+K');
95		}
96		shortcut.style.display = '';
97	})();
98</script>
98 
98<script type="module" src="/_astro/Search.astro_astro_type_script_index_0_lang.cjYDvRdi.js"></script>
98   </div> <div class="sl-hidden md:sl-flex print:hidden right-group astro-kmkmnagf"> <div class="sl-flex social-icons astro-kmkmnagf"> <a href="https://github.com/mohitsaxenacs/" rel="me" class="sl-flex astro-wy4te6ga"><span class="sr-only astro-wy4te6ga">GitHub</span><svg aria-hidden="true" class="astro-wy4te6ga astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a><a href="https://linkedin.com/in/mohitsaxena21" rel="me" class="sl-flex astro-wy4te6ga"><span class="sr-only astro-wy4te6ga">LinkedIn</span><svg aria-hidden="true" class="astro-wy4te6ga astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M20.47 2H3.53a1.45 1.45 0 0 0-1.47 1.43v17.14A1.45 1.45 0 0 0 3.53 22h16.94a1.45 1.45 0 0 0 1.47-1.43V3.43A1.45 1.45 0 0 0 20.47 2ZM8.09 18.74h-3v-9h3v9ZM6.59 8.48a1.56 1.56 0 0 1 0-3.12 1.57 1.57 0 1 1 0 3.12Zm12.32 10.26h-3v-4.83c0-1.21-.43-2-1.52-2A1.65 1.65 0 0 0 12.85 13a2 2 0 0 0-.1.73v5h-3v-9h3V11a3 3 0 0 1 2.71-1.5c2 0 3.45 1.29 3.45 4.06v5.18Z"/></svg></a> </div>  
98<script type="module">class s extends HTMLElement{constructor(){super();const e=this.querySelector("select");e&&(e.addEventListener("change",t=>{t.currentTarget instanceof HTMLSelectElement&&(window.location.pathname=t.currentTarget.value)}),window.addEventListener("pageshow",t=>{if(!t.persisted)return;const n=e.querySelector("option[selected]")?.index;n!==e.selectedIndex&&(e.selectedIndex=n??0)}))}}customElements.define("starlight-lang-select",s);</script>
98 </div> </div> </header> <nav class="sidebar print:hidden astro-vrdttmbt" aria-label="Main"> <starlight-menu-button class="print:hidden astro-gs4upyxx"> <button aria-expanded="false" aria-label="Menu" aria-controls="starlight__sidebar" class="sl-flex md:sl-hidden astro-gs4upyxx"> <svg aria-hidden="true" class="open-menu astro-gs4upyxx astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M3 8h18a1 1 0 1 0 0-2H3a1 1 0 0 0 0 2Zm18 8H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2Zm0-5H3a1 1 0 0 0 0 2h18a1 1 0 0 0 0-2Z"/></svg> <svg aria-hidden="true" class="close-menu astro-gs4upyxx astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="m13.41 12 6.3-6.29a1.004 1.004 0 1 0-1.42-1.42L12 10.59l-6.29-6.3a1.004 1.004 0 0 0-1.42 1.42l6.3 6.29-6.3 6.29a1 1 0 0 0 0 1.42.998.998 0 0 0 1.42 0l6.29-6.3 6.29 6.3a.999.999 0 0 0 1.42 0 1 1 0 0 0 0-1.42L13.41 12Z"/></svg> </button> </starlight-menu-button> 
98<script type="module">class s extends HTMLElement{btn=this.querySelector("button");constructor(){super(),this.btn.addEventListener("click",()=>this.toggleExpanded());const t=this.closest("nav");t&&t.addEventListener("keyup",e=>this.closeOnEscape(e))}setExpanded(t){this.setAttribute("aria-expanded",String(t)),document.body.toggleAttribute("data-mobile-menu-expanded",t)}toggleExpanded(){this.setExpanded(this.getAttribute("aria-expanded")!=="true")}closeOnEscape(t){t.code==="Escape"&&(this.setExpanded(!1),this.btn.focus())}}customElements.define("starlight-menu-button",s);</script>
98   <div id="starlight__sidebar" class="sidebar-pane astro-vrdttmbt"> <div class="sidebar-content sl-flex astro-vrdttmbt"> <sl-sidebar-state-persist data-hash="1lnrxgf" class="astro-kku4brbg"> 
98<script aria-hidden="true">
99		(() => {
100			try {
101				if (!matchMedia('(min-width: 50em)').matches) return;
102				/** @type {HTMLElement | null} */
103				const target = document.querySelector('sl-sidebar-state-persist');
104				const state = JSON.parse(sessionStorage.getItem('sl-sidebar-state') || '0');
105				if (!target || !state || target.dataset.hash !== state.hash) return;
106				window._starlightScrollRestore = state.scroll;
107				customElements.define(
108					'sl-sidebar-restore',
109					class SidebarRestore extends HTMLElement {
110						connectedCallback() {
111							try {
112								const idx = parseInt(this.dataset.index || '');
113								const details = this.closest('details');
114								if (details && typeof state.open[idx] === 'boolean') details.open = state.open[idx];
115							} catch {}
116						}
117					}
118				);
119			} catch {}
120		})();
121	</script>
121  <ul class="top-level astro-6srjw6so"> <li class="astro-6srjw6so"> <details class="group-active astro-6srjw6so" style="--group-accent: #94A3B8;" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon astro-6srjw6so" style="--icon-color: #94A3B8"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">GenAI Engineer</span>   </span>  <span class="page-count astro-6srjw6so">145</span> </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="0" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <details data-group="Getting Started" data-total="11" class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #00D9FF"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <circle cx="12" cy="12" r="10"/><polygon points="10 8 16 12 10 16 10 8"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Getting Started</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="2" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Start Here</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-fundamentals/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Fundamentals</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/api-integration-basics/" class="astro-6srjw6so"> <span class="astro-6srjw6so">API Integration</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/python-for-genai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Python for GenAI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/async-python/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Async Python</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/python-data-structures/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Python Data Structures</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/llm-database-integration/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Database Integration</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/rag-pipeline-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">RAG Pipeline Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/pydantic-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Pydantic for AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/fastapi-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">FastAPI for AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/programming/python/type-hints-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Python Type Hints</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="Learning Paths" data-total="11" class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #EC4899"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <polygon points="3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21"/><line x1="9" x2="9" y1="3" y2="18"/><line x1="15" x2="15" y1="6" y2="21"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Learning Paths</span>
121  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="3" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/roadmap/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Career Roadmap</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ai-engineer-roadmap/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Engineer Roadmap 2026</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/career-change-to-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Career Change to AI Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/is-ai-right-for-me/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Is AI Engineering Right for Me?</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/frontend-to-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Frontend Dev to AI Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/data-analyst-to-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Data Analyst to AI Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/first-ai-job/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Get Your First AI Job</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ml-to-genai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">ML Engineer to GenAI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ai-engineering-for-students/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Engineering for Students</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/qa-to-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">QA Engineer to AI Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/devops-to-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">DevOps to AI Engineer</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="Core Curriculum" data-total="51" class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #3B82F6"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Core Curriculum</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="4" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">LLM Internals</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewB
121ox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="10" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/transformer-architecture/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Transformer Architecture</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/tokenization/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Tokenization</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/embeddings/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Embeddings</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/context-windows/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Context Windows</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/multimodal-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Multimodal AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/structured-outputs/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Structured Outputs</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/reasoning-models/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Reasoning Models</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/open-vs-closed-llms/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Open vs Closed LLMs</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Prompting</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="11" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/prompt-engineering/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Prompt Engineering</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/advanced-prompting/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Advanced Prompting</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/prompt-testing/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Prompt Testing</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/tool-calling/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Tool Calling</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/prompt-engineering-techniques/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Prompt Techniques</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">RAG &amp; Retrieval</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="12" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/rag/" aria-current="page" class="astro-6srjw6so" style="--sidebar-accent: #94A3B8"> <span class="astro-6srjw6so">RAG Architecture</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/rag-chunking/" class="astro-6srjw6so"> <span class="astro-6srjw6so">RAG Chunking</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/rag-evaluation/" class="astro-6srjw6so"> <span class="astro-6srjw6so">RAG Evaluation</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/advanced-rag/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Advanced RAG</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/fine-tuning-vs-rag/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Fine-Tuning vs RAG</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/fine-tuning/" class="astro-6srjw6so"> <span class="astro-6srjw6so">How to Fine-Tune</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/semantic-search/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Semantic Search</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/graph-rag/" class="astro-6srjw6so"> <span class="astro-6srjw6so">GraphRAG</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/agentic-rag/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agentic RAG</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/vector-search/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Vector Search Algorithms</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llama-fine-tuning/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Llama Fine-Tuning</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Agents</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewB
121ox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="13" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/agents/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Agents</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/agent-memory/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agent Memory</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/agent-debugging/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agent Debugging</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/human-in-the-loop/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Human-in-the-Loop</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/deep-research/" class="astro-6srjw6so"> <span class="astro-6srjw6so">
121Deep Research</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ai-guardrails/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Guardrails</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/langgraph-multi-agent/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangGraph Multi-Agent</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/agentic-patterns/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agentic Design Patterns</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/build-ai-agent-python/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Build AI Agent (Python)</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/agent-testing/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agent Testing</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Production</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="14" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/llmops/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLMOps</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-cost-optimization/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Cost Optimization</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-caching/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Caching</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-security/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Security</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/prompt-management/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Prompt Management</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/hallucination-mitigation/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Hallucination Mitigation</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/evaluation/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Evaluation</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-benchmarks/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Benchmarks</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ai-safety/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Safety &amp; Ethics</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/prompt-injection/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Prompt Injection &amp; Red Teaming</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/inference-optimization/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Inference Optimization</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/ai-compliance/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Compliance</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-routing/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Routing</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/project-architecture/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Project Architecture</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details class="astro-6srjw6so" open> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so">  <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">System Design</span>   </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewB
121ox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="15" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/system-design/" class="astro-6srjw6so"> <span class="astro-6srjw6so">System Design</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/system-design-interview/" class="astro-6srjw6so"> <span class="astro-6srjw6so">System Design Interview</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/tools/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Tech Decision Framework</span>   </a> </li> </ul>  </div> </details>  </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="Tools &#38; Frameworks" data-total="35" class="astro-6srjw6so"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #8B5CF6"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Tools &amp; Frameworks</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="5" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/tools/langchain-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangChain Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langchain-lcel-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangChain LCEL Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langgraph-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangGraph Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langchain-vs-langgraph/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangChain vs LangGraph</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langchain-vs-llamaindex/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangChain vs LlamaIndex</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langgraph-vs-crewai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangGraph vs CrewAI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/autogen-vs-langgraph/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AutoGen vs LangGraph</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llamaindex-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LlamaIndex Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llamaindex-vs-haystack/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LlamaIndex vs Haystack</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/pydantic-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Pydantic AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langsmith-vs-langfuse/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LangSmith vs Langfuse</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/langfuse-vs-phoenix-arize/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Langfuse vs Phoenix Arize</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/cohere-vs-openai-embeddings/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Cohere vs OpenAI Embeddings</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llm-observability/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Observability</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/hugging-face/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Hugging Face Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/ollama-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Ollama Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/vector-db-comparison/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Vector DB Comparison</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/pinecone-vs-weaviate/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Pinecone vs Weaviate</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/chroma-vs-faiss/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Chroma vs FAISS</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/pinecone-vs-qdrant/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Pinecone vs Qdrant</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/pinecone-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Pinecone Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/qdrant-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Qdrant Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/weaviate-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Weaviate Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/crewai-vs-autogen/" class="astro-6srjw6so"> <span class="astro-6srjw6so">CrewAI vs AutoGen</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/agentic-frameworks/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Agentic Frameworks</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/openai-assistants/" class="astro-6srjw6so"> <span class="astro-6srjw6so">OpenAI Assistants API</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/anthropic-api/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Anthropic API Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/mcp/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Model Context Protocol</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/mcp-server-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">MCP Server Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/crewai-tutorial/" class="astro-6srjw6so"> <span class="astro-6srjw6so">CrewAI Tutorial</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llm-api-comparison/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM API Comparison</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/embeddings-comparison/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Embeddings Comparison</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/mistral-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Mistral AI Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/dspy-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">DSPy Framework</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llm-pricing-comparison/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Pricing Comparison</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="AI Code Editors" data-total="12" class="astro-6srjw6so"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #10B981"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="m14.5 4-5 16"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">AI Code Editors</span>
121  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="6" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/tools/agentic-ides/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Code Editors</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/claude-code/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Claude Code Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/cursor-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Cursor AI Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/cursor-vs-claude-code/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Cursor vs Claude Code</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/opencode-vs-claude-code/" class="astro-6srjw6so"> <span class="astro-6srjw6so">OpenCode vs Claude Code</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/gemini-cli-vs-claude-code/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Gemini CLI vs Claude Code</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/github-copilot/" class="astro-6srjw6so"> <span class="astro-6srjw6so">GitHub Copilot</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/openai-codex/" class="astro-6srjw6so"> <span class="astro-6srjw6so">OpenAI Codex</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/antigravity-vs-cursor/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Antigravity vs Cursor</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/vibe-coding/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Vibe Coding</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/windsurf-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Windsurf AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/ai-coding-best-practices/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Coding Best Practices</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="AI Models" data-total="9" class="astro-6srjw6so"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #F97316"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">AI Models</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="7" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/tools/ai-models/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Models Hub</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/claude-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Claude AI Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/openai-gpt-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">OpenAI GPT Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/gemini-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Gemini AI Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/llama-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Llama Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/claude-sonnet-vs-haiku/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Claude Sonnet vs Haiku</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/claude-vs-chatgpt/" class="astro-6srjw6so"> <span class="astro-6srjw6so">
121Claude vs ChatGPT</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/claude-vs-gemini/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Claude vs Gemini</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/gpt-vs-gemini/" class="astro-6srjw6so"> <span class="astro-6srjw6so">GPT vs Gemini</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="Cloud AI Platforms" data-total="6" class="astro-6srjw6so"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #7C3AED"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Cloud AI Platforms</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="8" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/tools/cloud-ai-platforms/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Platform Overview</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/aws-bedrock/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AWS Bedrock</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/google-vertex-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Google Vertex AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/azure-ai-foundry/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Azure AI Foundry</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/bedrock-vs-vertex-ai/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Bedrock vs Vertex AI</span>   </a> </li><li class="astro-6srjw6so"> <a href="/tools/azure-vs-bedrock/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Azure vs Bedrock</span>   </a> </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <details data-group="Career Resources" data-total="10" class="astro-6srjw6so"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon group-icon--nested astro-6srjw6so" style="--icon-color: #059669"> <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <rect width="20" height="14" x="2" y="7" rx="2" ry="2"/><path d="M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Career Resources</span>  <span class="group-progress astro-6srjw6so" aria-hidden="true"></span> </span>   </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="9" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/genai-engineer/ai-vs-software-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI vs Software Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/portfolio-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Portfolio &amp; Resume Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/certifications/" class="astro-6srjw6so"> <span class="astro-6srjw6so">AI Certifications</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/projects/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Project Ideas</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/interview-questions/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Interview Questions</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/llm-interview-questions/" class="astro-6srjw6so"> <span class="astro-6srjw6so">LLM Interview Questions</span>   </a> </li><li class="astro-6srjw6so"> <a href="/interview-guide/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Interview Guide</span>  <span class="sl-badge success small  astro-6srjw6so astro-avdet4wd">PDF</span> </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/staff-ai-engineer/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Staff AI Engineer</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/salary/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Salary Guide</span>   </a> </li><li class="astro-6srjw6so"> <a href="/genai-engineer/day-in-the-life/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Day in the Life</span>   </a> </li> </ul>  </div> </details>  </li> </ul>  </div> </details>  </li><li class="astro-6srjw6so"> <hr class="group-divider astro-6srjw6so"><details class="astro-6srjw6so" style="--group-accent: #94A3B8;"> <summary class="astro-6srjw6so"> <span class="group-label astro-6srjw6so"> <span class="group-icon astro-6srjw6so" style="--icon-color: #94A3B8"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
121ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-6srjw6so" aria-hidden="true"> <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10"/> </svg> </span> <span class="group-label-text astro-6srjw6so"> <span class="large astro-6srjw6so">Legal</span>   </span>  <span class="page-count astro-6srjw6so">4</span> </span> <svg aria-hidden="true" class="caret astro-6srjw6so astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg> </summary> <sl-sidebar-restore data-index="1" class="astro-6srjw6so"></sl-sidebar-restore> <div class="collapse-wrapper astro-6srjw6so"> <ul class="astro-6srjw6so"> <li class="astro-6srjw6so"> <a href="/privacy-policy/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Privacy Policy</span>   </a> </li><li class="astro-6srjw6so"> <a href="/terms/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Terms &amp; Conditions</span>   </a> </li><li class="astro-6srjw6so"> <a href="/refund/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Refund Policy</span>   </a> </li><li class="astro-6srjw6so"> <a href="/cookie-notice/" class="astro-6srjw6so"> <span class="astro-6srjw6so">Cookie Notice</span>   </a> </li> </ul>  </div> </details>  </li> </ul>   
121<script aria-hidden="true">
122		(() => {
123			const scroller = document.getElementById('starlight__sidebar');
124			if (!window._starlightScrollRestore || !scroller) return;
125			scroller.scrollTop = window._starlightScrollRestore;
126			delete window._starlightScrollRestore;
127		})();
128	</script>
128 </sl-sidebar-state-persist>  <!-- Sidebar Footer CTA --> <a href="/genai-engineer/interview-questions/" class="sidebar-cta astro-3x5efdbn"> <span class="sidebar-cta-badge astro-3x5efdbn">Popular</span> <span class="sidebar-cta-title astro-3x5efdbn">GenAI Interview Guide</span> <span class="sidebar-cta-desc astro-3x5efdbn">30 questions · System design · Coding patterns</span> </a> <div class="md:sl-hidden astro-3x5efdbn"> <div class="mobile-preferences sl-flex astro-wu23bvmt"> <div class="social-icons astro-wu23bvmt"> <a href="https://github.com/mohitsaxenacs/" rel="me" class="sl-flex astro-wy4te6ga"><span class="sr-only astro-wy4te6ga">GitHub</span><svg aria-hidden="true" class="astro-wy4te6ga astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3Z"/></svg></a><a href="https://linkedin.com/in/mohitsaxena21" rel="me" class="sl-flex astro-wy4te6ga"><span class="sr-only astro-wy4te6ga">LinkedIn</span><svg aria-hidden="true" class="astro-wy4te6ga astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1em;"><path d="M20.47 2H3.53a1.45 1.45 0 0 0-1.47 1.43v17.14A1.45 1.45 0 0 0 3.53 22h16.94a1.45 1.45 0 0 0 1.47-1.43V3.43A1.45 1.45 0 0 0 20.47 2ZM8.09 18.74h-3v-9h3v9ZM6.59 8.48a1.56 1.56 0 0 1 0-3.12 1.57 1.57 0 1 1 0 3.12Zm12.32 10.26h-3v-4.83c0-1.21-.43-2-1.52-2A1.65 1.65 0 0 0 12.85 13a2 2 0 0 0-.1.73v5h-3v-9h3V11a3 3 0 0 1 2.71-1.5c2 0 3.45 1.29 3.45 4.06v5.18Z"/></svg></a> </div>   </div>  </div> <!-- Sidebar behavior: auto-collapse on navigation + reading progress tracker --> 
128<script type="module">function i(){const n=window.location.pathname,s=document.querySelector('[aria-current="page"]');if(s){const e=s.closest("details[data-group]");document.querySelectorAll("details[data-group]").forEach(o=>{o===e?o.open=!0:o.contains(s)||(o.open=!1)});const r=e?.parentElement?.closest("details");r&&(r.open=!0),requestAnimationFrame(()=>{s.scrollIntoView({block:"nearest",behavior:"smooth"})})}const c="mep-sidebar-visited";let a={};try{a=JSON.parse(localStorage.getItem(c)||"{}")}catch{}if(s){const e=s.closest("details[data-group]");if(e){const t=e.dataset.group;if(a[t]||(a[t]=[]),!a[t].includes(n)){a[t].push(n);try{localStorage.setItem(c,JSON.stringify(a))}catch{}}}}document.querySelectorAll(".group-progress").forEach(e=>{const t=e.closest("details[data-group]");if(!t)return;const r=t.dataset.group,o=parseInt(t.dataset.total||"0",10),l=(a[r]||[]).length;if(l>0&&o>0){const p=Math.min(100,Math.round(l/o*100)),d=t.style.getPropertyValue("--group-accent")||"#00D9FF";e.classList.add("has-progress"),e.innerHTML=`<span class="progress-fill" style="width:${p}%;background:${d}"></span>`}})}i();document.addEventListener("astro:page-load",i);</script>
128  </div> </div> </nav> <div class="main-frame astro-vrdttmbt">  
128<script type="module">const a=document.getElementById("starlight__sidebar"),n=a?.querySelector("sl-sidebar-state-persist"),o="sl-sidebar-state",i=()=>{let t=[];const e=n?.dataset.hash||"";try{const s=sessionStorage.getItem(o),r=JSON.parse(s||"{}");Array.isArray(r.open)&&r.hash===e&&(t=r.open)}catch{}return{hash:e,open:t,scroll:a?.scrollTop||0}},c=t=>{try{sessionStorage.setItem(o,JSON.stringify(t))}catch{}},d=()=>c(i()),l=(t,e)=>{const s=i();s.open[e]=t,c(s)};n?.addEventListener("click",t=>{if(!(t.target instanceof Element))return;const e=t.target.closest("summary")?.closest("details");if(!e)return;const s=e.querySelector("sl-sidebar-restore"),r=parseInt(s?.dataset.index||"");isNaN(r)||l(!e.open,r)});addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&d()});addEventListener("pageHide",d);</script>
128 <div class="lg:sl-flex astro-67yu43on"> <aside class="right-sidebar-container print:hidden astro-67yu43on"> <div class="right-sidebar astro-67yu43on"> 
128<script type="module" src="/_astro/MobileTableOfContents.astro_astro_type_script_index_0_lang.hwBsy0Mo.js"></script>
128<script type="module" src="/_astro/TableOfContents.astro_astro_type_script_index_0_lang.FuRcXuRY.js"></script>
128<div class="lg:sl-hidden astro-pb3aqygn"><mobile-starlight-toc data-min-h="2" data-max-h="3" class="astro-doynk5tl"><nav aria-labelledby="starlight__on-this-page--mobile" class="astro-doynk5tl"><details id="starlight__mobile-toc" class="astro-doynk5tl"><summary id="starlight__on-this-page--mobile" class="sl-flex astro-doynk5tl"><span class="toggle sl-flex astro-doynk5tl">On this page<svg aria-hidden="true" class="caret astro-doynk5tl astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1rem;"><path d="m14.83 11.29-4.24-4.24a1 1 0 1 0-1.42 1.41L12.71 12l-3.54 3.54a1 1 0 0 0 0 1.41 1 1 0 0 0 .71.29 1 1 0 0 0 .71-.29l4.24-4.24a1.002 1.002 0 0 0 0-1.42Z"/></svg></span><span class="display-current astro-doynk5tl"></span></summary><div class="dropdown astro-doynk5tl"><ul class="isMobile astro-g2bywc46" style="--depth: 0;"> <li class="astro-g2bywc46" style="--depth: 0;"> <a href="#_top" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">Overview</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#1-why-rag-matters-for-genai" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">1. Why RAG Matters for GenAI</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#why-rag-exists" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Why RAG Exists</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#what-you-will-learn" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">What You Will Learn</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#2-real-world-problem-context" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">2. Real-World Problem Context</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-document-qa-problem-at-scale" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Document Q&amp;A Problem at Scale</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#why-this-is-harder-than-it-looks" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Why This Is Harder Than It Looks</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#3-how-rag-works--retrieval-pipeline" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">3. How RAG Works — Retrieval Pipeline</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-two-pipeline-architecture" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Two-Pipeline Architecture</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking-strategies-deep-dive" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking Strategies Deep Dive</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#rag-chunking-strategies--code-examples" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">RAG Chunking Strategies — Code Examples</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking Pipeline</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-1" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#embedding-models" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Embedding Models</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#vector-databases" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Vector Databases</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#hybrid-search" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Hybrid Search</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-2" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#reranking" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Reranking</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#4-build-a-rag-pipeline-step-by-step" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">4. Build a RAG Pipeline Step by Step</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#building-the-indexing-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Building the Indexing Pipeline</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#building-the-retrieval-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Building the Retrieval Pipeline</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#5-rag-architecture-and-design" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">5. RAG Architecture and Design</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#naive-rag-vs-advanced-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Naive RAG vs Advanced RAG</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-3" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#advanced-retrieval-patterns" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Advanced Retrieval Patterns</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#6-rag-code-examples-in-python" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">6. RAG Code Examples in Python</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#example-1-enterprise-document-qa-system" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Example 1: Enterprise Document Q&amp;A System</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#example-2-customer-support-agent-with-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Example 2: Customer Support Agent with RAG</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#7-rag-trade-offs-and-pitfalls" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">7. RAG Trade-offs and Pitfalls</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-chunking-failure-mode" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Chunking Failure Mode</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-lost-in-the-middle-problem" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Lost-in-the-Middle Problem</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#hallucination-in-rag-systems" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Hallucination in RAG Systems</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#context-window-overflow" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Context Window Overflow</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#evaluation-without-ground-truth" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Evaluation Without Ground Truth</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#8-rag-interview-questions" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">8. RAG Interview Questions</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#what-interviewers-are-assessing" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">What Interviewers Are Assessing</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#common-interview-questions-on-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Common Interview Questions on RAG</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#9-rag-in-production" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">9. RAG in Production</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#latency-budget" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">
128Latency Budget</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#infrastructure-considerations" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Infrastructure Considerations</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#monitoring-what-matters" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Monitoring What Matters</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#10-summary-and-key-takeaways" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">10. Summary and Key Takeaways</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-core-mental-model" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Core Mental Model</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#rag-design-checklist" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">RAG Design Checklist</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#when-rag-is-the-right-choice" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">When RAG Is the Right Choice</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#official-documentation-and-further-reading" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Official Documentation and Further Reading</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#what-is-rag-in-ai" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">What is RAG in AI?</span> </a> <ul class="isMobile astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#related" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Related</span> </a>  </li> </ul>  </li> </ul> </div></details></nav></mobile-starlight-toc></div><div class="right-sidebar-panel sl-hidden lg:sl-block astro-pb3aqygn"><div class="sl-container astro-pb3aqygn"><starlight-toc data-min-h="2" data-max-h="3"><nav aria-labelledby="starlight__on-this-page"><h2 id="starlight__on-this-page">On this page</h2><ul class="astro-g2bywc46" style="--depth: 0;"> <li class="astro-g2bywc46" style="--depth: 0;"> <a href="#_top" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">Overview</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#1-why-rag-matters-for-genai" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">1. Why RAG Matters for GenAI</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#why-rag-exists" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Why RAG Exists</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#what-you-will-learn" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">What You Will Learn</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#2-real-world-problem-context" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">2. Real-World Problem Context</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-document-qa-problem-at-scale" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Document Q&amp;A Problem at Scale</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#why-this-is-harder-than-it-looks" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Why This Is Harder Than It Looks</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#3-how-rag-works--retrieval-pipeline" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">3. How RAG Works — Retrieval Pipeline</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-two-pipeline-architecture" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Two-Pipeline Architecture</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking-strategies-deep-dive" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking Strategies Deep Dive</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#rag-chunking-strategies--code-examples" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">RAG Chunking Strategies — Code Examples</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#chunking-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Chunking Pipeline</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-1" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#embedding-models" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Embedding Models</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#vector-databases" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Vector Databases</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#hybrid-search" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Hybrid Search</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-2" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#reranking" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Reranking</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#4-build-a-rag-pipeline-step-by-step" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">4. Build a RAG Pipeline Step by Step</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#building-the-indexing-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Building the Indexing Pipeline</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#building-the-retrieval-pipeline" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Building the Retrieval Pipeline</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#5-rag-architecture-and-design" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">5. RAG Architecture and Design</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#naive-rag-vs-advanced-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Naive RAG vs Advanced RAG</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#-visual-explanation-3" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">📊 Visual Explanation</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#advanced-retrieval-patterns" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Advanced Retrieval Patterns</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#6-rag-code-examples-in-python" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">6. RAG Code Examples in Python</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#example-1-enterprise-document-qa-system" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Example 1: Enterprise Document Q&amp;A System</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#example-2-customer-support-agent-with-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Example 2: Customer Support Agent with RAG</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#7-rag-trade-offs-and-pitfalls" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">7. RAG Trade-offs and Pitfalls</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-chunking-failure-mode" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Chunking Failure Mode</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-lost-in-the-middle-problem" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Lost-in-the-Middle Problem</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#hallucination-in-rag-systems" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Hallucination in RAG Systems</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#context-window-overflow" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Context Window Overflow</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#evaluation-without-ground-truth" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Evaluation Without Ground Truth</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#8-rag-interview-questions" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">8. RAG Interview Questions</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#what-interviewers-are-assessing" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">What Interviewers Are Assessing</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#common-interview-questions-on-rag" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Common Interview Questions on RAG</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#9-rag-in-production" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">9. RAG in Production</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#latency-budget" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">
128Latency Budget</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#infrastructure-considerations" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Infrastructure Considerations</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#monitoring-what-matters" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Monitoring What Matters</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#10-summary-and-key-takeaways" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">10. Summary and Key Takeaways</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#the-core-mental-model" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">The Core Mental Model</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#rag-design-checklist" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">RAG Design Checklist</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#when-rag-is-the-right-choice" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">When RAG Is the Right Choice</span> </a>  </li><li class="astro-g2bywc46" style="--depth: 1;"> <a href="#official-documentation-and-further-reading" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Official Documentation and Further Reading</span> </a>  </li> </ul>  </li><li class="astro-g2bywc46" style="--depth: 0;"> <a href="#what-is-rag-in-ai" class="astro-g2bywc46" style="--depth: 0;"> <span class="astro-g2bywc46" style="--depth: 0;">What is RAG in AI?</span> </a> <ul class="astro-g2bywc46" style="--depth: 1;"> <li class="astro-g2bywc46" style="--depth: 1;"> <a href="#related" class="astro-g2bywc46" style="--depth: 1;"> <span class="astro-g2bywc46" style="--depth: 1;">Related</span> </a>  </li> </ul>  </li> </ul> </nav></starlight-toc></div></div> </div> </aside> <div class="main-pane astro-67yu43on">  <main data-pagefind-body class="astro-bguv2lll" lang="en" dir="ltr">    <div class="content-panel astro-7nkwcw3z"> <div class="sl-container astro-7nkwcw3z"> <nav class="section-breadcrumb astro-nabvmdom" aria-label="Section" style="--breadcrumb-accent: #94A3B8"><span class="crumb astro-nabvmdom">GenAI Engineer</span><span class="separator astro-nabvmdom" aria-hidden="true">&rsaquo;</span><span class="crumb astro-nabvmdom">Core Curriculum</span><span class="separator astro-nabvmdom" aria-hidden="true">&rsaquo;</span><span class="crumb astro-nabvmdom">RAG &amp; Retrieval</span></nav><h1 id="_top" class="astro-nabvmdom">RAG Architecture Diagram — Production RAG Systems</h1>  </div> </div>  <div class="content-panel astro-7nkwcw3z"> <div class="sl-container astro-7nkwcw3z"> <div class="sl-markdown-content"> <p>Retrieval-Augmented Generation (RAG) is the most widely deployed architecture pattern in production GenAI systems. This guide covers everything GenAI engineers need to build production RAG pipelines — from chunking strategies and hybrid search to RAGAS evaluation and failure mode analysis.</p>
129<div class="sl-heading-wrapper level-h2"><h2 id="1-why-rag-matters-for-genai">1. Why RAG Matters for GenAI</h2><a class="sl-anchor-link" href="#1-why-rag-matters-for-genai"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “1. Why RAG Matters for GenAI”</span></a></div>
130<p>RAG solves the fundamental mismatch between LLMs’ static training data and the dynamic, private knowledge that production applications require.</p>
131<div class="sl-heading-wrapper level-h3"><h3 id="why-rag-exists">Why RAG Exists</h3><a class="sl-anchor-link" href="#why-rag-exists"><span aria-hidden="true" class="sl-anchor-icon">
131<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Why RAG Exists”</span></a></div>
132<p>Large language models are trained on a static snapshot of the internet with a hard knowledge cutoff. Once training ends, they cannot update what they know. They have no access to your private documents, internal wikis, customer data, real-time information, or anything that did not exist in their training corpus.</p>
133<p>This creates a fundamental problem for production applications. A customer service bot needs to know your current product catalog. A legal tool needs to reference the specific contract at hand. An enterprise search system needs to surface internal documentation that was written last week. The LLM’s parametric knowledge — the knowledge baked into its weights — cannot satisfy these requirements.</p>
134<p>The obvious solution is to supply the missing information directly. Include the relevant documents in the prompt. Let the LLM reason over that context rather than trying to recall something it was never trained on. This is the core idea behind <strong>Retrieval-Augmented Generation</strong>: at query time, retrieve the relevant documents from a knowledge base and inject them into the prompt before the LLM responds.</p>
135<p>The retrieval step is what makes this practical at scale. You cannot fit an entire enterprise document corpus into a single prompt — context windows are finite and LLM costs scale with token count. Retrieval narrows the corpus to only the documents most relevant to the current query, keeping prompts manageable and costs bounded.</p>
136<p>RAG is the dominant architecture for knowledge-intensive LLM applications because it solves the knowledge currency problem without requiring expensive model retraining, and it provides a form of <strong>grounding</strong> — the LLM’s answer is traceable back to specific source documents.</p>
137<div class="sl-heading-wrapper level-h3"><h3 id="what-you-will-learn">What You Will Learn</h3><a class="sl-anchor-link" href="#what-you-will-learn"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “What You Will Learn”</span></a></div>
138<p>This guide covers:</p>
139<ul>
140<li>The two-pipeline architecture of every RAG system: indexing and retrieval</li>
141<li>Chunking strategies and why they matter more than most engineers expect</li>
142<li>How embedding models and vector databases enable semantic search</li>
143<li>Hybrid search, reranking, and the retrieval quality improvement chain</li>
144<li>Advanced patterns including HyDE, multi-query retrieval, and contextual retrieval</li>
145<li>How to evaluate a RAG system using RAGAS metrics</li>
146<li>Where RAG fails in production and how to design against those failures</li>
147<li>What interviewers expect when discussing RAG architecture</li>
148</ul>
149<hr>
150<div class="sl-heading-wrapper level-h2"><h2 id="2-real-world-problem-context">2. Real-World Problem Context</h2><a class="sl-anchor-link" href="#2-real-world-problem-context"><span aria-hidden="true" class="sl-anchor-icon">
150<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “2. Real-World Problem Context”</span></a></div>
151<p>RAG exists because LLMs have a fundamental limitation: they can only use knowledge from their training data, which is static and eventually outdated.</p>
152<div class="sl-heading-wrapper level-h3"><h3 id="the-document-qa-problem-at-scale">The Document Q&#x26;A Problem at Scale</h3><a class="sl-anchor-link" href="#the-document-qa-problem-at-scale"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “The Document Q&#x26;A Problem at Scale”</span></a></div>
153<p>Consider a company with 50,000 internal documents: engineering RFCs, HR policies, product specs, customer contracts, meeting notes, support tickets. A new engineer asks: “What is our company’s policy on rotating database credentials?” Searching manually through a 50,000-document corpus is infeasible. A keyword search returns 300 documents, most irrelevant. A traditional search engine returns results ranked by keyword overlap, not by semantic relevance to the question.</p>
154<p>RAG solves this exactly. The offline indexing pipeline processes all 50,000 documents, chunks them, embeds them, and stores them in a vector database. At query time, the engineer’s question is embedded and the vector database returns the top 5 most semantically similar chunks — likely the security policy section that describes credential rotation requirements. Those chunks are injected into the prompt, and the LLM generates a specific, grounded answer.</p>
155<p>This is not a contrived example. Enterprise search was one of the first RAG applications deployed at scale, starting in 2023, and remains one of the most common production use cases.</p>
156<div class="sl-heading-wrapper level-h3"><h3 id="why-this-is-harder-than-it-looks">Why This Is Harder Than It Looks</h3><a class="sl-anchor-link" href="#why-this-is-harder-than-it-looks"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Why This Is Harder Than It Looks”</span></a></div>
157<p>The demo version of RAG is straightforward: load a PDF, chunk it into fixed-size paragraphs, embed them, store in a local vector DB, run a similarity search on the user’s question, stuff the results into a prompt. This works well for demos on clean, single-topic documents.</p>
158<p>Production RAG fails in ways the demo never encounters:</p>
159<ul>
160<li><strong>Heterogeneous documents</strong>: A mix of PDFs, HTML pages, Excel files, email threads, database records, and code files — each requiring different preprocessing</li>
161<li><strong>Document quality variance</strong>: Scanned PDFs with poor OCR, documents with heavy table/image content, deeply nested HTML that produces garbage text after extraction</li>
162<li><strong>Poor retrieval recall</strong>: The right document exists but is not retrieved because the query phrasing is different from the document’s language</li>
163<li><strong>Poor context precision</strong>: Retrieval returns 5 chunks, but 4 are tangentially related noise that c
163onfuses the LLM and degrades answer quality</li>
164<li><strong>Multi-hop questions</strong>: “What changed between the 2023 and 2024 versions of our security policy?” requires retrieving from two specific documents and comparing them</li>
165<li><strong>Latency at scale</strong>: A vector search that completes in 50ms for 10,000 documents may take 300ms for 10 million</li>
166</ul>
167<p>Real RAG engineering is mostly about fixing these production failures systematically.</p>
168<hr>
169<div class="sl-heading-wrapper level-h2"><h2 id="3-how-rag-works--retrieval-pipeline">3. How RAG Works — Retrieval Pipeline</h2><a class="sl-anchor-link" href="#3-how-rag-works--retrieval-pipeline"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “3. How RAG Works — Retrieval Pipeline”</span></a></div>
170<p>Every RAG system is built from four building blocks: a document-splitting strategy, an embedding model, a vector database, and a retrieval pipeline that connects them at query time.</p>
171<div class="sl-heading-wrapper level-h3"><h3 id="the-two-pipeline-architecture">The Two-Pipeline Architecture</h3><a class="sl-anchor-link" href="#the-two-pipeline-architecture"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “The Two-Pipeline Architecture”</span></a></div>
172<p>Every RAG system has two distinct execution paths that must be understood and optimized independently:</p>
173<p><strong>The indexing pipeline</strong> runs offline, asynchronously, when your knowledge base changes. It transforms raw documents into a form that enables fast, relevant retrieval at query time. It is batch-oriented, latency-tolerant, and can be expensive computationally.</p>
174<p><strong>The retrieval pipeline</strong> runs online, synchronously, on every user query. It must be fast — typically under 200ms for the retrieval step alone. It is the user-facing critical path.</p>
175<p>These two pipelines share a critical interface: the vector database. The indexing pipeline writes vectors into it; the retrieval pipeline reads from it. Every decision about chunking, embedding, and indexing made offline directly determines retrieval quality online.</p>
176<div class="sl-heading-wrapper level-h3"><h3 id="-visual-explanation">📊 Visual Explanation</h3><a class="sl-anchor-link" href="#-visual-explanation"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “📊 Visual Explanation”</span></a></div>
177<astro-island uid="Zbqepj" prefix="r4" component-url="/_astro/FlowDiagram.DhV5anj3.js" component-export="FlowDiagram" renderer-url="/_astro/client.Dc9Vh3na.js" props="{&quot;title&quot;:[0,&quot;RAG System Architecture — Two Pipelines&quot;],&quot;subtitle&quot;:[0,&quot;The offline indexing pipeline prepares your knowledge base. The online retrieval pipeline serves every query. Both connect through the vector store.&quot;],&quot;layout&quot;:[0,&quot;architectures&quot;],&quot;stages&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Offline: Index&quot;],&quot;sublabel&quot;:[0,&quot;Runs async when data changes&quot;],&quot;color&quot;:[0,&quot;blue&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Load Documents&quot;]}],[0,{&quot;label&quot;:[0,&quot;Chunk&quot;]}],[0,{&quot;label&quot;:[0,&quot;Embed&quot;]}],[0,{&quot;label&quot;:[0,&quot;Store in Vector DB&quot;]}]]]}],[0,{&quot;label&quot;:[0,&quot;Online: Retrieve&quot;],&quot;sublabel&quot;:[0,&quot;Runs on every user query&quot;],&quot;color&quot;:[0,&quot;cyan&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;User Query&quot;]}],[0,{&quot;label&quot;:[0,&quot;Embed Query&quot;]}],[0,{&quot;label&quot;:[0,&quot;Vector Search&quot;]}],[0,{&quot;label&quot;:[0,&quot;Return Top-K Chunks&quot;]}]]]}],[0,{&quot;label&quot;:[0,&quot;Online: Generate&quot;],&quot;sublabel&quot;:[0,&quot;Augment and respond&quot;],&quot;color&quot;:[0,&quot;purple&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Assemble Prompt&quot;]}],[0,{&quot;label&quot;:[0,&quot;Inject Context&quot;]}],[0,{&quot;label&quot;:[0,&quot;LLM Call&quot;]}],[0,{&quot;label&quot;:[0,&quot;Grounded Response&quot;]}]]]}]]]}" ssr client="visible" opts="{&quot;name&quot;:&quot;FlowDiagram&quot;,&quot;value&quot;:true}" await-children><div role="group" aria-label="RAG System Architecture — Two Pipelines" style="background:#12121A;border:1px solid rgba(255,255,255,0.07);border-radius:16px;padding:24px;margin:1.5rem 0;position:relative;font-family:inherit"><div style="margin-bottom:18px;padding-right:80px"><p style="margin:0;font-size:0.9375rem;font-weight:700;color:#F8FAFC;letter-spacing:-0.01em">RAG System Architecture — Two Pipelines</p><p style="margin:3px 0 0;font-size:0.8rem;color:#8494A7">The offline indexing pipeline prepares your knowledge base. The online retrieval pipeline serves every query. Both connect through the vector store.</p></div><button aria-label="Pause animation" style="position:absolute;top:14px;right:14px;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.10);border-radius:8px;padding:8px 14px;color:#94A3B8;cursor:pointer;font-size:0.72rem;display:flex;align-items:center;gap:5px;min-width:44px;min-height:44px;justify-content:center"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause" aria-hidden="true"><rect x="14" y="3" width="5" height="18" rx="1"></rect><rect x="5" y="3" width="5" height="18" rx="1"></rect></svg>Pause</button><div style="display:flex;flex-direction:column;gap:10px"><div style="background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #0EA5E9;border-radius:12px;padding:14px 16px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(16px)"><div style="margin-bottom:10px"><span style="font-size:0.8rem;font-weight:700;color:#0EA5E9">Offline: Index</span><span style="font-size:0.72rem;color:#8494A7;margin-left:8px">Runs async when data changes</span></div><div style="display:flex;align-items:center;gap:4px;flex-wrap:wrap"><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Load Documents</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Chunk</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Embed</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Store in Vector DB</div></div></div></div><div style="background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #00D9FF;border-radius:12px;padding:14px 16px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(16px)"><div style="margin-bottom:10px"><span style="font-size:0.8rem;font-weight:700;color:#00D9FF">Online: Retrieve</span><span style="font-size:0.72rem;color:#8494A7;margin-left:8px">Runs on every user query</span></div><div style="display:flex;align-items:center;gap:4px;flex-wrap:wrap"><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">User Query</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Embed Query</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Vector Search</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Return Top-K Chunks</div></div></div></div><div style="background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #8B5CF6;border-radius:12px;padding:14px 16px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(16px)"><div style="margin-bottom:10px"><span style="font-size:0.8rem;font-weight:700;color:#C4B5FD">Online: Generate</span><span style="font-size:0.72rem;color:#8494A7;margin-left:8px">Augment and respond</span></div><div style="display:flex;align-items:center;gap:4px;flex-wrap:wrap"><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Assemble Prompt</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Inject Context</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;flex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">LLM Call</div></div><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true" style="color:#334155;fl
177ex-shrink:0;margin-top:1px"><path d="m9 18 6-6-6-6"></path></svg><div style="padding:5px 10px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.07);border-radius:6px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:scale(0.88)"><div style="font-size:0.775rem;font-weight:400;color:#CBD5E1;transition:color 0.25s ease;white-space:nowrap">Grounded Response</div></div></div></div></div><div style="margin-top:14px;display:flex;align-items:center;gap:8px"><div style="width:7px;height:7px;border-radius:50%;flex-shrink:0"></div><span style="font-size:0.68rem;color:#8494A7;text-transform:uppercase;letter-spacing:0.06em">Idle</span></div></div><!--astro:end--></astro-island>
178<div class="sl-heading-wrapper level-h3"><h3 id="chunking">Chunking</h3><a class="sl-anchor-link" href="#chunking"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Chunking”</span></a></div>
179<p>Chunking is the process of splitting documents into retrievable units. The vector database indexes chunks, not whole documents. Retrieval returns chunks, not whole documents. The granularity of your chunks determines both what can be retrieved and what context the LLM receives.</p>
180<p>This decision has more impact on RAG quality than most engineers expect. Common chunking strategies:</p>
181<p><strong>Fixed-size chunking</strong>: Split every N tokens with an overlap of M tokens. Simple, fast, and predictable. The overlap prevents context loss at chunk boundaries. The main weakness: splits can bisect sentences, paragraphs, or conceptual units arbitrarily, creating chunks that make no sense in isolation.</p>
182<p><strong>Semantic chunking</strong>: Split on natural document boundaries — paragraphs, sections, sentences — rather than token count. Produces chunks that are semantically coherent. More expensive to compute. The main weakness: chunk sizes vary widely, making it harder to reason about context window usage.</p>
183<p><strong>Hierarchical chunking (parent-child)</strong>: Index small chunks for precise retrieval but return larger parent chunks to the LLM for context. The small chunk gets matched by similarity; the large chunk provides the surrounding context needed for a coherent answer. This is the most effective approach for most production systems.</p>
184<div class="sl-heading-wrapper level-h3"><h3 id="chunking-strategies-deep-dive">Chunking Strategies Deep Dive</h3><a class="sl-anchor-link" href="#chunking-strategies-deep-dive"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Chunking Strategies Deep Dive”</span></a></div>
185<p>Chunking is where most RAG systems silently fail. You pick a chunk size, ship it, and wonder why retrieval quality is mediocre. The problem is rarely the vector database or embedding model — it is almost always the chunking strategy.</p>
186<p>Here are the five major approaches, ranked from simplest to most effective:</p>
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228<table><thead><tr><th>
228Strategy</th><th>How It Works</th><th>Best For</th><th>Weakness</th></tr></thead><tbody><tr><td><strong>Fixed-size</strong></td><td>Split every N tokens with M-token overlap</td><td>Quick prototypes, uniform documents</td><td>Splits mid-sentence, destroys context boundaries</td></tr><tr><td><strong>Sentence</strong></td><td>Split on sentence boundaries (spaCy, NLTK)</td><td>Short-form content, FAQ pages</td><td>Chunks too small for complex topics</td></tr><tr><td><strong>Semantic</strong></td><td>Split on paragraph/section boundaries</td><td>Technical docs, articles with clear structure</td><td>Variable chunk sizes complicate token budgeting</td></tr><tr><td><strong>Hierarchical</strong></td><td>Small child chunks for retrieval, large parent chunks for context</td><td>Production RAG systems</td><td>More complex indexing pipeline, 2x storage</td></tr><tr><td><strong>Agentic</strong></td><td>LLM decides chunk boundaries based on content meaning</td><td>Research papers, legal documents</td><td>Expensive (1 LLM call per document), slow indexing</td></tr></tbody></table>
229<p><strong>The practical recommendation:</strong> Start with semantic chunking (split on <code dir="auto">\n\n</code> paragraph boundaries, max 512 tokens). Move to hierarchical chunking when retrieval precision matters. Use agentic chunking only for high-value corpora where indexing cost is justified.</p>
230<div class="sl-heading-wrapper level-h3"><h3 id="rag-chunking-strategies--code-examples">RAG Chunking Strategies — Code Examples</h3><a class="sl-anchor-link" href="#rag-chunking-strategies--code-examples"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “RAG Chunking Strategies — Code Examples”</span></a></div>
231<p><strong>Fixed-size chunking</strong> (baseline — fast but lossy):</p>
232<div class="expressive-code"><link rel="stylesheet" href="/_astro/ec.mvgwa.css">
232<script type="module" src="/_astro/ec.0vx5m.js"></script>
232<figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="python"><code><div class="ec-line"><div class="code"><span style="--0:#FF9492">from</span><span style="--0:#F0F3F6"> langchain.text_splitter </span><span style="--0:#FF9492">import</span><span style="--0:#F0F3F6"> RecursiveCharacterTextSplitter</span></div></div><div class="ec-line"><div class="code">
233</div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">splitter </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> RecursiveCharacterTextSplitter(</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FFB757">chunk_size</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">512</span><span style="--0:#F0F3F6">,</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FFB757">chunk_overlap</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">50</span><span style="--0:#F0F3F6">,</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FFB757">separators</span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6">[</span><span style="--0:#ADDCFF">"</span><span style="--0:#FF9492">\n\n</span><span style="--0:#ADDCFF">"</span><span style="--0:#F0F3F6">, </span><span style="--0:#ADDCFF">"</span><span style="--0:#FF9492">\n</span><span style="--0:#ADDCFF">"</span><span style="--0:#F0F3F6">, </span><span style="--0:#ADDCFF">". "</span><span style="--0:#F0F3F6">, </span><span style="--0:#ADDCFF">" "</span><span style="--0:#F0F3F6">],</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">)</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">chunks </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> splitter.split_text(document_text)</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="from langchain.text_splitter import RecursiveCharacterTextSplitter��splitter = RecursiveCharacterTextSplitter(�    chunk_size=512,�    chunk_overlap=50,�    separators=[&#x22;\n\n&#x22;, &#x22;\n&#x22;, &#x22;. &#x22;, &#x22; &#x22;],�)�chunks = splitter.split_text(document_text)"><div></div></button></div></figure></div>
234<p><strong>Semantic chunking</strong> (paragraph-aware — the sweet spot for most teams):</p>
235<div class="expressive-code"><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="python"><code><div class="ec-line"><div class="code"><span style="--0:#FF9492">from</span><span style="--0:#F0F3F6"> langchain_experimental.text_splitter </span><span style="--0:#FF9492">import</span><span style="--0:#F0F3F6"> SemanticChunker</span></div></div><div class="ec-line"><div class="code"><span style="--0:#FF9492">from</span><span style="--0:#F0F3F6"> langchain_openai </span><span style="--0:#FF9492">import</span><span style="--0:#F0F3F6"> OpenAIEmbeddings</span></div></div><div class="ec-line"><div class="code">
236</div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">chunker </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> SemanticChunker(</span></div></div><div class="ec-line"><div class="code"><span class="indent"><span style="--0:#F0F3F6">    </span></span><span style="--0:#F0F3F6">OpenAIEmbeddings(),</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FFB757">breakpoint_threshold_type</span><span style="--0:#FF9492">=</span><span style="--0:#ADDCFF">"percentile"</span><span style="--0:#F0F3F6">,</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FFB757">breakpoint_threshold_amount</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">90</span><span style="--0:#F0F3F6">,</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">)</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">chunks </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> chunker.split_text(document_text)</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="from langchain_experimental.text_splitter import SemanticChunker�from langchain_openai import OpenAIEmbeddings�
236�chunker = SemanticChunker(�    OpenAIEmbeddings(),�    breakpoint_threshold_type=&#x22;percentile&#x22;,�    breakpoint_threshold_amount=90,�)�chunks = chunker.split_text(document_text)"><div></div></button></div></figure></div>
237<p>Semantic chunking groups sentences with similar embeddings. When the similarity drops below the threshold, a new chunk starts. The result: chunks that align with topic boundaries rather than arbitrary token counts.</p>
238<p><strong>Hierarchical chunking</strong> (parent-child — best retrieval quality):</p>
239<div class="expressive-code"><figure class="frame not-content"><figcaption class="header"></figcaption><pre data-language="python"><code><div class="ec-line"><div class="code"><span style="--0:#FF9492">from</span><span style="--0:#F0F3F6"> langchain.text_splitter </span><span style="--0:#FF9492">import</span><span style="--0:#F0F3F6"> RecursiveCharacterTextSplitter</span></div></div><div class="ec-line"><div class="code">
240</div></div><div class="ec-line"><div class="code"><span style="--0:#BDC4CC"># Small child chunks for precise retrieval</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">child_splitter </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> RecursiveCharacterTextSplitter(</span><span style="--0:#FFB757">chunk_size</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">256</span><span style="--0:#F0F3F6">, </span><span style="--0:#FFB757">chunk_overlap</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">30</span><span style="--0:#F0F3F6">)</span></div></div><div class="ec-line"><div class="code">
241</div></div><div class="ec-line"><div class="code"><span style="--0:#BDC4CC"># Large parent chunks for rich LLM context</span></div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">parent_splitter </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> RecursiveCharacterTextSplitter(</span><span style="--0:#FFB757">chunk_size</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">1024</span><span style="--0:#F0F3F6">, </span><span style="--0:#FFB757">chunk_overlap</span><span style="--0:#FF9492">=</span><span style="--0:#91CBFF">100</span><span style="--0:#F0F3F6">)</span></div></div><div class="ec-line"><div class="code">
242</div></div><div class="ec-line"><div class="code"><span style="--0:#F0F3F6">parent_chunks </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> parent_splitter.split_text(document_text)</span></div></div><div class="ec-line"><div class="code"><span style="--0:#FF9492">for</span><span style="--0:#F0F3F6"> parent </span><span style="--0:#FF9492">in</span><span style="--0:#F0F3F6"> parent_chunks:</span></div></div><div class="ec-line"><div class="code"><span class="indent"><span style="--0:#F0F3F6">    </span></span><span style="--0:#F0F3F6">children </span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6"> child_splitter.split_text(parent)</span></div></div><div class="ec-line"><div class="code"><span class="indent">    </span><span style="--0:#FF9492">for</span><span style="--0:#F0F3F6"> child </span><span style="--0:#FF9492">in</span><span style="--0:#F0F3F6"> children:</span></div></div><div class="ec-line"><div class="code"><span class="indent">        </span><span style="--0:#BDC4CC"># Store child embedding → link to parent text</span></div></div><div class="ec-line"><div class="code"><span class="indent"><span style="--0:#F0F3F6">        </span></span><span style="--0:#F0F3F6">store(</span><span style="--0:#FFB757">child_embedding</span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6">embed(child), </span><span style="--0:#FFB757">parent_text</span><span style="--0:#FF9492">=</span><span style="--0:#F0F3F6">parent)</span></div></div></code></pre><div class="copy"><div aria-live="polite"></div><button title="Copy to clipboard" data-copied="Copied!" data-code="from langchain.text_splitter import RecursiveCharacterTextSplitter��# Small child chunks for precise retrieval�child_splitter = RecursiveCharacterTextSplitter(chunk_size=256, chunk_overlap=30)��# Large parent chunks for rich LLM context�parent_splitter = RecursiveCharacterTextSplitter(chunk_size=1024, 
242chunk_overlap=100)��parent_chunks = parent_splitter.split_text(document_text)�for parent in parent_chunks:�    children = child_splitter.split_text(parent)�    for child in children:�        # Store child embedding → link to parent text�        store(child_embedding=embed(child), parent_text=parent)"><div></div></button></div></figure></div>
243<p>At query time, you search against child embeddings (precise matching) but return the parent text to the LLM (rich context). This is the technique that consistently produces the biggest retrieval quality improvement in production systems.</p>
244<div class="sl-heading-wrapper level-h3"><h3 id="chunking-pipeline">Chunking Pipeline</h3><a class="sl-anchor-link" href="#chunking-pipeline"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Chunking Pipeline”</span></a></div>
245<div class="sl-heading-wrapper level-h3"><h3 id="-visual-explanation-1">📊 Visual Explanation</h3><a class="sl-anchor-link" href="#-visual-explanation-1"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “📊 Visual Explanation”</span></a></div>
246<astro-island uid="GTur1" prefix="r5" component-url="/_astro/FlowDiagram.DhV5anj3.js" component-export="FlowDiagram" renderer-url="/_astro/client.Dc9Vh3na.js" props="{&quot;title&quot;:[0,&quot;RAG Chunking Strategy Pipeline&quot;],&quot;subtitle&quot;:[0,&quot;Start simple, upgrade when retrieval metrics show gaps. Most teams stop at semantic or hierarchical.&quot;],&quot;layout&quot;:[0,&quot;columns&quot;],&quot;stages&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;1. Fixed-Size&quot;],&quot;sublabel&quot;:[0,&quot;Split every N tokens&quot;],&quot;color&quot;:[0,&quot;cyan&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Fast to implement&quot;]}],[0,{&quot;label&quot;:[0,&quot;No NLP dependencies&quot;]}],[0,{&quot;label&quot;:[0,&quot;Breaks mid-sentence&quot;]}],[0,{&quot;label&quot;:[0,&quot;Use for: prototypes&quot;]}]]]}],[0,{&quot;label&quot;:[0,&quot;2. Semantic&quot;],&quot;sublabel&quot;:[0,&quot;Split on topic boundaries&quot;],&quot;color&quot;:[0,&quot;blue&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Paragraph-aware splits&quot;]}],[0,{&quot;label&quot;:[0,&quot;Embedding similarity&quot;]}],[0,{&quot;label&quot;:[0,&quot;Variable chunk sizes&quot;]}],[0,{&quot;label&quot;:[0,&quot;Use for: most production&quot;]}]]]}],[0,{&quot;label&quot;:[0,&quot;3. Hierarchical&quot;],&quot;sublabel&quot;:[0,&quot;Child retrieval, parent context&quot;],&quot;color&quot;:[0,&quot;purple&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Small chunks → precise match&quot;]}],[0,{&quot;label&quot;:[0,&quot;Large chunks → rich context&quot;]}],[0,{&quot;label&quot;:[0,&quot;2x storage cost&quot;]}],[0,{&quot;label&quot;:[0,&quot;Use for: high-quality RAG&quot;]}]]]}],[0,{&quot;label&quot;:[0,&quot;4. Agentic&quot;],&quot;sublabel&quot;:[0,&quot;
246LLM-decided boundaries&quot;],&quot;color&quot;:[0,&quot;green&quot;],&quot;nodes&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Content-aware splitting&quot;]}],[0,{&quot;label&quot;:[0,&quot;Best boundary quality&quot;]}],[0,{&quot;label&quot;:[0,&quot;Expensive indexing&quot;]}],[0,{&quot;label&quot;:[0,&quot;Use for: high-value docs&quot;]}]]]}]]]}" ssr client="visible" opts="{&quot;name&quot;:&quot;FlowDiagram&quot;,&quot;value&quot;:true}" await-children><div role="group" aria-label="RAG Chunking Strategy Pipeline" style="background:#12121A;border:1px solid rgba(255,255,255,0.07);border-radius:16px;padding:24px;margin:1.5rem 0;position:relative;font-family:inherit"><div style="margin-bottom:18px;padding-right:80px"><p style="margin:0;font-size:0.9375rem;font-weight:700;color:#F8FAFC;letter-spacing:-0.01em">RAG Chunking Strategy Pipeline</p><p style="margin:3px 0 0;font-size:0.8rem;color:#8494A7">Start simple, upgrade when retrieval metrics show gaps. Most teams stop at semantic or hierarchical.</p></div><button aria-label="Pause animation" style="position:absolute;top:14px;right:14px;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.10);border-radius:8px;padding:8px 14px;color:#94A3B8;cursor:pointer;font-size:0.72rem;display:flex;align-items:center;gap:5px;min-width:44px;min-height:44px;justify-content:center"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause" aria-hidden="true"><rect x="14" y="3" width="5" height="18" rx="1"></rect><rect x="5" y="3" width="5" height="18" rx="1"></rect></svg>Pause</button><div style="display:flex;gap:0;align-items:stretch;flex-wrap:wrap"><div style="flex:1;min-width:140px;background:rgba(255,255,255,0.025);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:1px solid rgba(255,255,255,0.07);border-top:3px solid #00D9FF;border-radius:12px;padding:14px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="margin-bottom:10px"><div style="font-size:0.8125rem;font-weight:700;color:#00D9FF;line-height:1.3">1. Fixed-Size</div><div style="font-size:0.7rem;color:#8494A7;margin-top:2px">Split every N tokens</div></div><div style="display:flex;flex-direction:column;gap:5px"><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #00D9FF;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Fast to implement</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #00D9FF;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">No NLP dependencies</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #00D9FF;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Breaks mid-sentence</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #00D9FF;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Use for: prototypes</div></div></div></div><div style="display:flex;align-items:center;justify-content:center;padding:0 6px;flex-shrink:0;color:#334155;align-self:center;opacity:0;transform:translateY(18px)"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
246ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true"><path d="m9 18 6-6-6-6"></path></svg></div><div style="flex:1;min-width:140px;background:rgba(255,255,255,0.025);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:1px solid rgba(255,255,255,0.07);border-top:3px solid #0EA5E9;border-radius:12px;padding:14px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="margin-bottom:10px"><div style="font-size:0.8125rem;font-weight:700;color:#0EA5E9;line-height:1.3">2. Semantic</div><div style="font-size:0.7rem;color:#8494A7;margin-top:2px">Split on topic boundaries</div></div><div style="display:flex;flex-direction:column;gap:5px"><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #0EA5E9;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Paragraph-aware splits</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #0EA5E9;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Embedding similarity</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #0EA5E9;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Variable chunk sizes</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #0EA5E9;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Use for: most production</div></div></div></div><div style="display:flex;align-items:center;justify-content:center;padding:0 6px;flex-shrink:0;color:#334155;align-self:center;opacity:0;transform:translateY(18px)"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true"><path d="m9 18 6-6-6-6"></path></svg></div><div style="flex:1;min-width:140px;background:rgba(255,255,255,0.025);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:1px solid rgba(255,255,255,0.07);border-top:3px solid #8B5CF6;border-radius:12px;padding:14px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="margin-bottom:10px"><div style="font-size:0.8125rem;font-weight:700;color:#C4B5FD;line-height:1.3">3. Hierarchical</div><div style="font-size:0.7rem;color:#8494A7;margin-top:2px">Child retrieval, parent context</div></div><div style="display:flex;flex-direction:column;gap:5px"><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #8B5CF6;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Small chunks → precise match</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #8B5CF6;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Large chunks → rich context</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #8B5CF6;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">2x storage cost</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #8B5CF6;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Use for: high-quality RAG</div></div></div></div><div style="display:flex;align-items:center;justify-content:center;padding:0 6px;flex-shrink:0;color:#334155;align-self:center;opacity:0;transform:translateY(18px)"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewB
246ox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-right" aria-hidden="true"><path d="m9 18 6-6-6-6"></path></svg></div><div style="flex:1;min-width:140px;background:rgba(255,255,255,0.025);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:1px solid rgba(255,255,255,0.07);border-top:3px solid #10B981;border-radius:12px;padding:14px;transition:border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="margin-bottom:10px"><div style="font-size:0.8125rem;font-weight:700;color:#34D399;line-height:1.3">4. Agentic</div><div style="font-size:0.7rem;color:#8494A7;margin-top:2px">LLM-decided boundaries</div></div><div style="display:flex;flex-direction:column;gap:5px"><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #10B981;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Content-aware splitting</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #10B981;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Best boundary quality</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #10B981;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Expensive indexing</div></div><div style="padding:7px 9px;background:rgba(255,255,255,0.02);border-top:1px solid rgba(255,255,255,0.05);border-right:1px solid rgba(255,255,255,0.05);border-bottom:1px solid rgba(255,255,255,0.05);border-left:2px solid #10B981;border-radius:7px;transition:background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;box-shadow:none;opacity:0;transform:translateX(-8px)"><div style="font-size:0.8rem;font-weight:500;color:#CBD5E1;transition:color 0.25s ease;line-height:1.3">Use for: high-value docs</div></div></div></div></div><div style="margin-top:14px;display:flex;align-items:center;gap:8px"><div style="width:7px;height:7px;border-radius:50%;flex-shrink:0"></div><span style="font-size:0.68rem;color:#8494A7;text-transform:uppercase;letter-spacing:0.06em">Idle</span></div></div><!--astro:end--></astro-island>
247<div class="sl-heading-wrapper level-h3"><h3 id="embedding-models">Embedding Models</h3><a class="sl-anchor-link" href="#embedding-models"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Embedding Models”</span></a></div>
248<p>An embedding model converts a chunk of text into a dense vector — a list of hundreds or thousands of floating-point numbers that encodes the text’s semantic meaning. Chunks with similar meaning have vectors that are close in the high-dimensional space; chunks with different meanings have vectors that are far apart.</p>
249<p>The quality of your embedding model is the quality ceiling for your retrieval. A retrieval system that uses a weak embedding model cannot be fixed by improving the vector search algorithm — the signal is lost before search begins.
249</p>
250<p>Common options in 2026:</p>
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286<table><thead><tr><th>Model</th><th>Dimensions</th><th>Best For</th></tr></thead><tbody><tr><td><code dir="auto">text-embedding-3-small</code> (OpenAI)</td><td>1536</td><td>Cost-efficient general use</td></tr><tr><td><code dir="auto">text-embedding-3-large</code> (OpenAI)</td><td>3072</td><td>Higher quality, higher cost</td></tr><tr><td><code dir="auto">embed-english-v3.0</code> (Cohere)</td><td>1024</td><td>Strong general quality</td></tr><tr><td><code dir="auto">nomic-embed-text-v1.5</code> (open source)</td><td>768</td><td>Self-hosted deployments</td></tr><tr><td><code dir="auto">bge-large-en-v1.5</code> (BAAI, open source)</td><td>1024</td><td>Strong open-source baseline</td></tr></tbody></table>
287<div class="sl-heading-wrapper level-h3"><h3 id="vector-databases">Vector Databases</h3><a class="sl-anchor-link" href="#vector-databases"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Vector Databases”</span></a></div>
288<p>A vector database stores embeddings alongside their source text and metadata, and supports fast approximate nearest-neighbor (ANN) search. ANN returns vectors close to a query vector without checking every vector in the database — this is what makes vector search fast at scale.</p>
289<p>Most vector databases use <strong>HNSW (Hierarchical Navigable Small World)</strong> indexing, a graph-based ANN algorithm that provides excellent speed-quality tradeoffs.</p>
290<p>See <a href="/tools/vector-db-comparison/">Vector Database Comparison</a> for a detailed comparison of Pinecone, Weaviate, Qdrant, and Chroma.</p>
291<div class="sl-heading-wrapper level-h3"><h3 id="hybrid-search">Hybrid Search</h3><a class="sl-anchor-link" href="#hybrid-search"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Hybrid Search”</span></a></div>
292<p>Pure vector search retrieves semantically similar documents. It handles synonyms and paraphrasing well. But it struggles with exact matches — rare proper nouns, product codes, technical identifiers. A query for “JIRA-12345” might retrieve semantically similar tickets rather than that specific ticket.</p>
293<p><strong>Hybrid search</strong> combines vector search with keyword search (typically BM25, a classical term-frequency algorithm). The two result sets are merged using <strong>Reciprocal Rank Fusion (RRF)</strong> or a weighted combination. The result is significantly better recall: semantic search handles meaning, keyword search handles precision on exact terms.</p>
294<p>Hybrid search is the default choice for production systems with heterogeneous document types.</p>
295<div class="sl-heading-wrapper level-h3"><h3 id="-visual-explanation-2">📊 Visual Explanation</h3><a class="sl-anchor-link" href="#-visual-explanation-2"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24">
295<path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “📊 Visual Explanation”</span></a></div>
296<style>astro-island,astro-slot,astro-static-slot{display:contents}</style>
296<script>(()=>{var a=(s,i,o)=>{let r=async()=>{await(await s())()},t=typeof i.value=="object"?i.value:void 0,c={rootMargin:t==null?void 0:t.rootMargin},n=new IntersectionObserver(e=>{for(let l of e)if(l.isIntersecting){n.disconnect(),r();break}},c);for(let e of o.children)n.observe(e)};(self.Astro||(self.Astro={})).visible=a;window.dispatchEvent(new Event("astro:visible"));})();</script>
296<script>(()=>{var A=Object.defineProperty;var g=(i,o,a)=>o in i?A(i,o,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[o]=a;var d=(i,o,a)=>g(i,typeof o!="symbol"?o+"":o,a);{let i={0:t=>m(t),1:t=>a(t),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(a(t)),5:t=>new Set(a(t)),6:t=>BigInt(t),7:t=>new URL(t),8:t=>new Uint8Array(t),9:t=>new Uint16Array(t),10:t=>new Uint32Array(t),11:t=>1/0*t},o=t=>{let[l,e]=t;return l in i?i[l](e):void 0},a=t=>t.map(o),m=t=>typeof t!="object"||t===null?t:Object.fromEntries(Object.entries(t).map(([l,e])=>[l,o(e)]));class y extends HTMLElement{constructor(){super(...arguments);d(this,"Component");d(this,"hydrator");d(this,"hydrate",async()=>{var b;if(!this.hydrator||!this.isConnected)return;let e=(b=this.parentElement)==null?void 0:b.closest("astro-island[ssr]");if(e){e.addEventListener("astro:hydrate",this.hydrate,{once:!0});return}let c=this.querySelectorAll("astro-slot"),n={},h=this.querySelectorAll("template[data-astro-template]");for(let r of h){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("data-astro-template")||"default"]=r.innerHTML,r.remove())}for(let r of c){let s=r.closest(this.tagName);s!=null&&s.isSameNode(this)&&(n[r.getAttribute("name")||"default"]=r.innerHTML)}let p;try{p=this.hasAttribute("props")?m(JSON.parse(this.getAttribute("props"))):{}}catch(r){let s=this.getAttribute("component-url")||"<unknown>",v=this.getAttribute("component-export");throw v&&(s+=` (export ${v})`),console.error(`[hydrate] Error parsing props for component ${s}`,this.getAttribute("props"),r),r}let u;await this.hydrator(this)(this.Component,p,n,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),this.dispatchEvent(new CustomEvent("astro:hydrate"))});d(this,"unmount",()=>{this.isConnected||this.dispatchEvent(new CustomEvent("astro:unmount"))})}disconnectedCallback(){document.removeEventListener("astro:after-swap",this.unmount),document.addEventListener("astro:after-swap",this.unmount,{once:!0})}connectedCallback(){if(!this.hasAttribute("await-children")||document.readyState==="interactive"||document.readyState==="complete")this.childrenConnectedCallback();else{let e=()=>{document.removeEventListener("DOMContentLoaded",e),c.disconnect(),this.childrenConnectedCallback()},c=new MutationObserver(()=>{var n;((n=this.lastChild)==null?void 0:n.nodeType)===Node.COMMENT_NODE&&this.lastChild.nodeValue==="astro:end"&&(this.lastChild.remove(),e())});c.observe(this,{childList:!0}),document.addEventListener("DOMContentLoaded",e)}}async childrenConnectedCallback(){let e=this.getAttribute("before-hydration-url");e&&await import(e),this.start()}async start(){let e=JSON.parse(this.getAttribute("opts")),c=this.getAttribute("client");if(Astro[c]===void 0){window.addEventListener(`astro:${c}`,()=>this.start(),{once:!0});return}try{await Astro[c](async()=>{let n=this.getAttribute("renderer-url"),[h,{default:p}]=await Promise.all([import(this.getAttribute("component-url")),n?import(n):()=>()=>{}]),u=this.getAttribute("component-export")||"default";if(!u.includes("."))this.Component=h[u];else{this.Component=h;for(let f of u.split("."))this.Component=this.Component[f]}return this.hydrator=p,this.hydrate},e,this)}catch(n){console.error(`[astro-island] Error hydrating ${this.getAttribute("component-url")}`,n)}}attributeChangedCallback(){this.hydrate()}}d(y,"observedAttributes",["props"]),customElements.get("astro-island")||customElements.define("astro-island",y)}})();</script>
296<astro-island uid="Z1A77ys" prefix="r6" component-url="/_astro/StackDiagram.DQreU5Zv.js" component-export="StackDiagram" renderer-url="/_astro/client.Dc9Vh3na.js" props="{&quot;title&quot;:[0,&quot;RAG Retrieval Quality Stack&quot;],&quot;subtitle&quot;:[0,&quot;Each layer improves retrieval quality. Most production systems use hybrid search and reranking on top of basic vector search.&quot;],&quot;flowDirection&quot;:[0,&quot;both&quot;],&quot;packetLabel&quot;:[0,&quot;Query&quot;],&quot;layers&quot;:[1,[[0,{&quot;label&quot;:[0,&quot;Basic Vector Search&quot;],&quot;sublabel&quot;:[0,&quot;Semantic similarity — fast but misses exact matches and rare terms&quot;],&quot;color&quot;:[0,&quot;cyan&quot;]}],[0,{&quot;label&quot;:[0,&quot;Hybrid Search (BM25 + Vector)&quot;],&quot;sublabel&quot;:[0,&quot;Combines semantic and keyword retrieval via Reciprocal Rank Fusion — significantly better recall&quot;],&quot;color&quot;:[0,&quot;blue&quot;]}],[0,{&quot;label&quot;:[0,&quot;Reranking&quot;],&quot;sublabel&quot;:[0,&quot;Cross-encoder model scores each retrieved chunk against the query — improves precision of top-k&quot;],&quot;color&quot;:[0,&quot;purple&quot;]}],[0,{&quot;label&quot;:[0,&quot;Context Compression&quot;],&quot;sublabel&quot;:[0,&quot;Extract only the relevant sentences from each chunk — reduces noise in the LLM&#39;s context window&quot;],&quot;color&quot;:[0,&quot;violet&quot;]}]]]}" ssr client="visible" opts="{&quot;name&quot;:&quot;StackDiagram&quot;,&quot;value&quot;:true}" await-children><div role="group" aria-label="RAG Retrieval Quality Stack" style="background:#12121A;border:1px solid rgba(255,255,255,0.07);border-radius:16px;padding:24px;margin:1.5rem 0;position:relative;font-family:inherit"><div style="margin-bottom:18px;padding-right:80px"><p style="margin:0;font-size:0.9375rem;font-weight:700;color:#F8FAFC;letter-spacing:-0.01em">RAG Retrieval Quality Stack</p><p style="margin:3px 0 0;font-size:0.8rem;color:#8494A7">Each layer improves retrieval quality. Most production systems use hybrid search and reranking on top of basic vector search.</p></div><button aria-label="Pause animation" style="position:absolute;top:14px;right:14px;background:rgba(255,255,255,0.05);border:1px solid rgba(255,255,255,0.10);border-radius:8px;padding:8px 14px;color:#94A3B8;cursor:pointer;font-size:0.72rem;display:flex;align-items:center;gap:5px;transition:background 0.2s;min-width:44px;min-height:44px;justify-content:center"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pause" aria-hidden="true"><rect x="14" y="3" width="5" height="18" rx="1"></rect><rect x="5" y="3" width="5" height="18" rx="1"></rect></svg>Pause</button><div style="display:flex;flex-direction:column;gap:5px"><div style="display:flex;align-items:center;gap:11px;padding:13px 15px;background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #00D9FF;border-radius:10px;transition:background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="width:8px;height:8px;border-radius:50%;background:#00D9FF;flex-shrink:0;box-shadow:none;transition:box-shadow 0.35s ease"></div><div style="flex:1;min-width:0"><div style="font-size:0.875rem;font-weight:600;color:#E2E8F0;transition:color 0.3s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Basic Vector Search</div><div style="font-size:0.75rem;color:#8494A7;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Semantic similarity — fast but misses exact matches and rare terms</div></div></div><div style="display:flex;align-items:center;gap:11px;padding:13px 15px;background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #0EA5E9;border-radius:10px;transition:background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="width:8px;height:8px;border-radius:50%;background:#0EA5E9;flex-shrink:0;box-shadow:none;
296transition:box-shadow 0.35s ease"></div><div style="flex:1;min-width:0"><div style="font-size:0.875rem;font-weight:600;color:#E2E8F0;transition:color 0.3s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Hybrid Search (BM25 + Vector)</div><div style="font-size:0.75rem;color:#8494A7;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Combines semantic and keyword retrieval via Reciprocal Rank Fusion — significantly better recall</div></div></div><div style="display:flex;align-items:center;gap:11px;padding:13px 15px;background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #8B5CF6;border-radius:10px;transition:background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="width:8px;height:8px;border-radius:50%;background:#8B5CF6;flex-shrink:0;box-shadow:none;transition:box-shadow 0.35s ease"></div><div style="flex:1;min-width:0"><div style="font-size:0.875rem;font-weight:600;color:#E2E8F0;transition:color 0.3s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Reranking</div><div style="font-size:0.75rem;color:#8494A7;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Cross-encoder model scores each retrieved chunk against the query — improves precision of top-k</div></div></div><div style="display:flex;align-items:center;gap:11px;padding:13px 15px;background:rgba(255,255,255,0.025);border-top:1px solid rgba(255,255,255,0.07);border-right:1px solid rgba(255,255,255,0.07);border-bottom:1px solid rgba(255,255,255,0.07);border-left:3px solid #A78BFA;border-radius:10px;transition:background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;box-shadow:none;opacity:0;transform:translateY(18px)"><div style="width:8px;height:8px;border-radius:50%;background:#A78BFA;flex-shrink:0;box-shadow:none;transition:box-shadow 0.35s ease"></div><div style="flex:1;min-width:0"><div style="font-size:0.875rem;font-weight:600;color:#E2E8F0;transition:color 0.3s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Context Compression</div><div style="font-size:0.75rem;color:#8494A7;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">Extract only the relevant sentences from each chunk — reduces noise in the LLM&#x27;s context window</div></div></div></div><div style="margin-top:14px;display:flex;align-items:center;gap:8px"><div style="width:7px;height:7px;border-radius:50%"></div><span style="font-size:0.68rem;color:#8494A7;text-transform:uppercase;letter-spacing:0.06em">Idle</span></div></div><!--astro:end--></astro-island>
297<div class="sl-heading-wrapper level-h3"><h3 id="reranking">Reranking</h3><a class="sl-anchor-link" href="#reranking"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Reranking”</span></a></div>
298<p>The initial retrieval step returns the top-k most similar chunks (typically k=10–20) using approximate nearest-neighbor search. This is fast but approximate — the similarity scores are directional, not precise relevance scores.</p>
299<p><strong>Reranking</strong> applies a more expensive but more accurate model to score each retrieved chunk against the query. The reranker has access to both the query and the candidate chunk simultaneously, allowing it to model their interaction directly. The top 3–5 chunks after reranking are what actually go into the prompt.</p>
300<p>Reranking models are typically <strong>cross-encoders</strong> — models that read both the query and the candidate document as a single input. Popular options include Cohere Rerank, together with open-source cross-encoders from sentence-transformers. The cost is one reranker inference call per retrieved chunk — acceptable overhead for the quality improvement.</p>
301<hr>
302<div class="sl-heading-wrapper level-h2"><h2 id="4-build-a-rag-pipeline-step-by-step">4. Build a RAG Pipeline Step by Step</h2><a class="sl-anchor-link" href="#4-build-a-rag-pipeline-step-by-step"><span aria-hidden="true" class="sl-anchor-icon">
302<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “4. Build a RAG Pipeline Step by Step”</span></a></div>
303<p>A production RAG system has two pipelines — an ingestion pipeline that processes and indexes documents, and a query pipeline that retrieves and synthesizes answers.</p>
304<div class="sl-heading-wrapper level-h3"><h3 id="building-the-indexing-pipeline">Building the Indexing Pipeline</h3><a class="sl-anchor-link" href="#building-the-indexing-pipeline"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Building the Indexing Pipeline”</span></a></div>
305<p><strong>Step 1: Document loading</strong></p>
306<p>Every document type requires a different loader. PDFs require OCR or text extraction (PyMuPDF or pdfplumber for simple PDFs; Tesseract or Azure Document Intelligence for scanned or complex layouts). Web pages require HTML parsing (BeautifulSoup or Trafilatura). Databases require SQL queries. Each loader must handle encoding issues, corrupt files, and access control.</p>
307<p>The output of this step is a list of <code dir="auto">Document</code> objects, each containing the full text and metadata (source URL, file path, creation date, author, section headings).</p>
308<p><strong>Step 2: Chunking</strong></p>
309<p>Apply your chosen chunking strategy. For most production systems: use semantic chunking (paragraph or section boundaries) as the base, with a maximum chunk size of 512–1024 tokens. Store chunk metadata that preserves the parent document context — you will need this for citation and source attribution.</p>
310<p>If using parent-child chunking: create two embeddings per logical unit — the small child chunk for retrieval, and a reference to the larger parent chunk for context delivery.</p>
311<p><strong>Step 3: Embedding</strong></p>
312<p>Call your embedding model API (or run locally) for each chunk. This is typically the most expensive step in the indexing pipeline. For 100,000 chunks at 512 tokens each, using <code dir="auto">text-embedding-3-small</code> at $0.02/million tokens, the cost is approximately $1.00. For 10 million chunks, it is approximately $100.</p>
313<p>Batch your embedding calls to minimize API overhead. Most embedding APIs support batches of 100–2048 inputs per call.</p>
314<p><strong>Step 4: Storage</strong></p>
315<p>Upsert the vector + metadata into your vector database. Upsert (insert-or-update) is preferable to insert because it handles re-indexing when documents change. Include enough metadata to support filtering (by document type, date, access level) and source attribution.</p>
316<div class="sl-heading-wrapper level-h3"><h3 id="building-the-retrieval-pipeline">Building the Retrieval Pipeline</h3><a class="sl-anchor-link" href="#building-the-retrieval-pipeline"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Building the Retrieval Pipeline”</span></a></div>
317<p><strong>Step 1: Query embedding</strong></p>
318<p>Embed the user’s query using the same model used for document indexing. This is critical — you cannot mix embedding models between indexing and retrieval.</p>
319<p><strong>Step 2: Vector search (and hybrid search)</strong></p>
320<p>Submit the query vector to your vector database. For hybrid search: also submit the query as a keyword search using the vector DB’s BM25 or full-text search capability. Merge results using Reciprocal Rank Fu
320sion.</p>
321<p><strong>Step 3: Reranking (optional but recommended)</strong></p>
322<p>Submit the top-k retrieved chunks along with the original query to your reranker. Receive relevance scores. Keep the top 3–5 chunks by relevance score.</p>
323<p><strong>Step 4: Prompt assembly</strong></p>
324<p>Construct the final prompt: system instructions explaining the RAG task, the retrieved chunks (typically formatted as numbered sources), and the user’s question. Include instructions about citation format and what to do if the context does not contain the answer.</p>
325<p><strong>Step 5: LLM generation</strong></p>
326<p>Submit the assembled prompt to the LLM. The model generates an answer grounded in the retrieved context. A well-designed RAG prompt instructs the model to cite its sources by reference number and to say “I don’t have information on this” when the retrieved context is insufficient.</p>
327<hr>
328<div class="sl-heading-wrapper level-h2"><h2 id="5-rag-architecture-and-design">5. RAG Architecture and Design</h2><a class="sl-anchor-link" href="#5-rag-architecture-and-design"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “5. RAG Architecture and Design”</span></a></div>
329<p>Three RAG implementation patterns handle increasingly complex retrieval scenarios — from simple single-step lookup to iterative multi-hop reasoning.</p>
330<div class="sl-heading-wrapper level-h3"><h3 id="naive-rag-vs-advanced-rag">Naive RAG vs Advanced RAG</h3><a class="sl-anchor-link" href="#naive-rag-vs-advanced-rag"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Naive RAG vs Advanced RAG”</span></a></div>
331<p>The gap between a naive RAG implementation and a production-grade one is large. Most of the quality improvement comes from systematic improvements to chunking, retrieval, and evaluation.</p>
332<div class="sl-heading-wrapper level-h3"><h3 id="-visual-explanation-3">📊 Visual Explanation</h3><a class="sl-anchor-link" href="#-visual-explanation-3"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “📊 Visual Explanation”</span></a></div>
333<astro-island uid="23Hgsv" prefix="r7" component-url="/_astro/ComparisonDiagram.CbHdApJ0.js" component-export="ComparisonDiagram" renderer-url="/_astro/client.Dc9Vh3na.js" props="{&quot;title&quot;:[0,&quot;Naive RAG vs Advanced RAG&quot;],&quot;left&quot;:[0,{&quot;label&quot;:[0,&quot;Naive RAG&quot;],&quot;color&quot;:[0,&quot;cyan&quot;],&quot;tagline&quot;:[0,&quot;Fixed chunks, vector search only, stuff-and-generate&quot;],&quot;items&quot;:[1,[[0,{&quot;text&quot;:[0,&quot;Fixed-size chunking with arbitrary token boundaries&quot;],&quot;sentiment&quot;:[0,&quot;negative&quot;]}],[0,{&quot;text&quot;:[0,&quot;Single-vector semantic search only&quot;],&quot;sentiment&quot;:[0,&quot;negative&quot;]}],[0,{&quot;text&quot;:[0,&quot;Top-k chunks inserted verbatim into prompt&quot;],&quot;sentiment&quot;:[0,&quot;negative&quot;]}],[0,{&quot;text&quot;:[0,&quot;No reranking — retrieval order determines context priority&quot;],&quot;sentiment&quot;:[0,&quot;negative&quot;]}],[0,{&quot;text&quot;:[0,&quot;Simple to implement — works well on clean single-topic documents&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;Fast to prototype and evaluate against a baseline&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}]]]}],&quot;right&quot;:[0,{&quot;label&quot;:[0,&quot;Advanced RAG&quot;],&quot;color&quot;:[0,&quot;blue&quot;],&quot;tagline&quot;:[0,&quot;Semantic chunks, hybrid search, reranking, evaluation loop&quot;],&quot;items&quot;:[1,[[0,{&quot;text&quot;:[0,&quot;Semantic or hierarchical chunking preserves context boundaries&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;Hybrid search (BM25 + vector) improves recall significantly&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;Reranker model scores chunks for precise relevance ordering&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;Context compression removes noise before LLM ingestion&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;RAGAS evaluation pipeline measures retrieval and answer quality&quot;],&quot;sentiment&quot;:[0,&quot;positive&quot;]}],[0,{&quot;text&quot;:[0,&quot;
333Significantly more implementation and infrastructure complexity&quot;],&quot;sentiment&quot;:[0,&quot;negative&quot;]}]]]}],&quot;verdict&quot;:[0,&quot;Start with naive RAG to establish a baseline. Adopt advanced techniques selectively based on where your RAGAS evaluation shows quality gaps.&quot;],&quot;useCase&quot;:[0,{&quot;left&quot;:[0,&quot;Prototypes, demos, single-topic corpora with clean documents and lenient quality requirements&quot;],&quot;right&quot;:[0,&quot;Production systems with heterogeneous document types, strict quality requirements, or large corpora&quot;]}]}" ssr client="visible" opts="{&quot;name&quot;:&quot;ComparisonDiagram&quot;,&quot;value&quot;:true}" await-children><div role="group" aria-label="Naive RAG vs Advanced RAG" style="margin:1.5rem 0;font-family:inherit"><p style="margin:0 0 16px;font-size:0.9375rem;font-weight:700;color:#F8FAFC;text-align:center;opacity:0;transform:translateY(-8px)">Naive RAG vs Advanced RAG</p><div style="display:flex;gap:12px;align-items:stretch;flex-wrap:wrap"><div style="flex:1;background:rgba(18,18,26,0.72);backdrop-filter:blur(16px);border-right:1px solid #00D9FF;border-bottom:1px solid #00D9FF;border-left:1px solid #00D9FF;border-top:3px solid #00D9FF;border-radius:12px;padding:20px;box-shadow:0 0 8px rgba(0,217,255,0.10);min-width:0"><div style="margin-bottom:16px"><div style="font-size:1rem;font-weight:700;color:#00D9FF;letter-spacing:-0.01em">Naive RAG</div><div style="font-size:0.75rem;color:#8494A7;margin-top:3px">Fixed chunks, vector search only, stuff-and-generate</div></div><ul style="list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px"><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x" aria-hidden="true" style="color:#F87171;flex-shrink:0"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Fixed-size chunking with arbitrary token boundaries</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x" aria-hidden="true" style="color:#F87171;flex-shrink:0"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Single-vector semantic search only</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x" aria-hidden="true" style="color:#F87171;flex-shrink:0"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Top-k chunks inserted verbatim into prompt</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x" aria-hidden="true" style="color:#F87171;flex-shrink:0"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">No reranking — retrieval order determines context priority</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Simple to implement — works well on clean single-topic documents</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Fast to prototype and evaluate against a baseline</span></li></ul></div><div style="display:flex;align-items:center;justify-content:center;padding:0 4px;flex-shrink:0;
333opacity:0;transform:scale(0.5)"><div style="width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,0.06);border:1px solid rgba(255,255,255,0.12);display:flex;align-items:center;justify-content:center;font-size:0.7rem;font-weight:700;color:#8494A7;letter-spacing:0.05em">VS</div></div><div style="flex:1;background:rgba(18,18,26,0.72);backdrop-filter:blur(16px);border-right:1px solid #0EA5E9;border-bottom:1px solid #0EA5E9;border-left:1px solid #0EA5E9;border-top:3px solid #0EA5E9;border-radius:12px;padding:20px;box-shadow:0 0 8px rgba(14,165,233,0.10);min-width:0"><div style="margin-bottom:16px"><div style="font-size:1rem;font-weight:700;color:#38BDF8;letter-spacing:-0.01em">Advanced RAG</div><div style="font-size:0.75rem;color:#8494A7;margin-top:3px">Semantic chunks, hybrid search, reranking, evaluation loop</div></div><ul style="list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px"><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Semantic or hierarchical chunking preserves context boundaries</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Hybrid search (BM25 + vector) improves recall significantly</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Reranker model scores chunks for precise relevance ordering</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">Context compression removes noise before LLM ingestion</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check" aria-hidden="true" style="color:#34D399;flex-shrink:0"><path d="M20 6 9 17l-5-5"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">RAGAS evaluation pipeline measures retrieval and answer quality</span></li><li style="display:flex;align-items:flex-start;gap:8px;padding:8px 10px;background:rgba(255,255,255,0.025);border-radius:7px;border:1px solid rgba(255,255,255,0.05);opacity:0;transform:translateX(-12px)"><svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-x" aria-hidden="true" style="color:#F87171;flex-shrink:0"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg><span style="font-size:0.8125rem;color:#CBD5E1;line-height:1.5">
333Significantly more implementation and infrastructure complexity</span></li></ul></div></div><div style="margin-top:12px;padding:12px 16px;background:rgba(0,217,255,0.06);border:1px solid rgba(0,217,255,0.18);border-radius:10px;font-size:0.8125rem;color:#94A3B8;line-height:1.6;text-align:center;opacity:0;transform:translateY(10px)"><span style="color:#00D9FF;font-weight:600">Verdict: </span>Start with naive RAG to establish a baseline. Adopt advanced techniques selectively based on where your RAGAS evaluation shows quality gaps.</div><div style="margin-top:8px;display:flex;gap:8px;flex-wrap:wrap;opacity:0;transform:translateY(8px)"><div style="flex:1;padding:10px 14px;background:rgba(0,217,255,0.08);border:1px solid rgba(0,217,255,0.35);border-radius:9px;min-width:180px"><div style="font-size:0.72rem;font-weight:700;color:#00D9FF;text-transform:uppercase;letter-spacing:0.06em;margin-bottom:4px"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right" aria-hidden="true" style="display:inline;margin-right:4px;vertical-align:middle"><path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path></svg>Use <!-- -->Naive RAG<!-- --> when…</div><div style="font-size:0.8rem;color:#94A3B8;line-height:1.5">Prototypes, demos, single-topic corpora with clean documents and lenient quality requirements</div></div><div style="flex:1;padding:10px 14px;background:rgba(14,165,233,0.08);border:1px solid rgba(14,165,233,0.35);border-radius:9px;min-width:180px"><div style="font-size:0.72rem;font-weight:700;color:#38BDF8;text-transform:uppercase;letter-spacing:0.06em;margin-bottom:4px"><svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-right" aria-hidden="true" style="display:inline;margin-right:4px;vertical-align:middle"><path d="M5 12h14"></path><path d="m12 5 7 7-7 7"></path></svg>Use <!-- -->Advanced RAG<!-- --> when…</div><div style="font-size:0.8rem;color:#94A3B8;line-height:1.5">Production systems with heterogeneous document types, strict quality requirements, or large corpora</div></div></div></div><!--astro:end--></astro-island>
334<div class="sl-heading-wrapper level-h3"><h3 id="advanced-retrieval-patterns">Advanced Retrieval Patterns</h3><a class="sl-anchor-link" href="#advanced-retrieval-patterns"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Advanced Retrieval Patterns”</span></a></div>
335<p><strong>HyDE (Hypothetical Document Embeddings)</strong></p>
336<p>Instead of embedding the user’s raw question, ask the LLM to generate a hypothetical answer first. Embed the hypothetical answer, not the question. Search with that embedding.</p>
337<p>Why this helps: questions and answers have different linguistic structure. A question embedding is optimized to match other questions. A hypothetical answer embedding is closer in the vector space to the actual answer documents. HyDE consistently improves retrieval recall, especially for short questions that lack context.</p>
338<p>The cost: one extra LLM call per query. The latency impact: significant if not parallelized. HyDE is appropriate when retrieval recall is the bottleneck.</p>
339<p><strong>Multi-Query Retrieval</strong></p>
340<p>Generate 3–5 query variations from the original question using an LLM or a smaller model. Run retrieval for each variation. Merge and deduplicate the results before reranking.</p>
341<p>Why this helps: the user’s original phrasing may not match the language used in the documents. Alternative phrasings capture different relevant chunks. Multi-query retrieval is one of the highest-leverage improvements for recall.</p>
342<p><strong>Contextual Retrieval (Anthropic)</strong></p>
343<p>
343Before embedding chunks, ask an LLM to prepend a brief context summary to each chunk: “This excerpt is from a Q4 2024 earnings call discussing gross margin pressure in the hardware division.” The enriched chunk is what gets embedded and stored.</p>
344<p>Why this helps: chunks are often meaningful only in the context of their surrounding document. A chunk that says “The margin declined by 3.2%” is semantically ambiguous without knowing what document it came from. The prepended context makes the chunk self-contained for retrieval purposes.</p>
345<p><strong>Self-RAG and Agentic RAG</strong></p>
346<p>Standard RAG retrieves once per query. Agentic RAG treats retrieval as an action in a loop: retrieve, assess whether the retrieved context is sufficient, retrieve again with a refined query if not, and continue until the agent has enough information to answer.</p>
347<p>This is more powerful for multi-hop questions but adds LLM calls, latency, and cost. See <a href="/genai-engineer/agents/">AI Agents and Agentic Systems</a> for the agent architecture that underlies this pattern.</p>
348<aside class="product-cta product-cta-inline astro-vvp4kzz7" aria-label="RAG is Week 2 in the Study Tracker"> <div class="product-cta-content astro-vvp4kzz7"> <div class="product-cta-icon astro-vvp4kzz7"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-vvp4kzz7" aria-hidden="true"> <rect x="3" y="4" width="18" height="18" rx="2" ry="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/> </svg> </div> <div class="product-cta-text astro-vvp4kzz7"> <strong class="astro-vvp4kzz7">RAG is Week 2 in the Study Tracker</strong> <p class="astro-vvp4kzz7">Master RAG pipelines with daily tasks, a dedicated build project, and weekly scorecards — part of a 12-week structured preparation system.</p> </div> <a href="https://myengineeringpath.lemonsqueezy.com/checkout/buy/23aafb23-3cc7-4259-9d97-e23dcc3d542a?embed=1" class="product-cta-btn lemonsqueezy-button astro-vvp4kzz7" data-product="study-tracker"> Get the Tracker — $29 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-vvp4kzz7" aria-hidden="true"> <path d="M5 12h14"/><path d="m12 5 7 7-7 7"/> </svg> </a> </div> </aside> 
349<hr>
350<div class="sl-heading-wrapper level-h2"><h2 id="6-rag-code-examples-in-python">6. RAG Code Examples in Python</h2><a class="sl-anchor-link" href="#6-rag-code-examples-in-python"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “6. RAG Code Examples in Python”</span></a></div>
351<p>Two contrasting deployments illustrate the design tradeoffs that separate a prototype from a production-grade RAG system.</p>
352<div class="sl-heading-wrapper level-h3"><h3 id="example-1-enterprise-document-qa-system">Example 1: Enterprise Document Q&#x26;A System</h3><a class="sl-anchor-link" href="#example-1-enterprise-document-qa-system"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Example 1: Enterprise Document Q&#x26;A System”</span></a></div>
353<p><strong>Corpus</strong>
353: 20,000 internal documents — policy PDFs, engineering RFCs, product specs, support KB articles.</p>
354<p><strong>Indexing configuration</strong>:</p>
355<ul>
356<li>Loader: PyMuPDF for PDFs, HTML parser for web-based documents</li>
357<li>Chunking: section-aware semantic chunking, max 800 tokens, 150-token overlap</li>
358<li>Metadata: <code dir="auto">source_url</code>, <code dir="auto">document_type</code>, <code dir="auto">last_modified</code>, <code dir="auto">department</code>, <code dir="auto">access_level</code></li>
359<li>Embedding model: <code dir="auto">text-embedding-3-large</code> (quality requirement)</li>
360<li>Vector DB: Qdrant with HNSW index, hybrid search enabled</li>
361</ul>
362<p><strong>Retrieval configuration</strong>:</p>
363<ul>
364<li>Hybrid search: BM25 weight 0.3, vector weight 0.7</li>
365<li>Initial retrieval: top-20 chunks</li>
366<li>Reranker: Cohere Rerank, return top-5</li>
367<li>Access control: filter by <code dir="auto">access_level</code> at query time (critical for enterprise)</li>
368</ul>
369<p><strong>Key design decisions</strong>:</p>
370<ul>
371<li>Access control filtering must happen at the vector DB level (metadata filter), not post-retrieval. Returning unauthorized documents to the LLM and hoping it ignores them is not a security model.</li>
372<li>Section-aware chunking means each chunk maps to a complete policy section — no answer spans are split across chunks.</li>
373<li><code dir="auto">text-embedding-3-large</code> costs 5x more than <code dir="auto">text-embedding-3-small</code> but the quality requirement justified it for this corpus.</li>
374</ul>
375<div class="sl-heading-wrapper level-h3"><h3 id="example-2-customer-support-agent-with-rag">Example 2: Customer Support Agent with RAG</h3><a class="sl-anchor-link" href="#example-2-customer-support-agent-with-rag"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Example 2: Customer Support Agent with RAG”</span></a></div>
376<p><strong>Corpus</strong>: Product documentation, known issue articles, troubleshooting guides — updated weekly.</p>
377<p><strong>Critical requirement</strong>: When a user asks about a bug fixed last Tuesday, the system must return the fix, not the pre-fix workaround from 6 months ago.</p>
378<p><strong>Solution</strong>: Incremental indexing with document-level versioning. Each document has a <code dir="auto">version</code> and <code dir="auto">last_indexed_at</code> metadata field. The indexing pipeline runs nightly, detects changed documents (via hash comparison or last-modified timestamp), removes the old vectors for changed documents, and re-indexes them.</p>
379<p>This is one of the most underestimated operational requirements for production RAG systems. Static corpora are easy. Dynamic corpora require a full incremental indexing pipeline.</p>
380<hr>
381<div class="sl-heading-wrapper level-h2"><h2 id="7-rag-trade-offs-and-pitfalls">7. RAG Trade-offs and Pitfalls</h2><a class="sl-anchor-link" href="#7-rag-trade-offs-and-pitfalls"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “7. RAG Trade-offs and Pitfalls”</span></a></div>
382<p>Production RAG systems fail in predictable ways — most failures trace back to poor chunking, imprecise retrieval, or hallucination in the generation step.</p>
383<div class="sl-heading-wrapper level-h3"><h3 id="the-chunking-failure-mode">The Chunking Failure Mode</h3><a class="sl-anchor-link" href="#the-chunking-failure-mode"><span aria-hidden="true" class="sl-anchor-icon">
383<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “The Chunking Failure Mode”</span></a></div>
384<p>The most common production RAG failure is a retrieval system that returns chunks where the right answer exists in the corpus but is not retrieved — because the chunk that contains the answer is semantically different from the query phrasing.</p>
385<p>Example: The user asks “How do I reset my password?” The relevant policy document uses the phrase “Account credential recovery procedure.” Fixed-size chunking may also have split the relevant paragraph across two chunks.</p>
386<p>Mitigation: Semantic chunking on natural boundaries. Hybrid search for keyword coverage. Testing chunking decisions against a representative set of real queries before deploying.</p>
387<div class="sl-heading-wrapper level-h3"><h3 id="the-lost-in-the-middle-problem">The Lost-in-the-Middle Problem</h3><a class="sl-anchor-link" href="#the-lost-in-the-middle-problem"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “The Lost-in-the-Middle Problem”</span></a></div>
388<p>LLMs have a documented tendency to underweight information positioned in the middle of long contexts. If you retrieve 10 chunks and the most relevant one is chunk #5, the LLM may produce a worse answer than if it were chunk #1 or chunk #10.</p>
389<p>Mitigation: Rerank to put the most relevant chunks at the start and end of the context. Limit context to 3–5 high-quality chunks rather than stuffing 10 mediocre ones.</p>
390<div class="sl-heading-wrapper level-h3"><h3 id="hallucination-in-rag-systems">Hallucination in RAG Systems</h3><a class="sl-anchor-link" href="#hallucination-in-rag-systems"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Hallucination in RAG Systems”</span></a></div>
391<p>RAG reduces but does not eliminate hallucination. The LLM can:</p>
392<ul>
393<li>Ignore the retrieved context and use parametric knowledge instead</li>
394<li>Generate plausible-sounding details not present in the context</li>
395<li>Misattribute a quote from one chunk to a different source</li>
396</ul>
397<p>Mitigation: Explicit system prompt instructions to answer only from context and to cite sources by reference number. RAGAS faithfulness scoring to measure how often answers are actually grounded in the retrieved context.</p>
398<div class="sl-heading-wrapper level-h3"><h3 id="context-window-overflow">Context Window Overflow</h3><a class="sl-anchor-link" href="#context-window-overflow"><span aria-hidden="true" class="sl-anchor-icon">
398<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Context Window Overflow”</span></a></div>
399<p>If retrieved chunks plus the user query exceed the LLM’s context window, either the prompt is truncated (losing information) or the API call fails. For large retrieval sets or long documents, this is a real production issue.</p>
400<p>Mitigation: Enforce a strict token budget for retrieved context. Reranking helps by keeping only the most relevant chunks. Context compression (extracting only the relevant sentences from each chunk) can reduce token count by 50–70%.</p>
401<div class="sl-heading-wrapper level-h3"><h3 id="evaluation-without-ground-truth">Evaluation Without Ground Truth</h3><a class="sl-anchor-link" href="#evaluation-without-ground-truth"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Evaluation Without Ground Truth”</span></a></div>
402<p>Most production RAG systems are deployed without a labeled evaluation set — there is no pre-existing dataset of questions with known correct answers. Evaluation must be created from scratch, which requires dedicated time and tooling.</p>
403<p><strong>RAGAS</strong> (Retrieval Augmented Generation Assessment) provides reference-free metrics that partially address this:</p>
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429<table><thead><tr><th>Metric</th><th>What It Measures</th></tr></thead><tbody><tr><td><strong>Faithfulness</strong></td><td>Is the generated answer grounded in the retrieved context?</td></tr><tr><td><strong>Answer Relevancy</strong></td><td>Is the answer relevant to the question asked?</td></tr><tr><td><strong>Context Recall</strong></td><td>Did retrieval return the chunks needed to answer?</td></tr><tr><td><strong>Context Precision</strong></td><td>Are the retrieved chunks actually useful (not noisy)?</td></tr></tbody></table>
430<p>RAGAS can use an LLM-as-judge approach to score these metrics without human labels. This is not a perfect substitute for human evaluation, but it enables continuous monitoring and regression detection.</p>
431<hr>
432<div class="sl-heading-wrapper level-h2"><h2 id="8-rag-interview-questions">8. RAG Interview Questions</h2><a class="sl-anchor-link" href="#8-rag-interview-questions"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “8. RAG Interview Questions”</span></a></div>
433<p>Interviewers use RAG questions to separate candidates who have read about the topic from those who have debugged it in production.</p>
434<div class="sl-heading-wrapper level-h3"><h3 id="what-interviewers-are-assessing">What Interviewers Are Assessing</h3><a class="sl-anchor-link" href="#what-interviewers-are-assessing"><span aria-hidden="true" class="sl-anchor-icon">
434<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “What Interviewers Are Assessing”</span></a></div>
435<p>RAG architecture is one of the most common technical interview topics for GenAI engineering roles in 2025–2026. Most candidates know what RAG is. Interviewers are testing whether you can go beyond the definition.</p>
436<p><strong>1. Can you explain why naive RAG fails in production?</strong></p>
437<p>Interviewers expect you to articulate specific failure modes: poor chunking bisecting context, pure vector search missing exact terms, top-k stuffing causing lost-in-the-middle degradation. Generic “it’s not accurate enough” answers are not sufficient.</p>
438<p><strong>2. Can you describe how to improve retrieval quality systematically?</strong></p>
439<p>Walk through the improvement chain: semantic chunking → hybrid search → reranking → context compression. Explain the tradeoff each adds (quality vs latency/cost).</p>
440<p><strong>3. Can you design an evaluation framework?</strong></p>
441<p>“How do you know if your RAG system is working?” The answer should include RAGAS metrics, an offline evaluation dataset (even synthetic), and production monitoring using proxy metrics (thumbs up/down, escalation rate, answer length as a faithfulness proxy).</p>
442<p><strong>4. Can you handle dynamic corpora?</strong></p>
443<p>“What happens when a document in your knowledge base changes?” The answer must cover incremental indexing — not full re-indexing from scratch every time.</p>
444<div class="sl-heading-wrapper level-h3"><h3 id="common-interview-questions-on-rag">Common Interview Questions on RAG</h3><a class="sl-anchor-link" href="#common-interview-questions-on-rag"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Common Interview Questions on RAG”</span></a></div>
445<ul>
446<li>Explain the two-pipeline architecture of a RAG system</li>
447<li>What is chunking and how do you choose a chunking strategy?</li>
448<li>What is hybrid search and why is it better than pure vector search?</li>
449<li>What is reranking and when would you use it?</li>
450<li>How do you evaluate a RAG system?</li>
451<li>Design a RAG system for a corpus of 1 million documents with sub-200ms retrieval latency</li>
452<li>How do you handle documents that change frequently?</li>
453<li>What is HyDE and when does it help?</li>
454<li>What is the difference between RAG and fine-tuning? When do you use each?</li>
455</ul>
456<hr>
457<div class="sl-heading-wrapper level-h2"><h2 id="9-rag-in-production">9. RAG in Production</h2><a class="sl-anchor-link" href="#9-rag-in-production"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “9. RAG in Production”</span></a></div>
458<p>Shipping RAG to production requires managing three concerns that do not appear in demos: latency budgets, infrastru
458cture sizing, and access control.</p>
459<div class="sl-heading-wrapper level-h3"><h3 id="latency-budget">Latency Budget</h3><a class="sl-anchor-link" href="#latency-budget"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Latency Budget”</span></a></div>
460<p>A production RAG system serving interactive queries must complete the full retrieval-augment-generate cycle within an acceptable latency window — typically under 3–5 seconds for most applications, with streaming used to improve perceived responsiveness.</p>
461<p>The retrieval step itself must be fast. Vector search on a well-configured HNSW index with 1 million vectors typically completes in under 50ms. Reranking adds 100–200ms for a batch of 20 candidates. LLM generation dominates — 1–3 seconds for most queries depending on output length and model.</p>
462<p>Where production engineers spend time on latency:</p>
463<ul>
464<li><strong>Batch embedding calls</strong> to avoid per-chunk API overhead</li>
465<li><strong>Cache query embeddings</strong> for repeated or similar queries</li>
466<li><strong>Parallelize multi-query retrieval</strong> — all query variations run concurrently</li>
467<li><strong>Use streaming</strong> for LLM generation — return first tokens to the user while the rest generate</li>
468</ul>
469<div class="sl-heading-wrapper level-h3">
469<h3 id="infrastructure-considerations">Infrastructure Considerations</h3><a class="sl-anchor-link" href="#infrastructure-considerations"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Infrastructure Considerations”</span></a></div>
470<p><strong>Vector database sizing</strong>: A typical production deployment stores vectors for millions of documents. Memory requirements depend on vector dimensions. A system with 10 million 1536-dimensional float32 vectors requires approximately 60GB RAM for in-memory HNSW. Qdrant, Weaviate, and Pinecone all support quantization to reduce memory footprint at a small quality cost.</p>
471<p><strong>Indexing pipeline orchestration</strong>: The offline indexing pipeline needs to be treated as a first-class engineering concern. It should be monitored, have retry logic for failed embeddings, support incremental updates, and emit metrics on indexing lag (how stale is the current index relative to the source documents).</p>
472<p><strong>Access control</strong>: In enterprise deployments, users must only retrieve documents they are authorized to access. This requires metadata-filtered vector search — filters applied at the vector DB level before retrieval, not post-retrieval filtering. Post-retrieval filtering defeats the purpose of top-k retrieval.</p>
473<div class="sl-heading-wrapper level-h3"><h3 id="monitoring-what-matters">Monitoring What Matters</h3><a class="sl-anchor-link" href="#monitoring-what-matters"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Monitoring What Matters”</span></a></div>
474<p>Standard application metrics (p50/p99 latency, error rate) are necessary but insufficient for RAG systems. Additional metrics that matter in production:</p>
475<ul>
476<li><strong>Retrieval recall proxy</strong>: What fraction of answers include a citation from the retrieved chunks vs generating without citation?</li>
477<li><strong>No-answer rate</strong>: How often does the system respond with “I don’t have information on this”? Unexpected spikes indicate retrieval failures.</li>
478<li><strong>Context token utilization</strong>: Average tokens consumed by retrieved context. A sudden drop may indicate retrieval quality degradation.</li>
479<li><strong>User feedback signals</strong>: Thumbs up/down, follow-up clarification rate, escalation to human rate</li>
480</ul>
481<aside class="inline-newsletter astro-reoi52vd" aria-label="Stay current with GenAI engineering"> <div class="inline-newsletter-header astro-reoi52vd"> <div class="inline-newsletter-icon astro-reoi52vd"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="astro-reoi52vd" aria-hidden="true"> <rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/> </svg> </div> <div class="inline-newsletter-text astro-reoi52vd"> <strong class="astro-reoi52vd">Stay current with GenAI engineering</strong> <p class="astro-reoi52vd">Weekly insights on tools, architectures, and career moves. No spam.</p> </div> </div> <form class="nf-form nf-inline astro-vkuhopjv" data-nf-source="pulse" data-nf-success="You're subscribed!" data-nf-button-text="Subscribe" data-nf-kit-form-id="9129858" id="newsletter-pulse"> <div class="nf-row astro-vkuhopjv"> <label for="newsletter-pulse-email" class="sr-only astro-vkuhopjv">Email address</label> <input type="email" placeholder="[email protected]" required class="nf-input astro-vkuhopjv" id="newsletter-pulse-email"> <button type="submit" class="nf-btn astro-vkuhopjv" id="newsletter-pulse-btn"> Subscribe </button> </div> <p class="nf-status astro-vkuhopjv" id="newsletter-pulse-status" aria-l
481ive="polite"></p>  </form> 
481<script type="module">document.querySelectorAll("[data-nf-source]").forEach(t=>{const i=t.dataset.nfSuccess,c=t.dataset.nfButtonText,r=t.querySelector('input[type="email"]'),a=t.querySelector('button[type="submit"]'),e=t.querySelector(".nf-status");t.addEventListener("submit",async u=>{u.preventDefault();const o=r.value.trim();if(o){a.disabled=!0,a.textContent="Sending...",e.textContent="",e.className="nf-status",window.dispatchEvent(new CustomEvent("newsletter:submit-attempt",{detail:{source:t.dataset.nfSource}}));try{const n=t.dataset.nfKitFormId;if(!n)throw new Error("Email service is not configured.");const s=await fetch(`https://app.kit.com/forms/${n}/subscriptions`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({email_address:o}).toString()});if(s.ok)e.textContent=i,e.className="nf-status nf-success",r.value="",window.dispatchEvent(new CustomEvent("newsletter:subscribed",{detail:{source:t.dataset.nfSource}}));else if(s.status===422)e.textContent="Please enter a valid email address.",e.className="nf-status nf-error",window.dispatchEvent(new CustomEvent("newsletter:submit-error",{detail:{source:t.dataset.nfSource,error:"validation_422"}}));else throw new Error(`Kit API returned ${s.status}`)}catch(n){const s=n instanceof Error?n.message:"Unknown error";console.error("[Newsletter]",s,"formId:",t.dataset.nfKitFormId),e.textContent="Something went wrong. Please try again later.",e.className="nf-status nf-error",window.dispatchEvent(new CustomEvent("newsletter:submit-error",{detail:{source:t.dataset.nfSource,error:s.substring(0,100)}}))}finally{a.disabled=!1,a.textContent=c}}})});</script>
481  <a href="/pulse/" class="inline-newsletter-link astro-reoi52vd">Learn more about the Pulse newsletter →</a> </aside> 
482<hr>
483<div class="sl-heading-wrapper level-h2"><h2 id="10-summary-and-key-takeaways">10. Summary and Key Takeaways</h2><a class="sl-anchor-link" href="#10-summary-and-key-takeaways"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “10. Summary and Key Takeaways”</span></a></div>
484<p>The key decisions in any RAG system — chunking strategy, search type, reranking, and evaluation — all follow directly from a single mental model.</p>
485<div class="sl-heading-wrapper level-h3"><h3 id="the-core-mental-model">The Core Mental Model</h3><a class="sl-anchor-link" href="#the-core-mental-model"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “The Core Mental Model”</span></a></div>
486<p>RAG is two pipelines sharing a vector database. The offline indexing pipeline transforms documents into searchable vectors. The online retrieval pipeline finds the relevant vectors for each query and injects the source text into the LLM’s prompt. Every quality improvement comes from improving one of these pipelines or the interface between them.</p>
487<div class="sl-heading-wrapper level-h3"><h3 id="rag-design-checklist">RAG Design Checklist</h3><a class="sl-anchor-link" href="#rag-design-checklist"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “RAG Design Checklist”</span></a></div>
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529<table><thead><tr><th>Decision Point</th><th>Recommendation</th></tr></thead><tbody><tr><td>Chunking strategy</td><td>Semantic/section-aware, not fixed-size</td></tr><tr><td>Chunk size</td><td>512–1024 tokens with 10–20% overlap</td></tr><tr><td>Embedding model</td><td>Match quality to requirements; benchmark on your corpus</td></tr><tr><td>Search strategy</td><td>Hybrid (BM25 + vector) as default</td></tr><tr><td>Reranking</td><td>Yes for any corpus over 50K chunks</td></tr><tr><td>Access control</td><td>Metadata filter at the DB level, never post-retrieval</td></tr><tr><td>Evaluation</td><td>RAGAS metrics from day one</td></tr><tr><td>Dynamic corpora</td><td>Incremental indexing pipeline</td></tr></tbody></table>
530<div class="sl-heading-wrapper level-h3"><h3 id="when-rag-is-the-right-choice">When RAG Is the Right Choice</h3><a class="sl-anchor-link" href="#when-rag-is-the-right-choice"><span aria-hidden="true" class="sl-anchor-icon">
530<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “When RAG Is the Right Choice”</span></a></div>
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564<table><thead><tr><th>Scenario</th><th>RAG Appropriate?</th></tr></thead><tbody><tr><td>Private/internal knowledge base</td><td>Yes — core use case</td></tr><tr><td>Frequently updated information</td><td>Yes — no retraining required</td></tr><tr><td>Need source citations</td><td>Yes — retrieval provides grounding</td></tr><tr><td>Need to change behavior/tone</td><td>No — consider fine-tuning or prompt engineering</td></tr><tr><td>Knowledge is static and small</td><td>Maybe — consider in-context stuffing instead</td></tr><tr><td>Need factual recall of common knowledge</td><td>No — model parametric knowledge is sufficient</td></tr></tbody></table>
565<div class="sl-heading-wrapper level-h3"><h3 id="official-documentation-and-further-reading">Official Documentation and Further Reading</h3><a class="sl-anchor-link" href="#official-documentation-and-further-reading"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Official Documentation and Further Reading”</span></a></div>
566<p><strong>Frameworks:</strong></p>
567<ul>
568<li><a href="https://python.langchain.com/docs/use_cases/question_answering/">LangChain RAG Documentation</a> — Comprehensive RAG tutorials and integrations</li>
569<li><a href="https://docs.llamaindex.ai/en/stable/">LlamaIndex Documentation</a> — RAG-first framework with advanced retrieval modules</li>
570<li><a href="https://docs.haystack.deepset.ai/">Haystack</a> — Production-focused RAG framework from Deepset</li>
571</ul>
572<p><strong>Evaluation:</strong></p>
573<ul>
574<li><a href="https://docs.ragas.io/">RAGAS Documentation</a> — Reference-free RAG evaluation metrics</li>
575<li><a href="https://www.anthropic.com/news/contextual-retrieval">Anthropic Contextual Retrieval</a> — Anthropic’s research on context-aware chunking</li>
576</ul>
577<p><strong>Research:</strong></p>
578<ul>
579<li><a href="https://arxiv.org/abs/2312.10997">RAG Survey (Gao et al., 2023)</a> — Comprehensive survey of RAG techniques</li>
580</ul>
581<div class="sl-heading-wrapper level-h2"><h2 id="what-is-rag-in-ai">What is RAG in AI?</h2><a class="sl-anchor-link" href="#what-is-rag-in-ai"><span aria-hidden="true" class="sl-anchor-icon"><svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “What is RAG in AI?”</span></a></div>
582<p>RAG (Retrieval-Augmented Generation) is an architecture where an LLM retrieves relevant documents from a vector database at query time before generating a response. Instead of relying solely on training data, RAG grounds model outputs in specific documents — enabling factual, up-to-date answers without retraining the model. It is the most widely deployed pattern for building LLM applications over private or frequently updated knowledge bases.</p>
583<hr>
584<div class="sl-heading-wrapper level-h3"><h3 id="related">Related</h3><a class="sl-anchor-link" href="#related"><span aria-hidden="true" class="sl-anchor-icon">
584<svg width="16" height="16" viewBox="0 0 24 24"><path fill="currentcolor" d="m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z"></path></svg></span><span class="sr-only" data-pagefind-ignore>Section titled “Related”</span></a></div>
585<ul>
586<li><a href="/genai-engineer/roadmap/">GenAI Engineer Roadmap</a> — Complete career progression guide for GenAI engineers</li>
587<li><a href="/tools/vector-db-comparison/">Vector Database Comparison</a> — Choosing the right vector database for your use case</li>
588<li><a href="/tools/langchain-vs-langgraph/">LangChain vs LangGraph</a> — Comparing LLM orchestration frameworks</li>
589<li><a href="/tools/fine-tuning-vs-rag/">Fine-Tuning vs RAG</a> — When to use each approach and how to combine them</li>
590<li><a href="/genai-engineer/evaluation/">LLM Evaluation Guide</a> — Metrics and frameworks for measuring LLM system quality</li>
591<li><a href="/genai-engineer/agents/">AI Agents and Agentic Systems</a> — How Agentic RAG uses the ReAct loop for iterative retrieval</li>
592<li><a href="/genai-engineer/prompt-engineering/">Prompt Engineering</a> — How to write the RAG system prompt that instructs the LLM to use context correctly</li>
593<li><a href="/genai-engineer/tools/">Essential GenAI Tools</a> — The full production tool stack including vector DBs and observability</li>
594<li><a href="/genai-engineer/interview-questions/">GenAI Interview Questions</a> — Practice questions on RAG architecture</li>
595</ul>
596<hr>
597<p><em>Last updated: February 2026. RAG framework APIs evolve rapidly; verify specifics against current documentation.</em></p>
598<section class="doc-faq astro-2uhganid" aria-labelledby="doc-faq-heading"> <h2 id="doc-faq-heading" class="astro-2uhganid">Frequently Asked Questions</h2> <div class="doc-faq-list astro-2uhganid"> <details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">What is RAG (Retrieval-Augmented Generation)?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">RAG is an architecture pattern where relevant documents are retrieved from a knowledge base at query time and injected into the LLM prompt before generating a response. It solves the knowledge currency problem — LLMs have a training cutoff and cannot access private data — without requiring expensive model retraining. RAG provides grounding, meaning the LLM's answer is traceable back to specific source documents.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">What is the best chunking strategy for RAG?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Start with semantic chunking (split on paragraph boundaries, max 512 tokens) for most use cases. Move to <a href="/genai-engineer/rag-chunking/">hierarchical chunking</a> (small child chunks for precise retrieval, large parent chunks for rich LLM context) when retrieval precision matters. Use agentic chunking only for high-value corpora where the cost of one LLM call per document during indexing is justified.</p> </div> </details>
598<details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">How does hybrid search improve RAG quality?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Hybrid search combines <a href="/tools/vector-db-comparison/">vector similarity search</a> (semantic meaning) with traditional keyword search (BM25 for exact term matching). Vector search handles semantic meaning while keyword search handles technical terms, product names, and IDs. Results are merged using reciprocal rank fusion. Hybrid search outperforms pure vector search in most production RAG systems because it covers both semantic understanding and precise keyword matching.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">What are common RAG failure modes in production?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Common production RAG failures include poor retrieval recall (the r
598ight document exists but is not retrieved due to query-document language mismatch), poor context precision (retrieval returns noise that confuses the LLM), multi-hop question failures (questions requiring cross-document comparison), heterogeneous document quality, and latency at scale. Most RAG engineering is about fixing these production failures systematically.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">How do you evaluate a RAG system?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">RAG systems are evaluated using the RAGAS framework which measures four key metrics: context precision (are retrieved chunks relevant?), context recall (are all relevant chunks retrieved?), faithfulness (does the answer stay grounded in the retrieved context?), and answer relevancy (does the answer address the original question?). See the <a href="/genai-engineer/rag-evaluation/">RAG evaluation guide</a> for implementation details.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">When should you use RAG vs fine-tuning?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Use RAG when you need to query private or frequently updated knowledge bases, when you need source citations for grounding, or when the information changes too often for retraining. Use <a href="/tools/fine-tuning-vs-rag/">fine-tuning</a> when you need to change the model's behavior, tone, or output format rather than adding new knowledge. RAG adds external knowledge at query time without retraining, while fine-tuning bakes knowledge and behavior into model weights.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">What are the components of a RAG pipeline?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">A RAG pipeline has two main parts: an offline indexing pipeline and an online retrieval pipeline. The indexing pipeline loads documents, chunks them into retrievable units, embeds chunks into vectors, and stores them in a vector database. The retrieval pipeline embeds the user query, performs vector search (optionally with hybrid BM25), reranks results, assembles the prompt with retrieved context, and generates an LLM response.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">What is the difference between naive RAG and advanced RAG?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Naive RAG uses fixed-size chunking, single-vector search, and stuffs top-k results into the prompt without reranking. <a href="/genai-engineer/advanced-rag/">Advanced RAG</a>
598 uses semantic or hierarchical chunking, hybrid search combining BM25 and vector retrieval, cross-encoder reranking for precise relevance ordering, and context compression to reduce noise. Advanced RAG also adds RAGAS evaluation pipelines for continuous quality measurement.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">Can RAG work with long context models?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Yes, but RAG and long context windows solve different problems. Long context models can process entire documents but costs scale linearly with token count and LLMs underweight information in the middle of long contexts (the lost-in-the-middle problem). RAG narrows the corpus to only the most relevant chunks, keeping costs bounded and placing high-relevance content where the LLM attends to it best. Many production systems combine both approaches.</p> </div> </details><details class="faq-item astro-2uhganid"> <summary class="faq-question astro-2uhganid"> <span class="astro-2uhganid">How do you handle large documents in RAG?</span> <svg class="faq-chevron astro-2uhganid" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <polyline points="6 9 12 15 18 9" class="astro-2uhganid"></polyline> </svg> </summary> <div class="faq-answer astro-2uhganid"> <p class="astro-2uhganid">Large documents require a <a href="/genai-engineer/rag-chunking/">chunking strategy</a> that preserves context boundaries. Hierarchical chunking works best: create small child chunks (256 tokens) for precise retrieval and link them to larger parent chunks (1024 tokens) for rich LLM context. For dynamic corpora where documents change frequently, use incremental indexing with document-level versioning rather than full re-indexing.</p> </div> </details> </div> </section> <!-- GA4 faq_expand tracking (production only) --> 
598<script>
599  (function () {
600    if (window.location.hostname !== 'myengineeringpath.dev') return;
601    if (window.__docFaqTracked) return;
602    window.__docFaqTracked = true;
603    document.addEventListener('toggle', function (e) {
604      if (!e.target.matches || !e.target.matches('details.faq-item')) return;
605      if (!e.target.open) return;
606      var q = (e.target.querySelector('.faq-question span') || {}).textContent || '';
607      if (typeof gtag === 'function') {
608        gtag('event', 'faq_expand', {
609          question: q.substring(0, 100),
610          page_path: window.location.pathname,
611        });
612      }
613    }, true);
614  })();
615</script>
615  </div> <footer class="sl-flex astro-3yyafb3n"> <div class="meta sl-flex astro-3yyafb3n">  <p>Last updated: <time datetime="2026-03-20T00:00:00.000Z">Mar 20, 2026</time></p> </div> <!-- Person JSON-LD for E-E-A-T -->
615<script type="application/ld+json">{"@context":"https://schema.org","@type":"Person","name":"Mohit Saxena","jobTitle":"Senior GenAI Engineer","url":"https://myengineeringpath.dev","image":"https://myengineeringpath.dev/images/mohit-saxena-author.jpg","description":"GenAI Engineer with 17+ years building scalable software systems. Creator of MyEngineeringPath.","sameAs":["https://linkedin.com/in/mohitsaxena21","https://github.com/mohitsaxenacs"],"worksFor":{"@type":"Organization","name":"MyEngineeringPath","url":"https://myengineeringpath.dev"},"knowsAbout":["Generative AI","RAG Systems","Multi-Agent Systems","LLM Architecture","Python","Azure AI","LangChain","LangGraph"],"alumniOf":[{"@type":"Organization","name":"Cisco"},{"@type":"Organization","name":"Adobe"},{"@type":"Organization","name":"Capgemini"},{"@type":"CollegeOrUniversity","name":"University of New South Wales","location":"Sydney"},{"@type":"CollegeOrUniversity","name":"University of South Australia","location":"Adelaide"}]}</script>
615 <!-- Open Graph author meta --><meta property="article:author" content="https://linkedin.com/in/mohitsaxena21"><aside class="article-author astro-iq7fj3zv" aria-label="About the author" itemscope itemtype="https://schema.org/Person"> <p class="author-heading astro-iq7fj3zv">About the Author</p> <div class="author-card-compact astro-iq7fj3zv"> <div class="author-avatar-sm astro-iq7fj3zv"> <img src="/images/mohit-saxena-author.jpg" alt="Mohit Saxena" width="48" height="48" loading="lazy" class="avatar-img astro-iq7fj3zv" itemprop="image" onerror="this.style.display='none';this.nextElementSibling.style.display='flex'"> <span class="avatar-initials astro-iq7fj3zv" style="display:none">MS</span> </div> <div class="author-meta astro-iq7fj3zv"> <div class="author-top-row astro-iq7fj3zv"> <span class="author-name-sm astro-iq7fj3zv" itemprop="name">Mohit Saxena</span> <span class="author-sep astro-iq7fj3zv">&bull;</span> <span class="author-role-sm astro-iq7fj3zv" itemprop="jobTitle">17+ Years in Software Engineering</span> </div> <p class="author-bio-sm astro-iq7fj3zv" itemprop="description">
616GenAI Engineer with 17+ years building scalable software systems across Cisco, Adobe, Capgemini, University of New South Wales (Sydney), University of South Australia (Adelaide), and Australian state governments. Currently building production RAG and multi-agent systems for enterprise clients. Creator of MyEngineeringPath — 100+ free guides on agents, RAG, and GenAI system design.
617</p> <div class="author-links astro-iq7fj3zv"> <a href="https://github.com/mohitsaxenacs/" target="_blank" rel="noopener noreferrer" class="author-link-sm astro-iq7fj3zv" itemprop="sameAs"> <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" class="astro-iq7fj3zv"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" class="astro-iq7fj3zv"></path></svg>
618GitHub
619</a> <a href="https://linkedin.com/in/mohitsaxena21" target="_blank" rel="noopener noreferrer" class="author-link-sm astro-iq7fj3zv" itemprop="sameAs"> <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" class="astro-iq7fj3zv"><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" class="astro-iq7fj3zv"></path></svg>
620LinkedIn
621</a> </div> </div> </div> </aside>  <div class="pagination-links print:hidden astro-zz7x43zv" dir="ltr"> <a href="/genai-engineer/prompt-engineering-techniques/" rel="prev" class="pagination-link astro-zz7x43zv"> <svg aria-hidden="true" class="astro-zz7x43zv astro-c6vsoqas" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="M17 11H9.41l3.3-3.29a1.004 1.004 0 1 0-1.42-1.42l-5 5a1 1 0 0 0-.21.33 1 1 0 0 0 0 .76 1 1 0 0 0 .21.33l5 5a1.002 1.002 0 0 0 1.639-.325 1 1 0 0 0-.219-1.095L9.41 13H17a1 1 0 0 0 0-2Z"/></svg> <span class="astro-zz7x43zv"> <span class="pagination-label astro-zz7x43zv">Previous</span> <span class="pagination-title astro-zz7x43zv">Prompt Techniques</span> </span> </a> <a href="/genai-engineer/rag-chunking/" rel="next" class="pagination-link astro-zz7x43zv"> <span class="astro-zz7x43zv"> <span class="pagination-label astro-zz7x43zv">Next</span> <span class="pagination-title astro-zz7x43zv">RAG Chunking</span> </span> <svg aria-hidden="true" class="astro-zz7x43zv astro-c6vsoqas" width="16" height="16" viewB
621ox="0 0 24 24" fill="currentColor" style="--sl-icon-size: 1.25rem;"><path d="M17.92 11.62a1.001 1.001 0 0 0-.21-.33l-5-5a1.003 1.003 0 1 0-1.42 1.42l3.3 3.29H7a1 1 0 0 0 0 2h7.59l-3.3 3.29a1.002 1.002 0 0 0 .325 1.639 1 1 0 0 0 1.095-.219l5-5a1 1 0 0 0 .21-.33 1 1 0 0 0 0-.76Z"/></svg> </a> </div>   </footer>  </div> </div>   </main> </div> </div>  </div> </div>  
621<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v31edd6df95cf4e85bb4c19e7a9bdbcba1788362987495" integrity="sha512-iIg7k2xntmwu6/uSb5tpc/hySgZc4eoL31yB29W6tJFo2akwjPWcEqnCEdJvGexCL0KEQwVYv5BlowfhVz26hg==" data-cf-beacon='{"version":"2024.11.0","token":"3379dbdf466d4726bcaced4ba7846050","r":1,"spa":2}' crossorigin="anonymous"></script>
621
622</body></html>

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.