Contextual Retrieval and Agentic RAG for Two-Layer Memory
The report explains contextual retrieval, in which an LLM generates a context description for each document chunk before the chunk is embedded for sparse and dense retrieval with reranking. It also describes Agentic RAG as an iterative process in which an agent decides when to search, what to search for, and whether to continue. These methods are combined in a two-layer memory design: a resident overview containing structured cards for key preferences, relationships, and summaries, and an on-demand details layer that retrieves original records and passages. The report attributes a qualitative improvement in offline BM25 recall@k to a book experiment using contextual prefixes, but provides no numerical results or independent reproduction.
The report presents a practical architecture for improving retrieval, enabling agent-led search, and managing cross-session memory through a resident overview and on-demand details. Its performance claims are qualitative and not independently confirmed in the supplied report.
原文:mp.weixin.qq.com/s/e2P8r7YVr…(2026年10月04日)
拼图快齐了:记忆会提炼、会分格式,知识库会分块、会混合检索,还能长成树、织成网。但它们大多还是“你问一句、它查一下”的被动管道。这一篇就看最后三块——也是最“聪明”的三块——以及整套设计的收束。
一、上下文感知检索:给每个分块补上“身份”
还记得第三篇埋的伏笔吗?分块会切断片段和原文的联系,产生“孤儿分块”——“该公司”指代谁、“这段话出自哪份报告”,都留在了块外面。
上下文感知检索(Contextual Retrieval) 正是来修补这个最基础环节的(这个思路最早由 Anthropic 提出)。做法朴素但有效:在建索引之前,为每个分块生成一段专属于它的上下文说明,再把它和原文块一起嵌入。流水线大致是这样:
#Anthropic#ReAct#Contextual Retrieval#Advanced JSON Cards#RAPTOR#GraphRAG#OpenViking#Mem0#Memobase#LangChain#LlamaIndex#Zep