Modelfile
A Modelfile is Ollama’s declarative configuration file for specifying a model’s base, prompts, parameters, and other settings.
Build Applications with Local AI Models on a Mac
A Modelfile is Ollama's declarative file format for specifying the base model, prompts, parameters, and other settings of a custom model.
- How it is used
- Packages a base model, prompts, and parameters as a reusable named Ollama model.
- How deep it goes
- Defines required and optional instructions, then walks through creating and running custom models, including registration of exported GGUF models.
- Examples
- Uses a study buddy, a pirate tutor, a code reviewer, and an exported fine-tuned model as examples.
- What you can do after
- Apply it via Ollama to create, run, and test a named custom model.
Read how Build Applications with Local AI Models on a Mac explains Modelfile →
Domain-Specific Small Language Models
An Ollama configuration file that specifies how to package and serve a converted model, including template and generation parameters.
- How it is used
- Defines how Ollama deploys a converted custom model for local inference.
- How deep it goes
- Defines the FROM, TEMPLATE, and PARAMETER directives and their roles without detailing their implementation.
- Examples
- Uses a StarCoder2 code-generation model with a 4096-token context, an instruction template, and stop sequences.
- What you can do after
- Configure a converted GGUF model for Ollama by specifying its template and generation parameters.
Read how Domain-Specific Small Language Models explains Modelfile →
What to know first
- sensitive informationSensitive information is information whose access, disclosure, alteration, or misuse may cause harm or violate privacy, security, or confidentiality requirements.
Related concepts
- configuration filekind of · A configuration file is a file containing settings that software reads to determine how an application, system, or component operates.
- AI modelconfigures · An AI model is a computational system that learns or encodes patterns to map inputs to outputs such as predictions, classifications, or generated content.
- GGUFconfigures · GGUF is a binary file format for storing machine-learning model tensors and associated metadata, designed to support efficient model loading and inference.
- custom modelproduces · A custom model is a machine-learning model trained, adapted, or configured for a particular domain, task, or set of requirements.
Questions about Modelfile
What is Modelfile?
A Modelfile is Ollama’s declarative configuration file for specifying a model’s base, prompts, parameters, and other settings.
Which Manning books explain Modelfile?
Build Applications with Local AI Models on a Mac and Domain-Specific Small Language Models.
What should I know before learning Modelfile?
Manning books that teach Modelfile usually introduce sensitive information first.
What is Modelfile a kind of?
Modelfile is a kind of configuration file. A configuration file is a file containing settings that software reads to determine how an application, system, or component operates.
What are the parts of Modelfile?
Modelfile includes FROM instruction.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

