Module 1 • Lesson 5

How Prompts Interact with Models

Understand the mechanics of how your prompt text influences model behavior at a technical level.

How Prompts Interact with Models

A prompt is not just "a question you ask the AI." It is the entire input context that shapes the probability distribution over the model's next-token predictions.

Key Concepts

  • System Prompt: Sets the model's persona, constraints, and behavioral guidelines. Processed first, highest priority.
  • A prompt is not just "a question you ask the AI." It is the entire input context that shapes the probability distribution over the model's next-token predictions.

    Key Concepts

  • System Prompt: Sets the model's persona, constraints, and behavioral guidelines. Processed first, highest priority.
  • User Prompt: The actual task or question. This is what most people think of as "the prompt."
  • Assistant Prefix: Pre-filling part of the response to steer the model (e.g., starting with "Here is the JSON:")
  • Instruction Following: Modern models are fine-tuned to follow instructions — but the quality of the instruction determines the quality of the output.
  • Frameworks

  • Prompt = Context + Instruction + Format: Every effective prompt has these three components
  • Attention Budget: Tokens at the beginning and end of the context window get more attention than those in the middle ("lost in the middle" problem)
  • The "Lost in the Middle" Problem

    Research shows that LLMs pay less attention to information placed in the middle of long contexts. Place critical information at the beginning or end of your prompt.

    How Different Prompt Positions Affect Output

    PositionAttention LevelUse For
    Start of promptHighestSystem instructions, critical context
    Middle of promptLowestSupporting details, examples
    End of promptHighThe specific question/task
    Assistant prefixVery HighFormat control, response steering

    Common Mistakes

  • Burying the actual question deep inside a long prompt
  • Not using system prompts when available
  • Ignoring the "lost in the middle" effect in long-context tasks
  • Assuming the model reads prompts like a human (linearly with equal attention)
  • Read to the end of the lesson to mark it as read.