[GH-ISSUE #12150] issue: Bug Report: Controlling Vector Results Count in RAG System #136209

Closed
opened 2026-05-25 03:53:33 -05:00 by GiteaMirror · 16 comments
Owner

Originally created by @chalitbkb on GitHub (Mar 28, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12150

Problem Description: The number of vector data references related to user inputs remains high even after reducing the "RAG_TOP_K" results to consider for embedding when using RAG, and decreasing the "RAG_TOP_K_RERANKER" results as specified in the documentation. This causes errors in certain models that support small context window sizes, such as OpenAI's services. However, when I switched to using Gemini 2.0 Pro, which supports larger context window sizes, the model successfully generated responses to user questions because Gemini 2.0 Pro can handle a context window size of up to 2 million tokens, thus avoiding this issue. For other models, this problem persists because the "vector" dataset returns an excessive number of aggregated results. Therefore, I attempted to reduce the number of aggregated results from the "vector DB" but was unsuccessful in enabling models that support small context windows to function properly.

Additionally, regarding the "RAG_TOP_K_RERANKER" setting, I do not see it in the UI as the documentation states that "This environment variable is a PersistentConfig variable." I only see the "RAG_TOP_K" and "RAG_RELEVANCE_THRESHOLD" sections. Therefore, I am unsure where the "RAG_TOP_K_RERANKER" setting can be found in the UI as described in the documentation as a "PersistentConfig." I tried setting the number of search results for "vector" by configuring "RAG_TOP_K_RERANKER" directly in the environment variables, but it still did not work.

Summary: Currently, I am experiencing an issue with an excessive number of vector data search results, ranging from 50-100 sets, each containing large content sizes due to my own specifications for Chunk Size and Chunk Overlap. This occurs even though the "RAG_TOP_K" and "RAG_RELEVANCE_THRESHOLD" settings have been configured with lower values.

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.5.20

Ollama Version (if applicable)

No response

Operating System

Windows 11

Browser (if applicable)

Chrome 134.0.6998.118

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

  • The system should limit the number of vector results according to the value set in RAG_TOP_K_RERANKER. When this value is set lower, the number of results sent to the LLM model should decrease accordingly.
  • Adjusting the RAG_TOP_K_RERANKER setting should be possible through the UI or environment variables as specified in the documentation. This value should directly control the amount of data aggregated from the vector database.
  • Models with small context windows (such as OpenAI's services) should be able to function properly when the number of vector results is reduced to fit within the model's limitations.

Actual Behavior

  • Despite reducing the RAG_TOP_K value and setting RAG_TOP_K_RERANKER to a low value, the system continues to send an excessive number of vector results (50-100 sets) to the LLM model.
  • The RAG_TOP_K_RERANKER option is not found in the UI as described in the documentation as a "PersistentConfig variable". Only RAG_TOP_K and RAG_RELEVANCE_THRESHOLD are visible.
  • Setting RAG_TOP_K_RERANKER directly through environment variables has no effect on reducing the number of vector results.
  • Models with small context windows (such as OpenAI's services) encounter errors as they cannot handle the excessive amount of data, while Gemini 2.0 Pro, which supports a large context window of up to 2 million tokens, can operate without issues.

Steps to Reproduce

  1. Set RAG_TOP_K to a low value (e.g., 3-5) through the UI.
  2. Set RAG_RELEVANCE_THRESHOLD to a high value (e.g., 0.7-0.8) to limit results.
  3. Attempt to set RAG_TOP_K_RERANKER through environment variables to a low value (e.g., 3-5).
  4. Test the system with queries related to data in the vector database.
  5. Check the number of vector results sent to the model, which will still be excessively high (50-100 sets).
  6. Test with models that have small context windows (such as OpenAI's services) and observe that errors occur.
  7. Test with models that have large context windows (such as Gemini 2.0 Pro) and observe that they function properly.

Logs & Screenshots

Try using a model that supports large context windows. The Gemini 2.0 Pro model is capable of processing.
It’s noticeable that the up and down sliders are small, indicating that there are numerous vector data components with many items. I examined the list and found that there are 50 to 100 entries. Even though I attempted to adjust the relevant sections for re-ranking, it still produces a large number of related results.
Image

When testing models with smaller context windows, like the o3-mini, the model couldn't process them because there were too many vector results.
Image

Image

Additional Information

The main issue is the inability to effectively control the number of aggregated vector results through the RAG_TOP_K_RERANKER setting as described in the documentation, which prevents proper use of models with context window limitations.

Originally created by @chalitbkb on GitHub (Mar 28, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12150 **Problem Description:** The number of vector data references related to user inputs remains high even after reducing the "RAG_TOP_K" results to consider for embedding when using RAG, and decreasing the "RAG_TOP_K_RERANKER" results as specified in the documentation. This causes errors in certain models that support small context window sizes, such as OpenAI's services. However, when I switched to using Gemini 2.0 Pro, which supports larger context window sizes, the model successfully generated responses to user questions because Gemini 2.0 Pro can handle a context window size of up to 2 million tokens, thus avoiding this issue. For other models, this problem persists because the "vector" dataset returns an excessive number of aggregated results. Therefore, I attempted to reduce the number of aggregated results from the "vector DB" but was unsuccessful in enabling models that support small context windows to function properly. Additionally, regarding the "RAG_TOP_K_RERANKER" setting, I do not see it in the UI as the documentation states that "This environment variable is a PersistentConfig variable." I only see the "RAG_TOP_K" and "RAG_RELEVANCE_THRESHOLD" sections. Therefore, I am unsure where the "RAG_TOP_K_RERANKER" setting can be found in the UI as described in the documentation as a "PersistentConfig." I tried setting the number of search results for "vector" by configuring "RAG_TOP_K_RERANKER" directly in the environment variables, but it still did not work. **Summary:** Currently, I am experiencing an issue with an excessive number of vector data search results, ranging from 50-100 sets, each containing large content sizes due to my own specifications for Chunk Size and Chunk Overlap. This occurs even though the "RAG_TOP_K" and "RAG_RELEVANCE_THRESHOLD" settings have been configured with lower values. ### Check Existing Issues - [x] I have searched the existing issues and discussions. - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.5.20 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### Browser (if applicable) Chrome 134.0.6998.118 ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have listed steps to reproduce the bug in detail. ### Expected Behavior * The system should limit the number of vector results according to the value set in `RAG_TOP_K_RERANKER`. When this value is set lower, the number of results sent to the LLM model should decrease accordingly. * Adjusting the `RAG_TOP_K_RERANKER` setting should be possible through the UI or environment variables as specified in the documentation. This value should directly control the amount of data aggregated from the vector database. * Models with small context windows (such as OpenAI's services) should be able to function properly when the number of vector results is reduced to fit within the model's limitations. ### Actual Behavior * Despite reducing the `RAG_TOP_K` value and setting `RAG_TOP_K_RERANKER` to a low value, the system continues to send an excessive number of vector results (50-100 sets) to the LLM model. * The `RAG_TOP_K_RERANKER` option is not found in the UI as described in the documentation as a "PersistentConfig variable". Only `RAG_TOP_K` and `RAG_RELEVANCE_THRESHOLD` are visible. * Setting `RAG_TOP_K_RERANKER` directly through environment variables has no effect on reducing the number of vector results. * Models with small context windows (such as OpenAI's services) encounter errors as they cannot handle the excessive amount of data, while Gemini 2.0 Pro, which supports a large context window of up to 2 million tokens, can operate without issues. ### Steps to Reproduce 1. Set `RAG_TOP_K` to a low value (e.g., 3-5) through the UI. 2. Set `RAG_RELEVANCE_THRESHOLD` to a high value (e.g., 0.7-0.8) to limit results. 3. Attempt to set `RAG_TOP_K_RERANKER` through environment variables to a low value (e.g., 3-5). 4. Test the system with queries related to data in the vector database. 5. Check the number of vector results sent to the model, which will still be excessively high (50-100 sets). 6. Test with models that have small context windows (such as OpenAI's services) and observe that errors occur. 7. Test with models that have large context windows (such as Gemini 2.0 Pro) and observe that they function properly. ### Logs & Screenshots Try using a model that supports large context windows. The Gemini 2.0 Pro model is capable of processing. It’s noticeable that the up and down sliders are small, indicating that there are numerous vector data components with many items. I examined the list and found that there are 50 to 100 entries. Even though I attempted to adjust the relevant sections for re-ranking, it still produces a large number of related results. ![Image](https://github.com/user-attachments/assets/e8847690-11ba-44bd-acf0-a878c1594f0d) When testing models with smaller context windows, like the o3-mini, the model couldn't process them because there were too many vector results. ![Image](https://github.com/user-attachments/assets/6d2041d8-19c8-4b3e-be19-35d035e929e2) ![Image](https://github.com/user-attachments/assets/585fad42-9867-4a60-8e56-afdb534cb659) ### Additional Information The main issue is the inability to effectively control the number of aggregated vector results through the `RAG_TOP_K_RERANKER` setting as described in the documentation, which prevents proper use of models with context window limitations.
GiteaMirror added the bug label 2026-05-25 03:53:33 -05:00
Author
Owner

@tjbck commented on GitHub (Mar 28, 2025):

Are you 100% sure you configured everything right? @chalitbkb

cc @mahenning

<!-- gh-comment-id:2760710536 --> @tjbck commented on GitHub (Mar 28, 2025): Are you 100% sure you configured everything right? @chalitbkb cc @mahenning
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

Are you 100% sure you configured everything right? @chalitbkb

cc @mahenning

I’ve thoroughly reviewed all the relevant documents and feel reasonably confident that I’ve configured everything correctly. However, I’m uncertain if I’ve overlooked something. Even though I’ve tried to reduce the vector aggregation settings, the aggregation results still remain high. Therefore, I’m bringing up this issue.

<!-- gh-comment-id:2760731244 --> @chalitbkb commented on GitHub (Mar 28, 2025): > Are you 100% sure you configured everything right? [@chalitbkb](https://github.com/chalitbkb) > > cc [@mahenning](https://github.com/mahenning) I’ve thoroughly reviewed all the relevant documents and feel reasonably confident that I’ve configured everything correctly. However, I’m uncertain if I’ve overlooked something. Even though I’ve tried to reduce the vector aggregation settings, the aggregation results still remain high. Therefore, I’m bringing up this issue.
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

You wrote you're on Open-WebUI v0.5.20. Did you clone the repo and run on the dev branch or do you run Open-WebUI normally and are on v0.5.20? The RAG_TOP_K_RERANKER feature is not yet in v0.5.20, only on the dev branch at the moment. The feature is likely included in the next version.

When I run Open-WebUI on the dev branch, I get

Image

<!-- gh-comment-id:2761699485 --> @mahenning commented on GitHub (Mar 28, 2025): You wrote you're on Open-WebUI `v0.5.20`. Did you clone the repo and run on the `dev` branch or do you run Open-WebUI normally and are on `v0.5.20`? The `RAG_TOP_K_RERANKER` feature is not yet in `v0.5.20`, only on the dev branch at the moment. The feature is likely included in the next version. When I run Open-WebUI on the dev branch, I get ![Image](https://github.com/user-attachments/assets/070055e4-d325-4599-9426-5ef181510330)
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

Ah I see, the variable is already listed in the list of environment variables, because https://github.com/open-webui/docs (the repo for the documentation and stuff) has no dev branch, an my PR to include the documentation for RAG_TOP_K_RERANKER was merged into main. It seems the documentation is a bit ahead of the actual features of the main version of Open-WebUI ;)

<!-- gh-comment-id:2761711402 --> @mahenning commented on GitHub (Mar 28, 2025): Ah I see, the variable is already listed in [the list of environment variables](https://docs.openwebui.com/getting-started/env-configuration/), because https://github.com/open-webui/docs (the repo for the documentation and stuff) has no `dev` branch, an my PR to include the documentation for `RAG_TOP_K_RERANKER` was merged into main. It seems the documentation is a bit ahead of the actual features of the main version of Open-WebUI ;)
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

You wrote you're on Open-WebUI v0.5.20. Did you clone the repo and run on the dev branch or do you run Open-WebUI normally and are on v0.5.20? The RAG_TOP_K_RERANKER feature is not yet in v0.5.20, only on the dev branch at the moment. The feature is likely included in the next version.

When I run Open-WebUI on the dev branch, I get

Thank you. I'm currently using the DEV version of Open-WebUI and am enjoying the RAG_TOP_K_RERANKER feature. However, I've tested configuring RAG_TOP_K_RERANKER, but I still encounter the aforementioned problem.

<!-- gh-comment-id:2761714644 --> @chalitbkb commented on GitHub (Mar 28, 2025): > You wrote you're on Open-WebUI `v0.5.20`. Did you clone the repo and run on the `dev` branch or do you run Open-WebUI normally and are on `v0.5.20`? The `RAG_TOP_K_RERANKER` feature is not yet in `v0.5.20`, only on the dev branch at the moment. The feature is likely included in the next version. > > When I run Open-WebUI on the dev branch, I get > Thank you. I'm currently using the DEV version of Open-WebUI and am enjoying the RAG_TOP_K_RERANKER feature. However, I've tested configuring RAG_TOP_K_RERANKER, but I still encounter the aforementioned problem.
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

Thanks for the fast reply. Just to make sure I follow everything correctly:
Can you tell me how you start your dev version? Maybe our ways of starting/building differ and I can reconstruct it that way.
You said earlier you can neither set the variable in the UI nor as an environment variable, in the comment above you write you're "enjoying the RAG_TOP_K_RERANKER feature". Is it somehow/sometimes working for you now, or still not set-able in both ways?

If you have the local code at hand, can you look into the code if you find "k_reranker"? For instance, it should be a parameter for the function query_collection_with_hybrid_search in backend/open_webui/retrieval/utils.py:280.

Another question (please don't be mad at me for this), but did you make sure you're on the latest dev version? Did you pull changes/update your local version?

<!-- gh-comment-id:2761740469 --> @mahenning commented on GitHub (Mar 28, 2025): Thanks for the fast reply. Just to make sure I follow everything correctly: Can you tell me how you start your dev version? Maybe our ways of starting/building differ and I can reconstruct it that way. You said earlier you can neither set the variable in the UI nor as an environment variable, in the comment above you write you're "enjoying the RAG_TOP_K_RERANKER feature". Is it somehow/sometimes working for you now, or still not set-able in both ways? If you have the local code at hand, can you look into the code if you find "k_reranker"? For instance, it should be a parameter for the function `query_collection_with_hybrid_search` in backend/open_webui/retrieval/utils.py:280. Another question (please don't be mad at me for this), but did you make sure you're on the latest dev version? Did you pull changes/update your local version?
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

Thanks for the fast reply. Just to make sure I follow everything correctly: Can you tell me how you start your dev version? Maybe our ways of starting/building differ and I can reconstruct it that way. You said earlier you can neither set the variable in the UI nor as an environment variable, in the comment above you write you're "enjoying the RAG_TOP_K_RERANKER feature". Is it somehow/sometimes working for you now, or still not set-able in both ways?

If you have the local code at hand, can you look into the code if you find "k_reranker"? For instance, it should be a parameter for the function query_collection_with_hybrid_search in backend/open_webui/retrieval/utils.py:280.

Another question (please don't be mad at me for this), but did you make sure you're on the latest dev version? Did you pull changes/update your local version?

Is it currently working intermittently or is it still unable to be configured in both ways?

Ans: I mean, I tried testing with the dev version and found the "RAG_TOP_K_RERANKER" option on the UI. I set it to 1, but it still didn't work. It still returns a large number of vector components. It seems that configuring RAG_TOP_K_RERANKER has no effect.

To your question, "How do I start the development version?"

Ans: I use GHCR to update the version with a Dockerfile like:

FROM ghcr.io/open-webui/open-webui:dev

RUN chmod 777 -R /app /root

ENV PORT=7860
<!-- gh-comment-id:2761768762 --> @chalitbkb commented on GitHub (Mar 28, 2025): > Thanks for the fast reply. Just to make sure I follow everything correctly: Can you tell me how you start your dev version? Maybe our ways of starting/building differ and I can reconstruct it that way. You said earlier you can neither set the variable in the UI nor as an environment variable, in the comment above you write you're "enjoying the RAG_TOP_K_RERANKER feature". Is it somehow/sometimes working for you now, or still not set-able in both ways? > > If you have the local code at hand, can you look into the code if you find "k_reranker"? For instance, it should be a parameter for the function `query_collection_with_hybrid_search` in backend/open_webui/retrieval/utils.py:280. > > Another question (please don't be mad at me for this), but did you make sure you're on the latest dev version? Did you pull changes/update your local version? Is it currently working intermittently or is it still unable to be configured in both ways? Ans: I mean, I tried testing with the dev version and found the "RAG_TOP_K_RERANKER" option on the UI. I set it to 1, but it still didn't work. It still returns a large number of vector components. It seems that configuring RAG_TOP_K_RERANKER has no effect. To your question, "How do I start the development version?" Ans: I use GHCR to update the version with a Dockerfile like: ``` FROM ghcr.io/open-webui/open-webui:dev RUN chmod 777 -R /app /root ENV PORT=7860 ```
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

(For a (maybe) quick answer and solution, scroll down to the edit. It seems you asked 7 min before a new dev version was pushed)

I tried to reproduce your problem, but alas, "for me it works".. (That sentence again..)
Steps:
docker pull ghcr.io/open-webui/open-webui:dev
docker run -p 3003:8080 --add-host=host.docker.internal:host-gateway --name open-webui-dev ghcr.io/open-webui/open-webui :dev
I used the default settings for chunks, etc. I used sentence-transformers/all-MiniLM-L6-v2 and BAAI/bge-reranker-v2-m3. In the UI, Top K and Top K Reranker were set default to 3 and 3. I changed it to top k=10 and top k reranker=1, uploaded a document in the chat and asked a question. Then I changed the settings to top k=10, top k reranker=5.

In the logging of the container, I could see the following (truncated and shortened for readability)
top k reranker = 1:

Batches: 100%|██████████| 1/1 [00:00<00:00, 21.30it/s]
Batches: 100%|██████████| 1/1 [00:02<00:00, 2.06s/it]
2025-03-28 16:08:47.179 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [...] 'score': 0.11954475939273834} 0.11954475939273834 - {}
Batches: 100%|██████████| 1/1 [00:00<00:00, 3.97it/s]
Batches: 100%|██████████| 1/1 [00:02<00:00, 2.14s/it]
2025-03-28 16:08:49.613 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [...] 'score': 0.01118550170212984} 0.01118550170212984 - {}
Batches: 100%|██████████| 1/1 [00:00<00:00, 71.87it/s]
Batches: 100%|██████████| 1/1 [00:01<00:00, 1.90s/it]
2025-03-28 16:08:51.567 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [....] 'score': 0.017430100589990616} 0.017430100589990616 - {}

top k reranker=5
Batches: 100%|██████████| 1/1 [00:00<00:00, 21.85it/s]
Batches: 100%|██████████| 1/1 [00:02<00:00, 2.07s/it]
2025-03-28 16:09:59.597 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result 'score': 0.002910345559939742} 0.01118550170212984, 0.009643329307436943, 0.006689450703561306, 0.0032938995864242315, 0.002910345559939742 - {}
Batches: 100%|██████████| 1/1 [00:00<00:00, 97.11it/s]
Batches: 100%|██████████| 1/1 [00:01<00:00, 1.57s/it]
2025-03-28 16:10:01.210 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result 'score': 0.0007439087494276464} 0.007581176236271858, 0.003316872753202915, 0.0012548574013635516, 0.0012110307579860091, 0.0007439087494276464 - {}
Batches: 100%|██████████| 1/1 [00:00<00:00, 74.65it/s]
Batches: 100%|██████████| 1/1 [00:01<00:00, 1.96s/it]
2025-03-28 16:10:03.216 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result 'score': 0.0025328141637146473} 0.01953815668821335, 0.016017155721783638, 0.011503961868584156, 0.008491785265505314, 0.0025328141637146473 - {}

