download

You changed the prompt. How do you know nothing got worse?

System design~15 minReviewed 1 Nov 2026Free · No sign-in

Question

A teammate rewrites your support bot's system prompt so answers are friendlier and shorter. Before release, you must show that nothing got worse.

You have 300 logged user questions and an LLM judge that reads a question and two answers and picks the better one. As a first test, it compares old and new answers on 8 questions, twice: once with the old answer first, once with the new one first. Its picks:

questionold shown firstnew shown first
1oldnew
2newnew
3newnew
4oldold
5oldnew
6newnew
7oldnew
8oldold

How would you test the change before release? What do these 8 results tell you? How do you release it safely?

Show hints (3)
  1. "SAME QUESTIONS, BOTH PROMPTS"

    Run both prompts on the same fixed set of questions. Why is that better than reading a few answers by hand?

  2. "LOOK AT THE ORDER"

    Count how often the judge picked whichever answer it saw first. Does it look like it is judging the content?

  3. "BOTH ORDERS"

    Count a win only when the judge prefers the same answer in both orders. Call everything else a tie. Then count again.

Show checked explanation

Run both prompts on a fixed golden set. Compare them with exact checks and an LLM judge. This judge picked the first answer 11 times of 16, so count a win only when both orders agree: new 3, old 2, tie 3. Eight questions can't decide that. Then release to a small share of traffic, ready to roll back.

"SOLUTION · PYTHON"
from collections import Counter

# the judge's pick: (old answer shown first, new answer shown first)
picks = [("old", "new"), ("new", "new"), ("new", "new"), ("old", "old"),
         ("old", "new"), ("new", "new"), ("old", "new"), ("old", "old")]


def show(label, verdicts):
    c = Counter(verdicts)
    print(f"{label}: new {c['new']}, old {c['old']}, tie {c['tie']}")


show("old shown first", [old_first for old_first, _ in picks])
show("new shown first", [new_first for _, new_first in picks])
show("both orders", [a if a == b else "tie" for a, b in picks])
first = sum(a == "old" for a, _ in picks) + sum(b == "new" for _, b in picks)
print(f"picked the answer shown first: {first} of {2 * len(picks)}")
"OUTPUT"
old shown first: new 3, old 5, tie 0
new shown first: new 6, old 2, tie 0
both orders: new 3, old 2, tie 3
picked the answer shown first: 11 of 16

Code run on CPython 3.12 against the example above. Checked by an editor other than the author.

Walkthrough

A prompt change can fix ten questions and quietly break five others. Reading a few answers won't catch that, so build a regression test.

1. A fixed golden set. Use the 300 logged questions, grouped by topic: refunds, missing items, angry users, questions the bot must refuse. Run both prompts on the same set.

2. Exact checks first. Some rules need no judge: the answer is valid JSON, cites a help center page, refuses out-of-scope questions, stays under a length limit. Code checks these the same way every time.

3. An LLM judge for quality. Judges have known biases (Zheng et al., NeurIPS 2023). They favour one position, they favour longer answers, and they may favour answers from their own model. These 8 results show the position bias:

how you countnew winsold winsties
old shown first350
new shown first620
both orders must agree323

On questions 1, 5 and 7, the judge simply picked the first answer both times. Counting a win only when both orders agree turns those into ties. The length bias also works against the new, shorter answers.

4. Read the losses, not just the total. List every question where the old answer won. A small net win can hide a broken topic, like refunds.

5. Release slowly. Version prompts like code. Send 5% of traffic to the new prompt. Watch thumbs-down and hand-offs to human agents, and keep a one-click rollback.

Common mistakes

  • Judging in one order only. Here the result flips from "old wins 5 to 3" to "new wins 6 to 2" just by swapping the order.
  • Testing on the questions used while writing the new prompt. The prompt fits them. Keep a separate set from real logs.
  • Changing the prompt and the model on the same day. If quality drops, you can't tell which change caused it.

Follow-up questions

  • "The same prompt gives different answers on each run. How does that affect the test?" Run the old prompt against itself on the same set. The wins you see there are pure noise. Trust a difference between old and new only when it is clearly bigger. More questions make the noise smaller.
  • "Why not let humans judge everything?" Humans are slow and expensive, and they disagree with each other too. Use them to label a sample that checks the judge, and to review the losses. Run the exact checks and the judge on every change.

What a strong answer covers

Runs both prompts on a fixed set of real questions. Uses exact checks for hard rules and an LLM judge in both orders. Names the position and length biases. Reads the losses by topic and releases to a small share of traffic with a rollback.

Open in interactive practice deck →

Original OfferVibe question. Topic idea from System Design with AI Interview Guide (Rohit Bhardwaj, 2026); text, examples and code are our own.
© 2026 OfferVibe · Text CC BY-NC-SA 4.0 · code MITFree to share and adapt with credit, not for commercial use. Code samples are free for any use.