Module 5 Lesson 3: System Prompts
·AI & LLMs

Module 5 Lesson 3: System Prompts

The power of instruction. How to write effective system prompts that transform your model's personality.

System Prompts: Designing the Persona

The SYSTEM prompt is the most powerful tool in your Modelfile. It is the "Inner Voice" of the AI. Unlike a normal prompt (the "User Prompt"), the System Prompt is invisible during the chat, but it influences every single word the model generates.

1. The Anchor Effect

A small local model (like 7B or 8B) can easily get distracted. A strong system prompt acts as an "Anchor," constantly pulling the model back to its purpose.

The "Anemic" Prompt (Bad)

SYSTEM "You are a helpful assistant." Problem: This is too vague. The model will default to its base training, which might be too wordy, too cautious, or use the wrong tone for your specific app.

The "Structured" Prompt (Good)

SYSTEM "You are a Customer Support representative for 'Bolt-Speed Internet'. Your tone is professional and empathetic. You never offer refunds above $50. If you don't know the answer, tell the user to call 555-0199."


2. The Three Components of a Great System Prompt

When writing your SYSTEM instruction, try to include these three things:

A. The Identity

Who is the model? "You are a world-class investigative journalist with 20 years of experience."

B. The Constraints

What should it NOT do? "Do not use bullet points. Never apologize for being an AI. Do not provide medical advice."

C. The Format

What should the output look like? "Always respond in Markdown. Use bold text for key terms. Every response must end with a 'Sources' section."


3. "Pre-loading" Knowledge

While local models aren't "trained" on your specific data yet, you can use the System Prompt to give them a "pocket full of facts."

Example:

SYSTEM """
You are a concierge for the 'Grand Hotel'. 
Fact 1: Breakfast is 7am-10am. 
Fact 2: The pool is closed for maintenance. 
Fact 3: Checkout is 11am.
Answer all guest questions using ONLY these facts.
"""

4. Testing Your Persona

In the Ollama CLI, you can "Live-edit" the system prompt to see how the model reacts before you commit it to a Modelfile.

  1. Run ollama run llama3.
  2. Type /set system "You are a robot from the 1950s who is confused by modern technology.".
  3. Ask: "What is an iPhone?"
  4. Observe the response. Does it match the persona?

Key Takeaways

  • The System Prompt is the "hidden instruction" that sets the model's behavior.
  • Great prompts include an Identity, Constraints, and Formatting rules.
  • Local models need highly specific prompts to prevent "drifting."
  • Use triple quotes in your Modelfile for complex, multi-layered personas.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn