---
title: "Creating Custom AI Models with Modelfiles"  
description: "This blog is to learn how to create your own customized AI models using Ollama Modelfiles."  
author: "Yash Srivastava"  
published: 2026-06-08  
updated: 2026-06-08  
canonical: https://answers.mindstick.com/blog/374/creating-custom-ai-models-with-modelfiles  
category: "technology"  
tags: ["ollama", "ai model", "llm", "model customization"]  
reading_time: 3 minutes  

---

# Creating Custom AI Models with Modelfiles

## Introduction

In the previous blog, we learned what [Modelfiles](https://answers.mindstick.com/blog/373/understanding-modelfiles-in-ollama) are and how they help customize the behavior of AI models. However, understanding Modelfiles is only the first step. The real use of Modelfiles is when we ued them to create our own custom AI models.

By using Modelfiles we can convert a general purpose [AI model](https://www.mindstick.com/news/4386/tencent-unveils-new-ai-model-claims-it-responds-faster-than-deepseek-r1) into a [AI assistant](https://answers.mindstick.com/qa/116750/building-a-local-ai-assistant-in-dot-net-with-ollama) to perform any specific task. For example we can create AI Teacher, Coding Assistant, [Interview](https://www.mindstick.com/articles/328113/outsourcing-interviews-a-bliss-to-the-new-era) Coach, Customer Support Agent, or a personal AI assistant without retraining the original model.

## Why Create Custom AI Models?

Normally when we run a model such as Llama3 it behaves like a general purpose AI assistant.

Workflow:

```plaintext
user → llama3 → general response
```

The model tries to answer every type of question without following any specific role. However in real world applications we need specialized [AI assistants](https://yourviews.mindstick.com/view/88428/ai-assistants-in-2026-are-they-becoming-our-second-brain).

*Examples:*

- AI Teacher
- Coding Assistant
- Interview Coach
- Customer Support Assistant
- Personal Tutor
- [Research](https://www.mindstick.com/articles/311609/how-to-research-the-companies-before-applying-to-their-open-positions) Assistant

Instead of writing the same instructions repeatedly in every prompt we can create a [custom model](https://www.mindstick.com/forum/12981/how-to-open-bootstrap-multiple-custom-model-popup) that permanently follows those instructions. This is where Modelfiles become useful.

## Step 1: Create a Modelfile

The first step is creating a Modelfile.

*Example:*

```plaintext
FROM llama3

SYSTEM You are an AI teacher who explains every concept in short.
```

## Understanding the Modelfile

### FROM Instruction

The FROM instruction specifies the base model that will be used.

*Example:*

```plaintext
FROM llama3
```

This means our custom model will be built using Llama 3.

### SYSTEM Instruction

The SYSTEM instruction defines the personality and behavior of the model.

*Example:*

```plaintext
SYSTEM You are an AI teacher who explains every concept in short.
```

Now the model will try to answer like a teacher and provide short explanations.

## Step 2: Save the Modelfile

Create a file named:

```plaintext
Modelfile
```

and save the [content](https://www.mindstick.com/articles/324369/google-adsense-and-content-of-your-blog) inside it.

*Example:*

```plaintext
FROM llama3

SYSTEM You are an AI teacher who explains every concept in short.
```

## Step 3: Create the Custom Model

After creating the Modelfile use the following command:

```plaintext
ollama create myteacher -f Modelfile
```

## Understanding the Command

**ollama create :-** Used to create a new custom model.

**myteacher:-** This is the name of the new model.

**-f :-** Specifies the Modelfile location.

*Workflow:*

```plaintext
Modelfile → ollama create → custom model
```

Ollama reads the instructions from the Modelfile and creates a new customized model.

## Step 4: Run Custom Model

Once the model is created then it can be run using:

```plaintext
ollama run myteacher
```

Now your custom AI model is ready to use.

##

## Testing Model

let any question to ask like:

```plaintext
What is Artificial Intelligence?
```

*Possible response:*

```plaintext
Artificial Intelligence (AI) is a field of computer science that enables machines to simulate human intelligence and perform tasks such as learning, reasoning, problem-solving, decision-making, and understanding language.
```

Notice that the response style follows the teacher behavior defined in the SYSTEM instruction.

read more about ollama:

previous topic: [Understanding Modelfiles in Ollama](https://answers.mindstick.com/blog/373/understanding-modelfiles-in-ollama)\
next topic: [Building Technical Customer support model using ollama](https://answers.mindstick.com/blog/377/building-technical-customer-support-model-using-ollama)

---

Original Source: https://answers.mindstick.com/blog/374/creating-custom-ai-models-with-modelfiles

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
