[GH-ISSUE #6602] n_ctx parameter display error #50670

Closed
opened 2026-04-28 16:46:15 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ada-jt1725 on GitHub (Sep 3, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/6602

When I create model from a Modelfile:

FROM mistral:latest
PARAMETER num_ctx 4096

and load with:

ollama create mistral:latest-nctx4096 -f Modelfile
ollama run mistral:latest-nctx4096

setting n_ctx to 4096, it is discovered that on the server end n_ctx is wrongly displayed as 16384:
image

OS

Linux

GPU

No response

CPU

Intel

Ollama version

0.3.9

Originally created by @ada-jt1725 on GitHub (Sep 3, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/6602 When I create model from a Modelfile: ```log FROM mistral:latest PARAMETER num_ctx 4096 ``` and load with: ```log ollama create mistral:latest-nctx4096 -f Modelfile ollama run mistral:latest-nctx4096 ``` setting `n_ctx` to 4096, it is discovered that on the server end `n_ctx` is wrongly displayed as `16384`: ![image](https://github.com/user-attachments/assets/c71f4668-40cd-4bcf-b42d-186028eba52a) ### OS Linux ### GPU _No response_ ### CPU Intel ### Ollama version 0.3.9
GiteaMirror added the bug label 2026-04-28 16:46:15 -05:00
Author
Owner

@rick-github commented on GitHub (Sep 3, 2024):

You have OLLAMA_NUM_PARALLEL=4, or it's unset, and ollama is using a default value of 4. Each model instance has its own context space. n_ctx is the total space allocated for context, 4 * 4096 = 16384. If you set OLLAMA_NUM_PARALLEL=1 in the server environment, n_ctx will show as 4096.

<!-- gh-comment-id:2326186263 --> @rick-github commented on GitHub (Sep 3, 2024): You have `OLLAMA_NUM_PARALLEL=4`, or it's unset, and ollama is using a default value of 4. Each model instance has its own context space. `n_ctx` is the total space allocated for context, 4 * 4096 = 16384. If you set `OLLAMA_NUM_PARALLEL=1` in the server environment, `n_ctx` will show as 4096.
Author
Owner

@jmorganca commented on GitHub (Sep 3, 2024):

@rick-github is correct. Sorry this isn't more obvious – we'll improve the logging over time :)

<!-- gh-comment-id:2326946650 --> @jmorganca commented on GitHub (Sep 3, 2024): @rick-github is correct. Sorry this isn't more obvious – we'll improve the logging over time :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#50670