[{"data":1,"prerenderedAt":1000},["ShallowReactive",2],{"navigation_docs":3,"-ai-rag-rrf-reciprocal-rank-fusion-guide":352,"-ai-rag-rrf-reciprocal-rank-fusion-guide-surround":995},[4,54,83,116,125,161,179,200],{"title":5,"path":6,"stem":7,"children":8},"Ai","/ai","ai",[9,12,42,46,50],{"title":10,"path":6,"stem":11},"AI 技術探索","ai/index",{"title":13,"path":14,"stem":15,"children":16,"page":41},"Rag","/ai/rag","ai/RAG",[17,21,25,29,33,37],{"title":18,"path":19,"stem":20},"BM25 演算法深入解析：從 TF-IDF 到現代搜尋引擎的核心技術","/ai/rag/bm25-deep-dive-from-tf-idf-to-rag","ai/RAG/bm25-deep-dive-from-tf-idf-to-rag",{"title":22,"path":23,"stem":24},"Dense Retrieval（向量檢索）深入解析","/ai/rag/dense-retrieval-deep-dive","ai/RAG/dense-retrieval-deep-dive",{"title":26,"path":27,"stem":28},"RAG（Retrieval-Augmented Generation）原理與實作入門","/ai/rag/rag-intro-principles-and-implementation","ai/RAG/rag-intro-principles-and-implementation",{"title":30,"path":31,"stem":32},"RAG Retrieval Strategy 深入解析","/ai/rag/rag-retrieval-strategy-deep-dive","ai/RAG/rag-retrieval-strategy-deep-dive",{"title":34,"path":35,"stem":36},"Reciprocal Rank Fusion（RRF）教學：打造更穩定的檢索融合策略","/ai/rag/rrf-reciprocal-rank-fusion-guide","ai/RAG/rrf-reciprocal-rank-fusion-guide",{"title":38,"path":39,"stem":40},"TF-IDF（Term Frequency–Inverse Document Frequency）深入解析","/ai/rag/tf-idf-deep-dive","ai/RAG/tf-idf-deep-dive",false,{"title":43,"path":44,"stem":45},"Docus AI 功能完整實作指南","/ai/docus-ai-implementation","ai/docus-ai-implementation",{"title":47,"path":48,"stem":49},"llms.txt 是什麼？在 Nuxt 中控制 AI 與搜尋引擎爬蟲的新方式","/ai/llms-txt","ai/llms-txt",{"title":51,"path":52,"stem":53},"MCP（Model Context Protocol）是什麼？用「AI 的 USB-C」理解模型如何安全連接工具與資料","/ai/mcp_concept","ai/mcp_concept",{"title":55,"path":56,"stem":57,"children":58,"page":41},"Data Analysis","/data-analysis","data-analysis",[59,63,67,71,75,79],{"title":60,"path":61,"stem":62},"Exploratory Data Analysis（EDA）資料探索分析入門","/data-analysis/exploratory-data-analysis-eda","data-analysis/exploratory-data-analysis-eda",{"title":64,"path":65,"stem":66},"PR-AUC 深入解析：不平衡分類問題的重要評估指標","/data-analysis/pr-auc-for-imbalanced-classification","data-analysis/pr-auc-for-imbalanced-classification",{"title":68,"path":69,"stem":70},"ROC-AUC 深入解析：理解分類模型的判斷能力","/data-analysis/roc-auc-complete-guide","data-analysis/roc-auc-complete-guide",{"title":72,"path":73,"stem":74},"SHAP（SHapley Additive exPlanations）模型解釋方法深入解析","/data-analysis/shap-model-interpretation-complete-guide","data-analysis/shap-model-interpretation-complete-guide",{"title":76,"path":77,"stem":78},"Social Network Analysis（SNA）深入解析","/data-analysis/social-network-analysis-sna","data-analysis/social-network-analysis-sna",{"title":80,"path":81,"stem":82},"Time-based Split：為什麼時間序列資料不能使用 Random Split？","/data-analysis/time-based-split-vs-random-split","data-analysis/time-based-split-vs-random-split",{"title":84,"path":85,"stem":86,"children":87,"page":41},"MachineLearning","/machine_learning","machine_learning",[88,92,96,100,104,108,112],{"title":89,"path":90,"stem":91},"Confusion Matrix（混淆矩陣）完整解析","/machine_learning/confusion-matrix","machine_learning/confusion-matrix",{"title":93,"path":94,"stem":95},"Decision Tree 模型完整教學：從原理到 Python 實作","/machine_learning/decision-tree-complete-guide","machine_learning/decision-tree-complete-guide",{"title":97,"path":98,"stem":99},"為什麼 Decision Tree 在 Tabular Data 上常常勝過 Deep Learning？","/machine_learning/decision-tree-vs-deep-learning-on-tabular-data","machine_learning/decision-tree-vs-deep-learning-on-tabular-data",{"title":101,"path":102,"stem":103},"LightGBM 模型入門：理解高效能的 Gradient Boosting 演算法","/machine_learning/lightgbm-intro-for-tabular-data","machine_learning/lightgbm-intro-for-tabular-data",{"title":105,"path":106,"stem":107},"Logistic Regression（Logit 回歸）完整教學","/machine_learning/logistic-regression-complete-guide","machine_learning/logistic-regression-complete-guide",{"title":109,"path":110,"stem":111},"為什麼模型訓練需要 Train / Validation / Test Dataset？","/machine_learning/train-validation-test-dataset","machine_learning/train-validation-test-dataset",{"title":113,"path":114,"stem":115},"XGBoost 原理與實務教學","/machine_learning/xgboost-complete-guide","machine_learning/xgboost-complete-guide",{"title":117,"path":118,"stem":119,"children":120,"page":41},"Network","/network","network",[121],{"title":122,"path":123,"stem":124},"DNS 設定入門：CNAME vs A Record 完整解析","/network/dns-cname-vs-a-record-guide","network/dns-cname-vs-a-record-guide",{"title":126,"path":127,"stem":128,"children":129},"Nuxt","/nuxt","nuxt",[130,133,137,141,145,149,153,157],{"title":131,"path":127,"stem":132},"Nuxt 實戰指南","nuxt/index",{"title":134,"path":135,"stem":136},"Abstraction Layer 與 Adapter 的差別，一次搞懂設計角色","/nuxt/adapter_abstraction_layer","nuxt/adapter_abstraction_layer",{"title":138,"path":139,"stem":140},"Nuxt 4 全面理解 — 專案檔案結構解析","/nuxt/directory_structure","nuxt/directory_structure",{"title":142,"path":143,"stem":144},"Nuxt 前端 build 流程完整解析","/nuxt/frontend_build","nuxt/frontend_build",{"title":146,"path":147,"stem":148},"Nitro 是什麼？從 Nuxt 專案到 Server 與 Edge 的關鍵引擎","/nuxt/nitro","nuxt/nitro",{"title":150,"path":151,"stem":152},"深入理解 Nuxt 的 .nuxt 與 .output：為什麼部署時一定要分清楚？","/nuxt/nuxt_and_output","nuxt/nuxt_and_output",{"title":154,"path":155,"stem":156},"Nuxt 中 dev、build、preview 的差異一次搞懂","/nuxt/nuxt_dev_build_preview","nuxt/nuxt_dev_build_preview",{"title":158,"path":159,"stem":160},"Nuxt Image vs \u003Cimg>：為什麼 Nuxt 3 專案幾乎都該用 \u003CNuxtImg>？","/nuxt/nuxt_image","nuxt/nuxt_image",{"title":162,"path":163,"stem":164,"children":165},"Python 程式開發","/python","python/index",[166,167,171,175],{"title":162,"path":163,"stem":164},{"title":168,"path":169,"stem":170},"如何在 FastAPI 中調用記憶體 Buffer 回傳圖片 (附實例)","/python/memory_buffer","python/memory_buffer",{"title":172,"path":173,"stem":174},"Python 單元測試教學：如何為你的程式撰寫 Test","/python/python-unit-testing-unittest-pytest","python/python-unit-testing-unittest-pytest",{"title":176,"path":177,"stem":178},"如何使用 uv 取代 pip：改善 Python 專案的開發流程","/python/uv","python/uv",{"title":180,"path":181,"stem":182,"children":183,"page":41},"Statistic","/statistic","statistic",[184,188,192,196],{"title":185,"path":186,"stem":187},"卡方檢定（Chi-Square Test）入門教學","/statistic/chi-square-test-intro","statistic/chi-square-test-intro",{"title":189,"path":190,"stem":191},"常見抽樣方法（Sampling Methods）教學：Stratified、Quota、Convenience、Systematic、Simple Random","/statistic/common-sampling-methods-guide","statistic/common-sampling-methods-guide",{"title":193,"path":194,"stem":195},"Cramér’s V 指標介紹：如何衡量兩個類別變數之間的關聯","/statistic/cramers-v-for-categorical-association","statistic/cramers-v-for-categorical-association",{"title":197,"path":198,"stem":199},"Mann–Whitney U 與 Kolmogorov–Smirnov（KS）檢定：非參數統計檢定的入門指南","/statistic/mann-whitney-u-and-ks-test-intro","statistic/mann-whitney-u-and-ks-test-intro",{"title":201,"path":202,"stem":203,"children":204},"WebDev","/web_dev","web_dev",[205,208,234,248,282,312,334],{"title":206,"path":202,"stem":207},"Web 前端開發","web_dev/index",{"title":209,"path":210,"stem":211,"children":212},"瀏覽器與渲染","/web_dev/browser","web_dev/browser/index",[213,214,218,222,226,230],{"title":209,"path":210,"stem":211},{"title":215,"path":216,"stem":217},"瀏覽器儲存空間完整解析：Cookie、localStorage、IndexedDB 到 Cache Storage","/web_dev/browser/browser-storage-comprehensive-guide","web_dev/browser/browser-storage-comprehensive-guide",{"title":219,"path":220,"stem":221},"DOM (Document Object Model) 深入解析","/web_dev/browser/dom","web_dev/browser/dom",{"title":223,"path":224,"stem":225},"Service Worker Request Flow 深入解析","/web_dev/browser/service-worker-request-flow","web_dev/browser/service-worker-request-flow",{"title":227,"path":228,"stem":229},"CSR、SSR 與 SSG 是什麼？前端渲染策略完整比較","/web_dev/browser/ssr_csr_ssg","web_dev/browser/ssr_csr_ssg",{"title":231,"path":232,"stem":233},"Virtual DOM 深入解析：為什麼它能優化前端效能？","/web_dev/browser/virtual_dom","web_dev/browser/virtual_dom",{"title":235,"path":236,"stem":237,"children":238},"圖形技術","/web_dev/graphics","web_dev/graphics/index",[239,240,244],{"title":235,"path":236,"stem":237},{"title":241,"path":242,"stem":243},"為什麼 Three.js 專案幾乎都選擇 CSR？從 SSR 問題談起","/web_dev/graphics/threejs_csr","web_dev/graphics/threejs_csr",{"title":245,"path":246,"stem":247},"WebGL 是什麼？為什麼前端 3D 幾乎都靠它？","/web_dev/graphics/webgl","web_dev/graphics/webGL",{"title":249,"path":250,"stem":251,"children":252},"架構與配置","/web_dev/infrastructure","web_dev/infrastructure/index",[253,254,258,262,266,270,274,278],{"title":249,"path":250,"stem":251},{"title":255,"path":256,"stem":257},"Zeabur + K3s + Nuxt 部署架構完整解析","/web_dev/infrastructure/k3s-zeabur","web_dev/infrastructure/K3s-zeabur",{"title":259,"path":260,"stem":261},"ECS vs Docker vs Kubernetes：從部署堆疊理解三層架構","/web_dev/infrastructure/ecs-docker-kubernetes-stack","web_dev/infrastructure/ecs-docker-kubernetes-stack",{"title":263,"path":264,"stem":265},"ECS vs VPS 是什麼？從部署網站的角度一次搞懂差別","/web_dev/infrastructure/ecs-vs-vps","web_dev/infrastructure/ecs-vs-vps",{"title":267,"path":268,"stem":269},"Zeabur 內網服務連線完整入門指南","/web_dev/infrastructure/k3s-internal-networking","web_dev/infrastructure/k3s-internal-networking",{"title":271,"path":272,"stem":273},"使用 Microservices 架構設計系統的優勢解析","/web_dev/infrastructure/microservices-architecture-advantages","web_dev/infrastructure/microservices-architecture-advantages",{"title":275,"path":276,"stem":277},"Nginx 入門教學：從反向代理到與 Kubernetes 的架構比較","/web_dev/infrastructure/nginx-intro","web_dev/infrastructure/nginx-intro",{"title":279,"path":280,"stem":281},"YAML 配置是什麼？為什麼現代開發都在用它","/web_dev/infrastructure/yaml-configuration","web_dev/infrastructure/yaml-configuration",{"title":283,"path":284,"stem":285,"children":286},"網絡與通訊","/web_dev/network","web_dev/network/index",[287,288,292,296,300,304,308],{"title":283,"path":284,"stem":285},{"title":289,"path":290,"stem":291},"HTTP Request 結構完整解析：從 Request Line 到 Header 一次看懂","/web_dev/network/http-request-structure","web_dev/network/http-request-structure",{"title":293,"path":294,"stem":295},"OSI 模型（Open Systems Interconnection Model）完整解析","/web_dev/network/osi-model","web_dev/network/osi-model",{"title":297,"path":298,"stem":299},"RESTful API 設計原則與實務解析","/web_dev/network/restful-api","web_dev/network/restful-api",{"title":301,"path":302,"stem":303},"RESTful API 五大設計原則深入解析","/web_dev/network/restful-api-principles","web_dev/network/restful-api-principles",{"title":305,"path":306,"stem":307},"Server-Sent Events (SSE) 深入解析與實作教學","/web_dev/network/sse-introduction","web_dev/network/sse-introduction",{"title":309,"path":310,"stem":311},"WebSocket 入門教學：從概念到 Node.js 實作","/web_dev/network/websocket-introduction","web_dev/network/websocket-introduction",{"title":313,"path":314,"stem":315,"children":316},"認證與安全","/web_dev/security","web_dev/security/index",[317,318,322,326,330],{"title":313,"path":314,"stem":315},{"title":319,"path":320,"stem":321},"使用 Cookie 與 Session 建立使用者驗證（完整新手教學）","/web_dev/security/cookie-session-authentication","web_dev/security/cookie-session-authentication",{"title":323,"path":324,"stem":325},"JWT 驗證機制完整解析：從登入流程到實務應用","/web_dev/security/jwt-authentication","web_dev/security/jwt-authentication",{"title":327,"path":328,"stem":329},"Secret Key 簽名是什麼？從零理解資料簽名的本質","/web_dev/security/secret-key-signing","web_dev/security/secret-key-signing",{"title":331,"path":332,"stem":333},"SSH（Secure Shell）是什麼？從遠端登入到安全通道的核心概念","/web_dev/security/ssh","web_dev/security/ssh",{"title":335,"path":336,"stem":337,"children":338},"SEO 與規範","/web_dev/seo","web_dev/seo/index",[339,340,344,348],{"title":335,"path":336,"stem":337},{"title":341,"path":342,"stem":343},"Canonical URL 是什麼？用生活化方式搞懂前端 SEO 的基本保命符","/web_dev/seo/canonical_link","web_dev/seo/canonical_link",{"title":345,"path":346,"stem":347},"robots.txt 是什麼？SEO 的第一道守門員","/web_dev/seo/robot_txt","web_dev/seo/robot_txt",{"title":349,"path":350,"stem":351},"Nuxt SEO 中的 Meta 與 SEO 工具是如何運作的？","/web_dev/seo/seo","web_dev/seo/seo",{"id":353,"title":34,"body":354,"description":980,"extension":981,"links":982,"meta":983,"navigation":992,"path":35,"seo":993,"stem":36,"__hash__":994},"docs/ai/RAG/rrf-reciprocal-rank-fusion-guide.md",{"type":355,"value":356,"toc":955},"minimark",[357,362,366,379,382,388,391,394,398,401,409,412,423,426,446,448,452,455,460,466,470,476,479,505,508,513,516,523,525,529,532,539,550,553,556,563,566,568,572,575,581,584,591,594,602,604,608,612,615,619,622,626,629,643,647,650,652,656,659,663,666,670,673,677,680,682,686,689,697,700,859,862,865,873,875,878,881,892,895,902,904,907,910,913,920,922,925,951],[358,359,361],"h2",{"id":360},"為什麼需要多檢索融合","為什麼需要「多檢索融合」？",[363,364,365],"p",{},"在現代搜尋系統或 RAG（Retrieval-Augmented Generation）架構中，我們很少只依賴單一檢索方法。常見的做法是同時使用：",[367,368,369,373,376],"ul",{},[370,371,372],"li",{},"Dense Retrieval（語意向量）",[370,374,375],{},"BM25（關鍵字匹配）",[370,377,378],{},"Hybrid Search（混合策略）",[363,380,381],{},"這是因為不同檢索方法各自擅長的場景不同。例如，BM25 對關鍵字非常敏感，而 Dense Retrieval 則更擅長理解語意。但問題也隨之出現：",[363,383,384],{},[385,386,387],"strong",{},"當多個檢索結果同時存在時，我們該如何公平且有效地合併它們？",[363,389,390],{},"這正是 Reciprocal Rank Fusion（RRF）要解決的核心問題。",[392,393],"hr",{},[358,395,397],{"id":396},"rrf-的核心概念","RRF 的核心概念",[363,399,400],{},"Reciprocal Rank Fusion 是一種非常簡單但效果強大的排名融合方法。它的核心想法是：",[402,403,404],"blockquote",{},[363,405,406],{},[385,407,408],{},"不要直接比較分數，而是根據排名位置來做融合。",[363,410,411],{},"RRF 的公式如下：",[413,414,420],"pre",{"className":415,"code":417,"language":418,"meta":419},[416],"language-text","RRF_score(d) = Σ (1 / (k + rank_i(d)))\n","text","",[421,422,417],"code",{"__ignoreMap":419},[363,424,425],{},"其中：",[367,427,428,434,440],{},[370,429,430,433],{},[421,431,432],{},"d","：文件（document）",[370,435,436,439],{},[421,437,438],{},"rank_i(d)","：文件在第 i 個檢索結果中的排名（從 1 開始）",[370,441,442,445],{},[421,443,444],{},"k","：一個平滑參數（通常設為 60）",[392,447],{},[358,449,451],{"id":450},"用一個直覺的例子理解-rrf","用一個直覺的例子理解 RRF",[363,453,454],{},"假設我們有兩個檢索系統：",[456,457,459],"h3",{"id":458},"bm25-排名","BM25 排名",[413,461,464],{"className":462,"code":463,"language":418,"meta":419},[416],"1. A\n2. B\n3. C\n",[421,465,463],{"__ignoreMap":419},[456,467,469],{"id":468},"dense-retrieval-排名","Dense Retrieval 排名",[413,471,474],{"className":472,"code":473,"language":418,"meta":419},[416],"1. B\n2. C\n3. D\n",[421,475,473],{"__ignoreMap":419},[363,477,478],{},"我們來計算每個文件的 RRF 分數（假設 k = 60）：",[367,480,481,487,493,499],{},[370,482,483,484],{},"A：",[421,485,486],{},"1 / (60 + 1)",[370,488,489,490],{},"B：",[421,491,492],{},"1 / (60 + 2) + 1 / (60 + 1)",[370,494,495,496],{},"C：",[421,497,498],{},"1 / (60 + 3) + 1 / (60 + 2)",[370,500,501,502],{},"D：",[421,503,504],{},"1 / (60 + 3)",[363,506,507],{},"可以發現：",[363,509,510],{},[385,511,512],{},"B 會得到最高分，因為它在兩個系統中都排名很前面。",[363,514,515],{},"這正是 RRF 的核心優勢：",[402,517,518],{},[363,519,520],{},[385,521,522],{},"重視穩定出現在前段排名的結果，而不是單一系統的極端高分。",[392,524],{},[358,526,528],{"id":527},"為什麼-rrf-不用原始分數","為什麼 RRF 不用原始分數？",[363,530,531],{},"你可能會直覺想到：「那我直接把分數加起來不就好了？」",[363,533,534,535,538],{},"問題在於，不同檢索系統的分數",[385,536,537],{},"完全不可比較","：",[367,540,541,544,547],{},[370,542,543],{},"BM25 分數可能是 0~20",[370,545,546],{},"Dense similarity 可能是 0~1",[370,548,549],{},"Cross-encoder 甚至是另一種尺度",[363,551,552],{},"如果直接相加，結果會被某個模型主導，導致融合失效。",[363,554,555],{},"RRF 則完全避開這個問題：",[402,557,558],{},[363,559,560],{},[385,561,562],{},"它只看排名，不看分數。",[363,564,565],{},"這讓它在 heterogeneous systems（異質模型）中非常穩定。",[392,567],{},[358,569,571],{"id":570},"rrf-在-rag-系統中的角色","RRF 在 RAG 系統中的角色",[363,573,574],{},"在實務的 RAG pipeline 中，RRF 通常會出現在這個位置：",[413,576,579],{"className":577,"code":578,"language":418,"meta":419},[416],"Query\n├── Dense Retrieval\n├── BM25 Retrieval\n    ↓\nRRF Fusion\n    ↓\nReranker（Cross Encoder / LLM）\n    ↓\nLLM Answer\n",[421,580,578],{"__ignoreMap":419},[363,582,583],{},"RRF 的角色可以理解為：",[402,585,586],{},[363,587,588],{},[385,589,590],{},"第一層候選集合整理器。",[363,592,593],{},"它的任務不是找出最終答案，而是：",[367,595,596,599],{},[370,597,598],{},"提供一個高 recall + 穩定的候選集合",[370,600,601],{},"讓後續 reranker 有更好的輸入",[392,603],{},[358,605,607],{"id":606},"rrf-的優點","RRF 的優點",[456,609,611],{"id":610},"_1-非常穩定","1. 非常穩定",[363,613,614],{},"RRF 對 outlier（異常分數）不敏感，因為它不看分數。",[456,616,618],{"id":617},"_2-實作簡單","2. 實作簡單",[363,620,621],{},"只需要排名，不需要 normalization。",[456,623,625],{"id":624},"_3-對多模型友善","3. 對多模型友善",[363,627,628],{},"可以輕鬆融合：",[367,630,631,634,637,640],{},[370,632,633],{},"BM25",[370,635,636],{},"Dense Retrieval",[370,638,639],{},"Metadata filter",[370,641,642],{},"多語言搜尋",[456,644,646],{"id":645},"_4-在學術與實務中效果良好","4. 在學術與實務中效果良好",[363,648,649],{},"RRF 在多個 IR benchmark（如 TREC）中表現穩定，是業界常見方法。",[392,651],{},[358,653,655],{"id":654},"rrf-的限制","RRF 的限制",[363,657,658],{},"雖然 RRF 很強，但也不是萬能的。",[456,660,662],{"id":661},"_1-忽略分數資訊","1. 忽略分數資訊",[363,664,665],{},"有時候分數其實包含重要資訊，但 RRF 會完全忽略。",[456,667,669],{"id":668},"_2-無法學習權重","2. 無法學習權重",[363,671,672],{},"RRF 是 heuristic 方法，無法自動學習不同模型的重要性。",[456,674,676],{"id":675},"_3-對排名品質有依賴","3. 對排名品質有依賴",[363,678,679],{},"如果某個 retrieval 完全亂排，仍然會影響結果。",[392,681],{},[358,683,685],{"id":684},"rrf-reranker最佳實務組合","RRF + Reranker：最佳實務組合",[363,687,688],{},"在現代系統中，RRF 通常不會單獨使用，而是搭配 reranker：",[367,690,691,694],{},[370,692,693],{},"RRF：負責召回（recall）",[370,695,696],{},"Reranker：負責精排（precision）",[363,698,699],{},"例如：",[413,701,705],{"className":702,"code":703,"language":704,"meta":419,"style":419},"language-python shiki shiki-themes github-dark","def rrf_fusion(rankings, k=60):\n    scores = {}\n    for ranking in rankings:\n        for rank, doc_id in enumerate(ranking, start=1):\n            scores[doc_id] = scores.get(doc_id, 0) + 1 / (k + rank)\n    return sorted(scores.items(), key=lambda x: x[1], reverse=True)\n","python",[421,706,707,734,745,760,788,822],{"__ignoreMap":419},[708,709,712,716,720,724,727,731],"span",{"class":710,"line":711},"line",1,[708,713,715],{"class":714},"snl16","def",[708,717,719],{"class":718},"svObZ"," rrf_fusion",[708,721,723],{"class":722},"s95oV","(rankings, k",[708,725,726],{"class":714},"=",[708,728,730],{"class":729},"sDLfK","60",[708,732,733],{"class":722},"):\n",[708,735,737,740,742],{"class":710,"line":736},2,[708,738,739],{"class":722},"    scores ",[708,741,726],{"class":714},[708,743,744],{"class":722}," {}\n",[708,746,748,751,754,757],{"class":710,"line":747},3,[708,749,750],{"class":714},"    for",[708,752,753],{"class":722}," ranking ",[708,755,756],{"class":714},"in",[708,758,759],{"class":722}," rankings:\n",[708,761,763,766,769,771,774,777,781,783,786],{"class":710,"line":762},4,[708,764,765],{"class":714},"        for",[708,767,768],{"class":722}," rank, doc_id ",[708,770,756],{"class":714},[708,772,773],{"class":729}," enumerate",[708,775,776],{"class":722},"(ranking, ",[708,778,780],{"class":779},"s9osk","start",[708,782,726],{"class":714},[708,784,785],{"class":729},"1",[708,787,733],{"class":722},[708,789,791,794,796,799,802,805,808,811,814,817,819],{"class":710,"line":790},5,[708,792,793],{"class":722},"            scores[doc_id] ",[708,795,726],{"class":714},[708,797,798],{"class":722}," scores.get(doc_id, ",[708,800,801],{"class":729},"0",[708,803,804],{"class":722},") ",[708,806,807],{"class":714},"+",[708,809,810],{"class":729}," 1",[708,812,813],{"class":714}," /",[708,815,816],{"class":722}," (k ",[708,818,807],{"class":714},[708,820,821],{"class":722}," rank)\n",[708,823,825,828,831,834,837,840,843,845,848,851,853,856],{"class":710,"line":824},6,[708,826,827],{"class":714},"    return",[708,829,830],{"class":729}," sorted",[708,832,833],{"class":722},"(scores.items(), ",[708,835,836],{"class":779},"key",[708,838,839],{"class":714},"=lambda",[708,841,842],{"class":722}," x: x[",[708,844,785],{"class":729},[708,846,847],{"class":722},"], ",[708,849,850],{"class":779},"reverse",[708,852,726],{"class":714},[708,854,855],{"class":729},"True",[708,857,858],{"class":722},")\n",[363,860,861],{},"接著再將 top-k 文件丟入 reranker（如 cross-encoder 或 LLM）。",[363,863,864],{},"這樣的設計可以同時兼顧：",[367,866,867,870],{},[370,868,869],{},"recall（找得到）",[370,871,872],{},"precision（排得準）",[392,874],{},[358,876,877],{"id":877},"一個更直覺的比喻",[363,879,880],{},"你可以把 RRF 想成投票系統：",[367,882,883,886,889],{},[370,884,885],{},"每個 retrieval model 是一位評審",[370,887,888],{},"排名越前面，投票權重越高",[370,890,891],{},"多位評審都推薦的文件，得票最高",[363,893,894],{},"因此：",[402,896,897],{},[363,898,899],{},[385,900,901],{},"RRF 找的是共識，而不是單一最佳。",[392,903],{},[358,905,906],{"id":906},"結論",[363,908,909],{},"Reciprocal Rank Fusion（RRF）是一種簡單但極其實用的排名融合方法。它透過排名而非分數來整合多個檢索結果，能有效提升系統的穩定性與泛化能力。",[363,911,912],{},"在 RAG 系統中，RRF 幾乎是標準配置之一，特別適合用來結合 BM25 與 Dense Retrieval。當它與 reranker 搭配使用時，可以形成一條兼具高召回與高精度的檢索流程。",[363,914,915,916,919],{},"如果你正在設計搜尋系統或 RAG pipeline，RRF 會是一個",[385,917,918],{},"低成本但高回報","的關鍵組件。",[392,921],{},[358,923,924],{"id":924},"參考資料",[926,927,928,936,942],"ol",{},[370,929,930,931,935],{},"Cormack, G. V., Clarke, C. L. A., & Buettcher, S. (2009). ",[932,933,934],"em",{},"Reciprocal Rank Fusion outperforms Condorcet and individual rank learning methods",".",[370,937,938,939,935],{},"Manning, C. D. et al. ",[932,940,941],{},"Introduction to Information Retrieval",[370,943,944,945],{},"BEIR Benchmark: ",[946,947,948],"a",{"href":948,"rel":949},"https://github.com/beir-cellar/beir",[950],"nofollow",[952,953,954],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":419,"searchDepth":736,"depth":736,"links":956},[957,958,959,963,964,965,971,976,977,978,979],{"id":360,"depth":736,"text":361},{"id":396,"depth":736,"text":397},{"id":450,"depth":736,"text":451,"children":960},[961,962],{"id":458,"depth":747,"text":459},{"id":468,"depth":747,"text":469},{"id":527,"depth":736,"text":528},{"id":570,"depth":736,"text":571},{"id":606,"depth":736,"text":607,"children":966},[967,968,969,970],{"id":610,"depth":747,"text":611},{"id":617,"depth":747,"text":618},{"id":624,"depth":747,"text":625},{"id":645,"depth":747,"text":646},{"id":654,"depth":736,"text":655,"children":972},[973,974,975],{"id":661,"depth":747,"text":662},{"id":668,"depth":747,"text":669},{"id":675,"depth":747,"text":676},{"id":684,"depth":736,"text":685},{"id":877,"depth":736,"text":877},{"id":906,"depth":736,"text":906},{"id":924,"depth":736,"text":924},"深入理解 RRF（Reciprocal Rank Fusion）如何結合多種檢索結果，提升搜尋與 RAG 系統的準確度與穩定性。","md",null,{"tags":984,"category":990,"date":991},[985,986,987,988,989],"RRF","information retrieval","rag","search","ranking","RAG","2026-03-17",true,{"title":34,"description":980},"-9ApKvGFm7zVOjzt8xlYGxhSiXzpwIl5Qx5Kq4dYFjU",[996,998],{"title":30,"path":31,"stem":32,"description":997,"children":-1},"從 BM25、Dense Retrieval 到 Hybrid 與 Reranker，完整理解 RAG 系統中的檢索策略與其對模型品質的影響。",{"title":38,"path":39,"stem":40,"description":999,"children":-1},"從直覺理解到實務應用，完整掌握 TF-IDF 在資訊檢索與自然語言處理中的核心概念與使用方式。",1776690844878]