[GH-ISSUE #10374] no caching and tokenizing redundancy #6818

Closed
opened 2026-04-12 18:36:56 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @Abdulrahman392011 on GitHub (Apr 22, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10374

previous messages need to be tokenized and extract the embeddings along with the last message before pushing them into the language model. this needs to happen every single time. there is a framework that does the caching of the previous messages to prevent the redundancy and save resources and speed up the first response token in large context windows. it's called GPT CACHE.

from my understanding it is compatible with ollama and MIT license. can you guys look into implementing it into ollama API.

Originally created by @Abdulrahman392011 on GitHub (Apr 22, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10374 previous messages need to be tokenized and extract the embeddings along with the last message before pushing them into the language model. this needs to happen every single time. there is a framework that does the caching of the previous messages to prevent the redundancy and save resources and speed up the first response token in large context windows. it's called GPT CACHE. from my understanding it is compatible with ollama and MIT license. can you guys look into implementing it into ollama API.
GiteaMirror added the feature request label 2026-04-12 18:36:56 -05:00
Author
Owner

@Abdulrahman392011 commented on GitHub (Apr 22, 2025):

please correct me if I'm wrong about this. cause it seems unlikely that this hasn't been addressed prior to today. but the way the context window is set is somewhat obscure to me.

please note that I'm using the python API. perhaps this is different for the ollama run command in terminal.

<!-- gh-comment-id:2822292328 --> @Abdulrahman392011 commented on GitHub (Apr 22, 2025): please correct me if I'm wrong about this. cause it seems unlikely that this hasn't been addressed prior to today. but the way the context window is set is somewhat obscure to me. please note that I'm using the python API. perhaps this is different for the ollama run command in terminal.
Author
Owner

@rick-github commented on GitHub (Apr 22, 2025):

If you mean GPT cache from zilliz, it's a service that sits between the client and the LLM. There's no need to implement it in ollama, a user just needs to set up the cache server and configure server/client.

ALso, ollama does internal caching for prompts.

<!-- gh-comment-id:2822299352 --> @rick-github commented on GitHub (Apr 22, 2025): If you mean GPT cache from zilliz, it's a service that sits between the client and the LLM. There's no need to implement it in ollama, a user just needs to set up the cache server and configure server/client. ALso, ollama does internal caching for prompts.
Author
Owner

@Abdulrahman392011 commented on GitHub (Apr 22, 2025):

just to confirm, I am using ollama python API. it automatically manage the previous messages and there is no redundancy in processing the previous messages with every new message.

<!-- gh-comment-id:2822306523 --> @Abdulrahman392011 commented on GitHub (Apr 22, 2025): just to confirm, I am using ollama python API. it automatically manage the previous messages and there is no redundancy in processing the previous messages with every new message.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6818