Instruction Hierarchy

How to structure multiple instructions so the AI follows them in the right order of priority.

6 min read
2 quiz questions

Complex prompts often have multiple instructions that can conflict. "Be thorough and detailed" competes with "Keep it under 200 words." "Be creative" competes with "Follow this template exactly." Without a clear hierarchy, the AI makes its own priority choices — and they may not match yours.

Tell the AI which instructions are most important. Use explicit priority language:

  • "The most important rule is..." — establishes the top priority
  • "Above all else, ensure that..." — elevates one instruction above all others
  • "If you have to choose between X and Y, always choose X" — resolves specific conflicts
  • "CRITICAL:" or "MUST:" prefixes signal non-negotiable rules
  • "Nice to have:" or "If possible:" signals optional preferences

Structure your instructions as a pyramid from most to least important. The AI should satisfy higher-priority instructions first, then optimize for lower-priority ones within those constraints.

Priority-Layered Prompt

Establishes clear instruction priority so the AI knows what to optimize for.

Write [CONTENT TYPE] about [TOPIC].

CRITICAL (must follow):
- [Non-negotiable rule 1]
- [Non-negotiable rule 2]

IMPORTANT (follow unless it conflicts with Critical):
- [Important preference 1]
- [Important preference 2]

NICE TO HAVE (include if possible):
- [Optional preference 1]
- [Optional preference 2]

If any rules conflict, follow the higher-priority level.

Research shows that AI models pay the most attention to the beginning and end of a prompt. Place your most important instructions at the start. Repeat critical rules at the end. This is especially important for long prompts where middle instructions may get less attention.

The "sandwich" technique: State the most important rule first. Put supporting details in the middle. Repeat the most important rule at the end. This maximizes the chance the AI follows your critical instruction.

Rather than hoping the AI resolves contradictions correctly, resolve them yourself by turning competing goals into a constrained optimization.

Contradictory: "Be thorough AND keep it short." Resolved: "Keep the response under 200 words. Within that limit, cover the 3 most important points with maximum detail. If you can't cover all 3 in 200 words, cover 2 thoroughly rather than 3 superficially."
  1. Set a hard constraint on one dimension (word count, format, etc.)
  2. Optimize the other dimension within that constraint
  3. Specify what to sacrifice if both can't be satisfied

Prompt Templates

Sandwich Structure for Long Prompts

Uses the sandwich technique to ensure critical instructions are followed.

MOST IMPORTANT RULE: [STATE YOUR #1 PRIORITY]

[Full task description, context, examples, format specifications, and other instructions go here]

REMINDER — the most important rule above all else: [RESTATE YOUR #1 PRIORITY]

Conflict Resolver

Explicitly resolves competing goals with clear priority.

I need you to [TASK] with these potentially competing goals:

1. [GOAL 1]
2. [GOAL 2]

Priority: [GOAL 1] takes precedence. Optimize [GOAL 2] only to the extent it doesn't compromise [GOAL 1].

If you must sacrifice one, sacrifice [WHICH ONE] and explain why.

Test Your Knowledge

Knowledge Check

1 / 2

Where should you place the most important instructions in a long prompt?

Key Takeaways

  • Establish explicit priority when instructions might conflict
  • Use CRITICAL/IMPORTANT/NICE TO HAVE tiers for complex prompts
  • Place critical instructions at the beginning and end of long prompts
  • Resolve contradictions by constraining one dimension and optimizing the other
  • Specify what to sacrifice when competing goals can't both be fully satisfied