Retrieval Augmented Generation
Retrieval Algorithm Term based retrieval (Term based, Lexical retrieval) This vector representation based on TF-IDF. Most values are zero. Embedding-based retrieval (Dense vectores): This is semantic embedding learned. KNN LSH (Local Sensitive Hashing) HNSW (Hierarchical Navigable Small World) Product Quantization IVG (Inverted File Index) Annoy (Approximate Nearest Neighbors Oh Yeah) Metrics to evaluate RAG retrieval Context precision: Out of all the documents retrieved, what percentage is relevant to the query? Context recall: Out of all documents that are relevant to the query, what percentage is retrieved? Indexing: More the fine grained the indexing is more accurate the retrieval process will be. But there is trade off of memory consumption and query time. Indexing and query time of search algorithm is evaluated based on following metrics: ...