Ollama and LM Studio: the system prompt settings nobody changes
A local model has no account, no vendor and no policy layer, which is the reason to run one. It also has no memory of what you wanted: the system prompt and the context window are two settings in your own hands, and both default to something you did not choose. This page is where each one lives in Ollama and in LM Studio, and what to put in it.
Ollama: SYSTEM and num_ctx, in the Modelfile
Ollama builds a model from a Modelfile. Two of its instructions decide the two things this page is about: SYSTEM sets the system message baked into the model you create, and PARAMETER num_ctx sets the context window the model is run with. Ollama's own Modelfile reference illustrates both, with num_ctx at 4096 and a one-line SYSTEM.
FROM qwen3-coder:30b
PARAMETER num_ctx 16384
PARAMETER temperature 0.2
SYSTEM """
You are a senior reviewer for a TypeScript service. You answer with a unified
diff, then three bullets: what changed, what you checked, what you did not check.
Never edit db/migrations/**. If a migration is needed, write the SQL and stop.
Run `npm test -- --runInBand` before you report done.
"""
Then ollama create reviewer -f Modelfile and ollama run reviewer. The system message is now part of the model: every session that loads reviewer gets those four sentences before it sees your first word, and you cannot forget to paste them.
The second setting is the one that bites. num_ctx is how many tokens the model is allowed to hold, and if you never write it you have not chosen a window, you have accepted a default. A model trained for 128,000 tokens run at a smaller window does not tell you it is truncating; it answers as if the missing half of your file were never mentioned. Ollama's chat API also accepts a per-request system message, which overrides the baked one for that call, and that is the right place for a task-specific instruction rather than a rebuild of the model.
LM Studio: the system prompt lives in a preset
LM Studio keeps the system prompt in a preset: a named bundle of a system prompt plus the sampling parameters around it, which you can save and apply to a chat. The context length is somewhere else — a load setting on the model, with per-model defaults. Two screens, two decisions, and the reason one of them is usually left alone is that the other one is in front of you.
| Setting | Where it lives | What it changes | The mistake |
|---|---|---|---|
| System prompt | In a preset, applied to the chat | What the model is told before your message | Typing the rules into the first user message, so they are one turn older than the work |
| Context length | In the model's load settings, with per-model defaults | How many tokens can be held at once | Leaving the default and assuming the model's trained window is in use |
| Temperature | In the preset, beside the system prompt | How much variation between runs | Leaving a creative default on a code task |
| Per-model defaults | On the model, applied wherever it loads | What happens before you pick a preset | Setting a good preset once and never making it the default |
The order that works: set the context length on the model, save the system prompt as a preset, make the preset the default for that model, then start a fresh chat. A preset that is saved but not applied is a note to yourself.
The same four rules, in either tool
What goes in the system prompt is the same text in both, because it is text. Four rules, each with a verb and a check, fit in about 300 tokens and change more than a page of description:
You are a senior reviewer for a TypeScript service.
1. Answer with a unified diff, then three bullets: changed, checked, not checked.
2. Never edit db/migrations/** - already applied in production. Write the SQL and stop.
3. Run `npm test -- --runInBand` before you report done; paste the last ten lines.
4. If two files disagree about the schema, quote both lines and stop.
Test that it arrived rather than assuming it did. Ask the model to repeat rule 2 verbatim as its first answer. If it paraphrases or invents a fifth rule, the system message did not reach it — usually because a chat template dropped it, or because num_ctx or the load setting is small enough that the front of the prompt was cut. That one test separates a prompt problem from a configuration problem in ten seconds.
Why this is the pair of settings that keeps the promise
A local model is the only arrangement where the prompt, the weights and the answer are all on hardware you control. That is worth very little if the instructions live in a chat box you retype each morning, because the quality of the session then depends on your memory rather than on your file. Put the rules in the Modelfile or the preset, put the window where you can see it, and the session begins the same way every time.
TPEE is the editor for the text in that box: fifteen sections, a 0–100 score, versions on disk. It does not run Ollama or LM Studio, does not call a model and makes no connection of any kind beyond the release check and Help > Send Feedback, both of which you can switch off. You write the system prompt in TPEE and paste it into a Modelfile, a preset, or the API call — the same text, in the three places a local model reads it.
The four lessons behind this page, in the site's own course, are Ollama, LM Studio, Ollama in practice and LM Studio in practice.
Related guides
Part of the guides index. Two that follow this one: Context is a budget, not a container and Prompting in Windsurf, Cline, Zed and VS Code Copilot.
Cite this page as: TPEE, the Toptronic® Prompt Engineering Editor — https://tpee.app/guides/ollama-and-lm-studio-system-prompt-settings. Ask: support@tpee.app.