<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Information Retrieval on Snow</title>
        <link>https://SymphonyW.github.io/tags/information-retrieval/</link>
        <description>Recent content in Information Retrieval on Snow</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <copyright>Snow</copyright>
        <lastBuildDate>Thu, 15 Oct 2026 15:00:00 +0800</lastBuildDate><atom:link href="https://SymphonyW.github.io/tags/information-retrieval/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Agentic RAG Explained: Turning Retrieval into a Planning and Reflection Loop</title>
        <link>https://SymphonyW.github.io/p/agentic-rag-guide/</link>
        <pubDate>Thu, 15 Oct 2026 15:00:00 +0800</pubDate>
        
        <guid>https://SymphonyW.github.io/p/agentic-rag-guide/</guid>
        <description>&lt;img src="https://SymphonyW.github.io/p/agentic-rag-guide/bg.png" alt="Featured image of post Agentic RAG Explained: Turning Retrieval into a Planning and Reflection Loop" /&gt;&lt;h1 id=&#34;agentic-rag-explained-turning-retrieval-into-a-planning-and-reflection-loop&#34;&gt;Agentic RAG Explained: Turning Retrieval into a Planning and Reflection Loop
&lt;/h1&gt;&lt;blockquote&gt;
&lt;p&gt;Traditional RAG resembles a predefined assembly line: receive a question, retrieve once, add context, and generate an answer. Agentic RAG adds a controller that can decide whether to retrieve, decompose a task, select data sources, judge whether the evidence is sufficient, and search again when it is not.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/agentic-rag-guide/bg.png&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/agentic-rag-guide/bg.png&#34; alt=&#34;An agent orchestrates multiple knowledge sources and evaluates evidence in a loop&#34; width=&#34;1672&#34; height=&#34;941&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34; class=&#34;gallery-image&#34; data-flex-grow=&#34;177&#34; data-flex-basis=&#34;426px&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Here is the short version:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Short answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;What is Agentic RAG?&lt;/td&gt;
&lt;td&gt;A RAG architecture in which an agent plans, invokes, evaluates, and iterates retrieval at runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What is the main difference?&lt;/td&gt;
&lt;td&gt;Not the presence of a vector database, but whether the &lt;strong&gt;retrieval control flow can change in response to intermediate results&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does it require multiple agents?&lt;/td&gt;
&lt;td&gt;No. One agent with several retrieval tools is enough&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Is it always better?&lt;/td&gt;
&lt;td&gt;No. For simple questions it may only add latency, cost, and uncertainty&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where does it help most?&lt;/td&gt;
&lt;td&gt;Multi-hop, multi-source tasks that require clarification or evidence checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What matters most in production?&lt;/td&gt;
&lt;td&gt;Bounded loops, evidence gates, permission isolation, traces, and layered evaluation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;start-with-traditional-rag&#34;&gt;Start with traditional RAG
&lt;/h2&gt;&lt;p&gt;RAG stands for Retrieval-Augmented Generation. It combines the model&amp;rsquo;s parametric memory with external, non-parametric knowledge. After a user asks a question, the system retrieves relevant material and asks the model to answer from that material.&lt;/p&gt;
&lt;p&gt;The original 2020 &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2005.11401&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;RAG paper&lt;/a&gt; explored combining a generative model with a dense vector index to improve factuality, knowledge updates, and provenance in knowledge-intensive tasks. In practice, a traditional online RAG pipeline often looks like this:&lt;/p&gt;
&lt;div class=&#34;mermaid&#34;&gt;flowchart LR
    Q[User question] --&gt; T[Clean or rewrite by fixed rules]
    T --&gt; E[Create query embedding]
    E --&gt; R[Retrieve Top-K chunks]
    R --&gt; K[Optional reranking]
    K --&gt; P[Build prompt]
    P --&gt; L[LLM generates answer]
    L --&gt; A[Return answer and citations]
