Can I set num_ctx=-1 to use max possible context window? #47

Closed
opened 2026-02-15 16:27:42 -05:00 by yindo · 3 comments
Owner

Originally created by @eliranwong on GitHub (Mar 7, 2024).

Can I set num_ctx=-1 to use max possible context window?

so I don't need to change its value for different models

Originally created by @eliranwong on GitHub (Mar 7, 2024). Can I set num_ctx=-1 to use max possible context window? so I don't need to change its value for different models
yindo closed this issue 2026-02-15 16:27:42 -05:00
Author
Owner

@jmorganca commented on GitHub (Mar 8, 2024):

Hi there, you can set it to a large value (e.g. 16k, 1M) and Ollama will automatically use the largest context window the model was trained against. Hope this helps

@jmorganca commented on GitHub (Mar 8, 2024): Hi there, you can set it to a large value (e.g. 16k, 1M) and Ollama will automatically use the largest context window the model was trained against. Hope this helps
Author
Owner

@eliranwong commented on GitHub (Mar 9, 2024):

Your suggestion does not work in some models I tested. It just hangs forever without response, if I set num_ctx too high.

@eliranwong commented on GitHub (Mar 9, 2024): Your suggestion does not work in some models I tested. It just hangs forever without response, if I set num_ctx too high.
Author
Owner

@yusufcanb commented on GitHub (Feb 6, 2025):

I can agree that, most of the Qwen models hang if num_ctx too high.

@yusufcanb commented on GitHub (Feb 6, 2025): I can agree that, most of the Qwen models hang if `num_ctx` too high.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#47