Retrieval-Augmented Generation
Keywords
RAGretrieval-augmented generationembeddingvector searchANNrecallIVFHNSWProduct QuantizationLEANNgraph pruningLLMchunkingAsk ChatGPT
Prerequisites
Related Papers
- LEANN: A Low-Storage Overhead Vector Index(arXiv 2025)
Progress
Sign in to track your progress.
LLM 容易在不會的問題上產生 hallucination,因此我們需要 Retrieval-Augmented Generation(RAG)讓 LLM 在生成答案前,先從外部知識庫檢索相關片段作為依據。RAG 的 retrieval pipeline 把文件切成 chunk、用 embedding model 轉成高維向量並建立索引;查詢時對使用者問題做相同的 embedding,透過 ANN 搜尋取回 top-k 相似 chunk,再拼成 prompt 餵給 LLM。
今天的課程,我會介紹三種加速結構:IVF、HNSW、Product Quantization,並比較 PQ 套在 IVF 與 HNSW 上效果與取捨的差異。最後我會介紹 LEANN 這篇論文,看它如何透過 graph pruning 與「動態算 embedding」的設計,把向量索引的儲存量壓到極致。
Pro Tip: 開啟 YouTube 中文字幕。
Key Concepts
我理解 RAG 的動機,透過外部檢索把相關片段帶入 prompt,能讓生成結果有依據且可隨資料更新
我理解 recall 的定義
我理解為什麼大規模向量檢索必須做 approximate nearest neighbor search,以及如何用 recall 指標量化「近似」帶來的品質損失
我理解 LEANN 的核心想法:透過 graph pruning 移除 graph edge,並在搜尋時對需要比對的節點動態計算 embedding
Recommended Resources
- (補充資料,optional) DiskANN Overview (Harsha Simhadri)
- (補充資料,optional) DiskANN Overview Talk Slides (Sep 2025)