RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /How-to
  5. /How to create a Modelfile to customize model parameters
HOW-TO · INF

How to create a Modelfile to customize model parameters

intermediate·10 min·By Fredoline Eruo
Target environment
Ubuntu 24.04 · Ollama 0.4.x
PREREQUISITES

Ollama installed, base model already pulled to local library

What this does

Creates a named model variant with customized inference parameters, system prompts, and template overrides using a declarative Modelfile. After this guide a tailored version of the base model will be available for specialized use cases.

Steps

  1. Create a Modelfile in a working directory. The FROM directive specifies which base model to extend.

    cat > Modelfile << 'EOF'
    FROM llama3.2
    PARAMETER temperature 0.3
    PARAMETER num_ctx 8192
    PARAMETER top_p 0.9
    SYSTEM """You are a coding assistant. Always include code examples."""
    EOF
    

    Low temperature (0.3) produces deterministic output; higher values increase creativity.

  2. Create the custom model variant. Registers the customized model under a new name.

    ollama create coding-llama -f Modelfile
    

    Expected output: transferring model data followed by success.

  3. Run the custom model and verify behavior. Launches the variant with the baked-in parameters.

    ollama run coding-llama "Write a hello world in Python"
    

    Expected output: A response that includes a code example.

  • Record the local run evidence. Save the exact command, runtime or package version, model name if applicable, and observed output so the result can be reproduced later.

Verification

ollama show coding-llama
# Expected: output includes PARAMETER block with temperature 0.3 and num_ctx 8192

Common failures

  • unable to locate model - FROM references a model not in the local library; run ollama pull <name> first.
  • syntax error in Modelfile - Missing newline after a directive or unbalanced quotes; check the file character by character.
  • system prompt ignored - Some model architectures require a TEMPLATE directive before SYSTEM will take effect.
  • duplicate model name - A model with the target name already exists; choose a different name or delete the existing one.

Related guides

  • How to import custom GGUF model files into Ollama
  • How to configure the Ollama serve port for network access
RELATED GUIDES
INF
How to configure the Ollama serve port for network access
INF
How to import custom GGUF model files into Ollama
← All how-to guidesCourses →