[GH-ISSUE #10345] The model's memory and GPU memory usage increases #84479

Closed
opened 2026-05-09 20:51:16 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @1556900941lizerui on GitHub (Apr 19, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10345

I am running the qwq model on a server with L40GPU, but when I use ollama run qwq to run the model, I find that the model's memory usage needs 31GB, while on another server it only needs 23GB. When I adjust the context length to 8096, the model's memory usage reaches 68GB, causing 50% of the model parameters to be loaded into memory for CPU inference. On the other server, it only needs 32GB, which is the normal GPU memory usage. I'm not clear on the reason, it seems like I accidentally modified some parameters, causing the model to load into memory or GPU memory in a problematic way. Can you help me solve this confusion?

Originally created by @1556900941lizerui on GitHub (Apr 19, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10345 I am running the qwq model on a server with L40GPU, but when I use ollama run qwq to run the model, I find that the model's memory usage needs 31GB, while on another server it only needs 23GB. When I adjust the context length to 8096, the model's memory usage reaches 68GB, causing 50% of the model parameters to be loaded into memory for CPU inference. On the other server, it only needs 32GB, which is the normal GPU memory usage. I'm not clear on the reason, it seems like I accidentally modified some parameters, causing the model to load into memory or GPU memory in a problematic way. Can you help me solve this confusion?
Author
Owner

@ALLMI78 commented on GitHub (Apr 19, 2025):

check

OLLAMA_NUM_PARALLEL
OLLAMA_MAX_LOADED_MODELS
OLLAMA_FLASH_ATTENTION

if it does not help you need to wait for the pros here ;)

<!-- gh-comment-id:2816760035 --> @ALLMI78 commented on GitHub (Apr 19, 2025): check OLLAMA_NUM_PARALLEL OLLAMA_MAX_LOADED_MODELS OLLAMA_FLASH_ATTENTION if it does not help you need to wait for the pros here ;)
Author
Owner

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

OLLAMA_NUM_PARALLEL

This is the likely cause. If unset, ollama uses a default of 1 or 4, depending on how much VRAM you have. I'm guessing that on the L40, ollama is using 4 and on the other server, 1.

<!-- gh-comment-id:2816766625 --> @rick-github commented on GitHub (Apr 19, 2025): > OLLAMA_NUM_PARALLEL This is the likely cause. If unset, ollama uses a default of 1 or 4, depending on how much VRAM you have. I'm guessing that on the L40, ollama is using 4 and on the other server, 1.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#84479