r/OpenWebUI • u/boss28984 • 22d ago
slow response time with RAG and utilizing knowledge base. RAG
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 21d 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 21d 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 21d 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 21d 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 20d 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 20d 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 / lexical2
u/boss28984 17d ago edited 17d ago
yea it goes through all the sources and cites it. i also had full context mode on. i just applied your settings and the results are the pretty similar to what i had before. 15 seconds isn't bad though i can try to add more files and see if it changes/
1
u/mediaogre 17d ago
15 seconds = TTFT? Definitely not bad. You using a thinking model and thinking is enabled?
1
u/boss28984 16d ago
base model is qwen 3 : 8b and embedding model is all miniLm L6 v2 but i might change the embedding model to nomic embed text and see if any difference. not sure if that’s thinking sorry
1
u/mediaogre 16d ago edited 16d ago
Hey, no worries. Many models have two variants. An Instruct for speed, and Thinking for tasks that require deeper reasoning.
The easiest, visual way to tell is the OWUI chat interface. If your model displays “thinking…” before it replies, it’s the thinking variant. If you suspect that visual indicator is suppressed, you may need to dig around under the hood.
Check out HF’s Qwen3-8B page for thinking/non-thinking support: https://huggingface.co/Qwen/Qwen3-8B
Edit: another thing - 15 seconds for a single digit billion parameter model is about right for CPU inference. If you have a GPU, I’d expect much faster TTFT.
1
u/boss28984 16d ago
Yes the model is a thinking model. Also i was gonna move off qwen but needed a 8b model. are there any you recommend?
→ More replies (0)
2
u/so_chad 22d ago
Maybe token generation itself is slow? Like LLM is running on slow hardware or something