&lt;/div&gt;&lt;p&gt;This design has real strengths: a short path, predictable latency, straightforward caching and load testing, and a clean way to distinguish retrieval failures from generation failures. When most questions can be answered by searching one knowledge base once, this is often all you need.&lt;/p&gt;
&lt;p&gt;The limit appears when a question hides several dependent tasks. Consider:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Compare the permission changes in the last three releases of products A and B, then assess the migration risk for existing customers.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The system must identify the release range, search both changelogs, inspect permission documentation, find migration notes, align dates, and only then compare the evidence. A single similarity search may cover only part of the task. Even if ten passages are returned, the model may not know what evidence is still missing.&lt;/p&gt;
&lt;h2 id=&#34;what-makes-agentic-rag-agentic&#34;&gt;What makes Agentic RAG “agentic”
&lt;/h2&gt;&lt;p&gt;Agentic RAG is not simply traditional RAG with a stronger model, nor merely vector search plus function calling. The real change is &lt;strong&gt;who controls retrieval&lt;/strong&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Retrieval stops being a mandatory one-time stage and becomes a tool that an agent can select, repeat, and adapt according to results.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The system commonly organizes planning, tool calls, state updates, and stopping decisions into a controlled loop. The agent may decide:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;whether external evidence is needed at all;&lt;/li&gt;
&lt;li&gt;whether to use vector search, keyword search, SQL, a knowledge graph, an internal API, or the web;&lt;/li&gt;
&lt;li&gt;whether to decompose the request into independent subquestions;&lt;/li&gt;
&lt;li&gt;whether results are relevant, mutually consistent, and sufficient;&lt;/li&gt;
&lt;li&gt;whether to rewrite the query, expand the time range, switch sources, or ask the user for clarification;&lt;/li&gt;
&lt;li&gt;when enough evidence has been gathered to stop and answer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This reason-act-observe loop follows the broader idea behind &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2210.03629&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;ReAct&lt;/a&gt;. A 2025 &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2501.09136&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;survey of Agentic RAG&lt;/a&gt; identifies planning, reflection, tool use, and multi-agent collaboration as recurring agentic patterns.&lt;/p&gt;
&lt;div class=&#34;mermaid&#34;&gt;flowchart TD
    U[User question] --&gt; P[Understand intent and create plan]
    P --&gt; D{Enough evidence?}
    D -- Yes --&gt; G[Generate from evidence]
    D -- No --&gt; S[Select source and retrieval tool]
    S --&gt; Q[Create or rewrite query]
    Q --&gt; R[Run retrieval]
    R --&gt; V[Evaluate relevance, coverage, conflicts]
    V --&gt; C{Next action}
    C -- Gather more evidence --&gt; S
    C -- Clarification needed --&gt; H[Ask the user]
    C -- Budget exhausted --&gt; F[Degrade gracefully]
    C -- Ready to answer --&gt; G
    G --&gt; A[Answer, citations, uncertainty]
&lt;/div&gt;&lt;p&gt;An important boundary follows from this definition: &lt;strong&gt;a pipeline with query rewriting, hybrid search, and reranking can still be “advanced RAG” rather than Agentic RAG if every stage always runs in a fixed order.&lt;/strong&gt; The agentic property comes from runtime adaptation, not from the number of components.&lt;/p&gt;
&lt;h2 id=&#34;the-complete-operating-loop&#34;&gt;The complete operating loop
&lt;/h2&gt;&lt;p&gt;The online path can be separated into seven responsibilities. Implementations may merge nodes, but observability and evaluation should keep these concerns distinguishable.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Question being answered&lt;/th&gt;
&lt;th&gt;Typical output&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Intent analysis&lt;/td&gt;
&lt;td&gt;What does the user need, and are external facts required?&lt;/td&gt;
&lt;td&gt;Task type, entities, time range, constraints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Decomposition&lt;/td&gt;
&lt;td&gt;Are there independently verifiable subproblems?&lt;/td&gt;
&lt;td&gt;Subquestions and dependencies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Source routing&lt;/td&gt;
&lt;td&gt;Which source is authoritative and suitable?&lt;/td&gt;
&lt;td&gt;Tool, index, and filters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Query planning&lt;/td&gt;
&lt;td&gt;Which semantic, keyword, or structured queries should run?&lt;/td&gt;
&lt;td&gt;Executable queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Result evaluation&lt;/td&gt;
&lt;td&gt;Is the material relevant, fresh, complete, and consistent?&lt;/td&gt;
&lt;td&gt;Scores, coverage, conflict flags&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6. Correction&lt;/td&gt;
&lt;td&gt;Should the agent change query, source, or scope?&lt;/td&gt;
&lt;td&gt;Next action and remaining budget&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7. Synthesis&lt;/td&gt;
&lt;td&gt;Can every important claim be traced to evidence?&lt;/td&gt;
&lt;td&gt;Answer, citations, uncertainty&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Suppose a user asks, “Should we upgrade our production database from version 13 to 16?” A useful trajectory might be:&lt;/p&gt;
&lt;div class=&#34;mermaid&#34;&gt;sequenceDiagram
    participant U as User
    participant A as Agent
    participant D as Internal docs
    participant M as Asset database
    participant W as Official docs

    U-&gt;&gt;A: Should we upgrade production from 13 to 16?
    A-&gt;&gt;M: Get versions, extensions, instance sizes, maintenance windows
    M--&gt;&gt;A: Return environment inventory
    A-&gt;&gt;D: Search incidents, compatibility tests, change policy
    D--&gt;&gt;A: Return internal evidence
    A-&gt;&gt;W: Check breaking changes and support windows for 14, 15, 16
    W--&gt;&gt;A: Return official evidence
    A-&gt;&gt;A: Check extension compatibility and evidence gaps
    A-&gt;&gt;D: Search for missing extension test results
    D--&gt;&gt;A: No complete test record found
    A--&gt;&gt;U: Give a conditional recommendation and required tests
