HNSW
AdvancedAdvanced

HNSW

Keywords

HNSWapproximate nearest neighborANNnavigable small worldskip listgreedy routingMefConstructionefSearchrecallhigh-dimensional vectorbeam searchAsk ChatGPT

Prerequisites

None — this is a starting concept.

Progress

Sign in to track your progress.

HNSW 是目前最廣泛使用的 approximate nearest neighbor(ANN)索引之一。它建構一個多層的 proximity graph,每個節點以指數遞減的機率被分配到更高層,上層節點少、邊跨距大,負責快速定位;下層節點多、邊跨距小,負責精確的 local search。查詢時從最上層的 entry point 開始 greedy search,逐層下降並在底層以 beam search 展開搜尋。 (HNSW 在 RAG: Retrieval-Augmented Generation 也會介紹。

貢獻 HackMD 共筆 大抄

Key Concepts

我理解 HNSW 的查詢過程:在上層以 greedy search(ef=1)快速定位到目標區域,在底層以 beam search(beam width = efSearch)展開搜尋以收集足夠的候選點,最終回傳最近的 k 個結果

Recommended Resources

Test Your Understanding