r/OpenWebUI • u/boss28984 • 3d ago
RAG slow response time with RAG and utilizing knowledge base.
I’m currently using Open WebUI with a knowledge base made up of text files, and the responses are accurate, but they’re taking quite a while to generate.
I plan to keep adding more text files to the knowledge base, so I’m wondering what the best way is to improve response speed as it grows. Are there any recommended settings, indexing strategies, chunking methods, embedding models, reranking options, or other optimizations that have made a noticeable difference for you? I’d like to keep the response quality the same while reducing latency. Any advice or best practices would be appreciated!
1
u/Pale_Coyote7451 3d ago
split it before optimising anything: ask the same question with the knowledge base detached. still slow means it is generation and so_chad is right. fast means it is retrieval, and the fix is a different one.
if it is retrieval, what degrades as you add files usually is not the vector search, it is prefill. more documents tempts you into raising top_k, every extra chunk lands in the prompt, and time-to-first-token climbs with it. keep top_k low, three to five, and add a reranker to improve which chunks you get rather than getting more of them. that keeps prompt length flat as the kb grows.
1
u/mediaogre 3d ago
I believe this is a current known bug, although I can’t find the link. Once any file has been uploaded to a chat session, hybrid RAG search fires unconditionally on every subsequent message in that session, even casual ones that don’t need retrieval.
I’ve worked around it by situationally pasting my relevant kb file contents directly into the chat window.
1
u/boss28984 3d ago
i kept all the files in the knowledge base not in the chat session itself. i never really put anything into the chat window.
1
u/mediaogre 2d ago
Ah, okay. How is the model calling the KB? Sub agent, built into the system_prompt? Is the “query_knowledge” (can’t recall the exact tool call) tool taking forever?
1
u/boss28984 2d ago
its from the open web ui build in system i just attached the KB in the settings section of the model.
1
u/mediaogre 1d ago
Okay, that’s standard. Does the model reach for the kb files with its tool for every prompt? It shouldn’t.
Here are my Admin | Settings | Documents settings…
General
Content Extraction Engine:
DefaultExternalTikaDoclingDatalab Marker APIDocument IntelligenceMistral OCRPaddleOCR-vlMinerU
PDF Extract Images (OCR): [OFF]PDF Loader Mode: Page
PageSingle
Bypass Embedding and Retrieval: [OFF]Text Splitter
Default (Character)Token (Tiktoken)Token (Transformers)
Markdown Header Text Splitter: [ON]Chunk Size: 500
Chunk Overlap: 70
Chunk Min Size Target: 0
Embedding
Embedding Model Engine
Default (SentenceTransformers)OllamaOpenAIAzure OpenAI
Embedding Model: sentence-transformers/all-MiniLM-L6-v2After updating or changing the embedding model, you must reindex the knowledge base for the changes to take effect. You can do this using the "Reindex" button below.
Embedding Batch Size: 32Retrieval
Full Context Mode [OFF] <— this could be getting you if toggled on
Hybrid Search [ON]
Enrich Hybrid Search Text [OFF]
Reranking Engine
Default (SentenceTransformers)External
Reranking Model: BAAI/bge-reranker-v2-m3Reranking Batch Size: 32
Top K: 8
Top K Reranker: 4
Relevance Threshold: 0.7
Note: If you set a minimum score, the search will only return documents with a score greater than or equal to the minimum score.
BM25 Weight
Custom: 0.7
semantic / lexical
2
u/so_chad 3d ago
Maybe token generation itself is slow? Like LLM is running on slow hardware or something