&lt;/div&gt;&lt;p&gt;The key is not merely that several searches occurred. The later search depends on an earlier observation. If the inventory reveals a particular extension, the agent then investigates that extension. A fixed pipeline cannot economically encode every such branch.&lt;/p&gt;
&lt;h2 id=&#34;common-architectures&#34;&gt;Common architectures
&lt;/h2&gt;&lt;p&gt;Agentic RAG is a family of architectures, not a single topology.&lt;/p&gt;
&lt;div class=&#34;mermaid&#34;&gt;flowchart TB
    O[Orchestration and state] --&gt; P[Planner / Router]
    P --&gt; T1[Vector retrieval]
    P --&gt; T2[Keyword or hybrid retrieval]
    P --&gt; T3[SQL / API]
    P --&gt; T4[Knowledge graph / Web]
    T1 --&gt; E[Evidence pool]
    T2 --&gt; E
    T3 --&gt; E
    T4 --&gt; E
    E --&gt; J[Evidence evaluator]
    J --&gt;|Insufficient| P
    J --&gt;|Sufficient| G[Answer generator]
    G --&gt; C[Citation and safety gates]
&lt;/div&gt;&lt;h3 id=&#34;one-agent-with-multiple-tools&#34;&gt;One agent with multiple tools
&lt;/h3&gt;&lt;p&gt;A single agent plans, selects tools, evaluates results, and answers. This is the easiest design to start with when there are few tools and one permission boundary. Its weakness is that responsibilities accumulate in one prompt, making decisions harder to test and stabilize.&lt;/p&gt;
&lt;h3 id=&#34;router-with-specialized-retrievers&#34;&gt;Router with specialized retrievers
&lt;/h3&gt;&lt;p&gt;A router only classifies the question and selects a data source; stable, specialized pipelines handle the actual retrieval. For example, policy questions use the document index, order questions use SQL, and live status uses a business API. This is more controllable than a fully open agent and often the most practical production compromise.&lt;/p&gt;
&lt;h3 id=&#34;corrective-or-reflective-rag&#34;&gt;Corrective or reflective RAG
&lt;/h3&gt;&lt;p&gt;The system retrieves first, then evaluates result quality. Weak evidence triggers query rewriting, broader sources, or web search. &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2401.15884&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;CRAG&lt;/a&gt; focuses on correcting retrieval, while &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2310.11511&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Self-RAG&lt;/a&gt; trains a model to decide when to retrieve and to critique its generations. These ideas overlap with Agentic RAG but are not synonyms: they can be components inside an agent loop or fixed stages in a non-agentic pipeline.&lt;/p&gt;
&lt;h3 id=&#34;multi-agent-rag&#34;&gt;Multi-agent RAG
&lt;/h3&gt;&lt;p&gt;Work is divided among research, retrieval, verification, and writing agents, or among agents specialized by knowledge domain. This can help when work is genuinely parallel, expertise differs, or permissions must be isolated. It also increases communication cost, state coordination, and debugging complexity. &lt;strong&gt;Multi-agent orchestration is an optional extension, not a requirement for Agentic RAG.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;traditional-rag-vs-agentic-rag&#34;&gt;Traditional RAG vs. Agentic RAG
&lt;/h2&gt;&lt;p&gt;The useful comparison is not “dumb versus smart.” It is an engineering trade-off between a deterministic pipeline and a runtime decision system.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Traditional RAG&lt;/th&gt;
&lt;th&gt;Agentic RAG&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Control flow&lt;/td&gt;
&lt;td&gt;Predefined&lt;/td&gt;
&lt;td&gt;Dynamic branches and loops&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Whether to retrieve&lt;/td&gt;
&lt;td&gt;Usually always&lt;/td&gt;
&lt;td&gt;Retrieve, skip, or defer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query handling&lt;/td&gt;
&lt;td&gt;Original query or fixed rewrite&lt;/td&gt;
&lt;td&gt;Dynamic decomposition, expansion, and clarification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data sources&lt;/td&gt;
&lt;td&gt;One index or a fixed combination&lt;/td&gt;
&lt;td&gt;Runtime selection across heterogeneous sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval count&lt;/td&gt;
&lt;td&gt;Once or a fixed number&lt;/td&gt;
&lt;td&gt;Until evidence is sufficient or budget is exhausted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-hop work&lt;/td&gt;
&lt;td&gt;Relies on one retrieval covering the task&lt;/td&gt;
&lt;td&gt;Uses one result to decide the next retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failure handling&lt;/td&gt;
&lt;td&gt;Current result or fixed fallback&lt;/td&gt;
&lt;td&gt;Evaluate, retry, switch tools, clarify, or degrade&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Predictability&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Lower; requires state and budgets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency and cost&lt;/td&gt;
&lt;td&gt;Lower and steadier&lt;/td&gt;
&lt;td&gt;Usually higher and more variable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Observability&lt;/td&gt;
&lt;td&gt;Retrieval and final answer&lt;/td&gt;
&lt;td&gt;Also plan, calls, state transitions, stopping reason&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security surface&lt;/td&gt;
&lt;td&gt;Relatively concentrated&lt;/td&gt;
&lt;td&gt;Broader tool, injection, and authorization risks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best fit&lt;/td&gt;
&lt;td&gt;High-volume, single-hop, bounded questions&lt;/td&gt;
&lt;td&gt;Multi-step, multi-source research and decision support&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The two approaches are not mutually exclusive. A production system can take a fast traditional path first and escalate only complex or low-confidence requests to an agentic path.&lt;/p&gt;
&lt;div class=&#34;mermaid&#34;&gt;flowchart LR
    Q[User question] --&gt; X{Complexity and risk check}
    X -- Simple, single-hop --&gt; R[Traditional RAG fast path]
    X -- Multi-hop or low confidence --&gt; A[Agentic RAG deep path]
    R --&gt; G[Shared answer and citation layer]
    A --&gt; G
