Optimizing the RAG function #3455

Closed
opened 2025-11-11 15:32:04 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @Schwenn2002 on GitHub (Jan 27, 2025).

A suggestion for optimizing the RAG function.

Currently, you can improve the quality of the query using Top k and ReRanking.

It would be optimal to filter out the most important documents using Top k=50 and ReRanking (0.8). Then another parameter would be optimal if, after the reranking, maximum the best (Top Best=20) hits were passed on to the LLM as context.

This way, the context length can be kept shorter and the response time improved. This also ensures that the context cannot become larger than configured in the LLM.

The current behavior of the LLM is that a context that is too large cannot be processed (i.e. it is interpreted as empty). It would therefore make sense to truncate the context from the RAG query after reranking to the context length of the LLM, so that only the best hits are passed on

Originally created by @Schwenn2002 on GitHub (Jan 27, 2025). A suggestion for optimizing the RAG function. Currently, you can improve the quality of the query using Top k and ReRanking. It would be optimal to filter out the most important documents using Top k=50 and ReRanking (0.8). Then another parameter would be optimal if, after the reranking, maximum the best (Top Best=20) hits were passed on to the LLM as context. This way, the context length can be kept shorter and the response time improved. This also ensures that the context cannot become larger than configured in the LLM. The current behavior of the LLM is that a context that is too large cannot be processed (i.e. it is interpreted as empty). It would therefore make sense to truncate the context from the RAG query after reranking to the context length of the LLM, so that only the best hits are passed on
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3455