I tried to highlight the important part bold. Each chat question started 3 queries for documents. You can see that for top k reranker=1, there is only one score vector at the end in bold, while for top k reranker=5 there are 5 scores each. This and the fact that I got many more references with top k reranker=5 shows me that it worked, at least for me.

The question now is, why is it not working for you? You could try to again pull the newest image for dev. Both your issue and the newest dev image are "6 hours ago" and for the image, I can not see the exact time it got pushed. It could be that your image version is not the latest anymore?

Edit: Okay, found the time (2025-03-28T02:37:39-7:00), which is apparently 9:37 (UTC, London time). You started the issue at 9:30 UTC if I'm not mistaken, so the newest image should be newer than your issue. Can you re-pull and try again? :)

<!-- gh-comment-id:2761850442 --> @mahenning commented on GitHub (Mar 28, 2025): (For a (maybe) quick answer and solution, scroll down to the edit. It seems you asked 7 min before a new dev version was pushed) I tried to reproduce your problem, but alas, "for me it works".. (_That_ sentence again..) Steps: `docker pull ghcr.io/open-webui/open-webui:dev` `docker run -p 3003:8080 --add-host=host.docker.internal:host-gateway --name open-webui-dev ghcr.io/open-webui/open-webui :dev` I used the default settings for chunks, etc. I used `sentence-transformers/all-MiniLM-L6-v2` and `BAAI/bge-reranker-v2-m3`. In the UI, Top K and Top K Reranker were set default to 3 and 3. I changed it to top k=10 and top k reranker=1, uploaded a document in the chat and asked a question. Then I changed the settings to top k=10, top k reranker=5. In the logging of the container, I could see the following (truncated and shortened for readability) top k reranker = 1: Batches: 100%|██████████| 1/1 [00:00<00:00, 21.30it/s] Batches: 100%|██████████| 1/1 [00:02<00:00, 2.06s/it] 2025-03-28 16:08:47.179 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[[...] 'score': 0.11954475939273834}]] **[[0.11954475939273834]]** - {} Batches: 100%|██████████| 1/1 [00:00<00:00, 3.97it/s] Batches: 100%|██████████| 1/1 [00:02<00:00, 2.14s/it] 2025-03-28 16:08:49.613 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[[...] 'score': 0.01118550170212984}]] **[[0.01118550170212984]]** - {} Batches: 100%|██████████| 1/1 [00:00<00:00, 71.87it/s] Batches: 100%|██████████| 1/1 [00:01<00:00, 1.90s/it] 2025-03-28 16:08:51.567 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[[....] 'score': 0.017430100589990616}]] **[[0.017430100589990616]]** - {} top k reranker=5 Batches: 100%|██████████| 1/1 [00:00<00:00, 21.85it/s] Batches: 100%|██████████| 1/1 [00:02<00:00, 2.07s/it] 2025-03-28 16:09:59.597 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[ 'score': 0.002910345559939742}]] **[[0.01118550170212984, 0.009643329307436943, 0.006689450703561306, 0.0032938995864242315, 0.002910345559939742]]** - {} Batches: 100%|██████████| 1/1 [00:00<00:00, 97.11it/s] Batches: 100%|██████████| 1/1 [00:01<00:00, 1.57s/it] 2025-03-28 16:10:01.210 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[ 'score': 0.0007439087494276464}]] **[[0.007581176236271858, 0.003316872753202915, 0.0012548574013635516, 0.0012110307579860091, 0.0007439087494276464]]** - {} Batches: 100%|██████████| 1/1 [00:00<00:00, 74.65it/s] Batches: 100%|██████████| 1/1 [00:01<00:00, 1.96s/it] 2025-03-28 16:10:03.216 | INFO | open_webui.retrieval.utils:query_doc_with_hybrid_search:160 - query_doc_with_hybrid_search:result [[ 'score': 0.0025328141637146473}]] **[[0.01953815668821335, 0.016017155721783638, 0.011503961868584156, 0.008491785265505314, 0.0025328141637146473]]** - {} I tried to highlight the important part bold. Each chat question started 3 queries for documents. You can see that for top k reranker=1, there is only one score vector at the end in bold, while for top k reranker=5 there are 5 scores each. This and the fact that I got many more references with top k reranker=5 shows me that it worked, at least for me. The question now is, why is it not working for you? You could try to again pull the newest image for dev. Both your issue and the newest dev image are "6 hours ago" and for the image, I can not see the exact time it got pushed. It could be that your image version is not the latest anymore? Edit: Okay, found the time (2025-03-28T02:37:39-7:00), which is apparently 9:37 (UTC, London time). You started the issue at 9:30 UTC if I'm not mistaken, so the newest image should be newer than your issue. Can you re-pull and try again? :)
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