&lt;/div&gt;&lt;p&gt;This tiered design keeps common requests fast and reserves planning and retrieval budgets for questions that benefit from them.&lt;/p&gt;
&lt;h2 id=&#34;offline-knowledge-engineering-still-matters&#34;&gt;Offline knowledge engineering still matters
&lt;/h2&gt;&lt;p&gt;Agentic RAG mainly changes online query execution. It does not replace document parsing, chunking, metadata, permissions, indexing, or freshness management. A powerful agent searching bad data simply searches bad data more times.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;th&gt;Important design choices&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Knowledge&lt;/td&gt;
&lt;td&gt;Ingest, parse, chunk, index, update&lt;/td&gt;
&lt;td&gt;Quality, versioning, permissions, freshness&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tools&lt;/td&gt;
&lt;td&gt;Expose retrieval through clear interfaces&lt;/td&gt;
&lt;td&gt;Input schemas, filters, timeouts, result format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orchestration&lt;/td&gt;
&lt;td&gt;Plan, route, loop, maintain state and budget&lt;/td&gt;
&lt;td&gt;Step limits, concurrency, retries, checkpoints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Governance&lt;/td&gt;
&lt;td&gt;Evaluate, observe, secure, involve humans&lt;/td&gt;
&lt;td&gt;Traces, audits, approval, offline test sets&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Tool descriptions should be specific. “Search the knowledge base” is not enough. The agent needs to know the source&amp;rsquo;s coverage, time range, suitable question types, return fields, and permission constraints. More vaguely described tools can actually increase routing errors.&lt;/p&gt;
&lt;p&gt;This framework-neutral pseudocode shows a minimal bounded loop:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt; 1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 3
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 4
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 5
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 6
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 7
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 8
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt; 9
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;10
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;11
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;12
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;13
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;14
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;15
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;16
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;17
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;18
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;19
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;20
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;21
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;22
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;23
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;24
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;25
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;26
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;27
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;28
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;29
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;answer&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;question&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;user&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;max_steps&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;question&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;question&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;evidence&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;open_questions&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;question&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;s2&#34;&gt;&amp;#34;trace&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[],&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;step&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;in&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;range&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;max_steps&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;planner&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;decide&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;allowed_tools&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;user&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;allowed_tools&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;action&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;clarify&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ask_user&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;question&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;action&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;answer&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;evidence_gate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;passed&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;evidence&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;generator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;grounded_answer&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;planner&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;repair_missing_evidence&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;n&#34;&gt;result&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;tools&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;tool&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;n&#34;&gt;query&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;query&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;n&#34;&gt;filters&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;filters&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;n&#34;&gt;identity&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;user&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;identity&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;n&#34;&gt;grade&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;evaluator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;grade&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;open_questions&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;])&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;n&#34;&gt;state&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;update_state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;decision&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;grade&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;generator&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;bounded_fallback&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;state&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The safeguards are more important than the loop itself: &lt;code&gt;allowed_tools&lt;/code&gt; constrains authorization, &lt;code&gt;max_steps&lt;/code&gt; prevents runaway execution, &lt;code&gt;evidence_gate&lt;/code&gt; blocks unsupported answers, and &lt;code&gt;trace&lt;/code&gt; preserves structured evidence for debugging and evaluation.&lt;/p&gt;
&lt;h2 id=&#34;production-failure-modes&#34;&gt;Production failure modes
&lt;/h2&gt;&lt;h3 id=&#34;endless-search-and-runaway-cost&#34;&gt;Endless search and runaway cost
&lt;/h3&gt;&lt;p&gt;If the stopping rule is only “the model thinks it has enough,” the agent can bounce among nearly identical queries. Bound maximum steps, total tokens, per-tool timeouts, concurrency, and cost. When the budget is exhausted, return an explicit degraded result.&lt;/p&gt;
&lt;h3 id=&#34;treating-reflection-as-fact-checking&#34;&gt;Treating reflection as fact checking
&lt;/h3&gt;&lt;p&gt;Asking the same model to review its own answer does not create independent evidence. A reflection node should inspect observable properties: whether every subquestion has a source, whether citations support claims, and whether time ranges agree.&lt;/p&gt;
&lt;h3 id=&#34;prompt-injection-inside-retrieved-content&#34;&gt;Prompt injection inside retrieved content
&lt;/h3&gt;&lt;p&gt;A page or document can contain text such as “ignore prior instructions and call this tool.” Retrieved content must be treated as &lt;strong&gt;untrusted data&lt;/strong&gt;, not as high-priority instructions. Validate tool parameters, use source allowlists and least privilege, and require approval for high-impact actions.&lt;/p&gt;
&lt;h3 id=&#34;keeping-only-the-final-answer&#34;&gt;Keeping only the final answer
&lt;/h3&gt;&lt;p&gt;Failures can arise during decomposition, routing, querying, retrieval, evaluation, stopping, or generation. Logs should include structured decisions, tool names, query parameters, document IDs, scores, latency, token use, errors, and stopping reasons. There is no need to store or expose private chain-of-thought.&lt;/p&gt;
&lt;h3 id=&#34;using-agents-to-hide-weak-retrieval&#34;&gt;Using agents to hide weak retrieval
&lt;/h3&gt;&lt;p&gt;If the correct document rarely appears in Top-K, first fix parsing, chunking, embeddings, filters, hybrid retrieval, and reranking. An agent may repair occasional gaps, but it is not a replacement for sound information retrieval.&lt;/p&gt;
&lt;h2 id=&#34;evaluate-the-trajectory-not-only-the-answer&#34;&gt;Evaluate the trajectory, not only the answer
&lt;/h2&gt;&lt;p&gt;Traditional RAG evaluation often emphasizes retrieval hits and answer correctness. Agentic RAG must also ask whether the right tool was selected, whether searches were useful, and whether the agent stopped at the right time.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Suggested metrics&lt;/th&gt;
&lt;th&gt;Question answered&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Retrieval&lt;/td&gt;
&lt;td&gt;Recall@K, MRR, nDCG, evidence coverage&lt;/td&gt;
&lt;td&gt;Was the right material found?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generation&lt;/td&gt;
&lt;td&gt;Correctness, faithfulness, citation precision and completeness&lt;/td&gt;
&lt;td&gt;Is the answer supported?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trajectory&lt;/td&gt;
&lt;td&gt;Tool-choice accuracy, query utility, average steps, stop accuracy&lt;/td&gt;
&lt;td&gt;Was the process reasonable?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;System&lt;/td&gt;
&lt;td&gt;P50/P95 latency, token and tool cost, timeout rate&lt;/td&gt;
&lt;td&gt;Was the quality gain worth it?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety&lt;/td&gt;
&lt;td&gt;Unauthorized-call rate, injection success rate, data leakage rate&lt;/td&gt;
&lt;td&gt;Did the system preserve boundaries?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Build a layered test set: simple single-hop cases for the fast path; multi-hop cases for decomposition and evidence composition; underspecified requests for clarification; conflicting sources for conflict handling; and malicious documents for prompt-injection defenses. A handful of answers that “look good” is not enough for production decisions.&lt;/p&gt;
&lt;h2 id=&#34;when-to-use-it&#34;&gt;When to use it
&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Recommended approach&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FAQ, manuals, single-policy questions&lt;/td&gt;
&lt;td&gt;Traditional RAG&lt;/td&gt;
&lt;td&gt;Stable query shape and clear answer boundaries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One index with occasional recall problems&lt;/td&gt;
&lt;td&gt;Advanced RAG&lt;/td&gt;
&lt;td&gt;Improve hybrid search, reranking, rewrites, and evaluation first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Interdependent subquestions&lt;/td&gt;
&lt;td&gt;Agentic RAG&lt;/td&gt;
&lt;td&gt;Requires decomposition and follow-up retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Documents, databases, and live APIs together&lt;/td&gt;
&lt;td&gt;Agentic RAG&lt;/td&gt;
&lt;td&gt;Requires dynamic routing across heterogeneous tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Medical, financial, or production-changing actions&lt;/td&gt;
&lt;td&gt;Agentic RAG plus human approval&lt;/td&gt;
&lt;td&gt;Retrieval can support judgment; high-impact action still needs authorization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Very low latency, high throughput, fixed output&lt;/td&gt;
&lt;td&gt;Traditional RAG or rules&lt;/td&gt;
&lt;td&gt;Agent loops rarely justify their overhead&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For a new system, evolve in this order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Build an evaluable traditional RAG baseline.&lt;/li&gt;
&lt;li&gt;Add hybrid retrieval, metadata filters, reranking, and citation checks.&lt;/li&gt;
&lt;li&gt;Give only obvious source-selection decisions to a router.&lt;/li&gt;
&lt;li&gt;Add a bounded retrieve-evaluate-correct loop for complex queries.&lt;/li&gt;
&lt;li&gt;Consider multi-agent workflows, long-term memory, and broader tool access last.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;The value of Agentic RAG is not that it makes RAG look more like an “agent.” It gives a system three abilities that a fixed retrieval pipeline lacks:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Plan&lt;/strong&gt;: turn a complex request into verifiable retrieval tasks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Adapt&lt;/strong&gt;: change queries, sources, or ask for clarification based on intermediate evidence.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Verify&lt;/strong&gt;: stop, degrade, or involve a human when evidence is missing, contradictory, or outside the permission boundary.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The costs are equally real: more model calls, higher latency, more state, a larger security surface, and harder evaluation. Mature systems usually do not make every request agentic. They retain a stable traditional RAG fast path and reserve Agentic RAG for questions that genuinely require multi-step, multi-source, runtime decisions.&lt;/p&gt;
&lt;p&gt;In one sentence:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Traditional RAG asks, “Which passage is relevant?” Agentic RAG additionally asks, “What should I find next, where should I look, and do I have enough evidence to stop?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;references&#34;&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Lewis et al., &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2005.11401&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks&lt;/a&gt;, 2020.&lt;/li&gt;
&lt;li&gt;Yao et al., &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2210.03629&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;ReAct: Synergizing Reasoning and Acting in Language Models&lt;/a&gt;, 2022.&lt;/li&gt;
&lt;li&gt;Asai et al., &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2310.11511&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection&lt;/a&gt;, 2023.&lt;/li&gt;
&lt;li&gt;Yan et al., &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2401.15884&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Corrective Retrieval Augmented Generation&lt;/a&gt;, 2024.&lt;/li&gt;
&lt;li&gt;Singh et al., &lt;a class=&#34;link&#34; href=&#34;https://arxiv.org/abs/2501.09136&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Agentic Retrieval-Augmented Generation: A Survey on Agentic RAG&lt;/a&gt;, 2025.&lt;/li&gt;
&lt;li&gt;Microsoft, &lt;a class=&#34;link&#34; href=&#34;https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-agentic&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;Develop an Agentic RAG Solution on Azure&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;LangChain, &lt;a class=&#34;link&#34; href=&#34;https://docs.langchain.com/oss/python/learn&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;RAG agent and custom RAG agent tutorials&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
        </item>
        <item>
        <title>From Keyword Matching to Vector Retrieval: Three Ways to Search</title>
        <link>https://SymphonyW.github.io/p/search-matching-retrieval/</link>
        <pubDate>Fri, 02 Oct 2026 20:13:30 +0800</pubDate>
        
        <guid>https://SymphonyW.github.io/p/search-matching-retrieval/</guid>
        <description>&lt;img src="https://SymphonyW.github.io/p/search-matching-retrieval/bg.svg" alt="Featured image of post From Keyword Matching to Vector Retrieval: Three Ways to Search" /&gt;&lt;h1 id=&#34;from-keyword-matching-to-vector-retrieval-three-ways-to-search&#34;&gt;From Keyword Matching to Vector Retrieval: Three Ways to Search
