TechByteByByte

Instruction Following

How to write clear, unambiguous instructions an AI can actually follow reliably — explicitness, ordering, priorities, positive vs. negative instructions, and what happens when instructions quietly conflict.

#Prompt Engineering#AI#Instructions#Fundamentals#Beginner

Start with the real problem

An instruction tells the AI what action to take. Reliable instructions also say which rules matter most and what a successful answer must contain.

Models cannot recover a requirement that was never written, and conflicting instructions force them to choose an interpretation. Reliable prompting begins by making priorities and success conditions visible.

goal → ordered instructions → resolve conflicts → execute → verify

What you will learn

  • Write explicit, non-conflicting instructions.
  • Separate true rules that must never change from preferences.
  • Define priority and success criteria.
  • Test compliance instead of assuming it.

How this connects to current AI systems

Current reasoning models often benefit from outcome-first instructions with clear constraints and stopping conditions rather than a long prescribed procedure.

1. Why This Module Exists

Every module so far has assumed you can write a clear instruction — but “be clear” is easier said than done. This module breaks that down into concrete habits: being explicit, ordering instructions sensibly, signaling priorities, and — critically — noticing when your own instructions quietly contradict each other.


2. The Idea, in Plain Language

An instruction is only as clear as it is to someone with no other information — the AI can’t ask you what you meant, so it has to guess whenever something is left unclear.

This sounds obvious, but it’s the single most common reason a prompt doesn’t produce what you wanted: something in your head never actually made it into the words you typed.


3. Explicit vs. Implicit Instructions

Example — Leaving something unsaid

Implicit (assumes the AI will "just know"):
"Write a product description for these headphones."

Explicit (says what was only assumed):
"Write a product description for these headphones. Keep it under 100
words, avoid technical jargon, and end with a short call-to-action."

The first version might work fine — or it might come back too long, too technical, or missing a call-to-action, simply because none of that was ever actually stated. The AI isn’t failing to read your mind; there was nothing to read.

💡 The pattern to notice: if something matters to you about the result, it needs to be in the prompt — not just in your head.


4. Ordering and Priorities

When a prompt has multiple instructions, the order and emphasis you give them matters — especially when they could compete for attention.

Example — No clear priority

"Write a birthday message. Make it funny. Keep it short. Make it
heartfelt. Mention that she's turning 30."

Four instructions, no signal about which matters most if they start to pull in different directions (funny vs. heartfelt can be in tension).

Example — Priorities made explicit

"Write a birthday message for a friend turning 30. Priority order:
1. It must be heartfelt above all else.
2. If it fits naturally, add a light joke — but don't force humor if
   it doesn't fit.
3. Keep it under 3 sentences."

Now there’s no ambiguity about what to do if funny and heartfelt pull in different directions — heartfelt wins.


5. Positive vs. Negative Instructions

Both have their place, but they work a bit differently.

Positive instruction: "Use simple, everyday language."
Negative instruction:  "Don't use technical jargon."

Positive instructions tell the AI what to do — generally the more reliable choice, because it gives a clear target to aim for. Negative instructions tell it what not to do, which can be useful for ruling out a specific unwanted behavior you’ve actually observed, but on their own can leave the door open to other, equally unwanted outcomes you didn’t think to rule out.

Weaker (negative only):
"Don't make the email sound rude."

Stronger (negative + positive):
"Don't make the email sound rude. Instead, keep the tone warm and
professional throughout."

Analogy: The Conflicting GPS Directions Think of conflicting instructions in a prompt like a buggy GPS voice assistant:

  • The Setup: You set two simultaneous rules in your navigation preferences:
    • Rule A: “Always prioritize driving at exactly 60 MPH to arrive on time.”
    • Rule B: “Always stop immediately when a traffic light turns red.”
  • The Conflict: You approach a red traffic light at 60 MPH.
    • The two rules are now in absolute tension. The GPS cannot satisfy both.
    • Without a stated priority (e.g., “Rule B overrides Rule A in intersections”), the system will glitch, either running the red light (violating Rule B) or slamming the brakes too late (violating Rule A).
  • In prompt engineering, whenever you combine constraints like “detailed” and “short”, you must specify which one takes precedence if they clash.

📊 Visual Flowchart: Resolving Conflicting Instructions

Here is how formatting conflicts are diagnosed and resolved systematically:

graph TD
    classDef conflict fill:#e74c3c,stroke:#333,stroke-width:1px,color:#fff;
    classDef resolve fill:#2ecc71,stroke:#333,stroke-width:1px,color:#fff;

    Rule1["Rule A: Write a detailed overview"] --> Compare{"Check for semantic clash"}
    Rule2["Rule B: Keep under 2 sentences"] --> Compare

    Compare -->|Clash detected| LogicConflict["Logical Conflict:<br>'Detailed' vs. 'Very Short'"]:::conflict

    LogicConflict --> Resolution["Resolve via Prioritized override:<br>'Keep under 2 sentences. If context is large, prioritize brevity over completeness.'"]:::resolve

