Table of Contents

    A/B Testing & Iterating

    AB Testing & Iterating
    Figure: AB Testing & Iterating

    PROMPT ENGINEERING

    A/B Testing & Iterating

    Refine prompts systematically, not randomly — test, learn, improve, repeat.

    What Is A/B Testing for Prompts?

    Prompt engineering is iterative. You rarely get the perfect prompt on the first try — you refine it. A/B testing means running two versions of a prompt, comparing their output, and keeping the one that scores higher.

    The crucial discipline is to change only one thing at a time. That way, when the output improves, you know exactly what caused it — instead of guessing which of five changes made the difference.

    In one line: Test two versions, change one variable, keep the winner — and repeat until quality plateaus.

    A Simple Analogy

    It's like a scientist running an experiment. If you change the temperature and the ingredients at once, you'll never know which caused the result. Change one thing, measure, then change the next. Controlled testing is how you learn.

    The Iteration Loop

    Systematic improvement follows a repeatable five-step cycle.

    1

    Draft

    Start somewhere.

    Write an initial version of the prompt.

    2

    Test

    Try it for real.

    Run it on representative, real-world inputs.

    3

    Diagnose

    Find the weak spot.

    Identify the weakest quality dimension (accuracy, format, tone…).

    4

    Change One Thing

    One variable only.

    Adjust a single element and re-test.

    5

    Log

    Record what worked.

    Note the change and its score, then repeat until quality plateaus.

    THE GOLDEN RULE
    Change ONE variable = Know what caused the change

    Keep a Change Log

    A simple log helps you learn faster and avoid repeating mistakes. Track the version, what you changed, and the score:

    Version What Changed Score
    V1 Initial prompt 14 / 25
    V2 Added role + audience 19 / 25
    V3 Added format + constraints 24 / 25

    Example: One Change at a Time

    Watch how isolating a single change makes the cause of improvement obvious:

    V1: "Summarise this article."
        -> Score 14/25 (weak: format, completeness)
    
    V2: "Summarise this article for a busy manager."   [changed: added audience]
        -> Score 19/25 (better relevance & tone)
    
    V3: "Summarise this article for a busy manager in 5 bullet
         points, each under 15 words."                 [changed: added format]
        -> Score 24/25 (format now excellent)
    
    Learning: audience lifted tone; format lifted structure.

    When to Stop Iterating

    • The quality score plateaus across iterations
    • The output consistently meets your rubric
    • Further edits stop producing meaningful gains
    • The prompt performs well on varied, real inputs
    • The remaining gaps are model limits, not prompt issues

    Random Tweaking vs. Systematic Testing

    Aspect Random Tweaking Systematic A/B Testing
    Changes per test Many at once One at a time
    Learning You don't know what worked Clear cause and effect
    Repeatability Hard to reproduce Logged and repeatable
    Progress Circular, slow Steady, measurable

    Common Pitfalls to Watch Out For

    Pitfall 1 — Changing many things at once If you edit the role, format, and tone together, you'll never know which one actually helped.
    Pitfall 2 — Testing on one input A prompt that shines on a single example may fail on others. Test across varied, representative inputs.
    Pitfall 3 — Endless tweaking Chasing a perfect 25/25 wastes time. Know when "good enough" truly is enough.
    Fix — One variable, varied inputs, clear stop Change one thing, test on several inputs, log the result, and stop when quality plateaus.

    Key Takeaway

    A/B testing turns prompt improvement into a science. Follow the Draft → Test → Diagnose → Change → Log loop, change one variable at a time, keep a change log, and stop when quality plateaus.