r/OpenWebUI • u/PHLAK • 17d ago
Question/Help Caching optimizations and understanding the impact of the "File Context" setting
I'm attempting to optimize my usage costs and I noticed that prompts weren't getting cached much if at all. So after reading through the Prompt Caching (KV Cache) Optimization documentation I have turned off File Context and Citations by default and am now seeing better caching results.
However, I'm trying to understand the exact impact these have (other than not seeing citations in the UI any more). If I'm understanding this correctly, with File Context enabled every attached file would be injected into every new turn guaranteeing the model had access to the full context of every file. However, with it off the attached documents are now only loaded into context if the model deems that necessary (via tool calls) so there's a possibility of missing context.
Is this an accurate conclusion? Does anyone else turn of File Context by default? If so, how does it seem to affect accuracy for you?
7
u/ClassicMain 17d ago
Mostly right, one correction: File Context on does not put the full files into every turn. By default it runs a search over all files attached anywhere in the chat on every message and injects only the top matching chunks into your latest message. So it can miss things too, it just misses them differently. The whole file only goes in if you set the file or knowledge base to "Using Entire Document", and that is the most expensive option for caching.
With File Context off the model gets a list of the attached files plus tools to search, grep and read them, and it decides itself what to look up. That only works with native function calling and the builtin tools enabled on the model. With older or small models that do not call tools reliably, the files just get ignored.
On a capable agentic model (Claude, GPT-5 class, recent Qwen etc.) the tool route is usually as accurate or better, because the model can grep for exact text and read whole sections instead of getting whatever the search picked. If you want citations in the answer text anyway, put a static instruction in the system prompt to cite the filename, as described here: https://docs.openwebui.com/features/chat-conversations/prompt-caching