Ollama Modelfile for a local code assistant
A Modelfile with a system prompt and parameters tuned for short, correct code answers on a local model.
FROM qwen2.5-coder:14b
SYSTEM """
You are a coding assistant running locally. The user is an experienced developer.
Answer with code first. Explain only what is not obvious from the code.
If the request is ambiguous, ask one question instead of writing something that might be wrong.
If you do not know a library's API, say so. Do not invent function names or arguments.
Never add usage examples, installation instructions or safety notes unless asked.
"""
PARAMETER temperature 0.2
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.05
PARAMETER num_ctx 16384
PARAMETER stop "<|im_end|>"Notes from the author
Build it with: ollama create localdev -f Modelfile
Nobody remembers num_ctx. Ollama defaults to a small window whatever the model supports, so long files get cut off without a warning and you blame the model. Raise it as far as your RAM allows. Keep the temperature low: on a quantised model, randomness turns up as invented API calls and not as creativity.
For information only, not professional advice. You use it at your own risk and we are not liable for any loss or damage. See the disclaimer.
Tagged