[{"data":1,"prerenderedAt":868},["ShallowReactive",2],{"navigation_docs":3,"-ai-rag-bm25-deep-dive-from-tf-idf-to-rag":352,"-ai-rag-bm25-deep-dive-from-tf-idf-to-rag-surround":863},[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":18,"body":354,"description":848,"extension":849,"links":850,"meta":851,"navigation":860,"path":19,"seo":861,"stem":20,"__hash__":862},"docs/ai/RAG/bm25-deep-dive-from-tf-idf-to-rag.md",{"type":355,"value":356,"toc":830},"minimark",[357,362,370,373,383,386,398,401,404,408,411,414,426,433,435,439,442,453,456,458,462,467,478,481,487,490,498,501,505,508,514,517,534,537,545,549,552,566,569,573,576,590,593,605,607,611,614,620,623,631,634,642,648,651,653,657,660,663,677,680,691,694,702,705,710,713,715,719,786,789,794,796,799,802,816,819,821,824,827],[358,359,361],"h2",{"id":360},"為什麼需要-bm25","為什麼需要 BM25？",[363,364,365,366],"p",{},"在資訊檢索（Information Retrieval）的世界中，一個最核心的問題是：",[367,368,369],"strong",{},"如何判斷一篇文件是否與使用者的查詢相關？",[363,371,372],{},"最直覺的做法，是計算關鍵字出現的次數，也就是所謂的 TF（Term Frequency）。然而，很快你會發現，單純依靠 TF 並不足夠，因為：",[374,375,376,380],"ul",{},[377,378,379],"li",{},"常見詞（例如「的」、「是」）幾乎出現在所有文件中",[377,381,382],{},"文件越長，關鍵字出現的機率自然越高",[363,384,385],{},"因此，後來出現了 TF-IDF，用來降低常見詞的重要性。但即使如此，TF-IDF 仍然有幾個限制：",[387,388,389,392,395],"ol",{},[377,390,391],{},"沒有考慮「詞頻的飽和效應」（出現 10 次不一定比 5 次重要兩倍）",[377,393,394],{},"沒有良好處理文件長度差異",[377,396,397],{},"權重計算偏向線性，不夠貼近真實語意相關性",[363,399,400],{},"這些問題，正是 BM25 被提出的背景。",[402,403],"hr",{},[358,405,407],{"id":406},"bm25-是什麼","BM25 是什麼？",[363,409,410],{},"BM25（Best Matching 25）是一種基於機率模型（Probabilistic Retrieval Model）的排序演算法，被廣泛應用於搜尋引擎（如 Elasticsearch、Lucene）中。",[363,412,413],{},"它可以被視為 TF-IDF 的進化版本，但做了兩個關鍵改進：",[374,415,416,421],{},[377,417,418],{},[367,419,420],{},"引入詞頻飽和（TF Saturation）",[377,422,423],{},[367,424,425],{},"加入文件長度正規化（Length Normalization）",[363,427,428,429,432],{},"BM25 的核心目標是：",[367,430,431],{},"更準確地衡量「文件與查詢之間的相關性」","。",[402,434],{},[358,436,438],{"id":437},"bm25-的核心公式","BM25 的核心公式",[363,440,441],{},"BM25 的基本公式如下：",[443,444,450],"pre",{"className":445,"code":447,"language":448,"meta":449},[446],"language-text","score(D, Q) = Σ IDF(qi) * ((f(qi, D) * (k1 + 1)) / (f(qi, D) + k1 * (1 - b + b * |D| / avgdl)))\n","text","",[451,452,447],"code",{"__ignoreMap":449},[363,454,455],{},"讓我們拆解這個公式中每個元素的意義。",[402,457],{},[358,459,461],{"id":460},"每個參數在做什麼","每個參數在做什麼？",[463,464,466],"h3",{"id":465},"_1-fqi-d詞頻term-frequency","1. f(qi, D)：詞頻（Term Frequency）",[363,468,469,470,473,474,477],{},"代表查詢詞 ",[451,471,472],{},"qi"," 在文件 ",[451,475,476],{},"D"," 中出現的次數。",[363,479,480],{},"但與 TF-IDF 不同的是，BM25 不直接使用這個值，而是透過下面的公式做轉換：",[443,482,485],{"className":483,"code":484,"language":448,"meta":449},[446],"(f * (k1 + 1)) / (f + k1)\n",[451,486,484],{"__ignoreMap":449},[363,488,489],{},"這代表一種「飽和效果」：",[374,491,492,495],{},[377,493,494],{},"當 f 很小時，增加 f 會明顯提升分數",[377,496,497],{},"當 f 很大時，分數提升趨緩",[363,499,500],{},"這更符合真實情況：一個詞出現 3 次和 10 次，差異沒有那麼大。",[463,502,504],{"id":503},"_2-idfqi逆文件頻率","2. IDF(qi)：逆文件頻率",[363,506,507],{},"BM25 使用的 IDF 公式通常為：",[443,509,512],{"className":510,"code":511,"language":448,"meta":449},[446],"IDF(qi) = log((N - ni + 0.5) / (ni + 0.5))\n",[451,513,511],{"__ignoreMap":449},[363,515,516],{},"其中：",[374,518,519,525],{},[377,520,521,524],{},[451,522,523],{},"N","：總文件數",[377,526,527,530,531,533],{},[451,528,529],{},"ni","：包含詞 ",[451,532,472],{}," 的文件數",[363,535,536],{},"這個設計可以避免：",[374,538,539,542],{},[377,540,541],{},"詞出現在所有文件時（ni ≈ N）導致權重趨近於 0",[377,543,544],{},"極端值帶來的不穩定性",[463,546,548],{"id":547},"_3-d-avgdl文件長度正規化","3. |D| / avgdl：文件長度正規化",[363,550,551],{},"這一項是 BM25 非常重要的設計。",[374,553,554,560],{},[377,555,556,559],{},[451,557,558],{},"|D|","：文件長度",[377,561,562,565],{},[451,563,564],{},"avgdl","：所有文件的平均長度",[363,567,568],{},"如果一篇文件很長，BM25 會適度「懲罰」它，避免因為篇幅長而自然包含更多關鍵字。",[463,570,572],{"id":571},"_4-k1-與-b調整參數","4. k1 與 b：調整參數",[363,574,575],{},"BM25 有兩個重要超參數：",[374,577,578,584],{},[377,579,580,583],{},[451,581,582],{},"k1","（通常在 1.2 ~ 2.0）：控制 TF 的影響程度",[377,585,586,589],{},[451,587,588],{},"b","（通常為 0.75）：控制文件長度正規化的強度",[363,591,592],{},"簡單理解：",[374,594,595,600],{},[377,596,597,599],{},[451,598,582],{}," 越大 → 詞頻影響越大",[377,601,602,604],{},[451,603,588],{}," 越大 → 文件長度影響越明顯",[402,606],{},[358,608,610],{"id":609},"用一個例子直覺理解-bm25","用一個例子直覺理解 BM25",[363,612,613],{},"假設使用者搜尋：",[443,615,618],{"className":616,"code":617,"language":448,"meta":449},[446],"machine learning\n",[451,619,617],{"__ignoreMap":449},[363,621,622],{},"現在有兩篇文件：",[374,624,625,628],{},[377,626,627],{},"文件 A：短文章，出現 2 次",[377,629,630],{},"文件 B：長文章，出現 5 次",[363,632,633],{},"TF-IDF 可能會偏向文件 B，但 BM25 會考慮：",[374,635,636,639],{},[377,637,638],{},"文件 B 是否只是因為「很長」才出現較多次？",[377,640,641],{},"詞頻是否已經達到飽和？",[363,643,644,645,432],{},"最終結果可能是：",[367,646,647],{},"文件 A 的排名反而更高",[363,649,650],{},"這就是 BM25 比 TF-IDF 更貼近人類直覺的地方。",[402,652],{},[358,654,656],{"id":655},"bm25-在-rag-系統中的角色","BM25 在 RAG 系統中的角色",[363,658,659],{},"在現代的 RAG（Retrieval-Augmented Generation）系統中，BM25 通常扮演「第一階段檢索器」的角色。",[363,661,662],{},"典型流程如下：",[387,664,665,668,671,674],{},[377,666,667],{},"使用 BM25 從文件庫中找出 Top-K 相關文件",[377,669,670],{},"使用 embedding（向量檢索）補充語意搜尋",[377,672,673],{},"使用 reranker（例如 cross-encoder）重新排序",[377,675,676],{},"將結果交給 LLM 生成答案",[363,678,679],{},"BM25 的優勢在於：",[374,681,682,685,688],{},[377,683,684],{},"計算速度快（適合大規模資料）",[377,686,687],{},"不需要訓練資料",[377,689,690],{},"對關鍵字精準匹配效果很好",[363,692,693],{},"但它也有缺點：",[374,695,696,699],{},[377,697,698],{},"無法理解語意（例如同義詞）",[377,700,701],{},"對 query wording 很敏感",[363,703,704],{},"因此，現代系統通常會採用：",[363,706,707],{},[367,708,709],{},"BM25 + Dense Retrieval（混合檢索）",[363,711,712],{},"來兼顧精準匹配與語意理解。",[402,714],{},[358,716,718],{"id":717},"與-tf-idf-的比較","與 TF-IDF 的比較",[720,721,722,738],"table",{},[723,724,725],"thead",{},[726,727,728,732,735],"tr",{},[729,730,731],"th",{},"特性",[729,733,734],{},"TF-IDF",[729,736,737],{},"BM25",[739,740,741,753,764,775],"tbody",{},[726,742,743,747,750],{},[744,745,746],"td",{},"詞頻處理",[744,748,749],{},"線性",[744,751,752],{},"飽和函數",[726,754,755,758,761],{},[744,756,757],{},"文件長度",[744,759,760],{},"簡單正規化",[744,762,763],{},"更精細控制",[726,765,766,769,772],{},[744,767,768],{},"參數調整",[744,770,771],{},"無",[744,773,774],{},"有 k1, b",[726,776,777,780,783],{},[744,778,779],{},"表現",[744,781,782],{},"基本可用",[744,784,785],{},"更佳",[363,787,788],{},"可以簡單記住一句話：",[363,790,791],{},[367,792,793],{},"BM25 = 更聰明的 TF-IDF",[402,795],{},[358,797,798],{"id":798},"實務應用場景",[363,800,801],{},"BM25 被廣泛應用在：",[374,803,804,807,810,813],{},[377,805,806],{},"搜尋引擎（Elasticsearch、OpenSearch）",[377,808,809],{},"文件搜尋系統",[377,811,812],{},"FAQ 檢索",[377,814,815],{},"RAG 系統中的第一階段 retrieval",[363,817,818],{},"如果你正在開發 AI 應用（例如知識庫問答系統），BM25 幾乎是必備工具之一。",[402,820],{},[358,822,823],{"id":823},"總結",[363,825,826],{},"BM25 是資訊檢索領域中非常經典且實用的演算法，它透過詞頻飽和與文件長度正規化，大幅改善了 TF-IDF 的缺點，使搜尋結果更符合人類直覺。",[363,828,829],{},"在現代 AI 系統中，BM25 不但沒有被取代，反而與向量搜尋結合，成為 Hybrid Search 的核心組件。理解 BM25，不只是理解一個公式，而是理解「搜尋引擎如何判斷相關性」這件事的本質。",{"title":449,"searchDepth":831,"depth":831,"links":832},2,[833,834,835,836,843,844,845,846,847],{"id":360,"depth":831,"text":361},{"id":406,"depth":831,"text":407},{"id":437,"depth":831,"text":438},{"id":460,"depth":831,"text":461,"children":837},[838,840,841,842],{"id":465,"depth":839,"text":466},3,{"id":503,"depth":839,"text":504},{"id":547,"depth":839,"text":548},{"id":571,"depth":839,"text":572},{"id":609,"depth":831,"text":610},{"id":655,"depth":831,"text":656},{"id":717,"depth":831,"text":718},{"id":798,"depth":831,"text":798},{"id":823,"depth":831,"text":823},"本文帶你理解 BM25 的原理、公式推導與實務應用，並說明它在搜尋與 RAG 系統中的關鍵角色。","md",null,{"tags":852,"category":858,"date":859},[853,854,855,856,857],"bm25","information_retrieval","rag","search_engine","nlp","RAG","2026-03-17",true,{"title":18,"description":848},"641YX0eQyMgN_zTdAHkjs-NwXsWZ5It8sd2xS1oMaBo",[864,866],{"title":10,"path":6,"stem":11,"description":865,"children":-1},"探索人工智慧的最前沿技術，包括大型語言模型、模型上下文協議 (MCP) 等。",{"title":22,"path":23,"stem":24,"description":867,"children":-1},"從原理到實務應用，完整理解 Dense Retrieval 在現代搜尋與 RAG 系統中的角色與運作方式。",1776690839959]