{"id":109355,"date":"2026-09-24T00:56:43","date_gmt":"2026-09-23T16:56:43","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/109355.html"},"modified":"2026-09-24T00:56:43","modified_gmt":"2026-09-23T16:56:43","slug":"rag-%e6%96%87%e6%a1%a3%e5%88%87%e5%88%86%e7%ad%96%e7%95%a5%e5%85%a8%e6%99%af%e8%a7%a3%e6%9e%90%ef%bc%9a%e5%9b%ba%e5%ae%9a%e9%95%bf%e5%ba%a6-vs-%e8%af%ad%e4%b9%89%e5%88%87%e5%88%86%e7%9a%84%e6%8a%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/109355.html","title":{"rendered":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5"},"content":{"rendered":"<h2>RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790&#xff1a;\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5<\/h2>\n<h3>\u6458\u8981<\/h3>\n<p>\u6587\u6863\u5207\u5206&#xff08;Document Chunking&#xff09;\u662f RAG&#xff08;Retrieval-Augmented Generation&#xff09;\u7cfb\u7edf\u4e2d\u6700\u57fa\u7840\u5374\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u7684\u9884\u5904\u7406\u73af\u8282\u3002\u5207\u5206\u8d28\u91cf\u76f4\u63a5\u51b3\u5b9a\u68c0\u7d22\u53ec\u56de\u7387\u7684\u4e0a\u9650&#xff0c;\u8fdb\u800c\u5f71\u54cd LLM \u751f\u6210\u7b54\u6848\u7684\u51c6\u786e\u6027\u548c\u5e7b\u89c9\u7387\u3002\u672c\u6587\u7cfb\u7edf\u68b3\u7406\u4ece\u89c4\u5219\u5207\u5206\u5230\u8bed\u4e49\u5207\u5206\u3001\u4ece\u5ef6\u8fdf\u5207\u5206\u5230\u77e5\u8bc6\u56fe\u8c31\u7684\u5b8c\u6574\u6280\u672f\u6f14\u8fdb\u8def\u5f84&#xff0c;\u7ed3\u5408\u4ee3\u7801\u5b9e\u73b0\u3001\u53c2\u6570\u8c03\u4f18\u5efa\u8bae\u548c\u8bc4\u4f30\u65b9\u6cd5\u8bba&#xff0c;\u4e3a\u5de5\u7a0b\u5b9e\u8df5\u63d0\u4f9b\u53ef\u843d\u5730\u7684\u51b3\u7b56\u6846\u67b6\u3002<\/p>\n<p>\u5173\u952e\u8bcd&#xff1a;RAG\u3001\u6587\u6863\u5207\u5206\u3001Chunking\u3001\u8bed\u4e49\u5207\u5206\u3001Late Chunking\u3001Contextual Retrieval\u3001GraphRAG<\/p>\n<hr \/>\n<h3>1. \u5f15\u8a00&#xff1a;\u4e3a\u4ec0\u4e48\u5207\u5206\u662f RAG \u7684\u6838\u5fc3\u74f6\u9888<\/h3>\n<p>\u5728 RAG \u6807\u51c6\u5de5\u4f5c\u6d41\u4e2d&#xff0c;\u5207\u5206\u5904\u4e8e&#034;\u6587\u6863\u89e3\u6790 \u2192 \u5207\u5206 \u2192 Embedding \u2192 \u68c0\u7d22 \u2192 \u751f\u6210&#034;\u94fe\u8def\u7684\u6700\u524d\u7aef[citation:7]\u3002Amir Teymoori \u4e0e Chroma 2025 \u7684\u7814\u7a76\u90fd\u5c06\u5207\u5206\u5217\u4e3a&#034;RAG \u6210\u8d25\u7684\u7b2c\u4e00\u53d8\u91cf&#034;[citation:1]\u3002<\/p>\n<p>\u5207\u5206\u7684\u6839\u672c\u52a8\u56e0\u6709\u56db\u4e2a&#xff1a;<\/p>\n<table>\n<tr>\u52a8\u56e0\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u4e0a\u4e0b\u6587\u7a97\u53e3\u9650\u5236<\/td>\n<td>\u5408\u540c\u6570\u5341\u4e07\u5b57&#xff0c;\u65e0\u6cd5\u4e00\u6b21\u6027\u585e\u5165\u6a21\u578b&#xff1b;\u5373\u4f7f\u80fd\u585e&#xff0c;\u6210\u672c\u4e5f\u4e0d\u53ef\u63a5\u53d7<\/td>\n<\/tr>\n<tr>\n<td>\u68c0\u7d22\u7cbe\u5ea6<\/td>\n<td>\u5411\u91cf\u8868\u793a\u5b58\u5728&#034;\u5e73\u5747\u5316&#034;\u503e\u5411\u2014\u2014\u6587\u672c\u8d8a\u957f&#xff0c;\u8bed\u4e49\u4fe1\u53f7\u8d8a\u88ab\u7a00\u91ca<\/td>\n<\/tr>\n<tr>\n<td>\u68c0\u7d22\u6548\u7387<\/td>\n<td>\u5c0f\u5757\u624d\u80fd\u7cbe\u51c6\u547d\u4e2d&#034;\u8fdd\u7ea6\u8d23\u4efb\u5728\u7b2c\u51e0\u6761&#034;\u8fd9\u7c7b\u7ec6\u7c92\u5ea6\u67e5\u8be2<\/td>\n<\/tr>\n<tr>\n<td>\u751f\u6210\u8d28\u91cf<\/td>\n<td>\u7247\u6bb5\u662f\u5426\u5b8c\u6574\u3001\u4e0a\u4e0b\u6587\u662f\u5426\u5145\u8db3&#xff0c;\u76f4\u63a5\u51b3\u5b9a\u5e7b\u89c9\u7387<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>1.1 \u6838\u5fc3\u77db\u76fe&#xff1a;\u7cbe\u51c6 vs \u5b8c\u6574<\/h4>\n<p>\u5757\u592a\u5c0f \u2192 \u68c0\u7d22\u7cbe\u51c6&#xff0c;\u4f46\u8131\u79bb\u4e0a\u4e0b\u6587&#xff08;\u201c\u8be5\u65b9\u6848\u201d&#034;\u4e0a\u8ff0\u65b9\u6cd5&#034;\u60ac\u7a7a&#xff09;<br \/>\n\u5757\u592a\u5927 \u2192 \u4e0a\u4e0b\u6587\u5b8c\u6574&#xff0c;\u4f46\u5411\u91cf\u88ab\u65e0\u5173\u5185\u5bb9\u7a00\u91ca&#xff0c;\u53ec\u56de\u7387\u4e0b\u964d<\/p>\n<p>\u8fd9\u4e00\u77db\u76fe\u8d2f\u7a7f\u6240\u6709\u5207\u5206\u65b9\u6cd5\u7684\u6f14\u8fdb\u3002\u7406\u89e3\u8fd9\u4e00\u70b9&#xff0c;\u5c31\u7406\u89e3\u4e86\u5207\u5206\u7b56\u7565\u7684\u672c\u8d28&#xff1a;\u5728\u7cbe\u51c6\u4e0e\u5b8c\u6574\u4e4b\u95f4\u5bfb\u627e\u6700\u4f18\u5e73\u8861\u70b9\u3002<\/p>\n<hr \/>\n<h3>2. \u5207\u5206\u7b56\u7565\u5168\u666f&#xff1a;\u4e09\u4ee3\u6280\u672f\u6f14\u8fdb<\/h3>\n<h4>2.1 \u7b2c\u4e00\u4ee3&#xff1a;\u89c4\u5219\u5207\u5206&#xff08;Structure-Agnostic&#xff09;<\/h4>\n<h5>2.1.1 \u56fa\u5b9a\u957f\u5ea6\u5207\u5206&#xff08;Fixed-Size&#xff09;<\/h5>\n<p>\u6309\u5b57\u7b26\u6570 \/ Token \u6570\u5747\u7b49\u5207\u5272&#xff0c;\u662f\u6700\u6734\u7d20\u7684\u65b9\u6cd5\u3002<\/p>\n<p><span class=\"token keyword\">from<\/span> langchain<span class=\"token punctuation\">.<\/span>text_splitter <span class=\"token keyword\">import<\/span> CharacterTextSplitter<\/p>\n<p>splitter <span class=\"token operator\">&#061;<\/span> CharacterTextSplitter<span class=\"token punctuation\">(<\/span><br \/>\n    chunk_size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">512<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    chunk_overlap<span class=\"token operator\">&#061;<\/span><span class=\"token number\">50<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    separator<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\\\\n&#034;<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\nchunks <span class=\"token operator\">&#061;<\/span> splitter<span class=\"token punctuation\">.<\/span>split_documents<span class=\"token punctuation\">(<\/span>docs<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4f18\u70b9&#xff1a;\u5b9e\u73b0\u6700\u7b80\u5355\u3001\u901f\u5ea6\u6700\u5feb\u3001\u5bf9\u4efb\u610f\u6587\u672c\u901a\u7528[citation:7]\u3002<br \/>\n\u7f3a\u70b9&#xff1a;\u5bb9\u6613\u5728\u53e5\u5b50\u4e2d\u95f4\u622a\u65ad&#xff0c;\u7834\u574f\u8bed\u4e49\u5b8c\u6574\u6027[citation:1]\u3002<br \/>\n\u9002\u7528\u573a\u666f&#xff1a;\u9ad8\u5ea6\u7edf\u4e00\u7684\u77ed\u6587\u672c&#xff08;\u793e\u4ea4\u5e16\u5b50\u3001\u77ed\u6d88\u606f&#xff09;&#xff0c;\u6216\u4f5c\u4e3a\u57fa\u7ebf\u65b9\u6848[citation:1]\u3002<\/p>\n<h5>2.1.2 \u9012\u5f52\u5b57\u7b26\u5207\u5206&#xff08;Recursive Character&#xff09;\u2014\u2014 \u5de5\u4e1a\u754c\u9996\u9009\u57fa\u7ebf<\/h5>\n<p>\u6309\u5206\u9694\u7b26\u4f18\u5148\u7ea7 \\\\n\\\\n \u2192 \\\\n \u2192 \u7a7a\u683c \u2192 \u5b57\u7b26 \u9010\u7ea7\u56de\u9000&#xff0c;\u4f18\u5148\u5728\u8bed\u4e49\u5b8c\u6574\u5904\u4e0b\u5200[citation:1][citation:10]\u3002<\/p>\n<p><span class=\"token keyword\">from<\/span> langchain<span class=\"token punctuation\">.<\/span>text_splitter <span class=\"token keyword\">import<\/span> RecursiveCharacterTextSplitter<\/p>\n<p>splitter <span class=\"token operator\">&#061;<\/span> RecursiveCharacterTextSplitter<span class=\"token punctuation\">(<\/span><br \/>\n    chunk_size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">512<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    chunk_overlap<span class=\"token operator\">&#061;<\/span><span class=\"token number\">100<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    length_function<span class=\"token operator\">&#061;<\/span><span class=\"token builtin\">len<\/span>  <span class=\"token comment\"># \u5efa\u8bae\u7528 tiktoken \u7cbe\u786e\u8ba1\u6570<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\nchunks <span class=\"token operator\">&#061;<\/span> splitter<span class=\"token punctuation\">.<\/span>split_documents<span class=\"token punctuation\">(<\/span>docs<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u5173\u952e\u53c2\u6570&#xff08;\u7ecf\u9a8c\u503c&#xff09;[citation:1]&#xff1a;<\/p>\n<table>\n<tr>\u53c2\u6570\u9ed8\u8ba4\u503c\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>chunk_size<\/td>\n<td>400\u2013512 token<\/td>\n<td>\u77ed\u6587 200\u2013400&#xff1b;\u957f\u6587\/\u8bba\u6587 512\u2013800<\/td>\n<\/tr>\n<tr>\n<td>chunk_overlap<\/td>\n<td>10\u201320%<\/td>\n<td>\u7ed3\u6784\u5316\u6587\u6863 5\u201310%&#xff1b;\u975e\u7ed3\u6784\u5316 15\u201320%<\/td>\n<\/tr>\n<tr>\n<td>length_function<\/td>\n<td>tiktoken<\/td>\n<td>\u5fc5\u987b\u786e\u4fdd\u4e0e Embedding \u6a21\u578b\u7684 token \u8ba1\u6570\u4e00\u81f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u26a0\ufe0f \u5e38\u89c1\u8bef\u533a&#xff1a;chunk_overlap \u5fc5\u987b\u4e0e chunk_size \u4f7f\u7528\u540c\u4e00\u5355\u4f4d&#xff08;\u90fd\u662f token \u6216\u90fd\u662f char&#xff09;&#xff0c;\u5426\u5219\u884c\u4e3a\u4f1a&#034;\u5bf9\u4e0d\u4e0a&#034;[citation:1]\u3002<\/p>\n<p>\u9012\u5f52\u5207\u5206\u662f LangChain \u9ed8\u8ba4\u7b56\u7565&#xff0c;\u88ab\u79f0\u4e3a&#034;\u751f\u4ea7\u73af\u5883 80% \u7684\u9009\u62e9&#034;[citation:1]&#xff0c;\u9002\u5408\u4f5c\u4e3a\u9879\u76ee\u8d77\u70b9\u3002<\/p>\n<h5>2.1.3 \u7ed3\u6784\u611f\u77e5\u5207\u5206&#xff08;Structure-Aware&#xff09;<\/h5>\n<p>\u76f4\u63a5\u5229\u7528\u6587\u6863\u56fa\u6709\u7ed3\u6784&#xff1a;\u6807\u9898\u5c42\u7ea7\u3001\u6bb5\u843d\u3001\u8868\u683c\u3001\u4ee3\u7801\u5757\u7b49[citation:13]\u3002<\/p>\n<p><span class=\"token keyword\">from<\/span> langchain<span class=\"token punctuation\">.<\/span>text_splitter <span class=\"token keyword\">import<\/span> MarkdownHeaderTextSplitter<\/p>\n<p>headers_to_split_on <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;#&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;h1&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;##&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;h2&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;###&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;h3&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><br \/>\nsplitter <span class=\"token operator\">&#061;<\/span> MarkdownHeaderTextSplitter<span class=\"token punctuation\">(<\/span>headers_to_split_on<span class=\"token operator\">&#061;<\/span>headers_to_split_on<span class=\"token punctuation\">)<\/span><br \/>\nchunks <span class=\"token operator\">&#061;<\/span> splitter<span class=\"token punctuation\">.<\/span>split_text<span class=\"token punctuation\">(<\/span>markdown_text<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4e24\u9636\u6bb5\u4e32\u8054\u7b56\u7565&#xff08;\u63a8\u8350&#xff09;&#xff1a;\u5148\u7528 MarkdownHeaderTextSplitter \u6cbf\u6807\u9898\u5206\u5927\u5757&#xff0c;\u518d\u5c06\u5927\u5757\u5582\u7ed9 RecursiveCharacterTextSplitter \u63a7\u5927\u5c0f\u2014\u2014\u65e2\u4fdd\u7ed3\u6784\u53c8\u4fdd\u957f\u5ea6[citation:1]\u3002<\/p>\n<p>PDF \u9875\u9762\u7ea7\u5207\u5206\u5728\u5b9e\u8df5\u4e2d\u4e5f&#034;\u76f8\u5f53\u80fd\u6253&#034;[citation:1]&#xff0c;\u5c24\u5176\u9002\u5408\u62a5\u544a\u3001\u8bba\u6587\u7b49\u683c\u5f0f\u7a33\u5b9a\u7684\u6587\u6863\u3002<\/p>\n<h4>2.2 \u7b2c\u4e8c\u4ee3&#xff1a;\u8bed\u4e49\u5207\u5206&#xff08;Semantic Chunking&#xff09;<\/h4>\n<p>\u6838\u5fc3\u601d\u60f3&#xff1a;\u4e0d\u4f9d\u8d56\u7269\u7406\u8fb9\u754c&#xff0c;\u800c\u662f\u901a\u8fc7\u8ba1\u7b97\u76f8\u90bb\u53e5\u5b50\u7684 Embedding \u76f8\u4f3c\u5ea6&#xff0c;\u5728&#034;\u8bed\u4e49\u7a81\u53d8\u70b9&#034;\u5207\u5206[citation:17]\u3002<\/p>\n<p><span class=\"token keyword\">from<\/span> langchain_experimental<span class=\"token punctuation\">.<\/span>text_splitter <span class=\"token keyword\">import<\/span> SemanticChunker<br \/>\n<span class=\"token keyword\">from<\/span> langchain_openai <span class=\"token keyword\">import<\/span> OpenAIEmbeddings<\/p>\n<p>splitter <span class=\"token operator\">&#061;<\/span> SemanticChunker<span class=\"token punctuation\">(<\/span><br \/>\n    OpenAIEmbeddings<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    breakpoint_threshold_type<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;percentile&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    breakpoint_threshold_amount<span class=\"token operator\">&#061;<\/span><span class=\"token number\">50<\/span>  <span class=\"token comment\"># \u76f8\u4f3c\u5ea6\u4e0b\u964d\u8d85\u8fc7 50 \u767e\u5206\u4f4d\u65f6\u5207\u5206<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><br \/>\nchunks <span class=\"token operator\">&#061;<\/span> splitter<span class=\"token punctuation\">.<\/span>split_text<span class=\"token punctuation\">(<\/span>document<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u7b97\u6cd5\u6d41\u7a0b&#xff1a;<\/p>\n<li>\u5c06\u6587\u672c\u5207\u5206\u4e3a\u53e5\u5b50\u5e8f\u5217 [s\u2081, s\u2082, &#8230;, s\u2099]<\/li>\n<li>\u8ba1\u7b97\u6bcf\u4e2a\u53e5\u5b50\u7684 Embedding \u5411\u91cf<\/li>\n<li>\u8ba1\u7b97\u76f8\u90bb\u53e5\u5bf9\u7684\u4f59\u5f26\u76f8\u4f3c\u5ea6 sim(e\u1d62, e\u1d62\u208a\u2081)<\/li>\n<li>\u5f53\u76f8\u4f3c\u5ea6\u663e\u8457\u4e0b\u964d&#xff08;\u4f4e\u4e8e\u9608\u503c&#xff09;\u65f6&#xff0c;\u6807\u8bb0\u5207\u5206\u70b9<\/li>\n<li>\u5c06\u8fb9\u754c\u4e4b\u95f4\u7684\u53e5\u5b50\u5408\u5e76\u4e3a\u8bed\u4e49\u4e00\u81f4\u7684\u5757<\/li>\n<p>\u6548\u679c&#xff1a;Chroma \u7814\u7a76\u663e\u793a&#xff0c;LLM \u8bed\u4e49\u5207\u5206\u53ef\u8fbe 91.9% recall&#xff08;\u6240\u6709\u7b56\u7565\u6700\u9ad8&#xff09;[citation:1]\u3002<br \/>\n\u4ee3\u4ef7&#xff1a;\u6bcf\u53e5\u90fd\u9700\u8981 Embedding&#xff0c;\u8ba1\u7b97\u6210\u672c\u7ebf\u6027\u589e\u52a0[citation:1]\u3002<\/p>\n<h4>2.3 \u7b2c\u4e09\u4ee3&#xff1a;\u4e0a\u4e0b\u6587\u589e\u5f3a\u5207\u5206<\/h4>\n<h5>2.3.1 Late Chunking&#xff08;\u5ef6\u8fdf\u5207\u5206&#xff09;<\/h5>\n<p>\u6838\u5fc3\u6d1e\u5bdf&#xff1a;\u4f20\u7edf&#034;\u5148\u5207\u540e\u5d4c&#034;\u5bfc\u81f4\u6bcf\u4e2a\u5757\u5728\u8131\u79bb\u5168\u6587\u8bed\u5883\u4e0b\u7f16\u7801&#xff0c;\u201cits&#034;\u548c&#034;the city&#034;\u65e0\u6cd5\u5173\u8054\u5230&#034;Berlin\u201d[citation:2][citation:5]\u3002<\/p>\n<p>\u5de5\u4f5c\u6d41\u7a0b[citation:5]&#xff1a;<\/p>\n<li>\u6574\u4f53\u7f16\u7801&#xff1a;\u5c06\u5b8c\u6574\u6587\u6863&#xff08;\u6700\u957f 8192 token&#xff09;\u4e00\u6b21\u6027\u8f93\u5165\u957f\u4e0a\u4e0b\u6587 Embedding \u6a21\u578b&#xff0c;\u83b7\u53d6\u6bcf\u4e2a Token \u7684\u5411\u91cf\u8868\u793a<\/li>\n<li>\u8fb9\u754c\u6620\u5c04&#xff1a;\u5c06\u9884\u5b9a\u4e49\u7684\u5757\u8fb9\u754c\u6620\u5c04\u5230 Token Embedding \u5e8f\u5217<\/li>\n<li>\u5747\u503c\u6c60\u5316&#xff1a;\u5bf9\u6bcf\u4e2a\u5757\u7684 Token Embedding \u505a Mean Pooling&#xff0c;\u5f97\u5230\u5e26\u5168\u5c40\u4e0a\u4e0b\u6587\u7684\u5757\u5411\u91cf<\/li>\n<p><span class=\"token keyword\">import<\/span> requests<br \/>\n<span class=\"token keyword\">import<\/span> numpy <span class=\"token keyword\">as<\/span> np<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">late_chunk<\/span><span class=\"token punctuation\">(<\/span>document_text<span class=\"token punctuation\">,<\/span> chunk_boundaries<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u5ef6\u8fdf\u5207\u5206&#xff1a;\u5148\u5d4c\u5165\u5168\u6587&#xff0c;\u518d\u63d0\u53d6\u5757\u5411\u91cf&#034;&#034;&#034;<\/span><br \/>\n    <span class=\"token comment\"># Step 1: \u83b7\u53d6\u5168\u6587\u7684 Token \u7ea7 Embedding<\/span><br \/>\n    response <span class=\"token operator\">&#061;<\/span> requests<span class=\"token punctuation\">.<\/span>post<span class=\"token punctuation\">(<\/span><br \/>\n        EMBEDDING_API_ENDPOINT<span class=\"token punctuation\">,<\/span><br \/>\n        headers<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;Authorization&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Bearer <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>JINA_API_KEY<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        json<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token string\">&#034;model&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;jina-embeddings-v3&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;input&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">[<\/span>document_text<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;task&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;retrieval.passage&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n            <span class=\"token string\">&#034;late_chunking&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token boolean\">True<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><br \/>\n    token_embeddings <span class=\"token operator\">&#061;<\/span> response<span class=\"token punctuation\">.<\/span>json<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;data&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;embeddings&#034;<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p>    <span class=\"token comment\"># Step 2: \u5bf9\u6bcf\u4e2a\u5757\u505a Mean Pooling<\/span><br \/>\n    chunk_embeddings <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> start<span class=\"token punctuation\">,<\/span> end <span class=\"token keyword\">in<\/span> chunk_boundaries<span class=\"token punctuation\">:<\/span><br \/>\n        chunk_emb <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>mean<span class=\"token punctuation\">(<\/span>token_embeddings<span class=\"token punctuation\">[<\/span>start<span class=\"token punctuation\">:<\/span>end<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> axis<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        chunk_embeddings<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span>chunk_emb<span class=\"token punctuation\">)<\/span><\/p>\n<p>    <span class=\"token keyword\">return<\/span> chunk_embeddings<\/p>\n<p>\u5173\u952e\u7ed3\u679c[citation:5]&#xff1a;<\/p>\n<ul>\n<li>\u4f7f\u7528\u53e5\u5b50\u8fb9\u754c\u65f6&#xff0c;\u76f8\u5bf9\u63d0\u5347 3.63%&#xff08;\u7edd\u5bf9 1.9%&#xff09;<\/li>\n<li>\u4f7f\u7528\u56fa\u5b9a\u7a97\u53e3\u65f6&#xff0c;\u76f8\u5bf9\u63d0\u5347 3.46%&#xff08;\u7edd\u5bf9 1.8%&#xff09;<\/li>\n<li>\u4f7f\u7528\u8bed\u4e49\u5207\u5206\u65f6&#xff0c;\u76f8\u5bf9\u63d0\u5347 2.70%&#xff08;\u7edd\u5bf9 1.5%&#xff09;<\/li>\n<\/ul>\n<p>\u641c\u7d22 \u201cBerlin\u201d \u65f6&#xff0c;\u6734\u7d20\u5207\u5206\u5bf9\u542b \u201cits\u201d \u548c \u201cthe city\u201d \u7684\u5757\u7ed9\u51fa 0.70\u20130.75 \u7684\u76f8\u4f3c\u5ea6&#xff1b;Late Chunking \u5c06\u5176\u63d0\u5347\u81f3 0.82\u20130.85[citation:5]\u3002<\/p>\n<p>\u9650\u5236&#xff1a;\u53d7\u9650\u4e8e Embedding \u6a21\u578b\u7684\u6700\u5927\u4e0a\u4e0b\u6587\u957f\u5ea6&#xff1b;\u5bf9\u4e8e\u8d85\u957f\u6587\u6863&#xff0c;Jina \u63d0\u51fa\u4e86 \u201cLong Late Chunking\u201d&#xff08;\u91cd\u53e0\u5b8f\u5757\u5904\u7406&#xff09;[citation:5]\u3002<\/p>\n<h5>2.3.2 Contextual Retrieval&#xff08;\u4e0a\u4e0b\u6587\u68c0\u7d22&#xff09;<\/h5>\n<p>\u7531 Anthropic \u4e8e 2024 \u5e74 9 \u6708\u63d0\u51fa[citation:8]&#xff0c;\u601d\u8def\u662f\u8ba9 LLM \u4e3a\u6bcf\u4e2a\u5757\u751f\u6210\u4e00\u6bb5&#034;\u51fa\u8eab\u8bf4\u660e&#034;&#xff0c;\u518d\u4e0e\u539f\u6587\u62fc\u63a5\u540e Embedding\u3002<\/p>\n<p>Prompt \u6a21\u677f&#xff1a;<br \/>\n{{WHOLE_DOCUMENT}}<br \/>\nHere is the chunk we want to situate within the whole document:<br \/>\n{{CHUNK_CONTENT}}<br \/>\nPlease give a short succinct context to situate this chunk&#8230;<br \/>\nAnswer only with the succinct context and nothing else.<\/p>\n<p>\u751f\u6210\u7684 50\u2013100 token \u4e0a\u4e0b\u6587\u88ab\u524d\u7f6e\u5230\u539f\u59cb\u5757&#xff0c;\u518d\u4e00\u8d77 Embedding[citation:8]\u3002<\/p>\n<p>\u4e0e Late Chunking \u7684\u5bf9\u6bd4[citation:8]&#xff1a;<\/p>\n<table>\n<tr>\u7ef4\u5ea6Late ChunkingContextual Retrieval<\/tr>\n<tbody>\n<tr>\n<td>\u4e0a\u4e0b\u6587\u6765\u6e90<\/td>\n<td>Encoder \u7684 Attention \u77e9\u9635<\/td>\n<td>LLM \u751f\u6210\u7684\u6587\u672c\u63cf\u8ff0<\/td>\n<\/tr>\n<tr>\n<td>\u662f\u5426\u9700\u8981 LLM<\/td>\n<td>\u274c \u4ec5\u9700 Embedding \u6a21\u578b<\/td>\n<td>\u2705 \u6bcf\u4e2a\u5757\u90fd\u9700\u8981 LLM \u8c03\u7528<\/td>\n<\/tr>\n<tr>\n<td>\u7d22\u5f15\u8017\u65f6&#xff08;\u6bcf\u6587\u6863&#xff09;<\/td>\n<td>15.81 ms<\/td>\n<td>1890.94 ms&#xff08;\u7ea6 120\u00d7&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>nDCG&#064;10<\/td>\n<td>61.0<\/td>\n<td>72.4<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u89c4\u6a21<\/td>\n<td>\u5927\u89c4\u6a21\u79bb\u7ebf\u7d22\u5f15<\/td>\n<td>\u9ad8\u4ef7\u503c\u3001\u4f4e\u6570\u91cf\u6587\u6863<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7ed3\u8bba&#xff1a;Late Chunking \u662f&#034;\u514d\u8d39\u7684\u5348\u9910&#034;\u2014\u2014\u51e0\u4e4e\u4e0d\u589e\u52a0\u989d\u5916\u6210\u672c\u5373\u53ef\u83b7\u5f97\u4e0a\u4e0b\u6587\u611f\u77e5&#xff1b;Contextual Retrieval \u8d28\u91cf\u66f4\u9ad8\u4f46\u4ee3\u4ef7\u6602\u8d35&#xff0c;\u9002\u5408\u5173\u952e\u6587\u6863[citation:8]\u3002<\/p>\n<hr \/>\n<h3>3. \u8fdb\u9636\u67b6\u6784&#xff1a;\u4ece\u6241\u5e73\u5207\u5206\u5230\u5c42\u6b21\u5316\u7d22\u5f15<\/h3>\n<h4>3.1 Small-to-Big&#xff08;\u7236\u5b50\u6587\u6863\u7b56\u7565&#xff09;<\/h4>\n<p>\u601d\u8def\u6781\u5176\u6734\u7d20&#xff1a;\u68c0\u7d22\u7528\u5c0f\u5757&#xff0c;\u751f\u6210\u7528\u5927\u5757[citation:1]\u3002<\/p>\n<p>\u4e09\u6b65\u6d41\u7a0b&#xff1a;<\/p>\n<li>\u7528\u7ec6\u7c92\u5ea6\u5b50\u5757&#xff08;256\u2013512 token&#xff09;\u505a\u5411\u91cf\u68c0\u7d22&#xff0c;\u4fdd\u8bc1\u53ec\u56de\u7cbe\u51c6<\/li>\n<li>\u547d\u4e2d\u540e&#xff0c;\u901a\u8fc7\u5143\u6570\u636e\u56de\u6eaf\u5230\u7236\u5757&#xff08;1024\u20132048 token&#xff09;<\/li>\n<li>\u5c06\u5b8c\u6574\u7684\u7236\u5757\u5582\u7ed9 LLM \u751f\u6210\u7b54\u6848<\/li>\n<p><span class=\"token comment\"># \u4f2a\u4ee3\u7801\u793a\u610f<\/span><br \/>\nchild_chunks <span class=\"token operator\">&#061;<\/span> split_into_small<span class=\"token punctuation\">(<\/span>document<span class=\"token punctuation\">,<\/span> size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">256<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u5b50\u5757\u505a\u68c0\u7d22<\/span><br \/>\nparent_map <span class=\"token operator\">&#061;<\/span> build_parent_mapping<span class=\"token punctuation\">(<\/span>child_chunks<span class=\"token punctuation\">,<\/span> document<span class=\"token punctuation\">,<\/span> parent_size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1024<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>retrieved_children <span class=\"token operator\">&#061;<\/span> vector_store<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span>query<span class=\"token punctuation\">,<\/span> top_k<span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><br \/>\nretrieved_parents <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>parent_map<span class=\"token punctuation\">[<\/span>c<span class=\"token punctuation\">]<\/span> <span class=\"token keyword\">for<\/span> c <span class=\"token keyword\">in<\/span> retrieved_children<span class=\"token punctuation\">]<\/span>  <span class=\"token comment\"># \u56de\u6eaf\u7236\u5757<\/span><br \/>\nanswer <span class=\"token operator\">&#061;<\/span> llm<span class=\"token punctuation\">.<\/span>generate<span class=\"token punctuation\">(<\/span>query<span class=\"token punctuation\">,<\/span> context<span class=\"token operator\">&#061;<\/span>retrieved_parents<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u5927\u591a\u6570\u95ee\u7b54\u578b RAG \u7cfb\u7edf&#xff0c;\u6027\u4ef7\u6bd4\u6700\u9ad8\u7684\u7ec4\u5408\u62f3[citation:1]\u3002<\/p>\n<h4>3.2 RAPTOR&#xff1a;\u9012\u5f52\u6458\u8981\u6811<\/h4>\n<p>\u7531\u65af\u5766\u798f\u5927\u5b66\u63d0\u51fa&#xff0c;ICLR 2024 \u53d1\u8868[citation:9]\u3002\u6838\u5fc3\u601d\u60f3&#xff1a;\u5c06\u5207\u597d\u7684\u5757\u4e00\u5c42\u4e00\u5c42\u505a\u805a\u7c7b&#043;\u6458\u8981&#xff0c;\u957f\u6210\u4e00\u68f5&#034;\u6458\u8981\u6811&#034;\u3002<\/p>\n<p>\u6784\u5efa\u6d41\u7a0b&#xff1a;<\/p>\n<li>\u53f6\u5b50\u5c42&#xff1a;\u539f\u59cb\u6587\u6863\u5757&#xff08;\u7ec6\u7c92\u5ea6&#xff09;<\/li>\n<li>\u805a\u7c7b&#xff1a;\u7528 K-Means \/ \u5c42\u6b21\u805a\u7c7b\u5c06\u8bed\u4e49\u76f8\u8fd1\u7684\u5757\u805a\u5408<\/li>\n<li>\u6458\u8981&#xff1a;LLM \u4e3a\u6bcf\u4e2a\u805a\u7c7b\u751f\u6210\u9ad8\u5c42\u6458\u8981&#xff08;\u7236\u8282\u70b9&#xff09;<\/li>\n<li>\u9012\u5f52&#xff1a;\u5c06\u6458\u8981\u518d\u6b21\u805a\u7c7b\u3001\u6458\u8981&#xff0c;\u76f4\u5230\u6839\u8282\u70b9<\/li>\n<p>\u68c0\u7d22\u65b9\u5f0f&#xff1a;\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u81ea\u4e0a\u800c\u4e0b\u904d\u5386&#xff0c;\u5b8f\u89c2\u95ee\u9898\u547d\u4e2d\u4e0a\u5c42\u6458\u8981&#xff0c;\u7ec6\u8282\u95ee\u9898\u4e00\u8def\u5411\u4e0b\u5230\u53f6\u5b50[citation:3][citation:12]\u3002<\/p>\n<p>\u6548\u679c&#xff1a;\u5728 QuALITY \u57fa\u51c6\u4e0a&#xff0c;\u914d\u5408 GPT-4 \u6700\u4f73\u6027\u80fd\u63d0\u5347 20%[citation:9]\u3002<\/p>\n<h4>3.3 GraphRAG&#xff1a;\u77e5\u8bc6\u56fe\u8c31 &#043; \u793e\u533a\u805a\u7c7b<\/h4>\n<p>\u7531\u5fae\u8f6f\u63d0\u51fa&#xff0c;\u601d\u8def\u66f4\u5f7b\u5e95&#xff1a;\u5c06\u6587\u6863\u4e2d\u7684\u5b9e\u4f53\u548c\u5173\u7cfb\u62bd\u53d6\u4e3a\u77e5\u8bc6\u56fe\u8c31&#xff0c;\u6309\u793e\u533a&#xff08;Leiden \u7b97\u6cd5&#xff09;\u805a\u7c7b\u5e76\u751f\u6210\u6458\u8981[citation:6]\u3002<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u8de8\u6587\u6863\u3001\u591a\u8df3\u63a8\u7406\u7684\u5168\u5c40\u95ee\u7b54&#xff08;\u5982&#034;\u8fd9\u4e9b\u6750\u6599\u6574\u4f53\u5728\u8bb2\u4ec0\u4e48&#034;&#xff09;[citation:3]\u3002<br \/>\n\u4ee3\u4ef7&#xff1a;\u6784\u5efa\u6210\u672c\u9ad8&#xff0c;\u9002\u5408\u79bb\u7ebf\u6162\u6162\u5efa[citation:9]\u3002<\/p>\n<hr \/>\n<h3>4. \u4e2d\u6587\u5207\u5206\u7684\u7279\u6b8a\u8003\u91cf<\/h3>\n<p>\u4e2d\u6587\u5207\u5206\u76f8\u6bd4\u82f1\u6587\u9762\u4e34\u989d\u5916\u6311\u6218[citation:13][citation:23]&#xff1a;<\/p>\n<table>\n<tr>\u6311\u6218\u8bf4\u660e\u89e3\u51b3\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>\u65e0\u5929\u7136\u7a7a\u683c\u8fb9\u754c<\/td>\n<td>\u4e0d\u80fd\u7528\u7a7a\u683c\u5206\u8bcd<\/td>\n<td>\u4f7f\u7528 jieba \/ HanLP \u7b49\u5206\u8bcd\u5de5\u5177<\/td>\n<\/tr>\n<tr>\n<td>\u6807\u70b9\u7528\u6cd5\u7075\u6d3b<\/td>\n<td>\u201c\u3002\u201d \u4e4b\u5916\u8fd8\u6709 \u201c&#xff01;\u201d \u201c&#xff1f;\u201d \u7b49<\/td>\n<td>\u5b8c\u5584\u7684\u6b63\u5219\u5206\u53e5\u89c4\u5219<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u53e5\u65e0\u6807\u70b9<\/td>\n<td>\u4e00\u5927\u957f\u53e5\u4e0d\u5e26\u6807\u70b9<\/td>\n<td>\u7ed3\u5408\u8bed\u4e49\u5206\u6790\u505a\u4e8c\u6b21\u5207\u5206<\/td>\n<\/tr>\n<tr>\n<td>\u56db\u5b57\u6210\u8bed\/\u53e4\u8bd7\u8bcd<\/td>\n<td>\u5fc5\u987b\u4fdd\u6301\u5b8c\u6574<\/td>\n<td>\u81ea\u5b9a\u4e49\u8bcd\u5178 &#043; \u89c4\u5219\u4fdd\u62a4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token keyword\">import<\/span> jieba<br \/>\n<span class=\"token keyword\">import<\/span> re<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">chinese_sentence_split<\/span><span class=\"token punctuation\">(<\/span>text<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u4e2d\u6587\u5206\u53e5&#xff1a;\u7ed3\u5408\u6807\u70b9\u548c\u6b63\u5219&#034;&#034;&#034;<\/span><br \/>\n    sentences <span class=\"token operator\">&#061;<\/span> re<span class=\"token punctuation\">.<\/span>split<span class=\"token punctuation\">(<\/span><span class=\"token string\">r&#039;(?&lt;&#061;[\u3002&#xff01;&#xff1f;&#xff1b;\\\\.\\\\!\\\\?\\\\;])&#039;<\/span><span class=\"token punctuation\">,<\/span> text<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token punctuation\">[<\/span>s<span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">for<\/span> s <span class=\"token keyword\">in<\/span> sentences <span class=\"token keyword\">if<\/span> s<span class=\"token punctuation\">.<\/span>strip<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">chinese_chunk_with_jieba<\/span><span class=\"token punctuation\">(<\/span>text<span class=\"token punctuation\">,<\/span> chunk_size<span class=\"token operator\">&#061;<\/span><span class=\"token number\">512<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;\u7ed3\u5408 jieba \u5206\u8bcd\u7684\u4e2d\u6587\u5207\u5206&#034;&#034;&#034;<\/span><br \/>\n    words <span class=\"token operator\">&#061;<\/span> jieba<span class=\"token punctuation\">.<\/span>lcut<span class=\"token punctuation\">(<\/span>text<span class=\"token punctuation\">,<\/span> cut_all<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    chunks <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    current <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><br \/>\n    current_len <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> word <span class=\"token keyword\">in<\/span> words<span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> current_len <span class=\"token operator\">&#043;<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>word<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;<\/span> chunk_size <span class=\"token keyword\">and<\/span> current<span class=\"token punctuation\">:<\/span><br \/>\n            chunks<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>current<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n            current <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span>word<span class=\"token punctuation\">]<\/span><br \/>\n            current_len <span class=\"token operator\">&#061;<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>word<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">else<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            current<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span>word<span class=\"token punctuation\">)<\/span><br \/>\n            current_len <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>word<span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> current<span class=\"token punctuation\">:<\/span><br \/>\n        chunks<span class=\"token punctuation\">.<\/span>append<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;&#034;<\/span><span class=\"token punctuation\">.<\/span>join<span class=\"token punctuation\">(<\/span>current<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> chunks<\/p>\n<p>\u5b9e\u8df5\u5efa\u8bae&#xff1a;\u5148\u7528\u7ed3\u6784\u8fb9\u754c\u505a\u7b2c\u4e00\u6b21\u5207\u5206&#xff0c;\u518d\u7528\u53e5\u7ea7\/\u9012\u5f52\u7b56\u7565\u505a\u4e8c\u6b21\u7ec6\u5206&#xff1b;\u4f18\u5148\u4f7f\u7528&#034;\u7ed3\u6784\u91cd\u53e0&#034;&#xff08;\u7236\u6807\u9898\u8def\u5f84\u3001\u4e0a\u6bb5\u6807\u9898&#043;\u6458\u8981&#xff09;\u66ff\u4ee3\u5927\u6bd4\u4f8b\u5b57\u7b26\u91cd\u53e0[citation:27]\u3002<\/p>\n<hr \/>\n<h3>5. \u5de5\u7a0b\u9009\u578b\u51b3\u7b56\u6811<\/h3>\n<p>\u7efc\u5408\u4ee5\u4e0a\u5206\u6790&#xff0c;\u7ed9\u51fa\u4ee5\u4e0b\u9009\u578b\u5efa\u8bae[citation:1][citation:13]&#xff1a;<\/p>\n<p>\u6587\u6863\u662f\u5426\u6709\u6e05\u6670\u7ed3\u6784&#xff1f;<br \/>\n\u251c\u2500\u2500 \u662f&#xff08;Markdown \/ HTML \/ PDF \/ \u4ee3\u7801&#xff09;<br \/>\n\u2502   \u2192 \u7ed3\u6784\u5207\u5206&#xff08;\u6807\u9898\u5c42\u7ea7&#xff09;&#043; \u9012\u5f52\u5b57\u7b26\u5207\u5206&#xff08;\u4e24\u9636\u6bb5&#xff09;<br \/>\n\u2502<br \/>\n\u2514\u2500\u2500 \u5426&#xff08;\u7eaf\u6587\u672c \/ \u6df7\u5408\u5185\u5bb9&#xff09;<br \/>\n    \u2502<br \/>\n    \u251c\u2500\u2500 \u9700\u8981\u6781\u5feb\u901f\u5ea6 \/ \u539f\u578b\u9a8c\u8bc1&#xff1f;<br \/>\n    \u2502   \u2192 \u56fa\u5b9a\u957f\u5ea6\u5207\u5206&#xff08;512 token &#043; 10% overlap&#xff09;<br \/>\n    \u2502<br \/>\n    \u251c\u2500\u2500 \u9700\u8981\u8bed\u4e49\u5b8c\u6574\u6027&#xff08;\u9ad8\u8d28\u91cf\u95ee\u7b54&#xff09;&#xff1f;<br \/>\n    \u2502   \u2192 \u8bed\u4e49\u5207\u5206&#xff08;SemanticChunker&#xff09;<br \/>\n    \u2502<br \/>\n    \u251c\u2500\u2500 \u6587\u6863\u6709\u9891\u7e41\u8de8\u5757\u5f15\u7528&#xff08;&#034;\u5982\u4e0a\u6240\u8ff0&#034;&#034;\u8be6\u89c1\u7b2c\u4e8c\u8282&#034;&#xff09;&#xff1f;<br \/>\n    \u2502   \u2192 Late Chunking \/ Contextual Retrieval<br \/>\n    \u2502<br \/>\n    \u2514\u2500\u2500 \u95ee\u7b54\u578b RAG&#xff0c;\u517c\u987e\u7cbe\u5ea6\u548c\u4e0a\u4e0b\u6587&#xff1f;<br \/>\n        \u2192 Small-to-Big&#xff08;\u7236\u5b50\u6587\u6863\u7b56\u7565&#xff09;<\/p>\n<p>\u67e5\u8be2\u662f\u5426\u8de8\u6587\u6863 \/ \u591a\u8df3&#xff1f;<br \/>\n\u251c\u2500\u2500 \u662f \u2192 RAPTOR&#xff08;\u5c42\u7ea7\u603b\u7ed3&#xff09;\/ GraphRAG&#xff08;\u77e5\u8bc6\u56fe\u8c31&#xff09;<br \/>\n\u2514\u2500\u2500 \u5426 \u2192 \u4e0a\u8ff0\u7b56\u7565\u5df2\u8db3\u591f<\/p>\n<h4>5.1 \u901f\u67e5\u8868<\/h4>\n<table>\n<tr>\u573a\u666f\u63a8\u8350\u7b56\u7565\u53c2\u6570\u8d77\u70b9\u9884\u671f\u6548\u679c<\/tr>\n<tbody>\n<tr>\n<td>\u901a\u7528\u57fa\u7ebf<\/td>\n<td>\u9012\u5f52\u5b57\u7b26\u5207\u5206<\/td>\n<td>512 token, 10% overlap<\/td>\n<td>\u7a33\u5b9a\u53ef\u8dd1\u901a<\/td>\n<\/tr>\n<tr>\n<td>Markdown\/PDF\/\u4ee3\u7801<\/td>\n<td>\u7ed3\u6784\u5207\u5206 &#043; \u9012\u5f52<\/td>\n<td>\u6309\u6807\u9898\u5206\u5927\u5757&#xff0c;\u518d\u63a7 512<\/td>\n<td>\u7ed3\u6784\u5b8c\u6574<\/td>\n<\/tr>\n<tr>\n<td>FAQ\/\u77ed\u95ee\u7b54<\/td>\n<td>\u53e5\u5b50\u5207\u5206 &#043; \u805a\u5408<\/td>\n<td>200\u2013400 token<\/td>\n<td>\u7cbe\u786e\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td>\u957f\u6587\u6863\/\u8bba\u6587<\/td>\n<td>\u8bed\u4e49\u5207\u5206 \/ Late Chunking<\/td>\n<td>512\u2013800 token<\/td>\n<td>\u8bed\u4e49\u8fde\u8d2f<\/td>\n<\/tr>\n<tr>\n<td>\u95ee\u7b54\u578b RAG<\/td>\n<td>Small-to-Big<\/td>\n<td>\u5b50 256 \/ \u7236 1024<\/td>\n<td>\u7cbe\u5ea6&#043;\u4e0a\u4e0b\u6587<\/td>\n<\/tr>\n<tr>\n<td>\u8de8\u6587\u6863\/\u591a\u8df3<\/td>\n<td>RAPTOR \/ GraphRAG<\/td>\n<td>\u2014<\/td>\n<td>\u5168\u5c40\u89c6\u91ce<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>6. \u5e38\u89c1\u9677\u9631\u4e0e\u89c4\u907f<\/h3>\n<h4>6.1 \u8868\u683c\u548c\u7248\u9762\u7ed3\u6784\u4e22\u5931<\/h4>\n<p>\u8868\u683c\u88ab\u786c\u5207\u6210\u7eaf\u6587\u672c\u540e&#xff0c;\u884c\u5217\u5173\u7cfb\u5168\u4e22\u3002\u89e3\u51b3\u65b9\u6848&#xff1a;\u5207\u5206\u524d\u5148\u505a\u7ed3\u6784\u89e3\u6790&#xff0c;\u5c06\u8868\u683c\u8f6c\u4e3a&#034;\u8868\u5934:\u5355\u5143\u683c\u503c&#034;\u7684\u683c\u5f0f[citation:13]\u3002<\/p>\n<h4>6.2 Overlap \u8fc7\u5927<\/h4>\n<p>\u8d85\u8fc7 30% \u7684 overlap \u901a\u5e38\u5bfc\u81f4\u7d22\u5f15\u4f53\u79ef\u4e0e\u68c0\u7d22\u5f00\u9500\u663e\u8457\u4e0a\u5347&#xff0c;\u4f46\u5bf9\u6548\u679c\u7684\u589e\u76ca\u8fb9\u9645\u9012\u51cf[citation:13]\u3002\u5efa\u8bae\u4ece 10\u201320% \u8d77\u6b65\u3002<\/p>\n<h4>6.3 \u7b54\u6848\u6a2a\u8de8\u4e24\u4e2a\u76f8\u90bb\u5757<\/h4>\n<p>\u7ed3\u8bba\u5728\u5757 A&#xff0c;\u8bba\u636e\u5728\u5757 B\u3002Reranker \u53ea\u80fd\u8c03\u987a\u5e8f&#xff0c;\u65e0\u6cd5&#034;\u53d8\u51fa&#034;\u672a\u53ec\u56de\u7684\u5757[citation:1]\u3002\u89e3\u51b3\u65b9\u6848&#xff1a;\u9002\u5f53\u589e\u52a0 overlap \u6216\u91c7\u7528 Small-to-Big \u56de\u6eaf\u7236\u5757\u3002<\/p>\n<h4>6.4 \u5207\u5206\u7b56\u7565\u7684\u5f71\u54cd\u88ab\u4f4e\u4f30<\/h4>\n<p>\u5207\u5206\u7b56\u7565\u5bf9\u68c0\u7d22\u8d28\u91cf\u7684\u5f71\u54cd&#xff0c;\u53ef\u80fd\u6bd4\u6362\u4e00\u4e2a\u66f4\u5f3a\u7684 Embedding \u6a21\u578b\u8fd8\u8981\u5927[citation:1]\u3002<\/p>\n<p>\u4e0e\u5176\u7ea0\u7ed3\u6362\u6a21\u578b&#xff0c;\u4e0d\u5982\u5148\u628a\u5207\u5206\u53c2\u6570\u8c03\u597d\u2014\u2014\u6536\u76ca\u5f80\u5f80\u66f4\u5b9e\u5728\u3002<\/p>\n<h4>6.5 Metadata \u7f3a\u5931<\/h4>\n<p>\u6bcf\u4e2a\u5757\u5e94\u4fdd\u7559\u6765\u6e90\u3001\u7ae0\u8282\u6807\u9898\u3001\u9875\u7801\u7b49\u5143\u6570\u636e[citation:32]&#xff0c;\u8fd9\u5bf9\u540e\u7eed Reranking \u548c\u7b54\u6848\u6eaf\u6e90\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<hr \/>\n<h3>7. \u8bc4\u4f30\u9a71\u52a8&#xff1a;\u5982\u4f55\u79d1\u5b66\u8c03\u4f18\u5207\u5206\u7b56\u7565<\/h3>\n<p>\u6838\u5fc3\u539f\u5219&#xff1a;\u5207\u5206\u53c2\u6570\u4e0d\u80fd\u62cd\u8111\u888b&#xff0c;\u5fc5\u987b\u7528\u6570\u636e\u8bf4\u8bdd[citation:26][citation:30]\u3002<\/p>\n<h4>7.1 \u56db\u6b65\u8bc4\u4f30\u6d41\u7a0b<\/h4>\n<h5>Step 1&#xff1a;\u89e3\u6790\u5f52\u4e00\u5316<\/h5>\n<p>\u5c06\u4e0d\u540c\u683c\u5f0f\u6587\u6863\u7edf\u4e00\u4e3a\u5e26\u7ed3\u6784\u6807\u7b7e\u7684\u6587\u672c[citation:1]\u3002<\/p>\n<h5>Step 2&#xff1a;\u5efa\u7acb\u57fa\u7ebf<\/h5>\n<p>\u7528\u9012\u5f52\u5207\u5206 &#043; overlap \u8dd1\u901a\u5168\u94fe\u8def&#xff0c;\u83b7\u53d6 Recall&#064;K \u57fa\u51c6\u503c[citation:36]\u3002<\/p>\n<h5>Step 3&#xff1a;\u6784\u5efa\u8bc4\u6d4b\u96c6<\/h5>\n<p>\u51c6\u5907 30\u2013200 \u6761&#xff08;\u95ee\u9898, \u671f\u671b\u539f\u6587\u6bb5\u843d&#xff09;\u5bf9[citation:24][citation:30]\u3002<\/p>\n<p>\u26a0\ufe0f \u91cd\u8981&#xff1a;\u7528\u771f\u5b9e\u7528\u6237\u67e5\u8be2\u6784\u5efa&#xff0c;\u800c\u975e LLM \u5408\u6210\u95ee\u9898\u3002\u5408\u6210\u95ee\u9898\u7684\u63aa\u8f9e\u4e0e\u6587\u6863\u9ad8\u5ea6\u4e00\u81f4&#xff0c;\u4f1a\u865a\u9ad8\u6240\u6709\u7b56\u7565\u7684\u53ec\u56de\u7387[citation:30]\u3002<\/p>\n<h5>Step 4&#xff1a;\u6d88\u878d\u5b9e\u9a8c<\/h5>\n<p>\u5728\u540c\u4e00\u6570\u636e\u96c6\u4e0a\u5bf9\u6bd4\u4e0d\u540c\u7b56\u7565&#xff1a;<\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">recall_at_k<\/span><span class=\"token punctuation\">(<\/span>retriever<span class=\"token punctuation\">,<\/span> golden_set<span class=\"token punctuation\">,<\/span> k<span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token triple-quoted-string string\">&#034;&#034;&#034;Recall&#064;K \u8bc4\u4f30\u811a\u624b\u67b6&#034;&#034;&#034;<\/span><br \/>\n    hits <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> query<span class=\"token punctuation\">,<\/span> expected_passage <span class=\"token keyword\">in<\/span> golden_set<span class=\"token punctuation\">:<\/span><br \/>\n        results <span class=\"token operator\">&#061;<\/span> retriever<span class=\"token punctuation\">.<\/span>retrieve<span class=\"token punctuation\">(<\/span>query<span class=\"token punctuation\">,<\/span> top_k<span class=\"token operator\">&#061;<\/span>k<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token builtin\">any<\/span><span class=\"token punctuation\">(<\/span>expected_passage <span class=\"token keyword\">in<\/span> r<span class=\"token punctuation\">.<\/span>text <span class=\"token keyword\">for<\/span> r <span class=\"token keyword\">in<\/span> results<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            hits <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token number\">1<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> hits <span class=\"token operator\">\/<\/span> <span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>golden_set<span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u5bf9\u6bd4\u4e0d\u540c\u7b56\u7565<\/span><br \/>\nstrategies <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">[<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Fixed 512&#034;<\/span><span class=\"token punctuation\">,<\/span> fixed_retriever<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Recursive 512&#034;<\/span><span class=\"token punctuation\">,<\/span> recursive_retriever<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Semantic&#034;<\/span><span class=\"token punctuation\">,<\/span> semantic_retriever<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Small-to-Big&#034;<\/span><span class=\"token punctuation\">,<\/span> parent_child_retriever<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token punctuation\">]<\/span><\/p>\n<p><span class=\"token keyword\">for<\/span> name<span class=\"token punctuation\">,<\/span> retriever <span class=\"token keyword\">in<\/span> strategies<span class=\"token punctuation\">:<\/span><br \/>\n    r5 <span class=\"token operator\">&#061;<\/span> recall_at_k<span class=\"token punctuation\">(<\/span>retriever<span class=\"token punctuation\">,<\/span> golden_set<span class=\"token punctuation\">,<\/span> k<span class=\"token operator\">&#061;<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    r10 <span class=\"token operator\">&#061;<\/span> recall_at_k<span class=\"token punctuation\">(<\/span>retriever<span class=\"token punctuation\">,<\/span> golden_set<span class=\"token punctuation\">,<\/span> k<span class=\"token operator\">&#061;<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: Recall&#064;5&#061;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>r5<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2%<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">, Recall&#064;10&#061;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>r10<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2%<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h4>7.2 \u5173\u952e\u8bc4\u4f30\u6307\u6807<\/h4>\n<table>\n<tr>\u6307\u6807\u542b\u4e49\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>Recall&#064;K<\/td>\n<td>Top-K \u662f\u5426\u5305\u542b\u76ee\u6807\u5757<\/td>\n<td>\u6700\u6838\u5fc3\u6307\u6807&#xff0c;\u51b3\u5b9a\u7b54\u6848\u8d28\u91cf\u4e0a\u9650<\/td>\n<\/tr>\n<tr>\n<td>Precision&#064;K<\/td>\n<td>\u53ec\u56de\u5757\u4e2d\u6709\u591a\u5c11\u76f8\u5173<\/td>\n<td>\u63a7\u5236\u566a\u58f0<\/td>\n<\/tr>\n<tr>\n<td>MRR<\/td>\n<td>\u7b2c\u4e00\u4e2a\u76f8\u5173\u5757\u7684\u4f4d\u7f6e<\/td>\n<td>\u53cd\u6620\u6392\u5e8f\u8d28\u91cf<\/td>\n<\/tr>\n<tr>\n<td>nDCG&#064;K<\/td>\n<td>\u76f8\u5173\u5757\u7684\u6392\u5e8f\u8d28\u91cf&#xff08;\u52a0\u6743&#xff09;<\/td>\n<td>\u591a\u76f8\u5173\u5757\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>Faithfulness<\/td>\n<td>\u751f\u6210\u7b54\u6848\u662f\u5426\u5fe0\u4e8e\u4e0a\u4e0b\u6587<\/td>\n<td>\u7aef\u5230\u7aef\u6307\u6807<\/td>\n<\/tr>\n<tr>\n<td>Latency<\/td>\n<td>\u68c0\u7d22\u5ef6\u8fdf<\/td>\n<td>\u5de5\u7a0b\u7ea6\u675f<\/td>\n<\/tr>\n<tr>\n<td>Index Size<\/td>\n<td>\u7d22\u5f15\u4f53\u79ef<\/td>\n<td>\u6210\u672c\u7ea6\u675f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>7.3 \u5b9e\u9a8c\u77e9\u9635\u5efa\u8bae<\/h4>\n<p>\u53c2\u8003 StackAI \u7684\u5b9e\u8df5[citation:24]&#xff0c;\u5efa\u8bae\u8dd1\u4e00\u4e2a\u53c2\u6570\u7f51\u683c&#xff1a;<\/p>\n<ul>\n<li>chunk_size \u00d7 overlap&#xff1a;300\/500\/800 token \u00d7 0%\/10%\/20% overlap<\/li>\n<li>\u7b56\u7565\u5bf9\u6bd4&#xff1a;\u9012\u5f52 vs \u53e5\u5b50 vs \u8bed\u4e49 vs \u5c42\u6b21\u5316<\/li>\n<li>Reranker&#xff1a;\u6709\/\u65e0 \u5404\u8dd1\u4e00\u7ec4<\/li>\n<\/ul>\n<p>\u5982\u679c\u4e24\u79cd\u7b56\u7565\u5dee\u8ddd\u5728 1\u20132% \u4ee5\u5185&#xff0c;\u4e0d\u503c\u5f97\u8fc7\u5ea6\u4f18\u5316&#xff1b;\u8d85\u8fc7 5%&#xff0c;\u5207\u5206\u5c31\u662f\u7b2c\u4e00\u4f18\u5148\u7ea7[citation:36]\u3002<\/p>\n<hr \/>\n<h3>8. \u524d\u6cbf\u8d8b\u52bf<\/h3>\n<h4>8.1 Agentic Chunking<\/h4>\n<p>\u8ba9 Agent \u6309\u6587\u6863\u7c7b\u578b\u52a8\u6001\u9009\u62e9\u5207\u5206\u7b56\u7565&#xff08;Markdown \u4e00\u79cd\u3001\u4ee3\u7801\u4e00\u79cd\u3001\u5bf9\u8bdd\u4e00\u79cd&#xff09;\u3002Amir Teymoori \u9884\u6d4b&#xff1a;2025 \u4e0b\u534a\u5e74 Agentic Chunking \u5c06\u8fdb\u5165\u4e3b\u6d41\u751f\u4ea7\u7ea7 RAG[citation:1]\u3002<\/p>\n<h4>8.2 \u591a\u6a21\u6001\u5207\u5206<\/h4>\n<p>\u56fe\u6587\u5173\u8054\u5207\u5206\u3001\u89c6\u9891\u6309\u573a\u666f\u5206\u5272\u3001\u97f3\u9891\u9759\u97f3\u68c0\u6d4b\u7b49[citation:4]&#xff0c;\u5c06\u5207\u5206\u4ece\u7eaf\u6587\u672c\u6269\u5c55\u5230\u591a\u6a21\u6001\u9886\u57df\u3002<\/p>\n<h4>8.3 Layout-Aware Segmentation<\/h4>\n<p>\u6700\u65b0\u7814\u7a76&#xff08;\u5982 DocETL\u3001BookRAG&#xff09;\u5f3a\u8c03\u4fdd\u7559\u6587\u6863\u539f\u59cb\u7248\u9762\u4fe1\u606f&#xff08;\u6bb5\u843d\u3001\u8868\u683c\u3001\u56fe\u3001\u516c\u5f0f&#xff09;&#xff0c;\u907f\u514d\u56fa\u5b9a chunk \u5bfc\u81f4\u7684\u4fe1\u606f\u788e\u7247\u5316[citation:6]\u3002<\/p>\n<hr \/>\n<h3>9. \u603b\u7ed3<\/h3>\n<p>\u6587\u6863\u5207\u5206\u6ca1\u6709\u94f6\u5f39\u3002\u672c\u6587\u68b3\u7406\u7684\u6280\u672f\u5168\u666f\u53ef\u5f52\u7eb3\u4e3a\u4e09\u4e2a\u5c42\u6b21&#xff1a;<\/p>\n<li>\u89c4\u5219\u5c42&#xff08;\u56fa\u5b9a\/\u9012\u5f52\/\u7ed3\u6784&#xff09;&#xff1a;\u7b80\u5355\u9ad8\u6548&#xff0c;\u662f\u5de5\u7a0b\u8d77\u70b9<\/li>\n<li>\u8bed\u4e49\u5c42&#xff08;\u8bed\u4e49\u5207\u5206\/Late Chunking\/Contextual Retrieval&#xff09;&#xff1a;\u63d0\u5347\u8bed\u4e49\u8fde\u8d2f\u6027&#xff0c;\u4ee3\u4ef7\u662f\u8ba1\u7b97\u6210\u672c<\/li>\n<li>\u67b6\u6784\u5c42&#xff08;Small-to-Big\/RAPTOR\/GraphRAG&#xff09;&#xff1a;\u901a\u8fc7\u5c42\u6b21\u5316\u7d22\u5f15\u89e3\u51b3\u590d\u6742\u67e5\u8be2<\/li>\n<p>\u5de5\u7a0b\u5b9e\u8df5\u7684\u6838\u5fc3\u5fc3\u6cd5&#xff1a;<\/p>\n<p>\u5148\u8dd1\u901a\u57fa\u7ebf \u2192 \u6784\u5efa\u8bc4\u6d4b\u96c6 \u2192 \u6d88\u878d\u5b9e\u9a8c \u2192 \u6570\u636e\u9a71\u52a8\u9009\u578b \u2192 \u6301\u7eed\u76d1\u63a7\u8fed\u4ee3<\/p>\n<p>\u56f4\u7ed5\u68c0\u7d22\u8d28\u91cf\u3001\u4e0a\u4e0b\u6587\u5b8c\u6574\u6027\u548c\u6210\u672c\u5ef6\u8fdf\u8fd9\u4e09\u4e2a\u7ef4\u5ea6&#xff0c;\u5728\u4f60\u7684\u771f\u5b9e\u6570\u636e\u4e0a\u4e0d\u65ad\u5b9e\u9a8c&#xff0c;\u624d\u80fd\u6536\u655b\u5230\u6700\u4f18\u89e3\u3002<\/p>\n<hr \/>\n<h3>\u53c2\u8003\u8d44\u6599<\/h3>\n<li>Chroma. (2025). RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u4e0e\u5b9e\u73b0\u7ec6\u8282\u2014\u2014\u5168\u7f51\u6280\u672f\u6c47\u603b<\/li>\n<li>Jina AI. (2024). Late Chunking: Contextual Chunk Embeddings Using Long-Context Embedding Models. arXiv:2409.04701<\/li>\n<li>Sarthi, P. et al. (2024). RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval. ICLR 2024<\/li>\n<li>Redis. (2025). Chunking for RAG: Strategies, tradeoffs &amp; common mistakes<\/li>\n<li>Denser AI. (2025). RAG Chunking Strategies 2026: 8 Methods Compared<\/li>\n<li>BetterYeah. (2025). AI\u77e5\u8bc6\u5e93\u5982\u4f55\u8fdb\u884c\u6587\u672c\u5207\u5206&#xff1f;6\u79cd\u65b9\u6cd5<\/li>\n<li>\u963f\u91cc\u4e91\u5f00\u53d1\u8005\u793e\u533a. (2025). RAG\u5206\u5757\u6280\u672f\u5168\u666f\u56fe&#xff1a;5\u5927\u7b56\u7565\u89e3\u5256<\/li>\n<li>Particula Tech. (2025). Contextual Retrieval vs Late Chunking: Which One to Use<\/li>\n<li>\u5f97\u7269\u6280\u672f. (2025). RAG\u2014Chunking\u7b56\u7565\u5b9e\u6218<\/li>\n<li>Airbyte. (2025). RAG Document Chunking: 6 Best Practices<\/li>\n<li>StackAI. (2025). Chunking Strategies for RAG: How to Optimize Document Retrieval<\/li>\n<li>Beefed AI. (2025). Chunking Strategies for Reliable RAG<\/li>\n<li>CSDN. (2025). RAG \u7cfb\u7edf\u4e2d\u6587\u6863\u5207\u5206\u4e0e\u5411\u91cf\u5316\u7684\u6838\u5fc3\u6280\u672f\u4e0e\u5b9e\u8df5<\/li>\n","protected":false},"excerpt":{"rendered":"<p>RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790&#xff1a;\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5<br \/>\n\u6458\u8981<br \/>\n\u6587\u6863\u5207\u5206&#xff08;Document Chunking&#xff09;\u662f RAG&#xff08;Retrieval-Augmented Generation&#xff09;\u7cfb\u7edf\u4e2d\u6700\u57fa\u7840\u5374\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u7684\u9884\u5904\u7406\u73af\u8282\u3002\u5207\u5206\u8d28\u91cf\u76f4\u63a5\u51b3\u5b9a\u68c0\u7d22\u53ec\u56de\u7387\u7684\u4e0a\u9650&#xff0c;\u8fdb\u800c\u5f71\u54cd LLM \u751f\u6210\u7b54\u6848\u7684\u51c6\u786e\u6027\u548c\u5e7b\u89c9\u7387\u3002\u672c\u6587\u7cfb\u7edf\u68b3\u7406\u4ece\u89c4\u5219\u5207\u5206\u5230\u8bed\u4e49\u5207\u5206\u3001\u4ece\u5ef6\u8fdf\u5207\u5206\u5230\u77e5\u8bc6\u56fe\u8c31\u7684\u5b8c\u6574\u6280\u672f\u6f14\u8fdb\u8def\u5f84&amp;#<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1699,52,50,188,51],"topic":[],"class_list":["post-109355","post","type-post","status-publish","format-standard","hentry","category-server","tag-agi","tag-aigc","tag-50","tag-188","tag-51"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/109355.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790&#xff1a;\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 \u6458\u8981 \u6587\u6863\u5207\u5206&#xff08;Document Chunking&#xff09;\u662f RAG&#xff08;Retrieval-Augmented Generation&#xff09;\u7cfb\u7edf\u4e2d\u6700\u57fa\u7840\u5374\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u7684\u9884\u5904\u7406\u73af\u8282\u3002\u5207\u5206\u8d28\u91cf\u76f4\u63a5\u51b3\u5b9a\u68c0\u7d22\u53ec\u56de\u7387\u7684\u4e0a\u9650&#xff0c;\u8fdb\u800c\u5f71\u54cd LLM \u751f\u6210\u7b54\u6848\u7684\u51c6\u786e\u6027\u548c\u5e7b\u89c9\u7387\u3002\u672c\u6587\u7cfb\u7edf\u68b3\u7406\u4ece\u89c4\u5219\u5207\u5206\u5230\u8bed\u4e49\u5207\u5206\u3001\u4ece\u5ef6\u8fdf\u5207\u5206\u5230\u77e5\u8bc6\u56fe\u8c31\u7684\u5b8c\u6574\u6280\u672f\u6f14\u8fdb\u8def\u5f84&amp;#\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/109355.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-23T16:56:43+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/109355.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/109355.html\",\"name\":\"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-23T16:56:43+00:00\",\"dateModified\":\"2026-09-23T16:56:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/109355.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/109355.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/109355.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/109355.html","og_locale":"zh_CN","og_type":"article","og_title":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790&#xff1a;\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 \u6458\u8981 \u6587\u6863\u5207\u5206&#xff08;Document Chunking&#xff09;\u662f RAG&#xff08;Retrieval-Augmented Generation&#xff09;\u7cfb\u7edf\u4e2d\u6700\u57fa\u7840\u5374\u6700\u5bb9\u6613\u88ab\u4f4e\u4f30\u7684\u9884\u5904\u7406\u73af\u8282\u3002\u5207\u5206\u8d28\u91cf\u76f4\u63a5\u51b3\u5b9a\u68c0\u7d22\u53ec\u56de\u7387\u7684\u4e0a\u9650&#xff0c;\u8fdb\u800c\u5f71\u54cd LLM \u751f\u6210\u7b54\u6848\u7684\u51c6\u786e\u6027\u548c\u5e7b\u89c9\u7387\u3002\u672c\u6587\u7cfb\u7edf\u68b3\u7406\u4ece\u89c4\u5219\u5207\u5206\u5230\u8bed\u4e49\u5207\u5206\u3001\u4ece\u5ef6\u8fdf\u5207\u5206\u5230\u77e5\u8bc6\u56fe\u8c31\u7684\u5b8c\u6574\u6280\u672f\u6f14\u8fdb\u8def\u5f84&amp;#","og_url":"https:\/\/www.wsisp.com\/helps\/109355.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-23T16:56:43+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/109355.html","url":"https:\/\/www.wsisp.com\/helps\/109355.html","name":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-23T16:56:43+00:00","dateModified":"2026-09-23T16:56:43+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/109355.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/109355.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/109355.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"RAG \u6587\u6863\u5207\u5206\u7b56\u7565\u5168\u666f\u89e3\u6790\uff1a\u56fa\u5b9a\u957f\u5ea6 vs \u8bed\u4e49\u5207\u5206\u7684\u6280\u672f\u6743\u8861\u4e0e\u5de5\u7a0b\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/109355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=109355"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/109355\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=109355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=109355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=109355"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=109355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}