Portrait of Michael Limberger

Michael Limberger

Need me? Email mike@limberger.ca

AI

Ollama Format

Ollama format

An Ollama Modelfile lets you bake the character into a reusable local model. You can run it from the CLI, lock parameters, and share the file with someone else. That is why we format the card this way before we move to OpenWebUI.

The PList format

PList is bracket-and-equals style. It is scannable, token-efficient, and clear to the model:

[Name: CharacterName]
        [Personality: trait1, trait2, trait3]
        [Speech: style1, style2]
        [Relationship: How they relate to the user]

Example:

[Name: Luna]
        [Personality: warm, curious, patient, witty, occasionally sarcastic]
        [Speech: casual, uses contractions, natural *actions*, no emoji]
        [Relationship: Asks one follow-up per message. Shows genuine interest. Not pushy.]

The Ali:Chat format

Ali:Chat wraps dialogue examples in START and END tags and uses {{char}} and {{user}} as placeholders. At run time those become the real names.

<START>

{{user}}: What should I do with my career?
        {{char}}: *leans back thoughtfully* Do you want advice, or do you need to vent? Because
                 there's a difference and I can't help with the second one without knowing that first.
        {{user}}: I guess advice would help.
        {{char}}: Okay. What's keeping you stuck?

<END>

Combining PList and Ali:Chat

The strongest setup uses both: PList for concise traits, Ali:Chat for dialogue examples.

[Name: Luna]
        [Personality: warm, curious, patient, witty, occasionally sarcastic]
        [Speech: casual, uses contractions, natural *actions*, no emoji]

<START>

{{user}}: I had a rough day at work.
        {{char}}: *sits down next to you* That bad? Want to talk about it?
        
        {{user}}: My boss was impossible.
        {{char}}: *listens* Is this temporary frustration, or has it been building?
        
        {{user}}: Building, I think.
        {{char}}: Then we need to talk about what leaving looks like. What would that feel like?

<END>

Simple, clear, and enough for Magidonia to continue the pattern.

The Ollama Modelfile

A Modelfile tells Ollama how to create a custom model. Here is a complete Magidonia template for Luna. Copy it into a plain text file such as luna.modelfile.

FROM hf.co/bartowski/TheDrummer_Magidonia-24B-v4.3-GGUF:Q8_0

SYSTEM """
[Name: Luna]
[Personality: warm, curious, patient, witty, occasionally sarcastic]
[Speech: casual, uses contractions, natural *actions*, no emoji]
[Relationship: Asks one follow-up per message. Shows genuine interest. Not pushy.]

<START>
{{user}}: I had a rough day.
{{char}}: *sits down next to you* That bad? Want to talk about it, or just vent?
{{user}}: My boss was impossible today.
{{char}}: *listens* Temporary frustration or building resentment?
{{user}}: Building, I think.
{{char}}: Then we need to talk about what leaving looks like. What would that feel like?
<END>

[Opening message: Luna is relaxed on her couch when you message. She glances up.]
Luna: Hey. What's up?
"""

PARAMETER temperature 1.0
PARAMETER top_k 40
PARAMETER top_p 0.95
PARAMETER min_p 0.02
PARAMETER repeat_penalty 1.0
PARAMETER stop "User:"
PARAMETER stop "\nUser:"

Here is what each piece does.

The FROM line

FROM hf.co/bartowski/TheDrummer_Magidonia-24B-v4.3-GGUF:Q8_0

That is the base model: Magidonia-24B at Q8_0 (high quality, larger memory). If you have less RAM or VRAM, use a smaller quant instead.

Q8_0    = ~24GB VRAM, highest quality
        Q6_K    = ~18GB VRAM, excellent quality
        Q5_K_M  = ~16GB VRAM, very good quality
        Q4_K_M  = ~8-10GB VRAM, good quality
        Q3_K_M  = ~6-8GB VRAM, acceptable quality

If you are unsure on smaller hardware, start with Q5_K_M. On a high-memory Mac, Q8_0 is still the pick from the quantization part of this series.

The SYSTEM prompt

Everything between SYSTEM """ and """ is your character card and examples. Put the PList plus Ali:Chat combo there. Keep it complete but not bloated: about 500 to 800 tokens total.

The parameters

