langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
53.31k stars 7.79k forks source link

The Rerank model in RAG needs to support independent score_threshold and top_k #11068

Closed hustyichi closed 1 day ago

hustyichi commented 5 days ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Currently, the retrieval model and the re-ranking stage share the score_threshold and top_k parameters, which currently have the following problems:

  1. The retrieval model and the re-ranking model have different score distributions and need to use different thresholds, which cannot be supported under the current solution;
  2. In order to ensure the integrity of the information, as much text as possible is generally recalled during the retrieval stage, and compressed to a relatively small number after the re-ranking is completed to match the input context of the large model. Currently, when top_k is shared, if top_k is set too small, the retrieval stage cannot recall enough content, affecting the recall rate, or if top_k is set too large, it exceeds the context of the large model;

2. Additional context or comments

No response

3. Can you help us with this feature?

nadirvishun commented 5 days ago

A lot of people have been giving feedback for a long time, like: #7187, and the officials are aware of it, but are slow to change it.