[PR #13341] server: add optional setting that prevents unloading currently loaded models to make room for a new model #24710

Open
opened 2026-04-19 17:45:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13341
Author: @YetheSamartaka
Created: 12/5/2025
Status: 🔄 Open

Base: mainHead: no-model-evict


📝 Commits (3)

  • 2515127 Add optional setting for preventing unloading current models for new requests
  • 7b202a9 Merge branch 'main' into no-model-evict
  • 5ab8acd Merge branch 'main' into no-model-evict

📊 Changes

5 files changed (+93 additions, -0 deletions)

View changed files

📝 cmd/cmd.go (+1 -0)
📝 docs/faq.mdx (+1 -0)
📝 envconfig/config.go (+3 -0)
📝 server/sched.go (+27 -0)
📝 server/sched_test.go (+61 -0)

📄 Description

Currently there is no way how to create a ollama docker container with pre-defined ollama models that will be there preloaded and stay there indefinitely mainly because if a request to the ollama instance would want to load different model, even tho the OLLAMA_MAX_LOADED_MODELS is set to a fixed number, Ollama will just unload one of those models to load new one, or in cases where this is not set but there is not enough vRAM, Ollama will unload some model to load the newly request one.

This is often unwanted. I introduced a new env variable OLLAMA_NO_MODEL_EVICT that when set to "1" will prevent those models from unloading in such events. In default settings this is disabled so it is completely optional. I believe this small change will make Ollama even more powerful.

I've tested it thoroughly and included tests for the current suite.

  • Added optional setting (OLLAMA_NO_MODEL_EVICT) for preventing unloading current models for new requests
  • Added tests for this feature

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13341 **Author:** [@YetheSamartaka](https://github.com/YetheSamartaka) **Created:** 12/5/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `no-model-evict` --- ### 📝 Commits (3) - [`2515127`](https://github.com/ollama/ollama/commit/251512721f3a6b8b968feda98cf3e053d3b8b1de) Add optional setting for preventing unloading current models for new requests - [`7b202a9`](https://github.com/ollama/ollama/commit/7b202a959d1b78a79f87dca2bba2f711c9963f17) Merge branch 'main' into no-model-evict - [`5ab8acd`](https://github.com/ollama/ollama/commit/5ab8acddc8aebb72573ca2251c02346b00aa7deb) Merge branch 'main' into no-model-evict ### 📊 Changes **5 files changed** (+93 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+1 -0) 📝 `docs/faq.mdx` (+1 -0) 📝 `envconfig/config.go` (+3 -0) 📝 `server/sched.go` (+27 -0) 📝 `server/sched_test.go` (+61 -0) </details> ### 📄 Description Currently there is no way how to create a ollama docker container with pre-defined ollama models that will be there preloaded and stay there indefinitely mainly because if a request to the ollama instance would want to load different model, even tho the OLLAMA_MAX_LOADED_MODELS is set to a fixed number, Ollama will just unload one of those models to load new one, or in cases where this is not set but there is not enough vRAM, Ollama will unload some model to load the newly request one. This is often unwanted. I introduced a new env variable OLLAMA_NO_MODEL_EVICT that when set to "1" will prevent those models from unloading in such events. In default settings this is disabled so it is completely optional. I believe this small change will make Ollama even more powerful. I've tested it thoroughly and included tests for the current suite. - Added optional setting (OLLAMA_NO_MODEL_EVICT) for preventing unloading current models for new requests - Added tests for this feature --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 17:45:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#24710