跳到主要内容

Naive RAG

Naive RAG, as the name suggests, is a naive way to implement RAG. Being a naive implementation, it means naive RAG:

  • It's very easy to implement.
  • It has only limited usage scenarios.

Even though Naive RAG is a simple solution, it still has its valid scenarios. If you want to build an RAG application, Naive RAG can get you started quickly. Naive RAG may be good enough for your scenario.

Naive RAG implementation has two parts.

  • The first part is to put reference materials into a vector store.
  • The second part is to search reference materials based on a user query. Selected reference materials will be included in the prompt sent to an LLM.

Collect Materials

The goal of RAG is to provide context information to an LLM. These context information come from collected materials. Materials may come from various sources. These materials are extracted into documents, then transformed, and finally loaded into vector stores.

Augment Generation

With context information collected, the generation from LLM can be augmented by using these context information.

When receiving a user input, the user input is used to find similar documents in the vector store first. This is done by using vector similarity. The user input and found similar documents are combined together to create the prompt sent to an LLM.