6. When Instructions Quietly Conflict

This is one of the most common, hardest-to-spot sources of unreliable output — two instructions that sound fine individually but pull in different directions together.

"Write a detailed explanation. Keep it under 2 sentences."

“Detailed” and “under 2 sentences” are in real tension — the AI has to pick which one to prioritize, and it might not pick the one you actually cared about more.

"Summarize this document in bullet points. Write it as a flowing
narrative paragraph."

These two format instructions directly contradict each other.

The fix: re-read your own prompt looking specifically for pairs of instructions that can’t both be fully true at once — and decide, out loud, which one should win if they clash.


7. A Real Example From a Developer’s Perspective

Conflicting or ambiguous instructions are a common, real source of bugs in production prompts. Consider a content moderation feature:

Before (subtly conflicting):
"Flag any message that seems inappropriate. Only flag messages you're
completely certain about, to avoid false positives. Be thorough and
catch everything, even borderline cases."

After (priorities made explicit, conflict resolved):
"Flag messages that clearly violate these rules: [list]. If a message
is borderline or ambiguous, do NOT flag it — pass it to human review
instead by setting review_needed: true. Precision matters more than
catching every possible edge case."

The “before” version asks for both maximum thoroughness and maximum certainty — which can’t both be fully true. The “after” version resolves the tension explicitly: when in doubt, don’t guess, defer to a human instead. This kind of resolved, unambiguous instruction is exactly what production systems need to behave predictably.


8. A Simple Agentic AI Example

Ordering and priority matter enormously for agents, since their instructions often govern many decisions over an entire conversation, not just one response:

"You are a returns-processing agent. Follow these rules in order:
1. Always verify the order number exists before doing anything else.
2. If the order is outside the 30-day return window, deny the return
   and explain why — do not offer exceptions, even if the customer is
   upset.
3. If the order is within the window, process the return
   automatically.
4. Only escalate to a human if the customer explicitly asks to speak
   to one."

Numbering the rules and stating “in order” removes any ambiguity about what the agent should check first — this matters because agents often chain several decisions together, and an unclear priority early on can cascade into a wrong outcome several steps later.


9. How Is This Used in AI?

🤖 How Is This Used in AI?

Nearly every unreliable AI feature you’ve encountered — a chatbot that ignores half your request, a tool that formats things inconsistently — traces back to an instruction that was ambiguous, unstated, or quietly self-contradictory. Careful instruction writing, exactly as covered in this module, is one of the most direct, highest-leverage skills for fixing that kind of unreliability in a real product.


10. When Should You Focus Extra Care Here?

  • Any prompt with more than 2-3 instructions — the more there are, the higher the odds two of them quietly conflict
  • Any prompt going into production, where inconsistent behavior has real consequences
  • Any time you notice inconsistent results from the same prompt — that’s often a sign of unstated ambiguity or an unresolved conflict

11. When Is This Less Critical?

  • A single, simple, one-off instruction with no real room for competing interpretations doesn’t need this level of scrutiny

12. Common Mistakes

Incorrect idea

Assuming the AI will infer your unstated priorities.

Why it is incorrect

As shown directly, if two instructions compete and you never said which one wins, the AI has to guess — and it might guess wrong.

Incorrect idea

Writing only negative instructions.

Why it is incorrect

“Don’t be rude” doesn’t tell the AI what tone to use instead — pairing negative instructions with a positive alternative is more reliable.

Incorrect idea

Not noticing when two instructions can’t both be fully true.

Why it is incorrect

“Detailed but under 2 sentences” is a common shape of this mistake — it feels reasonable until you think about what happens when the two requirements actually collide.

Incorrect idea

Burying the most important instruction in the middle of a long list.

Why it is incorrect

If one requirement really matters more than the others, say so explicitly rather than trusting position alone to signal importance.


13. Limitations

  • Even a perfectly clear, non-conflicting instruction doesn’t guarantee the AI follows it exactly every single time — Module 22 covers the broader reliability limits of LLMs directly
  • Resolving conflicts explicitly helps, but doesn’t eliminate all ambiguity — some tasks are inherently a matter of judgment, and no amount of instruction-writing turns them into something purely mechanical
  • This module helps you write clearer instructions — it doesn’t by itself tell you how to verify the AI actually followed them correctly across many different inputs (Module 20, Prompt Evaluation, covers that)

14. Quick Reference — The Whole Idea in One Diagram

Multiple instructions in one prompt

Are any two of them UNSTATED, or could they COMPETE?
   ↓                                    ↓
  NO                                   YES
   ↓                                    ↓
Probably clear enough        State which one wins explicitly,
                              or rephrase so they don't conflict

15. Prompts in Code — Calling an LLM

Here’s how clear (and clearly-prioritized) instructions actually look when calling an LLM through code.

Example 1 — Simple

Multiple instructions stacked in a prompt with no explicit priority — exactly the ambiguous pattern Module 6 warned about.