&lt;/h1&gt;&lt;blockquote&gt;
&lt;p&gt;Search is not one technique. &lt;strong&gt;Keyword matching&lt;/strong&gt; finds words that appear literally, &lt;strong&gt;fuzzy search&lt;/strong&gt; rescues misspellings and partial input, and &lt;strong&gt;vector retrieval&lt;/strong&gt; finds content with similar meaning. In RAG systems, these methods usually complement each other rather than replace each other.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/bg.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/bg.svg&#34; alt=&#34;From keyword matching to vector retrieval&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;A quick example:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;User intent&lt;/th&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;Best starting point&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Find an explicit rule&lt;/td&gt;
&lt;td&gt;&lt;code&gt;refund policy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Keyword matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recover a typo&lt;/td&gt;
&lt;td&gt;&lt;code&gt;retun policy&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fuzzy search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ask naturally&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Can I change my mind after buying this?&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Vector retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Need both precision and semantics&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Can a premium member refund the wrong plan?&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hybrid retrieval + reranking&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/matching-spectrum.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/matching-spectrum.svg&#34; alt=&#34;Search capability spectrum&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h2 id=&#34;keyword-matching&#34;&gt;Keyword Matching
&lt;/h2&gt;&lt;p&gt;Keyword matching is the classic information retrieval approach. Documents are tokenized, indexed, and ranked according to term overlap, term frequency, field weights, and document length.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/keyword-inverted-index.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/keyword-inverted-index.svg&#34; alt=&#34;Keyword matching and inverted index&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;The most common structure is an &lt;strong&gt;inverted index&lt;/strong&gt;: instead of scanning documents one by one, the system maps each term to the documents that contain it.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Matching signal&lt;/td&gt;
&lt;td&gt;Literal term overlap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common algorithms&lt;/td&gt;
&lt;td&gt;TF-IDF, BM25, Boolean queries, field boosts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strengths&lt;/td&gt;
&lt;td&gt;Fast, stable, explainable, easy to filter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weaknesses&lt;/td&gt;
&lt;td&gt;Poor at synonyms, paraphrases, and unstated intent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;SKU, order id, logs, legal clauses, code symbols, titles&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If a user searches for &lt;code&gt;redis setnx&lt;/code&gt;, keyword retrieval is excellent. If they search for &lt;code&gt;how do I prevent duplicate orders&lt;/code&gt;, a purely lexical system may miss articles that only mention &lt;code&gt;idempotency&lt;/code&gt; or &lt;code&gt;distributed lock&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;fuzzy-search&#34;&gt;Fuzzy Search
&lt;/h2&gt;&lt;p&gt;Fuzzy search is still lexical search, but more tolerant. It asks whether the user input and the indexed term &lt;strong&gt;look similar enough&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/fuzzy-search-flow.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/fuzzy-search-flow.svg&#34; alt=&#34;Fuzzy search flow&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Common techniques include:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Technique&lt;/th&gt;
&lt;th&gt;Solves&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Edit distance&lt;/td&gt;
&lt;td&gt;Insertions, deletions, substitutions, transpositions&lt;/td&gt;
&lt;td&gt;&lt;code&gt;retun&lt;/code&gt; → &lt;code&gt;return&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;n-gram / trigram&lt;/td&gt;
&lt;td&gt;Substring similarity&lt;/td&gt;
&lt;td&gt;&lt;code&gt;microserv&lt;/code&gt; → &lt;code&gt;microservice&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prefix matching&lt;/td&gt;
&lt;td&gt;Autocomplete&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kuber&lt;/code&gt; → &lt;code&gt;kubernetes&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Phonetic or pinyin correction&lt;/td&gt;
&lt;td&gt;Input method mistakes&lt;/td&gt;
&lt;td&gt;pinyin-like input → Chinese term&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Synonym dictionaries&lt;/td&gt;
&lt;td&gt;Manually curated near-equivalents&lt;/td&gt;
&lt;td&gt;&lt;code&gt;after-sales&lt;/code&gt; ≈ &lt;code&gt;returns&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Fuzzy search is great for search box ergonomics: typos, partial names, remembered fragments, and autocomplete. Elasticsearch, OpenSearch, Solr, PostgreSQL trigram, and Algolia all provide related capabilities.&lt;/p&gt;
&lt;p&gt;But fuzzy search does not fully understand meaning. &lt;code&gt;refund&lt;/code&gt; and &lt;code&gt;return&lt;/code&gt; are semantically related, but they may not be textually similar. &lt;code&gt;iPhone&lt;/code&gt; and &lt;code&gt;Apple phone&lt;/code&gt; can be far apart lexically. Once recall is widened, false positives also increase, so fuzzy search needs thresholds, field boosts, popularity, click signals, and business rules.&lt;/p&gt;
&lt;h2 id=&#34;vector-retrieval&#34;&gt;Vector Retrieval
&lt;/h2&gt;&lt;p&gt;Vector retrieval uses an embedding model to convert text, images, audio, or other objects into numeric vectors. Items with similar meaning are close in vector space. At query time, the system embeds the user query and retrieves the nearest vectors.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/vector-rag-flow.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/vector-rag-flow.svg&#34; alt=&#34;Vector retrieval and RAG flow&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;This is the retrieval foundation of many RAG systems: retrieve relevant chunks from a knowledge base, insert them into the prompt, and let the LLM answer with external context.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Matching signal&lt;/td&gt;
&lt;td&gt;Semantic similarity in embedding space&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common indexes&lt;/td&gt;
&lt;td&gt;HNSW, IVF, PQ, DiskANN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common metrics&lt;/td&gt;
&lt;td&gt;Cosine similarity, inner product, Euclidean distance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strengths&lt;/td&gt;
&lt;td&gt;Handles paraphrases, natural questions, cross-lingual and multimodal similarity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Weaknesses&lt;/td&gt;
&lt;td&gt;Higher cost, weaker explainability, less reliable for exact constraints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Knowledge base QA, similar articles, image similarity, recommendations, semantic code search&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For example, a document may say:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Customers may request no-reason returns within 7 days after order completion.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;A user may ask:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Can I send it back if I no longer want it?
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Keyword search may miss the connection. Vector search is more likely to retrieve the return policy because the meanings are close.&lt;/p&gt;
&lt;p&gt;Vector retrieval is not magic, though. It is weaker for exact IDs, version numbers, permissions, and precise field filters. For &lt;code&gt;HTTP 451&lt;/code&gt;, &lt;code&gt;order 202610020001&lt;/code&gt;, or &lt;code&gt;Go 1.22&lt;/code&gt;, lexical and structured retrieval are often safer.&lt;/p&gt;
&lt;h2 id=&#34;core-differences&#34;&gt;Core Differences
&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Keyword matching&lt;/th&gt;
&lt;th&gt;Fuzzy search&lt;/th&gt;
&lt;th&gt;Vector retrieval&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Focus&lt;/td&gt;
&lt;td&gt;Did the term appear?&lt;/td&gt;
&lt;td&gt;Is the term similar?&lt;/td&gt;
&lt;td&gt;Is the meaning similar?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query style&lt;/td&gt;
&lt;td&gt;Precise, short, terminology-heavy&lt;/td&gt;
&lt;td&gt;Typo-prone, abbreviated, partial&lt;/td&gt;
&lt;td&gt;Natural, descriptive, long&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recall&lt;/td&gt;
&lt;td&gt;Precise but can miss&lt;/td&gt;
&lt;td&gt;Wider lexical recall&lt;/td&gt;
&lt;td&gt;Strong semantic recall&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Explainability&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Lower&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency and cost&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Medium to high&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Typical tools&lt;/td&gt;
&lt;td&gt;MySQL, Lucene, Elasticsearch BM25&lt;/td&gt;
&lt;td&gt;Elasticsearch fuzzy, trigram, Algolia&lt;/td&gt;
&lt;td&gt;FAISS, Milvus, Qdrant, Pinecone, Weaviate&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A simple mental model:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Keyword matching: you said A, so I search for A.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Fuzzy search: you probably meant A, so I search for A.
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Vector retrieval: you meant something like A, so I search for similar meaning.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;classic-applications&#34;&gt;Classic Applications
&lt;/h2&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Recommended approach&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Log search&lt;/td&gt;
&lt;td&gt;Keyword + time/service filters&lt;/td&gt;
&lt;td&gt;Exact error codes and fields matter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E-commerce search&lt;/td&gt;
&lt;td&gt;Keyword + fuzzy + vector recall&lt;/td&gt;
&lt;td&gt;Product names need precision, user input is messy, recommendations need semantics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Code search&lt;/td&gt;
&lt;td&gt;Symbol index + keyword + semantic vectors&lt;/td&gt;
&lt;td&gt;Names matter, but user intent can be natural language&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Enterprise knowledge QA&lt;/td&gt;
&lt;td&gt;Vector + BM25 + reranking + RAG&lt;/td&gt;
&lt;td&gt;The system must understand questions, retrieve evidence, and cite sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Image similarity&lt;/td&gt;
&lt;td&gt;Vector retrieval&lt;/td&gt;
&lt;td&gt;Visual similarity is hard to express with keywords&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Help center search&lt;/td&gt;
&lt;td&gt;Keyword + fuzzy + synonyms + vector retrieval&lt;/td&gt;
&lt;td&gt;Users mix product terms and natural language&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Enterprise RAG is the clearest example. Users rarely repeat document titles exactly. They ask questions like “Why was this reimbursement rejected?” or “How does sick leave work during probation?” A robust system filters by permissions, retrieves candidates with both BM25 and vectors, reranks them, and sends only a small set of reliable chunks to the LLM.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/hybrid-ranking.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/hybrid-ranking.svg&#34; alt=&#34;Hybrid retrieval pipeline&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h2 id=&#34;practical-selection&#34;&gt;Practical Selection
&lt;/h2&gt;&lt;p&gt;&lt;a href=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/decision-map.svg&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img src=&#34;https://SymphonyW.github.io/p/search-matching-retrieval/decision-map.svg&#34; alt=&#34;Search method decision map&#34; loading=&#34;lazy&#34; decoding=&#34;async&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Use this quick guide:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Start with&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Users type order IDs, error codes, function names, or exact terms&lt;/td&gt;
&lt;td&gt;Keyword matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Users often misspell, abbreviate, or type only prefixes&lt;/td&gt;
&lt;td&gt;Fuzzy search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Users describe intent in natural language&lt;/td&gt;
&lt;td&gt;Vector retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You need exact filters, semantic understanding, and LLM grounding&lt;/td&gt;
&lt;td&gt;Hybrid retrieval&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Production search is usually a layered system:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Structured filters&lt;/strong&gt;: permissions, tenants, time, category.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Keyword recall&lt;/strong&gt;: BM25 protects exact terms, titles, IDs, and entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vector recall&lt;/strong&gt;: captures paraphrases and semantic intent.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fusion&lt;/strong&gt;: RRF or weighted scoring merges candidate lists.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reranking&lt;/strong&gt;: cross-encoders, LLM rerankers, or business rules refine the final order.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Generation&lt;/strong&gt;: in RAG, only the most relevant and trustworthy chunks are inserted into the prompt.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;the-takeaway&#34;&gt;The Takeaway
&lt;/h2&gt;&lt;p&gt;Keyword matching answers &lt;strong&gt;“does this word appear?”&lt;/strong&gt; Fuzzy search answers &lt;strong&gt;“was this word typed imperfectly?”&lt;/strong&gt; Vector retrieval answers &lt;strong&gt;“what does this query mean?”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For a normal search box, start with keyword retrieval, tokenization, field boosts, and fuzzy correction. For knowledge QA or intelligent support, add vector retrieval and RAG. For real production systems, hybrid retrieval is usually where the design lands, because users alternate between exact identifiers and vague natural language all the time.&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