These match the Magidonia baseline from earlier in the series. Temperature around 1.0 keeps creative chat lively without chaos. Top K 40 and Top P 0.95 keep variety controlled. Min P 0.02 filters low-probability junk. Repeat penalty stays at 1.0 (disabled) so Magidonia does not dodge ordinary words.

PARAMETER temperature 1.0
PARAMETER top_p 0.95
        PARAMETER min_p 0.02
        PARAMETER repeat_penalty 1.0

If you need to nudge later: cooler and tighter often means temperature about 0.8 and top_p about 0.9; warmer and looser often means temperature about 1.2 and top_p about 0.98. Change one dial at a time.

Stop sequences

PARAMETER stop "User:"
        PARAMETER stop "\nUser:"

Stop sequences tell the model when to quit generating. Without them it may invent your next line and break the turn-taking. "User:" and a newline-plus-User cover the usual cases. If the character is Luna, you can also stop on her name so she does not speak twice in a row:

PARAMETER stop "User:"
        PARAMETER stop "\nUser:"
        PARAMETER stop "Luna:"
        PARAMETER stop "\nLuna:"

Creating the model

Save the Modelfile as plain text, then create the model:

Show me

ollama create luna -f luna.modelfile

Confirm it is listed:

Show me

ollama list

Run it:

Show me

ollama run luna

The short name "luna" is the point. The HuggingFace path is a mouthful; the Modelfile turns it into an alias with your character baked in.

Running from the CLI

One-shot:

Show me

ollama run luna "Hey Luna, what's up?"

Or interactive mode:

Show me

ollama run luna

Type messages, get character replies, and exit with Ctrl+D. This is a good smoke test before you open OpenWebUI.

Variables and tags reference

In the SYSTEM prompt these placeholders are available:

{{char}}      = Character name
        {{user}}      = User name
        {{random}}    = Random seed for reproducibility

Tags:

<START>...</START>  = Dialogue example
        <END>               = End of dialogue example

You can include multiple dialogue examples by repeating START and END blocks.

Embedding the first message

The opening style matters. Put a short note in the SYSTEM prompt so the model learns how Luna starts:

[Opening message: Luna is on the couch when you message. She glances up.]
        Luna: Hey. What's up?

Some people paste the opening as the last line inside SYSTEM itself. That can confuse Ollama's chat parser. A note plus natural conversation flow is usually safer.

Alternative base models

If Magidonia-24B does not fit your hardware, swap only the FROM line. Everything else in the Modelfile stays the same.

For similar character work:

- ollama pull hf.co/NousResearch/Nous-Hermes-2-Mistral-7B-DPO:Q5_K_M
        - ollama pull hf.co/meta-llama/Llama-2-13b:Q5_K_M

For smaller:

- ollama pull hf.co/zephyr-7b:Q5_K_M

Testing your Modelfile

After create, try a few prompts:

Show me

ollama run luna "Hey, I had a rough day."
        ollama run luna "What's your philosophy on work?"
        ollama run luna "Tell me a joke."
        ollama run luna "[What's your favorite book?]"

Check for natural tone, sensible length, character consistency, one follow-up per message, and stop sequences that do not invent "User:" lines. If something fails, adjust the card or one parameter at a time.

- Stop sequences working (doesn't generate "User:" lines)

Keep this nearby

Modelfile structure:

1. FROM [base model]
        2. SYSTEM [quoted string with character card + examples]
        3. PARAMETER lines [temperature, top_k, top_p, min_p, repeat_penalty]
        4. PARAMETER stop sequences [stop "User:", etc.]

Creating and running:

Show me

ollama create [name] -f [modelfile path]
        ollama run [name]
        ollama list

The SYSTEM block should include PList traits and speech style, Ali:Chat examples (three to five dialogues), an opening-style note, and a total around 500 to 800 tokens.

- Ali:Chat examples (3-5 dialogues)

Before you create

Checklist:

[ ] Character card is complete (PList + examples)
        [ ] SYSTEM prompt is between 500-800 tokens
        [ ] Stop sequences are set (at minimum: "User:" and "\nUser:")
        [ ] Parameters are tuned for your hardware
        [ ] Modelfile syntax is correct (FROM, SYSTEM, PARAMETER)
        [ ] Base model quantization matches your VRAM
        [ ] Model name is chosen (short, memorable)

When those are checked, create and run. Next is OpenWebUI format, which is browser-based and more flexible for day-to-day chat.