Skip to content

Allow changing the context window size for Ollama#44506

Merged
ConradIrwin merged 3 commits intozed-industries:mainfrom
sbe-arg:ollama/models
Feb 12, 2026
Merged

Allow changing the context window size for Ollama#44506
ConradIrwin merged 3 commits intozed-industries:mainfrom
sbe-arg:ollama/models

Conversation

@sbe-arg
Copy link
Contributor

@sbe-arg sbe-arg commented Dec 10, 2025

Release Notes:

  • Changed the way context window is set for ollama at the provider level instead of per model.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 10, 2025
@maxdeviant maxdeviant changed the title Feat: Ollama provider setup context window Allow changing the context window size for Ollama Dec 10, 2025
@sbe-arg sbe-arg marked this pull request as draft December 10, 2025 00:46
@sbe-arg sbe-arg marked this pull request as ready for review December 10, 2025 01:59
@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Dec 10, 2025
@mikebenfield
Copy link
Contributor

Can you tell me about the motivation for this change and what alternatives there may have been?

@sbe-arg
Copy link
Contributor Author

sbe-arg commented Dec 17, 2025

Can you tell me about the motivation for this change and what alternatives there may have been?

For context I use zed with ollama with 48gb vram.
Each time it loads models like devstral-small-2 or qwen3-coder with such vram it overspills the maximum context window of the model 389k for devstral2 and 256 for q3c. The problem is that the only way to mitigate this is creating local copies of the model changing the context window capacity and becomes a burden to do this for several models.

It is also known most local models do not operate well on consumer hardware at big context window so leaving this to be randomly decided by Zed based on vram availability and model config is a bad combination.

It is easier to setup a context window at the provider level like is done on other IDE addons such as cline, continue, roo, kilo, etc. So all models will use such context.

@mikebenfield
Copy link
Contributor

Great! Could you please change the name of the variable in code from context_window to max_tokens, and the name of the user visible setting to "Max Tokens", to match the user visible setting "Max Tokens" that already exists?

Also, would you mind explaining the change to the get_max_tokens function?

@sbe-arg
Copy link
Contributor Author

sbe-arg commented Dec 18, 2025

I don't think renaming context window to max tokens is a good idea. As token limits can be imposed on outputs making "Max Tokens" misleading.

The get_max_tokens function now only acts as fallback if the max_tokens var is passed empty under any user input error such as " "

@sbe-arg
Copy link
Contributor Author

sbe-arg commented Dec 31, 2025

No progress on this?

@benbrandt benbrandt requested review from ConradIrwin and removed request for ConradIrwin February 12, 2026 13:29
@benbrandt benbrandt assigned bennetbo and unassigned mikebenfield Feb 12, 2026
@ConradIrwin
Copy link
Member

@sbe-arg Sorry for the dropped hand-offs here.

Thanks for tidying this up.

@ConradIrwin ConradIrwin enabled auto-merge (squash) February 12, 2026 16:49
@ConradIrwin ConradIrwin merged commit 2eb015d into zed-industries:main Feb 12, 2026
27 checks passed
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Feb 12, 2026
@sbe-arg sbe-arg deleted the ollama/models branch February 12, 2026 17:31
morgankrey added a commit that referenced this pull request Feb 19, 2026
Auto-applied queued documentation suggestions from:
- PR #48908
- PR #48909
- PR #48910
- PR #48912
- PR #48930
- PR #44794
- PR #48763
- PR #45073
- PR #48495
- PR #49374
- PR #49139
- PR #48780
- PR #48619
- PR #48978
- PR #48962
- PR #48988
- PR #47860
- PR #49015
- PR #47095
- PR #47475
- PR #48542
- PR #46766
- PR #47754
- PR #48807
- PR #44506
- PR #49051
- PR #49069
- PR #48842
- PR #48851
- PR #48736
- PR #47673
- PR #49094
- PR #49098
- PR #49622

Generated with script/docs-suggest-publish for human review in draft PR.
morgankrey added a commit that referenced this pull request Feb 25, 2026
Auto-applied queued documentation suggestions from:
- PR #48908
- PR #48909
- PR #48910
- PR #48912
- PR #48930
- PR #44794
- PR #48763
- PR #45073
- PR #48495
- PR #49374
- PR #49139
- PR #48780
- PR #48619
- PR #48978
- PR #48962
- PR #48988
- PR #47860
- PR #49015
- PR #47095
- PR #47475
- PR #48542
- PR #46766
- PR #47754
- PR #48807
- PR #44506
- PR #49051
- PR #49069
- PR #48842
- PR #48851
- PR #48736
- PR #47673
- PR #49094
- PR #49098
- PR #49622
- PR #49554
- PR #49710
- PR #49716
- PR #49732
- PR #49788
- PR #49876
- PR #49902
- PR #49910
- PR #49390
- PR #50027

Generated with script/docs-suggest-publish for human review in draft PR.
morgankrey added a commit that referenced this pull request Feb 25, 2026
Auto-applied documentation from:
- PR #48542: Bedrock extended context window
- PR #46766: LSP adapters in settings schema
- PR #47754: VSCode tasks.json label generation

Skipped (no target file exists):
- PR #49069: panel zoom state persistence

Already documented from prior batches:
- PR #48807, PR #44506, PR #49051, PR #48842, PR #48851, PR #48736
morgankrey added a commit that referenced this pull request Feb 25, 2026
Auto-applied queued documentation suggestions from:
- PR #48908
- PR #48909
- PR #48910
- PR #48912
- PR #48930
- PR #44794
- PR #48763
- PR #45073
- PR #48495
- PR #49374
- PR #49139
- PR #48780
- PR #48619
- PR #48978
- PR #48962
- PR #48988
- PR #47860
- PR #49015
- PR #47095
- PR #47475
- PR #48542
- PR #46766
- PR #47754
- PR #48807
- PR #44506
- PR #49051
- PR #49069
- PR #48842
- PR #48851
- PR #48736
- PR #47673
- PR #49094
- PR #49098
- PR #49622
- PR #49554
- PR #49710
- PR #49716
- PR #49732
- PR #49788
- PR #49876
- PR #49902
- PR #49910
- PR #49390
- PR #50027

Generated with script/docs-suggest-publish for human review in draft PR.
morgankrey added a commit that referenced this pull request Feb 25, 2026
Auto-applied documentation from:
- PR #48542: Bedrock extended context window
- PR #46766: LSP adapters in settings schema
- PR #47754: VSCode tasks.json label generation

Skipped (no target file exists):
- PR #49069: panel zoom state persistence

Already documented from prior batches:
- PR #48807, PR #44506, PR #49051, PR #48842, PR #48851, PR #48736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

5 participants