[GH-ISSUE #11085] Auto-unload model or release GPU memory when idle #33072

Closed
opened 2026-04-22 15:17:00 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @barthwalsaurabh0 on GitHub (Jun 16, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/11085

Is your feature request related to a problem? Please describe.
Yes. When using ollama serve, models remain loaded in GPU memory even when not actively handling requests. This leads to unnecessary GPU usage, which can be problematic on shared systems or when switching between different workloads.


Describe the solution you'd like
Introduce a feature that automatically unloads a model or releases GPU memory after a configurable period of inactivity. This could include:

  • Monitoring for idle time (no incoming requests or inactivity on the model)
  • Unloading or stopping the model automatically after a timeout
  • Optionally reloading the model automatically when a new request arrives

This would function similarly to cache eviction or auto-scaling mechanisms.


Describe alternatives you’ve considered

  • Manually running ollama stop <model> to free GPU memory
  • Using ollama run instead of serve, but that doesn't support persistent API access
  • Writing a custom idle-time monitoring script to stop models automatically

Additional context
This feature would be very useful in environments with limited GPU resources, such as shared development machines, personal laptops, or multi-tenant servers.

Originally created by @barthwalsaurabh0 on GitHub (Jun 16, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/11085 **Is your feature request related to a problem? Please describe.** Yes. When using `ollama serve`, models remain loaded in GPU memory even when not actively handling requests. This leads to unnecessary GPU usage, which can be problematic on shared systems or when switching between different workloads. --- **Describe the solution you'd like** Introduce a feature that automatically unloads a model or releases GPU memory after a configurable period of inactivity. This could include: * Monitoring for idle time (no incoming requests or inactivity on the model) * Unloading or stopping the model automatically after a timeout * Optionally reloading the model automatically when a new request arrives This would function similarly to cache eviction or auto-scaling mechanisms. --- **Describe alternatives you’ve considered** * Manually running `ollama stop <model>` to free GPU memory * Using `ollama run` instead of `serve`, but that doesn't support persistent API access * Writing a custom idle-time monitoring script to stop models automatically --- **Additional context** This feature would be very useful in environments with limited GPU resources, such as shared development machines, personal laptops, or multi-tenant servers.
GiteaMirror added the feature request label 2026-04-22 15:17:01 -05:00
Author
Owner
<!-- gh-comment-id:2975937195 --> @rick-github commented on GitHub (Jun 16, 2025): https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-keep-a-model-loaded-in-memory-or-make-it-unload-immediately
Author
Owner

@barthwalsaurabh0 commented on GitHub (Jun 23, 2025):

Thanks, missed that.

<!-- gh-comment-id:2995780788 --> @barthwalsaurabh0 commented on GitHub (Jun 23, 2025): Thanks, missed that.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#33072