Sub topic 2
Running prompts under a controlled, documented protocol
This chapter assumes you have used a chat-based AI assistant, can read a spreadsheet or CSV file, and can read basic Python. A controlled protocol fixes every variable you can control, so a change in results reflects a change in the assistant, not in your test setup.
Running prompts under a controlled, documented protocol
Write the protocol before you run anything. Fix these items:
- The prompt set, with a stable ID for each prompt.
- The assistant and its mode, such as a web-search mode or a plain chat mode.
- The date and time of each run.
- Settings such as account, region, and any custom instructions.
- A fresh session for each run, so earlier questions do not shape later answers.
Paste the exact prompt text for every run. Do not reword it between runs.
Why answers differ between runs and how many repeats you need
An assistant samples each answer from a probability distribution, so the same prompt can produce different wording and different brands. A single run tells you little. Run each prompt several times, for example five, and report the share of runs that mention your brand. Choose the repeat count before you start, and keep it fixed for the whole test.
Recording answers and test conditions
Store one row per run, and keep the raw answer text so you can rescore it later.
| run_id | prompt_id | assistant | mode | date | run_no | answer_text |
|---|---|---|---|---|---|---|
| 001 | disc-01 | Assistant A | chat | 2026-11-02 | 1 | (full answer text) |
Record the assistant version when the tool shows it. Note any change in settings, because a change can shift results even when your brand has not changed.
Scoring answers: mention rate, position, share of voice, accuracy
Score each answer on four measures:
- Mention rate: the share of runs for a prompt in which your brand appears.
- Position: where your brand first appears in the list, counting from 1.
- Share of voice: your brand mentions divided by all tracked brand mentions for that prompt set.
- Accuracy: whether the claims about your brand are correct. Score this by hand, because a script cannot judge truth.
The script below computes mention rate and share of voice from saved answers.
import re
def brand_hits(answer: str, names: list[str]) -> list[str]:
return [n for n in names if re.search(r"\b" + re.escape(n) + r"\b", answer, re.IGNORECASE)]
def mention_rate(answers: list[str], brand: str) -> float:
return sum(1 for a in answers if brand_hits(a, [brand])) / len(answers)
def share_of_voice(answers: list[str], brand: str, competitors: list[str]) -> float:
all_names = [brand] + competitors
total = sum(len(brand_hits(a, all_names)) for a in answers)
ours = sum(len(brand_hits(a, [brand])) for a in answers)
return ours / total if total else 0.0
answers = [
"Try Example BI or Acme Analytics for a small shop.",
"Example BI is popular for small teams.",
"Acme Analytics works well for checkout tracking.",
]
print(mention_rate(answers, "Acme Analytics")) # 0.6666666666666666
print(share_of_voice(answers, "Acme Analytics", ["Example BI"])) # 0.5Exercise
A prompt mentions your brand in 2 of 5 runs. What is its mention rate, and why report that rate instead of one run's result?
Show answer
The mention rate is 2/5, or 0.4 (40 percent). Answers vary between runs, so a single run can be unusually high or low. The rate across repeated runs gives a more reliable picture.