Series: RAG 系統架構 (2/5)
- RAG completed a five-stage evolution (Naive → Advanced → Modular → Graph → Agentic) in two years, essentially by pulling reasoning deeper into the retrieval loop.
- The inflection point isn't stronger models — it's control shifting from pipeline to agent: from Retrieve-then-Read to Loop-until-Enough.
- Graph RAG closes the 'cross-document semantic gap'; Agentic RAG answers 'when to search, what to search, whether to search again'.
- engineer-news currently only runs a single vector lane with a keyword fallback — no rerank, no hybrid — so it sits right at the Naive RAG edge.
- For a personal site, the ROI of adding BGE-Reranker and BM25 hybrid is far higher than jumping straight to GraphRAG or Agentic.
Table of Contents
Recently I came across an interactive RAG tutorial on wenaidev that lays out RAG’s evolution on a timeline in three generations: Advanced RAG in 2023 (query rewriting, reranking, preprocessing), GraphRAG in 2024, and Agentic RAG in 2025. Clear structure — but it made me want to zoom in one more level. If you fold in the industrial pain points, the timeline actually splits into five stages: Naive → Advanced → Modular → Graph → Agentic.
This isn’t a straight translation. I’m reviewing the last two years of key papers and industry practice while looking back at my own site, engineer-news — which runs a RAG stack on Cloudflare D1 + Vectorize + bge-m3 + qwen-14b. Placed on the same spectrum, it sits at the far left: the Naive RAG edge. That contrast gives the evolution story an anchor, and doubles as a checklist for what a personal site should add next.
One yardstick: how deep does Reasoning reach?
There’s a simple way to read the two-year evolution: ask how far does the brain (Reasoning) reach into the loop?
- Naive RAG: Retrieve-then-Read, one shot, the brain doesn’t touch retrieval decisions.
- Advanced RAG: Add stages around retrieval — rewrite the query up front, rerank results at the back. The brain helps polish query and results.
- Modular RAG: Break into modules; a Router decides which pipeline to run. The brain decides which lane this query takes.
- Graph RAG: Introduce a knowledge graph to solve cross-document association. The brain works at graph construction (entity/relation extraction) and query-time traversal.
- Agentic RAG: A loop where the model itself controls search strategy. The brain decides whether to search again, what to search, and when to stop.
One-line thesis underneath: RAG is moving from System 1 (fast, pipeline) to System 2 (slow, looped reasoning).
One stage at a time.
Phase 1 — Naive RAG: the Retrieve-then-Read baseline
Facebook AI’s 2020 NeurIPS paper Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks set the paradigm: Query Encoder + Document Encoder map into the same vector space, MIPS (Maximum Inner Product Search) fetches Top-K docs, and a Generator (BART in the original paper) concatenates and produces the answer.
Industry usually adopts only the inference paradigm — LangChain / LlamaIndex + FAISS/Milvus + a fixed prompt. This solved LLMs’ stale-knowledge + hallucination problem from 0 to 1.
The pain point is blunt: recall is the ceiling. If Top-k doesn’t fetch the right doc, or fetches irrelevant noise, the answer is wrong. And vector retrieval itself has two structural limits:
- Proper nouns, model numbers, product codes, identifiers — vectors are inherently bad at these.
- One chunk = one vector, i.e. a semantic compression of the whole passage, which by design cannot express exact literal matches.
Phase 2 — Advanced RAG: Precision Matters
Industry quickly realized Naive RAG was weak, and started piling tricks around retrieval. Three canonical moves:
Hybrid Search
Vector retrieval (semantic) + BM25 (keyword). BM25 is 30 years old, but RAG has resuscitated it — because vectors can’t guarantee precise recall, and BM25 was literally designed for keyword matching.
IBM Research’s 2024 BlendedRAG went further: vector + sparse vector + full-text search is the recall ceiling. Sparse vectors (like SPLADE) handle generic queries but miss domain-specific words; BM25 fills that gap. The three lanes each specialize and cannot substitute for each other.
Reranker
The Bi-Encoder (embedding model) encodes query and doc separately, then just measures distance — fast but coarse. A Cross-Encoder (reranker) concatenates query and doc into BERT to capture pairwise token interactions — slow but precise.
The canonical work is BAAI’s BGE-Reranker (C-Pack paper). The engineering pattern: vector retrieval fetches Top-50 for coarse ranking, a Cross-Encoder refines to Top-5, and only that goes to the LLM. A few hundred milliseconds of extra latency for a qualitative jump in ranking.
By late 2024, the MTEB leaderboard’s top slots started being taken over by LLM-based Rerankers (like gte-Qwen2-7B), doubling inference cost. That prompted a middle ground — Tensor / Late Interaction Rerankers (the ColBERT family): store per-token vectors at index time, then at query time sum pairwise similarities between query and doc tokens. Quality approaches Cross-Encoder, and it can live inside the database (supported by Vespa, Infinity).
Query Rewriting / HyDE
CMU’s HyDE (Hypothetical Document Embeddings) is a clever move: let an LLM hallucinate a fake answer first, then run vector search on that fake answer.
Why does this work? Because queries and documents often phrase things very differently — a user asks “how do I fix D1 batch timeout?”, while the doc says “when a SQLite transaction exceeds 30 seconds, the Cloudflare Workers runtime aborts it.” Not close in vector space. But the LLM’s hallucinated answer speaks like the doc, so their embeddings land nearby. Searching with the fake answer’s embedding beats searching with the raw query’s.
Advanced RAG’s overall move can be summarized in one line: squeeze the recall ceiling with more tricks around retrieval. But the backbone is still a linear pipeline — the brain optimizes at both ends without entering the decision loop.
Phase 3 — Modular RAG: Dynamic Routing
When the business gets complex (query internal KB, search the web, call an API — all in one), a linear RAG breaks. The response is to break RAG into modules: Search / Memory / Routing / Tool as separate pieces, with a Router dispatching by query intent.
The canonical work is Stanford NLP’s DSPy. It treats RAG as a programming problem:
Signaturesdeclare I/O declarativelyModulesare composable building blocksTeleprompterauto-optimizes prompts and few-shot examples
Meaning: no more hand-tuning prompts — the framework compiles the optimal combination like source code. Prompt Engineering evolves into Prompt Compilation.
The most typical industry example is ChatGPT Plugins / Ernie Bot’s tool routing — user asks “Beijing weather today”, the Router identifies intent → routes to a weather API → fills the result into the prompt. Looks like just adding an if-else, but the “if-else” decision moves from the dev’s hands to the LLM’s. That’s the first qualitative moment of “the brain entering the loop.”
Phase 4 — Graph RAG: Global Understanding
Phases 1–3 all deal in fragments — each chunk is on its own, unable to answer “summarize the whole book’s views” or “what do these companies have in common” — the so-called Global Query.
Microsoft’s 2024 paper From Local to Global: A Graph RAG Approach to Query-Focused Summarization is the watershed. Core pipeline:
Source Documents
→ LLM extracts entities and relations
→ Leiden algorithm runs community detection (hierarchical communities)
→ LLM pre-generates a summary for each community
→ At query time, Map-Reduce over the community summaries: each answers once, then aggregate
What it solves is another structural pain point of RAG — the semantic gap. Search systems have always had this problem: queries and docs phrase things differently, and direct matches miss. When RAG replaces keywords with full-sentence questions, the gap widens. GraphRAG uses “LLM reads everything up front, extracts entities, builds a graph, writes community summaries” to fossilize cross-document associations offline, so query-time answers walk on those pre-generated summaries.
After Microsoft open-sourced GraphRAG, a whole spectrum of variants appeared, mostly aiming at cutting token cost:
- Fast GraphRAG: drop community summaries; use personalized PageRank random walks on the graph to fetch a subgraph, then let the LLM answer from it.
- LightRAG (HKU): drop the community layer, keep it lightweight.
- LazyGraphRAG (Microsoft, late 2024): drop even the LLM extraction — use a local small model for noun extraction + co-occurrence stats to build communities, and only generate summaries at query time. The other extreme: minimize preprocessing cost, defer everything to query time.
- HippoRAG: borrows the hippocampal indexing theory from neuroscience — personalized PageRank on the graph simulates human recall via random walks.
- KAG (Ant Group): the opposite direction — heavy on explainability, requires human curation of the knowledge graph, aimed at finance / risk-control where “why” needs to be explained.
Graph RAG’s comfort zone is strong cross-document association + need for global understanding:
- Financial risk control: querying “black-market groups”. Text RAG only finds one account’s violation; Graph RAG follows the graph out to the entire related account cluster.
- Enterprise knowledge management: cross-team, cross-project associations.
- Intelligence analysis: relationship networks between entities.
What isn’t it good at? Detail Q&A on a single long article — that’s chunking + rerank’s comfort zone, and force-fitting Graph RAG is overengineering.
Phase 5 — Agentic RAG: System 2 Reasoning
The first four phases still do “fill-in-the-blanks” (Retrieve → Fill Context → Generate). Agentic RAG starts doing “word problems” — it isn’t a Pipeline, it’s a Loop.
Three defining features:
- Autonomous planning: the model decides what to search, how many times, when to stop.
- Self-correction: if a search misses, it re-searches automatically.
- Process supervision: every step of the reasoning chain is scored.
Ordered by autonomy depth, Phase 5 has three internal layers:
Level 1: Explicit Correction
Pain point: traditional RAG blindly trusts retrieval, causing “retrieval-error-induced hallucinations”. The fix here is a patch — bolt on an external check.
- CRAG (Corrective RAG, USTC & Google, ICLR ‘24): add a lightweight Evaluator that three-way classifies retrieval results:
Correct→ refine, generate directlyIncorrect→ discard the results, forcibly trigger Web SearchAmbiguous→ combine retrieved knowledge with the model’s parametric knowledge
- Self-RAG (ICLR ‘24): train the model to emit Reflection Tokens (
[IsRel],[IsSup]), so as it generates each sentence it self-asks “does this sentence have evidence? is it relevant?”, making self-reflection part of generation itself.
Level 1 is currently the cheapest Agentic form to deploy in industry — it doesn’t need RL, only Prompt Engineering + a classifier.
Level 2: Reasoning with RL
Pain point: prompt-driven or rule-driven search hits a ceiling fast. Can the model, like AlphaGo, learn “how to search” by itself?
- Search-R1 (Google Cloud AI, COLM ‘25): imports DeepSeek-R1’s approach into RAG. The model actively emits a
<search>token during<think>, making tool calls part of the reasoning chain. Uses outcome reward — no per-step labels, only the final answer’s correctness — trained at scale with GRPO/PPO. Multi-step search, evidence sifting, and verify-reflect strategies emerge from training. - Search-o1 (RUC & Tsinghua): targets the long-reasoning problem of “retrieved content too long, too noisy”. Introduces a Reason-in-Documents module — after retrieval, don’t dump directly into context; first reason and denoise in an isolated module, extract the core logic chain, then feed the main model. Avoids blowing the context window and reduces noise.
Level 3: Process Supervision
Pain point: Search-R1’s outcome supervision has a huge exploration space, converges slowly, and long chains invite Reward Hacking (the model learns to “look like it’s searching” rather than searching correctly). Switch to process-level control.
- DecEx-RAG (Xiaohongshu & TJU): models RAG as a strict MDP (Markov Decision Process). Two decoupled modules:
- Decision Module: the “commander” — each step outputs
<terminate?>and<retrieve?> - Execution Module: the “worker” — generates the concrete query or answer
- Process Reward: unlike Search-R1’s final-only reward, uses Rollouts to score every intermediate decision node
- Pruning Strategy: if a step’s score is too low, prune immediately instead of wasting compute
- Decision Module: the “commander” — each step outputs
The three Levels in one line each:
- Search-R1: “Let it learn by failing.” — huge exploration space, slow convergence
- DecEx-RAG: “Guide it step-by-step.” — high exploration efficiency, 6× data efficiency
Phase 5’s three internal layers are themselves a miniature RAG evolution:
- CRAG / Self-RAG solves “dare to use retrieval” (explicit correction)
- Search-R1 / o1 solves “learn to use retrieval” (autonomous planning)
- DecEx-RAG solves “use retrieval efficiently” (process-level pruning)
One thesis: from System 1 to System 2
Zooming out, the main line of the evolution is from static to dynamic, from mindless to mindful.
Old RAG was System 1: chase millisecond latency, take whatever it retrieves. Current Agentic RAG is System 2: spend 5–10 seconds or more Thinking, search multiple times, self-reflect, and finally guarantee answer quality.
Three implications:
1. Test-time Compute is the next battleground
LLM competition used to be about “parameter count and pretraining loss” — training-time compute. Agentic RAG shifts the fight to “how much compute you’re willing to spend at inference for Reasoning.” DeepSeek-R1 and o1 already demoed this; Agentic RAG is that paradigm landing in retrieval.
2. Long Context won’t replace RAG
When Gemini 1.5 Pro opened up 1M+ tokens, people briefly asked whether RAG was still needed. The answer is clearly yes. Long Context solves “needle in a haystack” but not:
- Live knowledge updates: model knowledge is frozen after training; RAG is the only source of running water
- TB / PB-scale corpora: 1M tokens can’t fit an enterprise-scale dataset
- Cost: stuffing 1M tokens per request every time is a nasty bill
Future architectures will be Long Context LLM + Agentic RAG — the LLM provides Reasoning and local long context, RAG provides scalable, updatable knowledge access.
3. Process Supervision Data is the new moat
The process supervision data DecEx-RAG mentions — trajectories of “how humans solve complex problems through iterative search” — will be the new asset. Whoever holds this (search giants, browser vendors, coding-agent companies) leads in the Agentic era. That’s also why OpenAI acquired Rockset and Anthropic invested heavily in Computer Use — everyone is grabbing first-hand process trajectories.
Comparing my own site: where is engineer-news?
Time to turn the camera on myself. This blog runs on Astro + Cloudflare Workers, with a RAG stack. Opening scripts/sync-to-d1.ts and src/pages/api/search.ts and mapping against the five stages:
| Layer | engineer-news implementation | Stage |
|---|---|---|
| Chunking | Paragraph-merged with a 1000-char cap (pure length split) | Naive |
| Embedding | @cf/baai/bge-m3 | Naive |
| Retrieval | Single vector lane, topK=8 | Naive |
| Rerank | None | Missing Advanced |
| Hybrid Search | SQL LIKE fallback only when vector returns nothing | Half Advanced |
| Query Rewriting | None | Missing Advanced |
| Generation | qwen1.5-14b (site-wide) / llama-3.3-70b (single article) | — |
| Router / Agent Loop | None | — |
| Graph / KG | None | — |
The /api/search flow is literally three steps:
bge-m3embeds the query- Vectorize
topK=8 - Join
doc_chunks+posts, dedupe by source, dump into the prompt, qwen generates
The “ask this article” feature has one small twist: it skips vector retrieval, assembles all of a single article’s chunks in order into context, and feeds them to Llama-3.3-70B. This qualifies as routing to a specialized pipeline after intent detection — the seed of Modular RAG — but only for this one special case.
In other words, this site sits right at the Naive RAG edge, without even a complete Advanced RAG stage.
What to add next
The paper spectrum makes GraphRAG and Agentic RAG tempting. But for a personal site, the actual ROI order should be:
- BGE-Reranker (Cross-Encoder) — rerank the
topK=8results. Implementation is just an extra Workers AI call (Workers AI has@cf/baai/bge-reranker-base), a few hundred ms of extra latency for a qualitative jump in ranking. Cost = one evening, Gain = immediately noticeable. This is the absolute priority. - BM25 hybrid — Cloudflare D1 is SQLite, and SQLite’s built-in FTS5 can serve as the keyword lane directly. More work than the reranker, but it solves queries about proper nouns, product names, and version numbers that vectors aren’t naturally good at.
- HyDE — let an LLM hallucinate a fake answer before embedding the query. Implementation is minimal (one extra LLM call). Best for short, vague queries (e.g. “how do I solve D1 timeout”).
- Contextual Retrieval — Anthropic’s approach: use an LLM to generate a short context snippet per chunk, concatenate it with the original text before embedding, closing the semantic gap. Medium effort at sync time (one LLM call per chunk), strong results.
- GraphRAG / Agentic RAG — not yet. At ~150 articles, cross-document association is weak; Agentic loop’s token cost, latency, and debugging complexity haven’t crossed the threshold for investment.
The principle behind the ordering: a personal site’s RAG evolution should track data volume + user complexity, not the paper spectrum. GraphRAG suits TB-scale cross-team data; Agentic RAG suits open-domain deep research. Both are overengineering for “one personal tech site”.
Closing: RAG is the next-generation database
There’s a great line from InfiniFlow (the RAGFlow team)‘s late-2024 year-in-review:
RAG is a very complex system. It hasn’t attracted the flood of capital LLMs have, yet in real usage it’s not only indispensable — it’s incredibly complex.
The name RAG is well chosen — it stands for an architectural pattern, not a product, not an application. Just like databases in the past: the external interface is trivially simple (SELECT), while the internals are absurdly complex (optimizer, index, B-tree, transaction isolation, MVCC).
RAG’s external interface is equally trivial — “ask a question, get an answer” — but internally packs chunking / embedding / hybrid search / rerank / KG / agent loop / memory all together. RAG is the LLM-era database.
The last two years have been that “new database” going from v0.1 to v1.0. Zoom back into engineer-news, and its RAG is only v0.2. Next time I touch it, I’ll start with the Reranker.
References
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., NeurIPS 2020) — the original Naive RAG paper
- C-Pack: Packed Resources For General Chinese Embeddings (BAAI) — introduces BGE-Reranker
- Precise Zero-Shot Dense Retrieval without Relevance Labels (CMU / Waterloo) — HyDE
- DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines — https://github.com/stanfordnlp/dspy
- From Local to Global: A Graph RAG Approach to Query-Focused Summarization (Microsoft, 2024)
- Fast GraphRAG / LightRAG / LazyGraphRAG — cost-reduction variants of GraphRAG from Microsoft and the community
- HippoRAG (2024) — hippocampal indexing theory
- KAG (Ant Group) — https://github.com/OpenSPG/KAG
- Corrective Retrieval Augmented Generation (CRAG, ICLR ‘24)
- Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection (ICLR ‘24)
- Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning (Google Cloud, COLM ‘25)
- Search-o1: Agentic Search-Enhanced Large Reasoning Models (RUC & Tsinghua)
- DecEx-RAG: Boosting Agentic RAG with Decision and Execution Optimization via Process Supervision (Xiaohongshu & TJU)
- Contextual Retrieval (Anthropic) — https://www.anthropic.com/news/contextual-retrieval
- Blended RAG: Improving RAG Accuracy with Semantic Search and Hybrid Query-Based Retrievers (IBM Research, 2024)
- InfiniFlow — RAGFlow team’s 2024 year-in-review on RAG
- wenaidev interactive tutorial — https://www.wenaidev.com/interactive/rag
Answers come from this article only. Click any prompt below or open the chat at the bottom right.
🇺🇸 English
過去這兩年,RAG 從一條「線性 pipeline」演化成「帶迴圈的推理系統」。如果把工業界的痛點折進去,這條演化線可以清楚拆成五個階段:Naive、Advanced、Modular、Graph,還有 Agentic。真正的轉折點,是控制權從 pipeline 移到 agent 手上——這是一次從 System 1 到 System 2 的躍遷。而我自己的部落格 engineer-news,用 Cloudflare D1、Vectorize、bge-m3 加 qwen-14b 跑 RAG,放到這條光譜上,剛好卡在最左邊——Naive RAG 的邊緣。這種對照,反而給了整段演化故事一個錨點,也順便成了一份「個人站接下來該補什麼」的清單。
先給你一把量尺。想快速讀懂這兩年的演化,就問一個問題:大腦,也就是 Reasoning,伸進迴圈的深度有多深?
Naive RAG 是一發入魂的 Retrieve-then-Read,大腦完全不碰檢索決策。Advanced RAG 在檢索前後加料,前面幫你改寫 query,後面幫你重排結果,大腦優化兩端。Modular RAG 開始把 RAG 拆成模組,用 Router 判斷這個 query 該走哪條路。Graph RAG 用知識圖譜解決跨文件關聯,大腦既參與圖的建構、也參與查詢時的走圖。最後 Agentic RAG,模型自己控制搜尋策略,決定要不要再搜、搜什麼、什麼時候停。
一句話總結:RAG 正從快思考的 pipeline,走向慢思考的 looped reasoning。
我們一站一站看。
第一階段,Naive RAG,就是 Retrieve-then-Read 的基本盤。2020 年 Facebook AI 那篇 NeurIPS 論文奠定範式:query 和文件各自被編碼進同一個向量空間,MIPS 搜出 Top-K,然後生成模型接著寫答案。工業界通常只採用推理範式——LangChain 加向量庫加固定 prompt,把 LLM 的知識過期和幻覺問題從零推到一。
但 Naive RAG 的痛點很直接:召回率就是天花板。Top-K 沒撈到對的文件,或撈進一堆雜訊,答案就爛掉。而向量檢索本身有兩個結構性弱點:專有名詞、型號、代碼這種東西,向量天生不擅長;而且一個 chunk 壓成一個向量,本質是整段語義的壓縮,先天沒辦法做精確字面匹配。
第二階段,Advanced RAG,主題是精度。工業界很快意識到 Naive RAG 太弱,開始在檢索周邊堆技巧。三個經典手法。
第一個是 Hybrid Search,混合檢索。向量檢索管語義,加上 30 年老工具 BM25 管關鍵字。BM25 本來要被時代淘汰,RAG 反而把它救活了——因為向量沒辦法保證精確召回,而 BM25 就是為關鍵字匹配而生。IBM Research 2024 年的 BlendedRAG 更進一步,主張向量、稀疏向量、全文檢索三路混合才是召回的天花板,三條路各有專長、彼此無法替代。
第二個是 Reranker,重排序。傳統的雙塔模型把 query 跟文件各自編碼再算距離,快但粗;Cross-Encoder 把兩者拼在一起丟進 BERT,能捕捉 token 之間的細膩互動,慢但精。經典工作是 BAAI 的 BGE-Reranker。工程模式很固定:向量先粗排 Top-50,Cross-Encoder 精排 Top-5,只有這 5 篇進 LLM。多幾百毫秒延遲,排序品質質變。到 2024 年底,MTEB 排行榜前段被 LLM-based Reranker 佔領,但推理成本翻倍,於是出現折衷的 Late Interaction Reranker,也就是 ColBERT 家族——在索引時存下每個 token 的向量,查詢時做 token 對 token 的相似度加總,品質接近 Cross-Encoder,還能塞進資料庫裡跑。
第三個是 Query Rewriting,特別是 HyDE 這招很聰明。CMU 提出的做法是:先讓 LLM 幻想一個假答案,然後拿這個假答案去做向量搜尋。為什麼有效?因為使用者的問題和文件的敘述方式常常完全不同——你問「怎麼修 D1 batch timeout」,文件卻寫「當 SQLite 交易超過 30 秒,Cloudflare Workers runtime 會中止它」。這兩句話在向量空間裡不會靠近。但 LLM 幻想出來的答案,說話方式跟文件很像,兩者的 embedding 就會落在附近。用假答案搜,比用原始 query 搜還準。
Advanced RAG 的整體姿態一句話:靠周邊技巧榨壓召回天花板。但主幹還是線性 pipeline,大腦只在兩端優化,還沒進入決策迴圈。
第三階段,Modular RAG,動態路由登場。當業務複雜起來——一次請求可能要查內部知識庫、可能要查網頁、可能要打 API——線性 RAG 就撐不住了。回應方式是把 RAG 拆成模組,Search、Memory、Routing、Tool 各自獨立,前面加一個 Router 依照 query 意圖分派。
經典工作是 Stanford NLP 的 DSPy,把 RAG 當程式問題看待。Signatures 宣告輸入輸出、Modules 是可組合積木、Teleprompter 自動優化 prompt 跟 few-shot 範例。結果就是不再手調 prompt,框架像編譯原始碼一樣,直接編譯出最佳組合。Prompt Engineering 演化成 Prompt Compilation。
工業界最典型的例子是 ChatGPT Plugins、文心一言的工具路由——使用者問今天北京天氣,Router 判斷意圖,路由到氣象 API,結果填回 prompt。看起來只是多了個 if-else,但這個 if-else 從工程師手上移到了 LLM 手上。這是「大腦進入迴圈」的第一個質變時刻。
第四階段,Graph RAG,全局理解。前面三階段處理的都是「碎片」,每個 chunk 各自為政,回答不了「總結整本書的觀點」「這些公司有什麼共同點」——這種叫 Global Query。
微軟 2024 年的論文 From Local to Global 是分水嶺。核心流程是:源文件先讓 LLM 抽取實體跟關係,然後跑 Leiden 演算法做社群偵測,形成階層式社群;LLM 預先為每個社群寫摘要;查詢時對這些社群摘要做 Map-Reduce,每個社群各答一次再匯總。
它解決的是 RAG 的另一個結構性痛點——語義鴻溝。搜尋系統一直有這個問題:查詢跟文件講法不一樣、直接匹配會漏。RAG 用完整問句取代關鍵字,鴻溝更大。GraphRAG 的做法是離線階段就讓 LLM 通讀全文、抽實體、建圖、寫社群摘要,把跨文件關聯固化下來;查詢時等於是走在這些預先寫好的摘要上。
微軟開源之後,出現了一整光譜的變種,主打降 token 成本。Fast GraphRAG 砍掉社群摘要,改用 personalized PageRank 在圖上遊走取子圖;LightRAG 把整個社群層去掉;LazyGraphRAG 更極端,連 LLM 抽取都不用,用小模型加共現統計建社群,只有查詢時才生成摘要。HippoRAG 借用神經科學的海馬迴索引理論,用 personalized PageRank 模擬人類的隨機遊走式記憶。KAG 是螞蟻集團的做法,方向相反——重可解釋性,需要人工整理知識圖譜,主攻金融跟風控這種需要說清楚「為什麼」的場景。
Graph RAG 的舒適圈是「強跨文件關聯」加「需要全局理解」的任務。金融風控要查一個黑產團夥,文字 RAG 只能找到某個帳戶違規,Graph RAG 順著關係網一路找出整個關聯帳戶群。企業知識管理跨團隊跨專案的關聯、情報分析裡實體之間的關係網,都是它的主場。但它不擅長什麼?單篇長文的細節問答——那是 chunking 加 rerank 的舒適圈,硬套 Graph RAG 就是過度工程。
第五階段,Agentic RAG,System 2 推理。前面四階段本質上還在做「填空題」——檢索、填 context、生成。Agentic RAG 開始做「應用題」,它不是 pipeline,而是一個 loop。
三個定義性特徵:自主規劃,模型自己決定搜什麼、搜幾次、什麼時候停;自我糾錯,搜錯了自己重來;過程監督,推理鏈每一步都能被評分。
依自主性深度,Phase 5 內部又能分三層。
第一層是顯式糾錯。痛點是傳統 RAG 盲目相信檢索結果,導致「檢索錯了、幻覺就跟著錯」。這一層的解法是打補丁——外掛一個評估器。中科大跟 Google 的 CRAG 加了一個輕量 Evaluator,把檢索結果三分類:正確就精煉後生成、錯誤就丟掉並強制觸發網搜、模糊就結合模型自身知識。Self-RAG 則訓練模型輸出 Reflection Token,讓它一邊生成一邊自問「這句話有依據嗎?相關嗎?」讓自我反思變成生成過程的一部分。這一層是目前工業界最便宜的 Agentic 型態,不需要強化學習,Prompt Engineering 加分類器就行。
第二層是用強化學習做推理。痛點是靠 prompt 或規則驅動的搜尋很快就撞牆。模型能不能像 AlphaGo 一樣,自己學怎麼搜?Google Cloud AI 的 Search-R1 把 DeepSeek-R1 那套引進 RAG——模型在 think 過程中主動吐出 search token,把工具呼叫變成推理鏈的一部分。它用結果獎勵,不標註中間步驟,只看最終答對還是答錯,靠 GRPO、PPO 大規模訓練。多輪搜尋、篩證據、驗證反思這些策略,全都是訓練出來的。人大跟清華的 Search-o1 針對另一個問題——「檢索回來的東西太長太雜」——引入 Reason-in-Documents 模組,先在隔離空間裡推理去噪、抽出核心邏輯鏈,再餵給主模型,避免 context 爆炸。
第三層是過程監督。痛點是 Search-R1 的結果監督,探索空間太大、收斂慢,而且長鏈容易出現 Reward Hacking——模型學會「看起來像在搜尋」而不是「真的搜對」。切換成過程級控制。小紅書跟天大的 DecEx-RAG 把 RAG 建模成嚴格的馬可夫決策過程,拆成兩個解耦模組:決策模組像指揮官,每步輸出「該不該終止、該不該檢索」;執行模組像作業員,負責生成具體 query 或答案。它用 Rollouts 給每個中間節點評分,分數太低就即時剪枝,不再浪費算力。
三層各一句話:Search-R1「讓它跌倒中學」,探索空間大、收斂慢;DecEx-RAG「一步一步教」,探索效率高,資料效率提升 6 倍。你會發現 Phase 5 內部這三層,本身就是一部微型的 RAG 演化——CRAG 跟 Self-RAG 解決「敢用檢索」,Search-R1 跟 o1 解決「會用檢索」,DecEx-RAG 解決「高效用檢索」。
拉遠看,整條演化線的主軸是:從靜態到動態、從無腦到有腦。舊 RAG 是 System 1,追毫秒延遲,撿到什麼算什麼;當前的 Agentic RAG 是 System 2,願意花 5 到 10 秒甚至更久去思考、多次搜尋、自我反思,換來答案品質。
三個延伸推論。第一,Test-time Compute 是下一個戰場。LLM 過去比的是參數量跟預訓練損失——訓練時算力;Agentic RAG 把戰場推到「你願意在推理時花多少算力做推理」。DeepSeek-R1、o1 已經示範過,Agentic RAG 是這個範式在檢索場景的落地。
第二,Long Context 不會取代 RAG。Gemini 1.5 Pro 開出百萬 token 之後,一度有人問「還需要 RAG 嗎」。答案很清楚:需要。Long Context 解決的是「大海撈針」,但解不了三件事:知識即時更新,模型訓練完知識就凍結了,RAG 是唯一的活水;TB、PB 級語料,百萬 token 塞不下企業級資料;還有成本,每次都塞百萬 token,帳單會很難看。未來的架構會是 Long Context LLM 加 Agentic RAG——LLM 提供推理跟局部長 context,RAG 提供可擴展、可更新的知識存取。
第三,過程監督資料是新的護城河。DecEx-RAG 提到的過程監督資料——也就是「人類如何透過反覆搜尋解決複雜問題」的軌跡——會是新資產。誰握有這種資料,誰就在 Agentic 時代領先。這也是為什麼 OpenAI 收購 Rockset、Anthropic 重注 Computer Use——大家都在搶第一手的過程軌跡。
好,回頭看自己的站。engineer-news 跑 Astro 加 Cloudflare Workers,打開檢索相關的檔案對照五階段:切塊是段落合併、1000 字上限,純長度切,Naive;embedding 用 bge-m3,Naive;檢索是單一向量通道、topK 8,Naive;沒有 rerank,缺 Advanced;混合搜尋只有向量空搜時的 SQL LIKE 兜底,勉強算半個 Advanced;沒有 query rewriting;生成用 qwen 14b 或 llama 70b;沒有 Router、沒有 agent loop、沒有圖譜。
search API 的流程說白了就三步:bge-m3 embed query、Vectorize 拿 top 8、把 chunks 跟 posts join 起來去重丟進 prompt、qwen 生成。「問這篇文章」多了個小巧思,跳過向量檢索,直接把單篇文章的所有 chunk 按順序組成 context 丟給 Llama 70B。這算是「意圖識別後路由到專門 pipeline」——Modular RAG 的種子——但只有這一個特例。
換句話說,這個站就卡在 Naive RAG 的邊緣,連完整的 Advanced RAG 都還沒補齊。
那接下來要補什麼?論文光譜看下去,GraphRAG 跟 Agentic RAG 都很誘人,但對個人站來說,真正該按的 ROI 順序是這樣:
第一優先,BGE-Reranker。對 top 8 結果做重排,實作就是多一次 Workers AI 呼叫——Workers AI 剛好有 bge-reranker-base——幾百毫秒換排序品質的質變。一個晚上就能上,效果立刻感受到,絕對優先。
第二,BM25 混合檢索。Cloudflare D1 就是 SQLite,SQLite 內建的 FTS5 直接拿來當關鍵字通道。工作量比 reranker 大,但能解決專有名詞、產品名、版本號這種向量天生不擅長的查詢。
第三,HyDE。embed 之前先讓 LLM 幻想個假答案,實作極簡,特別適合短又模糊的查詢,像「D1 timeout 怎麼解」。
第四,Contextual Retrieval,Anthropic 的招——用 LLM 幫每個 chunk 生成一段簡短的上下文摘要,跟原文拼在一起再 embed,用來縮語義鴻溝。同步時要多一次 LLM 呼叫,效果扎實。
第五,GraphRAG 跟 Agentic RAG,還不用。文章才 150 篇上下,跨文件關聯還很弱;Agentic 迴圈的 token 成本、延遲跟除錯複雜度,還沒到值得投入的門檻。
背後的原則是:個人站的 RAG 演化該追隨資料量跟使用者複雜度,不是論文光譜。GraphRAG 適合 TB 級跨團隊資料,Agentic RAG 適合開放領域的深度研究,硬套在「一個個人技術站」上就是過度工程。
InfiniFlow——也就是 RAGFlow 團隊——2024 年年終回顧有一句話說得很好:RAG 是一套非常複雜的系統,它沒有像 LLM 那樣吸引到洪水般的資本,但在真實使用場景裡不僅不可或缺,還複雜得離譜。
RAG 這個名字取得好——它代表的是一個架構模式,不是產品、也不是應用。就像過去的資料庫,對外介面極簡——SELECT——內部卻極其複雜:優化器、索引、B-tree、交易隔離、MVCC。RAG 的對外介面同樣極簡——「問一個問題、給一個答案」——但內部把切塊、embedding、混合檢索、重排、知識圖譜、agent loop、記憶全部包在裡面。RAG 就是 LLM 時代的資料庫。
三個核心 takeaway。第一,RAG 這兩年真正的演化主軸,不是加了多少技巧,而是「大腦伸進迴圈的深度」——從線性 pipeline 走到帶迴圈的 System 2 推理,控制權從工程師手上移到 agent 手上。第二,Long Context 和 RAG 不是替代關係,未來架構會是 Long Context LLM 加 Agentic RAG,兩邊各司其職;而過程監督資料,會是 Agentic 時代真正的護城河。第三,個人站的 RAG 演化該對齊自己的資料量,不是對齊論文——engineer-news 現在該做的不是追 Graph 或 Agent,而是先把 Reranker、BM25、HyDE 這三塊 Advanced RAG 的地基補齊。
下一次動這個站,我會先從 Reranker 開始。
🇹🇼 中文
RAG 這個題目,這兩年變化真的很快。我最近看到 wenaidev 做了一個 RAG 的互動教學頁,用時間軸把它切成三代:2023 的進階 RAG、2024 的 GraphRAG、2025 的 Agentic RAG。結構很清楚,但我想把粒度再拉細一點——如果把工業界的實作痛點也算進去,其實可以切成五個階段:Naive、Advanced、Modular、Graph,最後到 Agentic。
這集不只是講演進主線,我還會回頭對照自己在跑的這個站 engineer-news。它用了 Cloudflare D1、Vectorize、bge-m3 加上 qwen-14b 這套組合。對照下來會發現,它其實還卡在最左邊,Naive RAG 的邊界。
先給你一個判準,看整個演進最快的方式,就是問一個問題——大腦,也就是 Reasoning,介入的程度到哪裡?
Naive RAG,一次到位,大腦完全不參與檢索決策。Advanced RAG,前後加料,大腦來幫忙重寫查詢、重排結果。Modular RAG,開始有 Router,大腦決定這個 query 該走哪條路。Graph RAG,引入知識圖譜,大腦在建圖時抽實體、在查詢時走圖。到了 Agentic RAG,是 Loop 迴圈,模型自己決定要不要再搜、什麼時候停。
一句話總結底層變化——RAG 正從 System 1、快思考、流水線,走向 System 2、慢思考、循環推理。
我們一階段一階段來看。
Phase 1,Naive RAG。2020 年 Facebook AI 那篇 NeurIPS 論文定調了整個範式:query 和 document 各自編碼成向量,用最大內積搜尋找 Top-K,拼進 Generator 生成答案。工業界落地就是 LangChain 加 FAISS 或 Milvus,再配一個固定的 Prompt。它解決了 LLM 知識過時加幻覺的從 0 到 1。
但痛點很直接:召回率就是上限。Top-K 沒撈到,或者撈到干擾文件,答案必錯。而向量檢索本身有兩個結構性限制——專有名詞、型號、產品碼,向量本身就不擅長。而且一個 chunk 只有一個向量,是語意壓縮,天生無法做精確字面匹配。
Phase 2,Advanced RAG,重點是 Precision。工業界很快發現 Naive 效果差,開始在檢索前後堆招數。三招最有代表性。
第一招 Hybrid Search。向量檢索處理語意,BM25 處理關鍵字,兩路並用。BM25 是 30 年前的老技術,但 RAG 把它救回來了。2024 年 IBM Research 的 BlendedRAG 更進一步,證明向量、稀疏向量、加全文搜尋三路混合才是召回品質的上限。稀疏向量比如 SPLADE 解通用查詢,但 domain 專有詞會漏,BM25 就補這一塊。
第二招 Reranker,也就是重排序。Bi-Encoder 分開編碼 query 和 doc,快但粗;Cross-Encoder 把兩者拼在一起送進 BERT,慢但精。代表就是 BAAI 的 BGE-Reranker。工程上很常見的做法是:向量先撈 Top-50 粗排,Cross-Encoder 精排到 Top-5 再送 LLM。多幾百毫秒延遲,換排序品質質變。到了 2024 下半年,MTEB 榜前面開始被 LLM-based Reranker 佔據,但成本翻倍。所以出現折衷方案——Late Interaction Reranker,ColBERT 家族。索引時保留每個 token 的向量,查詢時算 token 兩兩相似度。品質接近 Cross-Encoder,但可以下沉到資料庫層做。
第三招 HyDE,CMU 那篇,叫假想文件 embedding。做法很聰明——讓 LLM 先幻想一份假答案,用假答案去做向量檢索。為什麼有用?因為 query 和 document 表述方式差很遠。使用者問「怎麼修 D1 batch timeout」,doc 裡寫的是「SQLite transaction 超過 30 秒會被 Cloudflare Workers runtime 中止」。兩個向量距離不近。但 LLM 幻想出的假答案,語氣自然接近 doc,向量距離就拉近了。
Advanced 這一階段整體策略一句話:用更多手段逼近召回率上限。但骨幹還是線性 pipeline,大腦只是站在兩端幫忙,沒介入決策。
Phase 3,Modular RAG。當業務變複雜——要查內部 KB、要搜網、還要調 API——線性 RAG 跑不通。開始拆模組:Search、Memory、Routing、Tool 各自獨立,Router 根據 query 意圖分發。代表工作是 Stanford 的 DSPy,它把 RAG 當成編程問題。Signatures 定義輸入輸出,Modules 是可組合的 building block,Teleprompter 自動最佳化 Prompt。意思就是,不再手調 Prompt,而是像編譯代碼一樣,讓框架自動搜最優組合。Prompt Engineering 進化成 Prompt Compilation。
工業界最典型就是 ChatGPT Plugins 那種 Tool Routing——使用者問「今天北京天氣」,Router 識別意圖,路由到天氣 API,結果填進 Prompt。看起來就是加了個 if-else,但這個 if-else 的決策權從開發者手裡交到 LLM 手裡。這是大腦介入的第一次質變。
Phase 4,Graph RAG。前三階段的 RAG 都是碎片化的,每個 chunk 各自為政,沒辦法回答「總結全書觀點」這種 Global Query。微軟 2024 年那篇 From Local to Global 是分水嶺。核心 pipeline 是:LLM 先讀所有文件、抽實體與關係、用 Leiden 演算法做社群偵測、每個社群 LLM 預先寫摘要。查詢時走 Map-Reduce,每個社群摘要各回答一次再彙整。
它解決的是語意鴻溝。搜尋系統本身就有這個問題,query 和 doc 表述方式不同。GraphRAG 用 LLM 事先讀完全部文件、建圖、寫社群摘要,把跨文件關聯事先固化下來。
微軟開源之後短時間內出現一整光譜的變種,主線都在降低 token 成本。Fast GraphRAG 拿掉社群摘要,用個性化 PageRank 在圖上隨機遊走取子圖。LightRAG 更輕量,連社群那一層都不要。LazyGraphRAG 走另一個極端,連 LLM 抽取都不要,用本地小模型抽名詞加共現統計,摘要延到查詢時才動態生成,把預處理成本壓到最低。HippoRAG 借鑑神經科學的海馬體索引理論。KAG 是螞蟻做的,走可解釋性方向,引入人工介入維護圖譜,服務金融、風控這種需要說得出為什麼的場景。
Graph RAG 的舒適區是跨文件關聯強、需要全域理解的場景。金融風控查黑產團伙,文字 RAG 只能查到單一帳號違規,Graph RAG 順藤摸瓜找到整串關聯。企業跨部門知識管理、情報分析都是好例子。它不擅長的是單篇長文的細節問答,那是 chunking 加 rerank 的舒適區,硬套 Graph RAG 是過度工程。
好,重頭戲來了。Phase 5,Agentic RAG,也就是 System 2 Reasoning。前四階段還在做填空題:Retrieve、Fill Context、Generate。Agentic 開始做應用題——它不是 Pipeline,是 Loop。
核心特徵三個:自主規劃、自我糾錯、過程監督。模型自己決定搜什麼、搜幾次、什麼時候停;搜錯了自己重搜;推理鏈條每一步還會被打分。
按自主性深度,Phase 5 內部可以再切三層。
Level 1,顯式糾錯。傳統 RAG 對檢索結果盲目信任。這一層的思路是打補丁,外掛一個檢查模組。CRAG 是 USTC 和 Google 那篇,加一個 Evaluator 把檢索結果三分類——對的就直接用、錯的就強制觸發 Web Search 重找、模稜兩可就結合內外部知識。Self-RAG 則是訓練模型輸出反思 token,生成每句話時自問「這句有依據嗎?相關嗎?」,把自省變成生成流程的一部分。Level 1 是工業界成本最低的 Agentic 形態,不需要 RL,只需要 Prompt Engineering 加一個判別器。
Level 2,強化學習驅動的推理。痛點是靠 Prompt 或規則指導搜尋天花板太低。能不能像 AlphaGo 一樣讓模型自己學會怎麼搜?Search-R1 把 DeepSeek-R1 的思路搬進 RAG,模型在 think 過程中主動生成 search token,工具呼叫變成推理鏈的一部分。它用結果監督——不標每一步搜得對不對,只看最後答案對不對,用 GRPO 或 PPO 大規模 RL。模型會湧現出多步搜尋、去偽存真、驗證反思這些策略。Search-o1 則針對長推理鏈中檢索內容太長、噪聲太大的問題,先在獨立模組內對文件做推理去噪,抽出核心邏輯鏈再喂主模型。
Level 3,過程監督。Search-R1 的結果監督探索空間太大、收斂慢,長鏈路容易 Reward Hacking,模型學到「假裝在搜」而不是真的搜對。改成過程級控制。DecEx-RAG 是小紅書和天大做的,把 RAG 建模成嚴格的馬可夫決策過程,雙模組解耦——Decision Module 負責指揮,每一步輸出「要不要停、要不要再搜」;Execution Module 負責幹活,生成具體 query 或答案。過程獎勵不像 Search-R1 只給最終獎勵,而是用 Rollout 對中間每個決策節點打分。分數過低直接剪枝。
三個 Level 一句話總結:Search-R1 是 let it learn by failing,探索空間大、收斂慢;DecEx-RAG 是 guide it step-by-step,探索效率高、數據利用率大概 6 倍。
而且你會發現 Phase 5 內部這三層自己就是一個小版的 RAG 演進——CRAG 和 Self-RAG 解決敢不敢用,Search-R1 解決會不會用,DecEx-RAG 解決能不能高效用。
好,拉高一階看整體。整個演進主線就是——從靜態到動態,從無腦到有腦。以前的 RAG 是 System 1,追求毫秒級響應,搜到啥就是啥。現在 Agentic RAG 是 System 2,花 5 到 10 秒甚至更久 Thinking,多次搜尋、自我反思,換答案品質。
這意味三件事。
第一,Test-time Compute 是下一個戰場。以前 LLM 競爭焦點是參數量、預訓練 loss,那是訓練階段的算力。Agentic RAG 把競爭拉到推理時願意花多少算力做 Reasoning。
第二,Long Context 不會取代 RAG。Gemini 1.5 Pro 開了 1M+ tokens 之後有人問 RAG 是不是不需要了。答案很清楚,還需要。Long Context 解決大海撈針,但解決不了知識即時更新——模型訓練好知識就凍住了;也解決不了 TB PB 級全網資料;而且成本很難看,每次 1M tokens 塞進去帳單會爆。未來一定是 Long Context LLM 加 Agentic RAG 的組合。
第三,過程監督資料是新護城河。人類如何一步步透過搜尋解決複雜問題的軌跡,會成為大廠的新資產。誰有這種資料——搜尋大廠、瀏覽器廠、Coding Agent 廠——誰就在 Agentic 時代領先。這也是為什麼 OpenAI 收 Rockset、Anthropic 大力做 Computer Use。
聊完主線,回頭看自己這個站。engineer-news 用 Astro 加 Cloudflare Workers 跑了一套 RAG。實際打開 sync-to-d1 和 search 這兩個檔案對照下來——Chunking 是純長度切分到 1000 字上限,Naive;Embedding 用 bge-m3,Naive;Retrieval 向量單路 topK=8,Naive;沒有 Reranker,缺 Advanced;Hybrid 只在向量無結果時 fallback SQL LIKE,算半個 Advanced;沒有 Query Rewriting;沒有 Router、沒有 Agent Loop、沒有 Graph。
search API 的實際流程就三步:bge-m3 embed query、Vectorize 撈 topK=8、Join 表塞進 prompt 讓 qwen 生成。「問這篇」功能有個小巧思,跳過向量檢索,把整篇文章所有 chunks 依序組成 context,餵給 Llama 3.3 70B。這算是識別意圖後路由到專用管線,Modular RAG 的雛形——但只有這一個特例。
換句話說,這個站落在 Naive RAG 的邊界,甚至還沒完成 Advanced RAG。
下一步該補什麼?按論文光譜,GraphRAG、Agentic RAG 都很誘人。但對個人站的實際狀況,性價比排序是這樣。
第一優先,BGE-Reranker。把 topK=8 撈上來的結果重排。Workers AI 就有 bge-reranker-base,加一層呼叫,延遲增加幾百毫秒,排序品質差異巨大。一個晚上就能做完,明顯感覺。這是絕對優先。
第二,BM25 三路混合。Cloudflare D1 是 SQLite,可以直接用 FTS5 全文索引補上關鍵字檢索。解決專有名詞、產品名、版本號這類向量本身不擅長的查詢。
第三,HyDE。查詢前先讓 LLM 生成假想答案再 embed,實作極簡,適合 query 短而模糊的場景。
第四,Contextual Retrieval,Anthropic 提的方案。用 LLM 給每個 chunk 生成一小段上下文摘要,跟原文一起 embed,緩解語意鴻溝。
至於 GraphRAG 和 Agentic RAG,暫時輪不到。這個站目前 150 篇左右,跨文件關聯需求不夠強;Agentic 迴圈的 token 成本、延遲、debugging 複雜度也還沒到值得投入的臨界點。
背後的判準是——個人站的 RAG 演進,應該跟著資料量加使用者複雜度走,而不是跟著論文光譜衝。
最後拉遠一點看。InfiniFlow,就是 RAGFlow 團隊,2024 年底那篇年度總結講得很好——RAG 是一個非常複雜的系統,沒有像 LLM 那樣吸引海量資金,但真正使用中不僅不可或缺,還非常複雜。
我很喜歡一個類比:RAG 是 LLM 時代的資料庫。就像過去的資料庫對外介面極簡單,一個 SELECT,內部卻塞了 optimizer、index、B-tree、事務隔離、MVCC。RAG 對外也就是問一句答一句,內部卻塞了 chunking、embedding、hybrid search、rerank、KG、agent loop、memory 一整套。
所以三個帶走的重點。
第一,判斷 RAG 演進最好的尺子,是 Reasoning 介入的深度。從 Naive 到 Agentic,大腦從完全不參與、到站在管線兩端、到當 Router、到建圖、到最後全面控制 Loop。
第二,分水嶺是 System 1 到 System 2。控制權從管線移交到 Agent 手上,願意花多少推理時算力 Thinking,是下一個戰場。
第三,個人站或中小型專案不用衝到 GraphRAG 或 Agentic RAG。從 Reranker、Hybrid、HyDE、Contextual Retrieval 這條路補起,性價比高得多。至於這個站,下次動手,就從 Reranker 開始。
Tags
Related Articles
Building a Real RAG: 5 Infra Lessons from InfiniFlow's 2024 Year-in-Review
The previous post zoomed out for a five-stage panorama of RAG. This one zooms in on the five infra lessons any real RAG has to face: document ingestion, contextualized chunking, three-lane hybrid search, tensor reranker, and GraphRAG's semantic gap. Each lesson is checked against engineer-news's current stack, ending with a priority list for a personal site.
PageIndex Deep Dive: A RAG Architecture That Replaces Vector Search with LLM Reasoning
PageIndex swaps the vector DB for a hierarchical tree index plus an LLM Agent that reasons over it, and it shines on long structured documents (98.7% on FinanceBench). This site's Hybrid RAG instead runs vector search with a keyword fallback on the Cloudflare edge — a completely different set of tradeoffs.
Is Claude Code's On-Demand Loading of Skills/Tools a Form of RAG? Unpacking Agentic Retrieval
When an agent loads tools on demand, it's essentially applying RAG's 'retrieve-then-inject' pattern to tool schemas — the only difference is the retriever is the LLM's own reasoning instead of vector similarity.