Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAG Performance Improvements #96

Open
CamDuffy1 opened this issue Feb 20, 2024 · 0 comments
Open

RAG Performance Improvements #96

CamDuffy1 opened this issue Feb 20, 2024 · 0 comments

Comments

@CamDuffy1
Copy link

The RAG performance of this application can be improved by using more advanced techniques for retrieval and synthesis.

Currently, the app uses the SentenceSplitter node parser to parse text into chunks for each sentence. Then, it uses the same chunk for both context retrieval and response synthesis when querying the LLM. It is not optimal to use the same chunk size for retrieval and synthesis, as a smaller chunk size helps embedding-based retrieval to find more relevant context, while a larger chunk size helps the LLM to synthesize a better response.

Implementing a technique to use a smaller chunk size for retrieval and a larger chunk size for synthesis can help improve RAG performance. Two of these techniques include:

  1. Sentence-Window Retrieval
    • Text is parsed into sentence nodes that include metadata containing additional context of surrounding sentences.
    • Relevant sentences are retrieved, then replaced with the larger window of surrounding context before being used to synthesize a response.
  2. Auto-Merging Retrieval
    • Text is parsed into hierarchical nodes (i.e., parent, child).
    • Child nodes are smaller in size and used for retrieval.
    • If enough child nodes from the same parent node are retrieved, they are merged into their larger parent node which is then used for synthesis.
    • The parent nodes may contain additional child nodes not originally retrieved. This provides additional context to the LLM during synthesis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant