BoltAI Blog
BoltAI HomepageBlogDocumentation
  • BoltAI Blog
  • What is ChatGPT o1? Understanding Its Features, Benefits, and Uses
  • Claude 3.5 Sonnet vs GPT-4o: A Comprehensive Comparison
  • ChatGPT API Cost: Features, Plans, Pros and Cons
  • How to Use ChatGPT API: A Comprehensive Guide
  • Top AI Tools for Developers: Boost Productivity and Code Smarter
  • How to Run LLM Locally on Mac: A Step-by-Step Guide
  • How to Use ChatGPT as a Search Engine: A Complete Guide
  • ChatGPT vs Claude: Which AI Tool Fits Your Needs?
  • ChatGPT vs Gemini: Which AI Tool Is Right For You?
  • Perplexity vs. ChatGPT: Our In-Depth Comparison
  • How to Train ChatGPT on Your Own Data: Enhance AI Accuracy & Relevance
  • DeepSeek vs. ChatGPT: Which AI Model Is Right for You?
  • Exploring the Top 10 ChatGPT Alternatives for Better AI Conversations in 2025
  • Top 7 AI Tools for Students to Boost Productivity and Success in 2025
  • How to Get a ChatGPT API Key: Step-by-Step Guide
  • Tech Stack Analysis for a Cross-Platform Offline-First AI Chat Client
  • BoltAI Projects, DeepSeek support and more
  • A Developer’s Guide to Bard vs. ChatGPT for Coding
  • ChatGPT Keyboard Shortcuts for Mac: Enhance Your Workflow with Quick Commands
  • ChatGPT for Programmers: How to Boost Productivity and Efficiency
  • Here’s Our Step-by-Step Guide on How to Use Mistral 7B
  • Claude vs. ChatGPT for Coding: Which AI Assistant is Best for You?
  • Amazon Bedrock & xAI support, cache breakpoint and more
  • Advanced Voice Mode, Improved Document Analysis and more
  • How to use local Whisper instance in BoltAI
  • Optimize Ollama Models for BoltAI
  • How to use xAI in BoltAI?
  • How BoltAI handles your API keys
  • How to build an AI Coding Assistant with BoltAI
  • Best Black Friday Deals 2024 for Mac
  • A simple A/B testing setup with Simple Analytics
Powered by GitBook
On this page
  • 1. Prepare the Modelfile for the new model
  • 2. Create a new model based on the modified Modelfile
  • 3. Try the new model in BoltAI
  • Setting the context window parameter at runtime
  • And that's it for now 👋

Was this helpful?

Optimize Ollama Models for BoltAI

PreviousHow to use local Whisper instance in BoltAINextHow to use xAI in BoltAI?

Last updated 6 months ago

Was this helpful?

BoltAI supports both online and local models. If privacy is your primary concern, you can use BoltAI to interact with your local AI models. We recommend using .

By default, Ollama uses a context window size of 2048 tokens. This is not ideal for more complex tasks such as document analysis or heavy tool uses. Follow this step-by-step guide to modify the context window size in Ollama.

1. Prepare the Modelfile for the new model

In Ollama, a Modelfile serves as a configuration blueprint for creating and sharing models. To modify the context window size for a model on Ollama, we will need to build a new model with the new num_ctx configuration.

Create a new file Modelfile with this content:

FROM <your model>
PARAMETER num_ctx <context size>

Here is my Modelfile to build qwen2 128K context window:

FROM qwen2.5-coder:7b
PARAMETER num_ctx 32000

2. Create a new model based on the modified Modelfile

Run this command to create the new model

ollama create <model name> -f ./Modelfile

If you've already pulled the model, it should be very fast. You can verify it by running ollama list. You can see the new model qwen2.5-coder-32k

> ollama list
NAME                        ID              SIZE      MODIFIED           
qwen2.5-coder-32k:latest    b8989a4336cf    4.7 GB    12 seconds ago        
qwen2.5-coder:7b            2b0496514337    4.7 GB    12 seconds ago        
qwen2.5-coder:latest        2b0496514337    4.7 GB    About a minute ago    
llama3.2-vision:latest      38107a0cd119    7.9 GB    5 days ago            
llama3.2:3b                 a80c4f17acd5    2.0 GB    6 weeks ago           
llama3.2:1b                 baf6a787fdff    1.3 GB    6 weeks ago           
llama3.1:latest             a340353013fd    4.7 GB    3 months ago          
nomic-embed-text:latest     0a109f422b47    274 MB    6 months ago          
llava:latest                8dd30f6b0cb1    4.7 GB    6 months ago          

3. Try the new model in BoltAI

Go back to BoltAI and refresh the model list.

  1. Open BoltAI Settings (command + ,)

  2. Navigate to Models > Ollama

  3. Click "Refresh"

Start a new chat with this model:

Setting the context window parameter at runtime

There are 2 sets of API in Ollama:

In the next version, I will add support for the official Ollama API endpoint but for now, please create a new model with the modified num_ctx parameter.

And that's it for now 👋

If you are new here, BoltAI is a mac app that allows you to use top AI services and local models easily, all from a single native Mac app.

and

Ollama allows setting the num_ctx parameter when . Unfortunately, this is when using the OpenAI-compatible API, which BoltAI is using.

Ollama
Ollama API
OpenAI-compatible API
using the Ollama API endpoint
not possible
Download Now
Working with the new model in BoltAI