import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=150,
    messages=[
        {"role": "user", "content": "Write a birthday message. Make it "
                                     "funny. Keep it short. Make it "
                                     "heartfelt."}
    ]
)
print(response.content[0].text)

Example 2 — Intermediate

The same request, now with an explicit priority order — resolving the tension between “funny” and “heartfelt” the way Module 6 recommended.

import anthropic

client = anthropic.Anthropic()

prompt = """Write a birthday message for a friend turning 30.
Priority order:
1. It must be heartfelt above all else.
2. If it fits naturally, add a light joke -- but don't force humor.
3. Keep it under 3 sentences."""

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=150,
    messages=[{"role": "user", "content": prompt}]
)
print(response.content[0].text)

Example 3 — Production Grade

A reusable function that separates instructions into an ordered list programmatically — making priority explicit and structured, and easy to adjust or test without editing a raw prompt string by hand.

import anthropic

client = anthropic.Anthropic()

def build_prioritized_prompt(task: str, priorities: list[str]) -> str:
    numbered = "\n".join(f"{i+1}. {rule}" for i, rule in enumerate(priorities))
    return f"{task}\nPriority order (highest priority first):\n{numbered}"

def generate_birthday_message(name: str, age: int) -> str:
    prompt = build_prioritized_prompt(
        task=f"Write a birthday message for {name}, turning {age}.",
        priorities=[
            "It must be heartfelt above all else.",
            "If it fits naturally, add a light joke -- but don't force humor.",
            "Keep it under 3 sentences.",
        ],
    )
    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=150,
        messages=[{"role": "user", "content": prompt}],
    )
    return response.content[0].text

message = generate_birthday_message("Sarah", 30)
print(message)

Structuring priorities as an actual ordered list (rather than a loosely-worded sentence) makes the resolved-conflict pattern from Module 6 something the team can review, test, and update systematically — not something buried in prose that’s easy to accidentally break.


When to use it—and when not to

Use it when:

  • outputs must satisfy several rules.
  • applications need repeatable behavior.

Do not rely on it when:

  • code can enforce the rule more safely.
  • an excessive rule list makes the main goal harder to find.

16. Interview Questions

Q: Why can two individually reasonable instructions still cause unreliable output when combined in one prompt?

Ans: Because the AI has to resolve the tension between them somehow, and if the prompt never states which instruction takes priority, its resolution is essentially a guess — different runs, or even small variations in wording, can land differently. A classic example is asking for something both “detailed” and “under 2 sentences” — these requirements are in real tension, and without an explicit priority, the output becomes unpredictable.

Q: What’s the difference between a positive and a negative instruction, and why might relying only on negative instructions be risky?

Ans: A positive instruction states what to do (“use simple language”); a negative instruction states what not to do (“don’t use jargon”). Negative instructions rule out one specific unwanted behavior but leave open every other possible way the output could still go wrong — pairing a negative instruction with an explicit positive alternative (“don’t use jargon; instead, use plain, everyday language”) gives the model an actual target to aim for, rather than just a boundary to avoid.

Q: How would you debug a prompt that seems to follow some instructions but ignores others?

Ans: I’d first check for hidden conflicts — instructions that can’t both be fully satisfied at once, where the AI may be implicitly prioritizing one over the other. I’d also check whether the ignored instruction was actually stated explicitly, or whether it was something I assumed the AI would infer on its own. Finally, I’d check ordering and emphasis — if an important instruction is buried at the end of a long list with no explicit priority signal, it may simply be getting less weight than the instructions stated earlier or emphasized more strongly.

Q: In a production system, why is it worth explicitly stating what an AI should do in ambiguous or borderline cases, rather than trusting it to handle them sensibly?

Ans: Because “sensibly” is exactly the kind of judgment call that varies unpredictably without explicit guidance — as shown in the content moderation example, asking for both maximum thoroughness and maximum certainty creates a genuine conflict the model has to resolve on its own, potentially inconsistently across different inputs. Explicitly stating the desired behavior for borderline cases (e.g., “if uncertain, defer to human review rather than guessing”) removes that guesswork and makes the system’s behavior predictable and auditable — really important for anything with real consequences riding on the outcome.


17. What You Should Remember

  • An instruction is only as clear as what’s actually written down — the AI can’t read unstated assumptions.
  • When a prompt has multiple instructions, state explicitly which one wins if they ever compete.
  • Positive instructions (“do this”) are generally more reliable than negative instructions (“don’t do that”) alone — pair them when possible.
  • The most common, hardest-to-spot failure is two instructions that quietly can’t both be fully true — actively look for this before finalizing a prompt.

18. Quick Practice

Spot the hidden conflict in this instruction, and rewrite it to resolve it explicitly:

“Write a comprehensive guide covering every important detail. Keep the entire thing under 50 words.”

19. Next Step

Next: Module 7 — Delimiters and Context Separation — a simple habit for keeping your instructions and your actual content clearly separated, especially as prompts get longer or include pasted-in text.

Author
TechByteByByte Editorial Team
Reviewed by
TechByteByByte Admin
Published
Last reviewed