Skip to main content

Using Custom Instructions

M
Written by Michael McCarty
Updated over a month ago

# Using Custom Instructions


Learn how to use and override model instructions in Minibase Ollama.


## What Are Instructions?


Instructions tell your model what task to perform. Every Minibase model has a **default instruction** from training.


## Default Instructions


Your model's default instruction is automatically applied. For example, a toxic text removal model might have:


```

"Rewrite the provided text to remove the toxicity."

```


When you run:

```bash

echo "fuck you" | ollama run my-model

```


The model actually receives:

```

Instruction: Rewrite the provided text to remove the toxicity.


Input: fuck you


Response:

```


## Custom Instructions


Override the default with `--instruction`:


```bash

echo "fuck you" | ollama run my-model --instruction "Make the text polite"

# Output: "I respectfully disagree"

```


## Common Use Cases


### Change Task


```bash

# Default: Remove toxicity

echo "Hello world" | ollama run my-model


# Custom: Translate

echo "Hello world" | ollama run my-model --instruction "Translate to Spanish"

```


### Change Output Format


```bash

# Default: Natural language

echo "This is spam" | ollama run my-model


# Custom: JSON format

echo "This is spam" | ollama run my-model --instruction "Classify as spam/not-spam. Respond in JSON format."

```


### Add Constraints


```bash

# Custom: Limit length

echo "Long text..." | ollama run my-model --instruction "Summarize in under 10 words"

```


## Best Practices


**DO:**

* Be specific: "Translate to Spanish" not "translate this"

* Specify format: "Respond in JSON with keys: result, confidence"

* Add constraints: "Summarize in 2 sentences"


**DON'T:**

* Be vague: "make it better"

* Expect tasks the model wasn't trained for

* Use overly long instructions (keep under 100 words)


## Examples


### Content Moderation

```bash

echo "bad text" | ollama run my-model --instruction "Rate toxicity from 1-10"

```


### Classification

```bash

echo "email text" | ollama run my-model --instruction "Classify as: spam, phishing, or legitimate"

```


### Data Extraction

```bash

echo "John at [email protected]" | ollama run my-model --instruction "Extract email addresses"

```


## View Default Instruction


```bash

ollama show YOUR_MODEL_ID --modelfile

```


Look for the `SYSTEM` line - that's your default instruction.


## More Information


* [Prompt Engineering Guide](https://www.promptingguide.ai/)


Did this answer your question?