{"id":94620,"date":"2026-08-14T21:17:47","date_gmt":"2026-08-14T13:17:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/94620.html"},"modified":"2026-08-14T21:17:47","modified_gmt":"2026-08-14T13:17:47","slug":"%e3%80%8a%e5%88%ab%e5%8f%aa%e7%94%a8%e5%90%91%e9%87%8f%e6%90%9c%e7%b4%a2%ef%bc%9abm25-faiss-%e6%89%93%e9%80%a0%e5%b7%a5%e4%b8%9a%e7%ba%a7-rag-%e6%a3%80%e7%b4%a2%e7%b3%bb%e7%bb%9f%e3%80%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/94620.html","title":{"rendered":"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b"},"content":{"rendered":"<p>LlamaAI\u672c\u5730\u90e8\u7f72\u5b9e\u6218\u4e13\u680f\u7b2c7\u7bc7<\/p>\n<p>\u4e0a\u4e00\u7bc7\u6211\u4eec\u5df2\u7ecf\u5b9e\u73b0\u4e86\u4e00\u4e2a\u57fa\u7840 RAG \u7cfb\u7edf&#xff0c;\u4f46\u5f88\u5feb\u4f1a\u9047\u5230\u4e00\u4e2a\u975e\u5e38\u73b0\u5b9e\u7684\u95ee\u9898&#xff1a;<\/p>\n<p>\u77e5\u8bc6\u5e93\u91cc\u660e\u660e\u5b58\u5728\u7b54\u6848&#xff0c;\u4e3a\u4ec0\u4e48AI\u8fd8\u662f\u627e\u4e0d\u5230&#xff1f;<\/p>\n<p>\u672c\u7bc7\u6211\u4eec\u4ece\u5e95\u5c42\u68c0\u7d22\u539f\u7406\u51fa\u53d1&#xff0c;\u628a\u7b80\u5355\u7684\u201c\u5411\u91cf\u641c\u7d22\u201d\u5347\u7ea7\u6210 BM25 &#043; FAISS \u6df7\u5408\u68c0\u7d22&#xff0c;\u6700\u540e\u518d\u4ecb\u7ecd Reranker&#xff0c;\u8ba9\u672c\u5730RAG\u771f\u6b63\u8fdb\u5165\u5de5\u7a0b\u5316\u9636\u6bb5\u3002<\/p>\n<hr \/>\n<h2>\u4e00\u3001\u4e0a\u4e00\u7bc7\u7684RAG\u4e3a\u4ec0\u4e48\u8fd8\u4e0d\u591f&#xff1f;<\/h2>\n<p>\u4e0a\u4e00\u7bc7\u6211\u4eec\u5b9e\u73b0\u4e86&#xff1a;<\/p>\n<p>PDF<br \/>\n \u2193<br \/>\n\u6587\u672c\u5207\u7247<br \/>\n \u2193<br \/>\nEmbedding<br \/>\n \u2193<br \/>\nFAISS<br \/>\n \u2193<br \/>\n\u76f8\u4f3c\u5ea6\u641c\u7d22<br \/>\n \u2193<br \/>\nLlama<\/p>\n<p>\u770b\u8d77\u6765\u5df2\u7ecf\u5b8c\u6574\u3002<\/p>\n<p>\u4f46\u5b9e\u9645\u4f7f\u7528\u65f6\u53ef\u80fd\u51fa\u73b0&#xff1a;<\/p>\n<p>\u7528\u6237\u95ee&#xff1a;<\/p>\n<p>CUDA 12.6 \u5982\u4f55\u5b89\u88c5&#xff1f;<\/p>\n<p>\u77e5\u8bc6\u5e93\u91cc\u9762\u660e\u660e\u5b58\u5728&#xff1a;<\/p>\n<p>CUDA Toolkit 12.6 Installation Guide<\/p>\n<p>\u4f46\u662fFAISS\u8fd4\u56de&#xff1a;<\/p>\n<p>CUDA\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u65b9\u6cd5<br \/>\nGPU\u9a71\u52a8\u5b89\u88c5\u65b9\u6cd5<br \/>\nCUDA Runtime\u4ecb\u7ecd<\/p>\n<p>\u800c\u4e0d\u662f\u6700\u9700\u8981\u7684&#xff1a;<\/p>\n<p>CUDA Toolkit 12.6\u5b89\u88c5\u6b65\u9aa4<\/p>\n<p>\u4e3a\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u56e0\u4e3a&#xff1a;<\/p>\n<p>\u5411\u91cf\u76f8\u4f3c \u2260 \u5173\u952e\u8bcd\u5b8c\u5168\u5339\u914d\u3002<\/p>\n<p>\u8fd9\u5c31\u662f\u672c\u7bc7\u8981\u89e3\u51b3\u7684\u95ee\u9898\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u3001RAG\u68c0\u7d22\u5230\u5e95\u5728\u505a\u4ec0\u4e48&#xff1f;<\/h2>\n<p>\u9996\u5148\u91cd\u65b0\u7406\u89e3RAG\u3002<\/p>\n<p>\u7528\u6237\u8f93\u5165&#xff1a;<\/p>\n<p>CUDA 12.6\u5982\u4f55\u5b89\u88c5&#xff1f;<\/p>\n<p>\u7cfb\u7edf\u5b9e\u9645\u4e0a\u9700\u8981\u5b8c\u6210&#xff1a;<\/p>\n<p>\u95ee\u9898<br \/>\n \u2193<br \/>\n\u68c0\u7d22<br \/>\n \u2193<br \/>\n\u627e\u5230\u76f8\u5173\u6587\u6863<br \/>\n \u2193<br \/>\n\u4ea4\u7ed9LLM<br \/>\n \u2193<br \/>\n\u751f\u6210\u7b54\u6848<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>RAG\u6700\u7ec8\u6548\u679c&#xff0c;\u5f88\u5927\u7a0b\u5ea6\u53d6\u51b3\u4e8e\u68c0\u7d22\u8d28\u91cf\u3002<\/p>\n<p>\u5982\u679c\u68c0\u7d22\u9636\u6bb5\u62ff\u9519\u4e86\u8d44\u6599&#xff1a;<\/p>\n<p>\u9519\u8bef\u8d44\u6599<br \/>\n \u2193<br \/>\nLLM<br \/>\n \u2193<br \/>\n\u9519\u8bef\u7b54\u6848<\/p>\n<p>\u5373\u4f7f\u4f60\u7684Llama\u6a21\u578b\u975e\u5e38\u5f3a&#xff0c;\u4e5f\u5f88\u96be\u51ed\u7a7a\u89e3\u51b3\u3002<\/p>\n<hr \/>\n<h2>\u4e09\u3001\u4e3a\u4ec0\u4e48\u5355\u7eafFAISS\u4f1a\u51fa\u73b0\u95ee\u9898&#xff1f;<\/h2>\n<p>FAISS\u672c\u8d28\u4e0a\u662f&#xff1a;<\/p>\n<p>\u5411\u91cf\u76f8\u4f3c\u5ea6\u641c\u7d22\u5de5\u5177\u3002<\/p>\n<p>\u5047\u8bbe&#xff1a;<\/p>\n<p>\u95ee\u9898&#xff1a;<\/p>\n<p>CUDA 12.6\u5982\u4f55\u5b89\u88c5&#xff1f;<\/p>\n<p>\u7ecf\u8fc7Embedding&#xff1a;<\/p>\n<p>[0.21, 0.83, 0.17, &#8230;]<\/p>\n<p>\u77e5\u8bc6\u5e93&#xff1a;<\/p>\n<p>\u6587\u6863A \u2192 [0.20, 0.81, 0.19, &#8230;]<br \/>\n\u6587\u6863B \u2192 [0.72, 0.14, 0.82, &#8230;]<br \/>\n\u6587\u6863C \u2192 [0.23, 0.80, 0.18, &#8230;]<\/p>\n<p>FAISS\u8ba1\u7b97\u8ddd\u79bb&#xff1a;<\/p>\n<p>Query<br \/>\n \u2193<br \/>\nVector Search<br \/>\n \u2193<br \/>\nTop-K<\/p>\n<p>\u5b83\u5173\u6ce8\u7684\u662f&#xff1a;<\/p>\n<p>\u8bed\u4e49\u7a7a\u95f4\u4e2d\u7684\u8ddd\u79bb\u3002<\/p>\n<p>\u800c\u4e0d\u662f&#xff1a;<\/p>\n<p>\u201cCUDA 12.6\u201d\u8fd9\u4e2a\u5173\u952e\u8bcd\u6709\u6ca1\u6709\u51fa\u73b0\u3002<\/p>\n<hr \/>\n<h2>\u56db\u3001\u4ec0\u4e48\u662fBM25&#xff1f;<\/h2>\n<p>BM25\u662f\u4e00\u79cd\u7ecf\u5178\u7684\u4fe1\u606f\u68c0\u7d22\u7b97\u6cd5\u3002<\/p>\n<p>\u5b83\u4e0d\u662fEmbedding\u3002<\/p>\n<p>\u4e5f\u4e0d\u662f\u795e\u7ecf\u7f51\u7edc\u3002<\/p>\n<p>\u5b83\u4e3b\u8981\u8003\u8651&#xff1a;<\/p>\n<ul>\n<li>\u5173\u952e\u8bcd\u662f\u5426\u51fa\u73b0<\/li>\n<li>\u5173\u952e\u8bcd\u51fa\u73b0\u9891\u7387<\/li>\n<li>\u6587\u6863\u957f\u5ea6<\/li>\n<li>\u5173\u952e\u8bcd\u7a00\u6709\u7a0b\u5ea6<\/li>\n<\/ul>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u67e5\u8be2&#xff1a;<\/p>\n<p>CUDA 12.6 \u5b89\u88c5<\/p>\n<p>\u6587\u6863&#xff1a;<\/p>\n<p>CUDA 12.6 Installation Guide<\/p>\n<p>BM25\u4f1a\u53d1\u73b0&#xff1a;<\/p>\n<p>CUDA      \u221a<br \/>\n12.6      \u221a<br \/>\n\u5b89\u88c5      \u8bed\u4e49\u76f8\u5173<\/p>\n<p>\u56e0\u6b64\u7ed9\u5b83\u8f83\u9ad8\u7684\u76f8\u5173\u6027\u5206\u6570\u3002<\/p>\n<hr \/>\n<h2>\u4e94\u3001BM25\u548cFAISS\u6709\u4ec0\u4e48\u533a\u522b&#xff1f;<\/h2>\n<p>\u53ef\u4ee5\u7b80\u5355\u7406\u89e3&#xff1a;<\/p>\n<h4>FAISS&#xff1a;<\/h4>\n<p>\u201c\u8fd9\u4e24\u4e2a\u6587\u672c\u610f\u601d\u50cf\u4e0d\u50cf&#xff1f;\u201d<\/p>\n<h4>BM25&#xff1a;<\/h4>\n<p>\u201c\u8fd9\u51e0\u4e2a\u5173\u952e\u8bcd\u662f\u4e0d\u662f\u51fa\u73b0\u5728\u8fd9\u7bc7\u6587\u6863\u91cc&#xff1f;\u201d<\/p>\n<hr \/>\n<p>\u4f8b\u5982\u7528\u6237&#xff1a;<\/p>\n<p>RTX 4090 \u663e\u5b58\u591a\u5c11&#xff1f;<\/p>\n<p>\u77e5\u8bc6\u5e93&#xff1a;<\/p>\n<p>A&#xff1a;<br \/>\nRTX 4090\u62e5\u670924GB\u663e\u5b58\u3002<\/p>\n<p>B&#xff1a;<br \/>\nGPU\u663e\u5b58\u7ba1\u7406\u6280\u672f\u3002<\/p>\n<p>C&#xff1a;<br \/>\nCUDA\u7f16\u7a0b\u6a21\u578b\u4ecb\u7ecd\u3002<\/p>\n<p>BM25\u975e\u5e38\u64c5\u957f\u627e\u5230&#xff1a;<\/p>\n<p>RTX 4090<br \/>\n24GB<br \/>\n\u663e\u5b58<\/p>\n<p>\u800c\u5411\u91cf\u641c\u7d22\u5219\u53ef\u80fd\u8fd4\u56de&#xff1a;<\/p>\n<p>GPU\u663e\u5b58\u7ba1\u7406<br \/>\nGPU\u67b6\u6784<br \/>\nCUDA\u663e\u5b58<\/p>\n<p>\u4e24\u8005\u5404\u6709\u4f18\u52bf\u3002<\/p>\n<hr \/>\n<h2>\u516d\u3001\u4e3a\u4ec0\u4e48\u8981\u505a\u6df7\u5408\u68c0\u7d22&#xff1f;<\/h2>\n<p>\u73b0\u5728\u6211\u4eec\u628a\u4e24\u79cd\u65b9\u6cd5\u7ed3\u5408&#xff1a;<\/p>\n<p>                 \u7528\u6237\u95ee\u9898<br \/>\n                    |<br \/>\n          &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n          |                   |<br \/>\n       BM25                 FAISS<br \/>\n          |                   |<br \/>\n      \u5173\u952e\u8bcd\u68c0\u7d22           \u8bed\u4e49\u68c0\u7d22<br \/>\n          |                   |<br \/>\n          &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;<br \/>\n                      |<br \/>\n                  \u7ed3\u679c\u878d\u5408<br \/>\n                      |<br \/>\n                   Top-K<br \/>\n                      |<br \/>\n                   Reranker<br \/>\n                      |<br \/>\n                    Llama<\/p>\n<p>\u8fd9\u5c31\u662f&#xff1a;<\/p>\n<p>Hybrid Search&#xff08;\u6df7\u5408\u68c0\u7d22&#xff09;<\/p>\n<hr \/>\n<h2>\u4e03\u3001BM25\u5b89\u88c5<\/h2>\n<p>Python\u73af\u5883&#xff1a;<\/p>\n<p>pip install rank-bm25 jieba<\/p>\n<p>\u4e2d\u6587\u6587\u672c\u5efa\u8bae\u8fdb\u884c\u5206\u8bcd\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>import jieba<\/p>\n<p>text &#061; &#034;CUDA\u662f\u4e00\u79cdGPU\u8ba1\u7b97\u5e73\u53f0&#034;<\/p>\n<p>tokens &#061; list(jieba.cut(text))<\/p>\n<p>print(tokens)<\/p>\n<p>\u53ef\u80fd\u5f97\u5230&#xff1a;<\/p>\n<p>[&#039;CUDA&#039;, &#039;\u662f&#039;, &#039;\u4e00\u79cd&#039;, &#039;GPU&#039;, &#039;\u8ba1\u7b97&#039;, &#039;\u5e73\u53f0&#039;]<\/p>\n<hr \/>\n<h2>\u516b\u3001\u5efa\u7acbBM25\u7d22\u5f15<\/h2>\n<p>\u5047\u8bbe\u6211\u4eec\u5df2\u7ecf\u6709&#xff1a;<\/p>\n<p>chunks &#061; [<br \/>\n    &#034;CUDA\u662f\u4e00\u79cdGPU\u8ba1\u7b97\u5e73\u53f0&#034;,<br \/>\n    &#034;RTX 4090\u62e5\u670924GB\u663e\u5b58&#034;,<br \/>\n    &#034;Transformer\u662f\u4e00\u79cd\u795e\u7ecf\u7f51\u7edc\u67b6\u6784&#034;,<br \/>\n    &#034;FAISS\u53ef\u4ee5\u8fdb\u884c\u5411\u91cf\u76f8\u4f3c\u5ea6\u641c\u7d22&#034;<br \/>\n]<\/p>\n<p>\u9996\u5148\u5206\u8bcd&#xff1a;<\/p>\n<p>import jieba<\/p>\n<p>tokenized_chunks &#061; [<br \/>\n    list(jieba.cut(chunk))<br \/>\n    for chunk in chunks<br \/>\n]<\/p>\n<p>\u7136\u540e&#xff1a;<\/p>\n<p>from rank_bm25 import BM25Okapi<\/p>\n<p>bm25 &#061; BM25Okapi(<br \/>\n    tokenized_chunks<br \/>\n)<\/p>\n<p>BM25\u7d22\u5f15\u5efa\u7acb\u5b8c\u6210\u3002<\/p>\n<hr \/>\n<h2>\u4e5d\u3001BM25\u68c0\u7d22<\/h2>\n<p>\u7528\u6237&#xff1a;<\/p>\n<p>query &#061; &#034;RTX 4090\u663e\u5b58\u591a\u5c11&#034;<\/p>\n<p>\u5206\u8bcd&#xff1a;<\/p>\n<p>query_tokens &#061; list(<br \/>\n    jieba.cut(query)<br \/>\n)<\/p>\n<p>\u641c\u7d22&#xff1a;<\/p>\n<p>scores &#061; bm25.get_scores(<br \/>\n    query_tokens<br \/>\n)<\/p>\n<p>\u5f97\u5230&#xff1a;<\/p>\n<p>\u6587\u6863A&#xff1a;0.3<br \/>\n\u6587\u6863B&#xff1a;8.7<br \/>\n\u6587\u6863C&#xff1a;0.1<br \/>\n\u6587\u6863D&#xff1a;0.2<\/p>\n<p>\u663e\u7136&#xff1a;<\/p>\n<p>\u6587\u6863B<\/p>\n<p>\u6700\u76f8\u5173\u3002<\/p>\n<hr \/>\n<h2>\u5341\u3001FAISS\u68c0\u7d22<\/h2>\n<p>\u4e4b\u524d\u6211\u4eec\u5df2\u7ecf\u5efa\u7acb\u4e86FAISS&#xff1a;<\/p>\n<p>distance, ids &#061; index.search(<br \/>\n    question_vector,<br \/>\n    3<br \/>\n)<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>FAISS\u7ed3\u679c&#xff1a;<\/p>\n<p>chunk_8<br \/>\nchunk_2<br \/>\nchunk_15<\/p>\n<p>\u73b0\u5728&#xff1a;<\/p>\n<p>BM25&#xff1a;<\/p>\n<p>chunk_2<br \/>\nchunk_7<br \/>\nchunk_21<\/p>\n<p>FAISS&#xff1a;<\/p>\n<p>chunk_8<br \/>\nchunk_2<br \/>\nchunk_15<\/p>\n<p>\u53ef\u4ee5\u53d1\u73b0&#xff1a;<\/p>\n<p>chunk_2<\/p>\n<p>\u540c\u65f6\u88ab\u4e24\u79cd\u7b97\u6cd5\u627e\u5230\u3002<\/p>\n<p>\u8fd9\u901a\u5e38\u610f\u5473\u7740&#xff1a;<\/p>\n<p>\u5b83\u5f88\u53ef\u80fd\u662f\u9ad8\u76f8\u5173\u7ed3\u679c\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e00\u3001\u6700\u7b80\u5355\u7684\u7ed3\u679c\u878d\u5408<\/h2>\n<p>\u4e00\u79cd\u7b80\u5355\u65b9\u6cd5&#xff1a;<\/p>\n<p>BM25\u5206\u6570<br \/>\n&#043;<br \/>\nFAISS\u5206\u6570<br \/>\n&#061;<br \/>\n\u6700\u7ec8\u5206\u6570<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>Document A<\/p>\n<p>BM25 &#061; 8.2<br \/>\nFAISS &#061; 0.85<\/p>\n<p>\u53ef\u4ee5&#xff1a;<\/p>\n<p>Final Score<\/p>\n<p>&#061; \u03b1 \u00d7 BM25<br \/>\n&#043; \u03b2 \u00d7 FAISS<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u03b1 &#061; 0.5<br \/>\n\u03b2 &#061; 0.5<\/p>\n<p>\u4f46\u662f\u8fd9\u91cc\u5b58\u5728\u4e00\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<p>BM25\u548c\u5411\u91cf\u8ddd\u79bb\u7684\u6570\u503c\u8303\u56f4\u5e76\u4e0d\u76f8\u540c\u3002<\/p>\n<p>\u56e0\u6b64\u76f4\u63a5\u76f8\u52a0\u5e76\u4e0d\u7406\u60f3\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e8c\u3001RRF&#xff1a;\u66f4\u5b9e\u7528\u7684\u878d\u5408\u65b9\u6cd5<\/h2>\n<p>\u5b9e\u9645\u5de5\u7a0b\u4e2d\u53ef\u4ee5\u4f7f\u7528&#xff1a;<\/p>\n<p>Reciprocal Rank Fusion<\/p>\n<p>\u7b80\u79f0&#xff1a;<\/p>\n<p>RRF<\/p>\n<p>\u6838\u5fc3\u601d\u60f3&#xff1a;<\/p>\n<p>\u4e0d\u76f4\u63a5\u6bd4\u8f83\u4e24\u4e2a\u7b97\u6cd5\u7684\u539f\u59cb\u5206\u6570\u3002<\/p>\n<p>\u800c\u6bd4\u8f83&#xff1a;<\/p>\n<p>\u6392\u540d\u3002<\/p>\n<p>\u516c\u5f0f&#xff1a;<\/p>\n<p>RRF(d)<br \/>\n&#061;<br \/>\n\u03a3 1 \/ (k &#043; rank(d))<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>BM25&#xff1a;<\/p>\n<p>A \u2192 \u7b2c1<br \/>\nB \u2192 \u7b2c2<br \/>\nC \u2192 \u7b2c3<\/p>\n<p>FAISS&#xff1a;<\/p>\n<p>B \u2192 \u7b2c1<br \/>\nA \u2192 \u7b2c2<br \/>\nD \u2192 \u7b2c3<\/p>\n<p>\u90a3\u4e48&#xff1a;<\/p>\n<p>A&#xff1a;<br \/>\nBM25 Rank 1<br \/>\nFAISS Rank 2<\/p>\n<p>B&#xff1a;<br \/>\nBM25 Rank 2<br \/>\nFAISS Rank 1<\/p>\n<p>\u6700\u7ec8&#xff1a;<\/p>\n<p>A\u548cB\u90fd\u4f1a\u83b7\u5f97\u8f83\u9ad8\u5206\u6570\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e09\u3001\u5b9e\u73b0RRF<\/h2>\n<p>Python&#xff1a;<\/p>\n<p>def rrf_score(results, k&#061;60):<\/p>\n<p>    scores &#061; {}<\/p>\n<p>    for result in results:<\/p>\n<p>        for rank, doc_id in enumerate(<br \/>\n            result,<br \/>\n            start&#061;1<br \/>\n        ):<\/p>\n<p>            scores[doc_id] &#061; (<br \/>\n                scores.get(doc_id, 0)<br \/>\n                &#043; 1 \/ (k &#043; rank)<br \/>\n            )<\/p>\n<p>    return scores<\/p>\n<p>\u4f7f\u7528&#xff1a;<\/p>\n<p>bm25_results &#061; [<br \/>\n    2, 7, 21<br \/>\n]<\/p>\n<p>faiss_results &#061; [<br \/>\n    8, 2, 15<br \/>\n]<\/p>\n<p>scores &#061; rrf_score(<br \/>\n    [<br \/>\n        bm25_results,<br \/>\n        faiss_results<br \/>\n    ]<br \/>\n)<\/p>\n<p>\u6392\u5e8f&#xff1a;<\/p>\n<p>sorted(<br \/>\n    scores.items(),<br \/>\n    key&#061;lambda x: x[1],<br \/>\n    reverse&#061;True<br \/>\n)<\/p>\n<p>\u7ed3\u679c\u53ef\u80fd&#xff1a;<\/p>\n<p>2<br \/>\n8<br \/>\n7<br \/>\n15<br \/>\n21<\/p>\n<p>\u8fd9\u6837&#xff1a;<\/p>\n<p>chunk_2<\/p>\n<p>\u88ab\u4e24\u4e2a\u68c0\u7d22\u5668\u540c\u65f6\u53d1\u73b0&#xff0c;\u81ea\u7136\u6392\u5728\u524d\u9762\u3002<\/p>\n<hr \/>\n<h2>\u5341\u56db\u3001\u4e3a\u4ec0\u4e48\u8fd8\u9700\u8981Reranker&#xff1f;<\/h2>\n<p>\u5230\u8fd9\u91cc&#xff1a;<\/p>\n<p>BM25<br \/>\n &#043;<br \/>\nFAISS<br \/>\n \u2193<br \/>\nTop-K<\/p>\n<p>\u5df2\u7ecf\u6bd4\u5355\u72ecFAISS\u5f3a\u5f88\u591a\u3002<\/p>\n<p>\u4f46\u8fd8\u6709\u4e00\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<p>Top-K\u4e0d\u4e00\u5b9a\u5168\u90e8\u771f\u6b63\u76f8\u5173\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u7528\u6237&#xff1a;<\/p>\n<p>CUDA\u5982\u4f55\u914d\u7f6e\u73af\u5883\u53d8\u91cf&#xff1f;<\/p>\n<p>\u68c0\u7d22\u8fd4\u56de&#xff1a;<\/p>\n<p>Top 10<\/p>\n<p>\u91cc\u9762\u53ef\u80fd&#xff1a;<\/p>\n<p>\u771f\u6b63\u76f8\u5173&#xff1a;3\u4e2a<\/p>\n<p>\u4e00\u822c\u76f8\u5173&#xff1a;4\u4e2a<\/p>\n<p>\u65e0\u5173&#xff1a;3\u4e2a<\/p>\n<p>\u5982\u679c\u628a10\u4e2a\u5168\u90e8\u4ea4\u7ed9LLM&#xff1a;<\/p>\n<p>10\u4e2aChunk<br \/>\n \u2193<br \/>\nPrompt<br \/>\n \u2193<br \/>\nLlama<\/p>\n<p>\u4f1a\u5bfc\u81f4&#xff1a;<\/p>\n<ul>\n<li>Context\u53d8\u957f<\/li>\n<li>\u63a8\u7406\u901f\u5ea6\u4e0b\u964d<\/li>\n<li>\u566a\u58f0\u589e\u52a0<\/li>\n<li>\u6a21\u578b\u66f4\u5bb9\u6613\u53d7\u5230\u65e0\u5173\u5185\u5bb9\u5e72\u6270<\/li>\n<\/ul>\n<p>\u6240\u4ee5\u9700\u8981&#xff1a;<\/p>\n<p>Reranker\u91cd\u65b0\u6392\u5e8f\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e94\u3001Reranker\u662f\u4ec0\u4e48&#xff1f;<\/h2>\n<p>Reranker&#xff1a;<\/p>\n<p>\u5bf9Query\u548c\u5019\u9009\u6587\u6863\u8fdb\u884c\u66f4\u7cbe\u7ec6\u7684\u76f8\u5173\u6027\u5224\u65ad\u3002<\/p>\n<p>\u6d41\u7a0b&#xff1a;<\/p>\n<p>\u7528\u6237\u95ee\u9898<br \/>\n    |<br \/>\nBM25 &#043; FAISS<br \/>\n    |<br \/>\nTop 20<br \/>\n    |<br \/>\nReranker<br \/>\n    |<br \/>\nTop 5<br \/>\n    |<br \/>\nLlama<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4&#xff1a;<\/p>\n<h4>\u7b2c\u4e00\u9636\u6bb5&#xff1a;<\/h4>\n<p>\u5feb\u901f\u641c\u7d22\u3002<\/p>\n<h4>\u7b2c\u4e8c\u9636\u6bb5&#xff1a;<\/h4>\n<p>\u7cbe\u786e\u5224\u65ad\u3002<\/p>\n<hr \/>\n<h2>\u5341\u516d\u3001\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u76f4\u63a5\u8ba9Llama\u6392\u5e8f&#xff1f;<\/h2>\n<p>\u5f53\u7136\u53ef\u4ee5\u3002<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>Query&#xff1a;<\/p>\n<p>CUDA\u5982\u4f55\u5b89\u88c5&#xff1f;<\/p>\n<p>Document A<br \/>\nDocument B<br \/>\nDocument C<br \/>\n&#8230;<\/p>\n<p>\u7136\u540e\u8ba9Llama&#xff1a;<\/p>\n<p>\u8bf7\u6309\u7167\u76f8\u5173\u6027\u6392\u5e8f\u3002<\/p>\n<p>\u4f46\u662f\u8fd9\u6837\u6210\u672c\u8f83\u9ad8\u3002<\/p>\n<p>\u56e0\u4e3a&#xff1a;<\/p>\n<p>\u6bcf\u6b21\u68c0\u7d22<br \/>\n \u2193<br \/>\n\u8c03\u7528LLM<br \/>\n \u2193<br \/>\n\u5927\u91cfToken\u8ba1\u7b97<\/p>\n<p>Reranker\u5219\u4e13\u95e8\u89e3\u51b3&#xff1a;<\/p>\n<p>Query-Document\u76f8\u5173\u6027\u5224\u65ad\u3002<\/p>\n<p>\u56e0\u6b64\u901f\u5ea6\u548c\u6210\u672c\u66f4\u52a0\u5408\u9002\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e03\u3001\u5b8c\u6574\u5de5\u4e1a\u7ea7RAG\u67b6\u6784<\/h2>\n<p>\u73b0\u5728\u6211\u4eec\u7684\u67b6\u6784\u5347\u7ea7\u6210&#xff1a;<\/p>\n<p>                     \u7528\u6237\u95ee\u9898<br \/>\n                         |<br \/>\n              &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n              |                    |<br \/>\n             BM25                FAISS<br \/>\n              |                    |<br \/>\n           Top-K                Top-K<br \/>\n              |                    |<br \/>\n              &#8212;&#8212;&#8212;RRF&#8212;&#8212;&#8212;-<br \/>\n                         |<br \/>\n                       Top-20<br \/>\n                         |<br \/>\n                      Reranker<br \/>\n                         |<br \/>\n                       Top-5<br \/>\n                         |<br \/>\n                       Prompt<br \/>\n                         |<br \/>\n                    llama-server<br \/>\n                         |<br \/>\n                        Llama<br \/>\n                         |<br \/>\n                        \u7b54\u6848<\/p>\n<p>\u8fd9\u5df2\u7ecf\u662f\u975e\u5e38\u5178\u578b\u7684&#xff1a;<\/p>\n<p>Hybrid RAG Pipeline<\/p>\n<hr \/>\n<h2>\u5341\u516b\u3001\u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u4ee3\u7801\u7ed3\u6784<\/h2>\n<p>\u5efa\u8bae\u628a\u9879\u76ee\u7ec4\u7ec7\u6210&#xff1a;<\/p>\n<p>rag-project\/<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 data\/<br \/>\n\u2502   \u2514\u2500\u2500 documents\/<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 models\/<br \/>\n\u2502   \u2514\u2500\u2500 embedding\/<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 vectorstore\/<br \/>\n\u2502   \u2514\u2500\u2500 faiss.index<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 bm25\/<br \/>\n\u2502   \u2514\u2500\u2500 index.pkl<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 ingest.py<br \/>\n\u251c\u2500\u2500 retriever.py<br \/>\n\u251c\u2500\u2500 reranker.py<br \/>\n\u251c\u2500\u2500 llm.py<br \/>\n\u2514\u2500\u2500 main.py<\/p>\n<p>\u804c\u8d23&#xff1a;<\/p>\n<p>ingest.py<br \/>\n\u2193<br \/>\n\u5904\u7406\u6587\u6863<\/p>\n<p>retriever.py<br \/>\n\u2193<br \/>\nBM25 &#043; FAISS<\/p>\n<p>reranker.py<br \/>\n\u2193<br \/>\n\u91cd\u6392\u5e8f<\/p>\n<p>llm.py<br \/>\n\u2193<br \/>\n\u8c03\u7528llama-server<\/p>\n<p>main.py<br \/>\n\u2193<br \/>\n\u6574\u4f53\u6d41\u7a0b<\/p>\n<p>\u8fd9\u6bd4\u628a\u6240\u6709\u4ee3\u7801\u5199\u5728\u4e00\u4e2aPython\u6587\u4ef6\u91cc\u66f4\u9002\u5408\u540e\u7eed\u6269\u5c55\u3002<\/p>\n<hr \/>\n<h2>\u5341\u4e5d\u3001\u5b8c\u6574\u67e5\u8be2\u6d41\u7a0b<\/h2>\n<p>\u5047\u8bbe\u7528\u6237&#xff1a;<\/p>\n<p>RTX 4060\u8fd0\u884c7B\u6a21\u578b\u9700\u8981\u591a\u5c11\u663e\u5b58&#xff1f;<\/p>\n<p>\u7b2c\u4e00\u6b65&#xff1a;<\/p>\n<p>Query<\/p>\n<p>\u7b2c\u4e8c\u6b65&#xff1a;<\/p>\n<p>BM25&#xff1a;<\/p>\n<p>\u627e\u5230\u5305\u542b&#xff1a;<\/p>\n<p>RTX 4060<br \/>\n7B<br \/>\n\u663e\u5b58<\/p>\n<p>\u7684\u6587\u6863<\/p>\n<p>\u7b2c\u4e09\u6b65&#xff1a;<\/p>\n<p>FAISS&#xff1a;<\/p>\n<p>\u627e\u5230\u8bed\u4e49\u76f8\u4f3c&#xff1a;<\/p>\n<p>GPU\u663e\u5b58\u9700\u6c42<br \/>\n\u6a21\u578b\u91cf\u5316<br \/>\nQ4\u6a21\u578b<\/p>\n<p>\u7b2c\u56db\u6b65&#xff1a;<\/p>\n<p>RRF&#xff1a;<\/p>\n<p>\u878d\u5408\u4e24\u4e2a\u7ed3\u679c<\/p>\n<p>\u7b2c\u4e94\u6b65&#xff1a;<\/p>\n<p>Reranker&#xff1a;<\/p>\n<p>Top 20<br \/>\n \u2193<br \/>\nTop 5<\/p>\n<p>\u7b2c\u516d\u6b65&#xff1a;<\/p>\n<p>\u6784\u5efaPrompt&#xff1a;<\/p>\n<p>\u8bf7\u6839\u636e\u4ee5\u4e0b\u8d44\u6599\u56de\u7b54\u95ee\u9898\u3002<\/p>\n<p>\u8d44\u65991&#xff1a;<br \/>\n&#8230;&#8230;<\/p>\n<p>\u8d44\u65992&#xff1a;<br \/>\n&#8230;&#8230;<\/p>\n<p>\u8d44\u65993&#xff1a;<br \/>\n&#8230;&#8230;<\/p>\n<p>\u95ee\u9898&#xff1a;<br \/>\nRTX 4060\u8fd0\u884c7B\u6a21\u578b\u9700\u8981\u591a\u5c11\u663e\u5b58&#xff1f;<\/p>\n<p>\u7b2c\u4e03\u6b65&#xff1a;<\/p>\n<p>Prompt<br \/>\n \u2193<br \/>\nllama-server<br \/>\n \u2193<br \/>\n\u672c\u5730Llama<br \/>\n \u2193<br \/>\n\u7b54\u6848<\/p>\n<hr \/>\n<h2>\u4e8c\u5341\u3001\u4e3a\u4ec0\u4e48\u6df7\u5408RAG\u901a\u5e38\u6bd4\u5355\u4e00\u68c0\u7d22\u66f4\u52a0\u53ef\u9760&#xff1f;<\/h2>\n<p>\u53ef\u4ee5\u4ece\u4e09\u4e2a\u7ef4\u5ea6\u7406\u89e3\u3002<\/p>\n<h4>FAISS<\/h4>\n<p>\u64c5\u957f&#xff1a;<\/p>\n<p>\u8bed\u4e49\u641c\u7d22<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>\u201c\u663e\u5361\u5185\u5b58\u201d<\/p>\n<p>\u2248<\/p>\n<p>\u201cGPU\u663e\u5b58\u201d<\/p>\n<hr \/>\n<h4>BM25<\/h4>\n<p>\u64c5\u957f&#xff1a;<\/p>\n<p>\u7cbe\u786e\u5173\u952e\u8bcd<\/p>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>RTX 4060<br \/>\nCUDA 12.6<br \/>\nQ4_K_M<\/p>\n<p>\u8fd9\u4e9b\u6280\u672f\u540d\u8bcd\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<hr \/>\n<h4>Reranker<\/h4>\n<p>\u64c5\u957f&#xff1a;<\/p>\n<p>\u7cbe\u7ec6\u76f8\u5173\u6027\u5224\u65ad<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>BM25<br \/>\n&#043;<br \/>\nFAISS<br \/>\n&#043;<br \/>\nReranker<\/p>\n<p>\u5f62\u6210\u4e09\u7ea7\u68c0\u7d22\u4f53\u7cfb&#xff1a;<\/p>\n<p>\u7b2c\u4e00\u5c42&#xff1a;<\/p>\n<p>\u5feb\u901f\u53ec\u56de<\/p>\n<p>\u7b2c\u4e8c\u5c42&#xff1a;<\/p>\n<p>\u6df7\u5408\u878d\u5408<\/p>\n<p>\u7b2c\u4e09\u5c42&#xff1a;<\/p>\n<p>\u7cbe\u786e\u6392\u5e8f<\/p>\n<hr \/>\n<h2>\u4e8c\u5341\u4e00\u3001RAG\u6027\u80fd\u4f18\u5316\u7684\u6838\u5fc3\u53c2\u6570<\/h2>\n<p>\u771f\u6b63\u505aRAG\u65f6&#xff0c;\u4e0d\u8981\u53ea\u76ef\u7740\u6a21\u578b\u3002<\/p>\n<p>\u4e0b\u9762\u8fd9\u4e9b\u53c2\u6570\u540c\u6837\u91cd\u8981&#xff1a;<\/p>\n<h3>Chunk Size<\/h3>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>500<br \/>\n1000<br \/>\n1500<br \/>\n2000<\/p>\n<p>\u8fc7\u5c0f&#xff1a;<\/p>\n<p>\u4e0a\u4e0b\u6587\u4e0d\u5b8c\u6574<\/p>\n<p>\u8fc7\u5927&#xff1a;<\/p>\n<p>\u566a\u58f0\u589e\u52a0<\/p>\n<hr \/>\n<h3>Chunk Overlap<\/h3>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>50<br \/>\n100<br \/>\n200<\/p>\n<p>\u7528\u4e8e\u51cf\u5c11\u5207\u7247\u8fb9\u754c\u9020\u6210\u7684\u4fe1\u606f\u4e22\u5931\u3002<\/p>\n<hr \/>\n<h3>Top-K<\/h3>\n<p>\u4f8b\u5982&#xff1a;<\/p>\n<p>Top 3<br \/>\nTop 5<br \/>\nTop 10<br \/>\nTop 20<\/p>\n<p>\u4e00\u822c\u53ef\u4ee5&#xff1a;<\/p>\n<p>\u53ec\u56deTop 20<\/p>\n<p>\u2193<\/p>\n<p>Reranker<\/p>\n<p>\u2193<\/p>\n<p>Top 5<\/p>\n<hr \/>\n<h2>\u4e8c\u5341\u4e8c\u3001\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u5de5\u7a0b\u7ecf\u9a8c<\/h2>\n<p>\u5f88\u591a\u4eba\u505aRAG&#xff1a;<\/p>\n<p>Embedding\u6a21\u578b\u6362\u4e00\u4e2a<br \/>\n\u2193<\/p>\n<p>\u5411\u91cf\u6570\u636e\u5e93\u6362\u4e00\u4e2a<br \/>\n\u2193<\/p>\n<p>LLM\u6362\u4e00\u4e2a<\/p>\n<p>\u4f46\u6548\u679c\u8fd8\u662f\u4e0d\u597d\u3002<\/p>\n<p>\u5b9e\u9645\u4e0a&#xff1a;<\/p>\n<p>RAG\u6548\u679c\u7684\u74f6\u9888\u7ecf\u5e38\u4e0d\u662fLLM&#xff0c;\u800c\u662f\u68c0\u7d22\u3002<\/p>\n<p>\u4e00\u4e2a\u5f3a\u6a21\u578b&#xff1a;<\/p>\n<p>\u9519\u8bef\u8d44\u6599<br \/>\n \u2193<br \/>\n\u5f3aLLM<br \/>\n \u2193<br \/>\n\u9519\u8bef\u7b54\u6848<\/p>\n<p>\u4e00\u4e2a\u666e\u901a\u6a21\u578b&#xff1a;<\/p>\n<p>\u6b63\u786e\u8d44\u6599<br \/>\n \u2193<br \/>\n\u666e\u901aLLM<br \/>\n \u2193<br \/>\n\u9ad8\u8d28\u91cf\u7b54\u6848<\/p>\n<p>\u56e0\u6b64&#xff1a;<\/p>\n<p>\u5148\u628a\u68c0\u7d22\u505a\u597d&#xff0c;\u518d\u8c08\u6a21\u578b\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u5341\u4e09\u3001\u6700\u7ec8RAG\u67b6\u6784<\/h2>\n<p>\u5230\u8fd9\u91cc&#xff0c;\u6211\u4eec\u7684\u672c\u5730AI\u5df2\u7ecf\u53d8\u6210&#xff1a;<\/p>\n<p>                  \u7528\u6237<br \/>\n                   |<br \/>\n                 Query<br \/>\n                   |<br \/>\n          &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n          |                 |<br \/>\n        BM25              FAISS<br \/>\n          |                 |<br \/>\n        Top-K             Top-K<br \/>\n          |                 |<br \/>\n          &#8212;&#8212;- RRF &#8212;&#8212;-<br \/>\n                   |<br \/>\n                 Top 20<br \/>\n                   |<br \/>\n               Reranker<br \/>\n                   |<br \/>\n                 Top 5<br \/>\n                   |<br \/>\n                Prompt<br \/>\n                   |<br \/>\n             llama-server<br \/>\n                   |<br \/>\n               GGUF\u6a21\u578b<br \/>\n                   |<br \/>\n              CUDA GPU<br \/>\n                   |<br \/>\n                 \u7b54\u6848<\/p>\n<p>\u8fd9\u5df2\u7ecf\u4e0d\u518d\u662f\u4e00\u4e2a\u7b80\u5355\u7684&#xff1a;<\/p>\n<p>PDF &#043; LLM<\/p>\n<p>\u800c\u662f\u4e00\u4e2a\u5b8c\u6574\u7684&#xff1a;<\/p>\n<p>\u672c\u5730Hybrid RAG\u7cfb\u7edf\u3002<\/p>\n<hr \/>\n<h2>\u4e8c\u5341\u56db\u3001\u672c\u7bc7\u603b\u7ed3<\/h2>\n<p>\u8fd9\u4e00\u7bc7\u6211\u4eec\u89e3\u51b3\u4e86\u57fa\u7840RAG\u6700\u91cd\u8981\u7684\u95ee\u9898&#xff1a;<\/p>\n<p>\u5982\u4f55\u63d0\u9ad8\u68c0\u7d22\u51c6\u786e\u7387&#xff1f;<\/p>\n<p>\u6838\u5fc3\u6280\u672f\u8def\u7ebf&#xff1a;<\/p>\n<p>FAISS<br \/>\n \u2193<br \/>\n\u8bed\u4e49\u641c\u7d22<\/p>\n<p>BM25<br \/>\n \u2193<br \/>\n\u5173\u952e\u8bcd\u641c\u7d22<\/p>\n<p>RRF<br \/>\n \u2193<br \/>\n\u7ed3\u679c\u878d\u5408<\/p>\n<p>Reranker<br \/>\n \u2193<br \/>\n\u7cbe\u786e\u6392\u5e8f<\/p>\n<p>Llama<br \/>\n \u2193<br \/>\n\u751f\u6210\u7b54\u6848<\/p>\n<p>\u6700\u7ec8\u5f62\u6210&#xff1a;<\/p>\n<p>BM25<br \/>\n   &#043;<br \/>\nFAISS<br \/>\n   \u2193<br \/>\nHybrid Search<br \/>\n   \u2193<br \/>\nRRF<br \/>\n   \u2193<br \/>\nReranker<br \/>\n   \u2193<br \/>\nLlama.cpp<\/p>\n<hr \/>\n<h2>\u4e0b\u4e00\u7bc7\u9884\u544a<\/h2>\n<h3>\u300a\u672c\u5730Llama Agent\u5f00\u53d1&#xff1a;\u8ba9\u5927\u6a21\u578b\u5b66\u4f1a\u8c03\u7528\u5de5\u5177\u300b<\/h3>\n<p>\u5230\u8fd9\u91cc&#xff0c;\u6211\u4eec\u7684AI\u5df2\u7ecf\u53ef\u4ee5&#xff1a;<\/p>\n<p>\u7406\u89e3\u95ee\u9898 &#043; \u641c\u7d22\u77e5\u8bc6 &#043; \u751f\u6210\u7b54\u6848\u3002<\/p>\n<p>\u4f46\u662f\u5b83\u4ecd\u7136\u53ea\u80fd\u201c\u8bf4\u201d\u3002<\/p>\n<p>\u4e0b\u4e00\u6b65&#xff0c;\u6211\u4eec\u8ba9\u5b83\u771f\u6b63&#xff1a;<\/p>\n<p>\u505a\u4e8b\u60c5\u3002<\/p>\n<p>\u4e0b\u4e00\u7bc7\u5c06\u5b9e\u73b0&#xff1a;<\/p>\n<ul>\n<li>\u4ec0\u4e48\u662fAI Agent<\/li>\n<li>Function Calling\u539f\u7406<\/li>\n<li>Tool Calling<\/li>\n<li>\u6587\u4ef6\u64cd\u4f5c\u5de5\u5177<\/li>\n<li>Python\u5de5\u5177<\/li>\n<li>\u641c\u7d22\u5de5\u5177<\/li>\n<li>Agent\u5faa\u73af<\/li>\n<li>\u672c\u5730Llama &#043; RAG &#043; Tools<\/li>\n<li>\u6784\u5efa\u7b2c\u4e00\u4e2a\u672c\u5730AI Agent<\/li>\n<\/ul>\n<p>\u6700\u7ec8\u5b9e\u73b0&#xff1a;<\/p>\n<p>\u7528\u6237<br \/>\n \u2193<br \/>\nLlama<br \/>\n \u2193<br \/>\n\u5224\u65ad\u9700\u8981\u4ec0\u4e48\u5de5\u5177<br \/>\n \u2193<br \/>\n\u8c03\u7528\u5de5\u5177<br \/>\n \u2193<br \/>\n\u83b7\u5f97\u7ed3\u679c<br \/>\n \u2193<br \/>\n\u7ee7\u7eed\u601d\u8003<br \/>\n \u2193<br \/>\n\u751f\u6210\u6700\u7ec8\u7b54\u6848<\/p>\n<p>\u8fd9\u5c06\u662f\u6574\u4e2a\u4e13\u680f\u4ece\u201c\u672c\u5730\u5927\u6a21\u578b\u201d\u8fc8\u5411\u201c\u672c\u5730\u667a\u80fd\u4f53\u201d\u7684\u5173\u952e\u4e00\u7bc7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LlamaAI\u672c\u5730\u90e8\u7f72\u5b9e\u6218\u4e13\u680f\u7b2c7\u7bc7\u4e0a\u4e00\u7bc7\u6211\u4eec\u5df2\u7ecf\u5b9e\u73b0\u4e86\u4e00\u4e2a\u57fa\u7840 RAG \u7cfb\u7edf&#xff0c;\u4f46\u5f88\u5feb\u4f1a\u9047\u5230\u4e00\u4e2a\u975e\u5e38\u73b0\u5b9e\u7684\u95ee\u9898&#xff1a;\u77e5\u8bc6\u5e93\u91cc\u660e\u660e\u5b58\u5728\u7b54\u6848&#xff0c;\u4e3a\u4ec0\u4e48AI\u8fd8\u662f\u627e\u4e0d\u5230&#xff1f;\u672c\u7bc7\u6211\u4eec\u4ece\u5e95\u5c42\u68c0\u7d22\u539f\u7406\u51fa\u53d1&#xff0c;\u628a\u7b80\u5355\u7684\u201c\u5411\u91cf\u641c\u7d22\u201d\u5347\u7ea7\u6210 BM25  FAISS \u6df7\u5408\u68c0\u7d22&#xff0c;\u6700\u540e\u518d\u4ecb\u7ecd Reranker&#xff0c;\u8ba9\u672c\u5730RAG\u771f\u6b63\u8fdb\u5165\u5de5\u7a0b\u5316\u9636\u6bb5\u3002\u4e00\u3001\u4e0a\u4e00\u7bc7\u7684RAG\u4e3a\u4ec0\u4e48\u8fd8\u4e0d\u591f&#xff1f;\u4e0a\u4e00\u7bc7\u6211\u4eec\u5b9e\u73b0\u4e86&amp;#xff1<\/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":[10397,10839],"topic":[],"class_list":["post-94620","post","type-post","status-publish","format-standard","hentry","category-server","tag-deepseek","tag-faiss"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \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\/94620.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"LlamaAI\u672c\u5730\u90e8\u7f72\u5b9e\u6218\u4e13\u680f\u7b2c7\u7bc7\u4e0a\u4e00\u7bc7\u6211\u4eec\u5df2\u7ecf\u5b9e\u73b0\u4e86\u4e00\u4e2a\u57fa\u7840 RAG \u7cfb\u7edf&#xff0c;\u4f46\u5f88\u5feb\u4f1a\u9047\u5230\u4e00\u4e2a\u975e\u5e38\u73b0\u5b9e\u7684\u95ee\u9898&#xff1a;\u77e5\u8bc6\u5e93\u91cc\u660e\u660e\u5b58\u5728\u7b54\u6848&#xff0c;\u4e3a\u4ec0\u4e48AI\u8fd8\u662f\u627e\u4e0d\u5230&#xff1f;\u672c\u7bc7\u6211\u4eec\u4ece\u5e95\u5c42\u68c0\u7d22\u539f\u7406\u51fa\u53d1&#xff0c;\u628a\u7b80\u5355\u7684\u201c\u5411\u91cf\u641c\u7d22\u201d\u5347\u7ea7\u6210 BM25 FAISS \u6df7\u5408\u68c0\u7d22&#xff0c;\u6700\u540e\u518d\u4ecb\u7ecd Reranker&#xff0c;\u8ba9\u672c\u5730RAG\u771f\u6b63\u8fdb\u5165\u5de5\u7a0b\u5316\u9636\u6bb5\u3002\u4e00\u3001\u4e0a\u4e00\u7bc7\u7684RAG\u4e3a\u4ec0\u4e48\u8fd8\u4e0d\u591f&#xff1f;\u4e0a\u4e00\u7bc7\u6211\u4eec\u5b9e\u73b0\u4e86&amp;#xff1\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/94620.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-14T13:17:47+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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94620.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/94620.html\",\"name\":\"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-14T13:17:47+00:00\",\"dateModified\":\"2026-08-14T13:17:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/94620.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/94620.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/94620.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b\"}]},{\"@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":"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \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\/94620.html","og_locale":"zh_CN","og_type":"article","og_title":"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"LlamaAI\u672c\u5730\u90e8\u7f72\u5b9e\u6218\u4e13\u680f\u7b2c7\u7bc7\u4e0a\u4e00\u7bc7\u6211\u4eec\u5df2\u7ecf\u5b9e\u73b0\u4e86\u4e00\u4e2a\u57fa\u7840 RAG \u7cfb\u7edf&#xff0c;\u4f46\u5f88\u5feb\u4f1a\u9047\u5230\u4e00\u4e2a\u975e\u5e38\u73b0\u5b9e\u7684\u95ee\u9898&#xff1a;\u77e5\u8bc6\u5e93\u91cc\u660e\u660e\u5b58\u5728\u7b54\u6848&#xff0c;\u4e3a\u4ec0\u4e48AI\u8fd8\u662f\u627e\u4e0d\u5230&#xff1f;\u672c\u7bc7\u6211\u4eec\u4ece\u5e95\u5c42\u68c0\u7d22\u539f\u7406\u51fa\u53d1&#xff0c;\u628a\u7b80\u5355\u7684\u201c\u5411\u91cf\u641c\u7d22\u201d\u5347\u7ea7\u6210 BM25 FAISS \u6df7\u5408\u68c0\u7d22&#xff0c;\u6700\u540e\u518d\u4ecb\u7ecd Reranker&#xff0c;\u8ba9\u672c\u5730RAG\u771f\u6b63\u8fdb\u5165\u5de5\u7a0b\u5316\u9636\u6bb5\u3002\u4e00\u3001\u4e0a\u4e00\u7bc7\u7684RAG\u4e3a\u4ec0\u4e48\u8fd8\u4e0d\u591f&#xff1f;\u4e0a\u4e00\u7bc7\u6211\u4eec\u5b9e\u73b0\u4e86&amp;#xff1","og_url":"https:\/\/www.wsisp.com\/helps\/94620.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-14T13:17:47+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/94620.html","url":"https:\/\/www.wsisp.com\/helps\/94620.html","name":"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-14T13:17:47+00:00","dateModified":"2026-08-14T13:17:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/94620.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/94620.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/94620.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u300a\u522b\u53ea\u7528\u5411\u91cf\u641c\u7d22\uff1aBM25 + FAISS \u6253\u9020\u5de5\u4e1a\u7ea7 RAG \u68c0\u7d22\u7cfb\u7edf\u300b"}]},{"@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\/94620","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=94620"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/94620\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=94620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=94620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=94620"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=94620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}