S06_Indexing - trankhoidang/RAG-wiki GitHub Wiki

Indexing

✏️ Page Contributors: Khoi Tran Dang

🕛 Creation date: 26/06/2024

📥 Last Update: 26/06/2024

Definition

In RAG, we aim to search over the external knowledge base to find the most relevant information. When the external knowledge base is very large, searching becomes challenging and requires preparation to optimize the results.

This is where indexing comes into play. Indexing organizes the data into a structure that facilitates efficient searching, thereby enhancing both accuracy and speed.

An index supplies:

  • the structure for efficient navigation
  • the mechanisms to carry out different operations such as create, read, update, delete

One very common type of index is the vector store index. In principle, vector embeddings of text chunks are indexed and stored in the vector store. This index is then used to perform similarity searches over the embeddings of all chunks, ensuring sufficiently fast retrieval even for large datasets.

There are other types of indexes which might be more suitable, depending on the use case. For more information, please refer to Further read. Among different indexes, some do not use embedding models while some might require extra calls to LLM. This brings considerations regarding cost, quality, speed and privacy trade-off.

Vector store versus Vector Database

Diving into RAG, we encounter two terms with subtle differences: vector store and vector database. A vector store focuses on efficient storage for retrieval for downstream tasks. In contrast, a vector database is optimized for scalability and supports multiple complex operations.

Further read

← Previous: S05_Embedding

Next: S07_Storing →

⚠️ **GitHub.com Fallback** ⚠️