@mahenning

I'm confident that it's the latest version, but I'm still encountering this problem. The results from the vector data still have too many components, even after reducing the Top K and Top K Reranker.

Image

Image

Image

Image

Image

<!-- gh-comment-id:2762091791 --> @chalitbkb commented on GitHub (Mar 28, 2025): @mahenning I'm confident that it's the latest version, but I'm still encountering this problem. The results from the vector data still have too many components, even after reducing the Top K and Top K Reranker. ![Image](https://github.com/user-attachments/assets/65b3ee30-f88b-4181-a697-e0d480cccf05) ![Image](https://github.com/user-attachments/assets/4ac9f080-631d-44a7-a8b8-bccf751e468b) ![Image](https://github.com/user-attachments/assets/330778d5-6b22-44ae-abeb-d7e75f30aea1) ![Image](https://github.com/user-attachments/assets/b50dfcaf-3cae-49a6-a951-052fadb98923) ![Image](https://github.com/user-attachments/assets/e05320e7-55dd-4854-8b44-292e4d65d49b)
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

@mahenning

Then I switched to using the Gemini model to test how many results obtained from the vector were discovered. I found that there were still many items even though the model was able to respond to me. This means that the "RAG_TOP_K_RERANKER" setting was not actually implemented or may be due to a defect elsewhere.

Image

Image

<!-- gh-comment-id:2762122412 --> @chalitbkb commented on GitHub (Mar 28, 2025): @mahenning Then I switched to using the Gemini model to test how many results obtained from the vector were discovered. I found that there were still many items even though the model was able to respond to me. This means that the "RAG_TOP_K_RERANKER" setting was not actually implemented or may be due to a defect elsewhere. ![Image](https://github.com/user-attachments/assets/d12fefc3-af09-4ccf-abba-d669cf634d9d) ![Image](https://github.com/user-attachments/assets/721784f3-09bf-4b48-a794-117c190d80d4)
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

I see in your screenshot below that "full context mode" is enabled. If thats enabled, the full document(s) are loaded into the chat, disabling the "chunking -> scoring -> reranking" pipeline that retrieves only (relevant) chunks of the documents. That could also explain your many results, and why top k and top k reranker settings are ignored. There is no filtering for the best, the LLM gets it all.

@mahenning

Image

<!-- gh-comment-id:2762343077 --> @mahenning commented on GitHub (Mar 28, 2025): I see in your screenshot below that "full context mode" is enabled. If thats enabled, the full document(s) are loaded into the chat, disabling the "chunking -> scoring -> reranking" pipeline that retrieves only (relevant) chunks of the documents. That could also explain your many results, and why top k and top k reranker settings are ignored. There is no filtering for the best, the LLM gets it all. > [@mahenning](https://github.com/mahenning) > > ![Image](https://github.com/user-attachments/assets/330778d5-6b22-44ae-abeb-d7e75f30aea1)
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

@tjbck Maybe it would be a good ida to hide the hybrid / top k / etc stuff if full context mode is enabled to signal that these settings are ignored in that case.

<!-- gh-comment-id:2762354808 --> @mahenning commented on GitHub (Mar 28, 2025): @tjbck Maybe it would be a good ida to hide the hybrid / top k / etc stuff if full context mode is enabled to signal that these settings are ignored in that case.
Author
Owner

@tjbck commented on GitHub (Mar 28, 2025):

@mahenning Addressed with 0413c747a9ba33275dc4e4d3146581ed52979474!

<!-- gh-comment-id:2762361519 --> @tjbck commented on GitHub (Mar 28, 2025): @mahenning Addressed with 0413c747a9ba33275dc4e4d3146581ed52979474!
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

Committed 2 mins ago? That was ninja-level fast.

<!-- gh-comment-id:2762363861 --> @mahenning commented on GitHub (Mar 28, 2025): Committed 2 mins ago? That was ninja-level fast.
Author
Owner

@chalitbkb commented on GitHub (Mar 28, 2025):

@tjbck Maybe it would be a good ida to hide the hybrid / top k / etc stuff if full context mode is enabled to signal that these settings are ignored in that case.

@mahenning
I was so focused on a tiny problem, it was like staring at a breadcrumb and forgetting I had a whole pizza!🍕😂

Thank you, it's working now. However, there seems to be a 20-30 second delay for the RERANKER.

<!-- gh-comment-id:2762372223 --> @chalitbkb commented on GitHub (Mar 28, 2025): > [@tjbck](https://github.com/tjbck) Maybe it would be a good ida to hide the hybrid / top k / etc stuff if full context mode is enabled to signal that these settings are ignored in that case. @mahenning I was so focused on a tiny problem, it was like staring at a breadcrumb and forgetting I had a whole pizza!🍕😂 Thank you, it's working now. However, there seems to be a 20-30 second delay for the RERANKER.
Author
Owner

@mahenning commented on GitHub (Mar 28, 2025):

If Open-WebUI does not run with GPU support, the embedding/reranking models runs on CPU. Depending on how many document chunks have to be reranked, this could take a while. Embedding only has do be done one time per document, reranking every time you ask something in the chat with documents available. If you habe a few GB VRAM to spare, you can run the :cuda (or :dev-cuda) image.

Would be actually a nice PR to enable e.g. only the reranker to GPU and letting the embedding model run on CPU..

<!-- gh-comment-id:2762388386 --> @mahenning commented on GitHub (Mar 28, 2025): If Open-WebUI does not run with GPU support, the embedding/reranking models runs on CPU. Depending on how many document chunks have to be reranked, this could take a while. Embedding only has do be done one time per document, reranking every time you ask something in the chat with documents available. If you habe a few GB VRAM to spare, you can run the `:cuda` (or :dev-cuda) image. Would be actually a nice PR to enable e.g. only the reranker to GPU and letting the embedding model run on CPU..
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#136209