Sub topic 12
Versioning the set and refreshing it over time
This chapter covers how to keep a finished prompt set stable enough to compare results across runs, and fresh enough to keep matching what customers ask. It assumes you have read the earlier chapters on cleaning, clustering, sampling and validation, and that you can read short Python scripts and JSON files. You should also know the basics of Git or another version control tool.
Why a prompt set needs versions
A prompt set is a measuring instrument. If you change it without recording the change, you can no longer tell whether a score moved because the AI assistant changed or because your questions changed.
Two things drift at the same time:
- The assistants change. Models are updated, retrieval features are added, and answer styles shift.
- The customers change. New products launch, old features are retired, seasonal topics come and go, and people start using new words for the same problem.
Versioning separates these two sources of change. Refreshing keeps the set relevant. The two pull in opposite directions: versioning wants things frozen, refreshing wants things updated. The solution is to freeze each version completely, and to release new versions on a schedule.
What belongs in a version
A version is more than a list of prompts. To reproduce a run months later, you need to store everything that decided which prompts were included.
Keep these together:
- The prompt records (text, source, intent, cluster, count).
- The set's version identifier.
- The date range of the source questions.
- The sampling settings: total size, minimum per cluster, and the random seed.
- The scrubbing and normalisation code, or a reference to its exact commit.
- A change log entry describing what differs from the previous version.
A small manifest file records items 2 to 6. Here is one example.
{
"version": "2.1.0",
"released": "2026-11-29",
"source_window": {"from": "2026-05-01", "to": "2026-10-31"},
"sources": ["support_tickets", "sales_calls", "site_search", "community", "reviews"],
"sampling": {"total": 200, "min_per_cluster": 2, "seed": 7},
"pipeline_commit": "a1b2c3d",
"prompt_count": 203,
"previous_version": "2.0.0",
"notes": "Added billing_changes cluster. Retired 6 prompts about the discontinued Lite plan."
}The actual count is 203 rather than 200 because the minimum per cluster can push the sample above the requested total, as the sampling chapter explained. Record the real number, not the requested one.
Choosing a version numbering scheme
Semantic versioning, with three numbers in the form MAJOR.MINOR.PATCH, works well here if you define what each number means for your set.
| Change | Example | Version bump | Are scores comparable? |
|---|---|---|---|
| Fix a typo or a mislabelled intent, with no change to prompt wording that assistants see | Correct `how_to` to `troubleshooting` in metadata | Patch (2.1.0 to 2.1.1) | Yes |
| Add or retire a few prompts, or add a new cluster | Add 8 prompts for a new product | Minor (2.1.0 to 2.2.0) | Partly. Compare on the shared prompts only. |
| Change the sampling method, the intent taxonomy, or replace most of the set | Switch from proportional to stratified sampling | Major (2.1.0 to 3.0.0) | No. Start a new baseline. |
Any change to the text of a prompt that assistants see is not a patch. A reworded prompt can produce a different answer, so treat it as a retirement plus an addition, which is a minor change at least.
Keeping prompts stable with IDs
Each prompt needs an ID that never changes and is never reused. The record in this tutorial already has one, such as q-0042. IDs let you match the same prompt across versions and compute trends on the shared part of the set.
A common mistake is to number prompts by their position in the file. When you insert or remove one, every later ID shifts, and comparisons between versions silently break.
Use these rules:
- Assign an ID once, when the prompt first enters the set.
- Never reassign the ID of a retired prompt to a new prompt.
- Mark retired prompts with a status field instead of deleting them from history.
A record with lifecycle fields looks like this:
{
"id": "q-0042",
"text": "Can I move my subscription to a different email address?",
"source": "support_tickets",
"intent": "how_to",
"cluster": "account_management",
"count": 37,
"added_in": "1.0.0",
"status": "active",
"retired_in": null
}Storing versions
For a text-based set, the simplest approach is a Git repository with one file per release, plus a tag for each version. Git then gives you history, review of changes through pull requests, and the ability to check out any older version.
A suggested layout:
prompt-set/
releases/
2.0.0/prompts.jsonl
2.0.0/manifest.json
2.1.0/prompts.jsonl
2.1.0/manifest.json
pipeline/
scrub.py
sample.py
CHANGELOG.mdKeep raw questions out of this repository. Raw data may contain personal information that survived scrubbing, and it often has access restrictions that the prompt repository should not inherit. Store only the scrubbed, sampled prompts in the release files. Keep the raw data in a restricted store, and record only a reference to it in the manifest.
Comparing two versions
Before releasing, compute exactly what changed. This script compares two JSONL release files by ID and reports additions, removals and cluster shifts.
import json
from collections import Counter
def load(path):
with open(path, encoding="utf-8") as f:
return {row["id"]: row for row in map(json.loads, f)}
def diff_versions(old_path, new_path):
old, new = load(old_path), load(new_path)
added = sorted(new.keys() - old.keys())
removed = sorted(old.keys() - new.keys())
kept = old.keys() & new.keys()
reworded = sorted(i for i in kept if old[i]["text"] != new[i]["text"])
old_clusters = Counter(r["cluster"] for r in old.values())
new_clusters = Counter(r["cluster"] for r in new.values())
cluster_change = {
c: new_clusters[c] - old_clusters[c]
for c in set(old_clusters) | set(new_clusters)
if new_clusters[c] != old_clusters[c]
}
return {
"added": added,
"removed": removed,
"reworded": reworded,
"shared": len(kept),
"cluster_change": cluster_change,
}
if __name__ == "__main__":
report = diff_versions("releases/2.0.0/prompts.jsonl", "releases/2.1.0/prompts.jsonl")
print(json.dumps(report, indent=2))Pay attention to the reworded list. If it is not empty, those prompts are no longer the same measurement, even though the ID matches. Either revert the wording or give the changed prompts new IDs.
The shared count tells you how much of the set can be compared directly. If it falls below roughly two thirds of the set, consider whether the release should be a major version.
Deciding when to refresh
You can refresh on a schedule, on a trigger, or both.
- Scheduled refresh. Collect new questions and rebuild every quarter, for example. This is predictable and easy to plan around.
- Triggered refresh. Rebuild early when something specific happens: a product launch, a pricing change, a large support incident, or a validation failure.
A quarterly schedule with triggers for exceptional events suits most teams. A faster schedule makes more of the set new each time, which gives you fewer shared prompts to compare. A slower one lets the set go stale.
You can detect staleness with measurable signals instead of guessing:
- Coverage drop. Run the held-out validation from the previous chapter on the newest questions. If a growing share of fresh questions has no close match in the set, the set is drifting.
- Cluster shift. Re-cluster recent questions and compare cluster sizes against the set. A cluster that doubled in real demand but not in your set is under-represented.
- Vocabulary change. New product names, error messages or slang that appear often in fresh questions but never in your prompts.
- Dead prompts. Prompts about features that no longer exist.
Refreshing without breaking comparisons
A full rebuild each cycle throws away your trend line. Use a hybrid approach.
- Keep a core. Mark a subset of prompts as core. These are long-lived, high-frequency questions that stay in every version unless the topic disappears. Trends are reported on the core.
- Rotate the rest. Replace the non-core prompts each cycle with ones from fresh data, so the set follows real demand.
- Report both. Show the trend on the core separately from the score on the full set.
A core flag in each record is enough to support this. When a core prompt must be retired, for example because the product was withdrawn, record the reason in the change log and note that the core trend now has a break at that point.
Rerunning old versions
Sometimes you need to rerun an old version against a new assistant, to see how it behaves on last year's questions. Because each release is frozen with its manifest, this is a simple checkout and run. Store the assistant name, its version if known, the date, and any settings such as region or language alongside each result. Without that information the run cannot be interpreted later, even though the prompts are preserved.
Common errors
- Editing a released file in place. This destroys comparability. Fix it with a new patch version.
- Positional IDs. Inserting a prompt shifts all later IDs. Use stable, never-reused IDs.
- Forgetting the seed. Without the recorded seed and settings you cannot explain why the sample looks as it does.
- Refreshing everything at once. With no shared prompts, no trend can be computed.
- Keeping raw data beside the release. Personal data that slipped past scrubbing then travels with every copy.
- Skipping validation on the new version. A refresh can introduce the same bias problems as the first build. Validate every release.
- No retirement rule. Prompts about discontinued products linger and produce meaningless results.
A release checklist
- Collect and scrub the new source window.
- Check coverage and cluster shift against the current version.
- Rebuild with the recorded seed and settings, keeping IDs for unchanged prompts.
- Validate on held-out questions.
- Run the diff script and review added, removed and reworded prompts.
- Choose the version number using the table above.
- Write the manifest and change log entry.
- Tag the release and archive the previous one without deleting it.
Exercise
Your current set is version 2.1.0 with 200 prompts. After a refresh, 150 prompts keep their IDs and text, 10 keep their IDs but have reworded text, and 40 are new. You also changed the sampling method from proportional to stratified. What version number should you give the release, and which prompts should you use to compare scores against 2.1.0?
Show answer
Use 3.0.0, because the sampling method changed, which is a major change. For comparison, use only the 150 prompts with unchanged IDs and text. The 10 reworded prompts are no longer the same measurement, so exclude them or give them new IDs. Even then, report the comparison with a caution, because the changed sampling method means the set as a whole is a new baseline.
Exercise
Why should a released prompt file never be edited in place, even to fix a typo in the metadata?
Show answer
Editing a released file makes the same version label refer to different content, so results recorded against that label can no longer be tied to a known set of prompts. Make the fix as a new patch version (for example 2.1.1) with a change log note, and keep the original file as it was.
Exercise
Name two measurable signals that suggest your prompt set is going stale, and say what you would do when each one fires.
Show answer
One signal is a coverage drop: many recent held-out questions have no close match in the set. Respond by re-clustering and re-sampling to add the missing topics. Another is cluster shift: a cluster has grown much faster in real questions than in the set. Respond by raising its share in the next sample. Other valid signals are new vocabulary appearing in fresh questions and prompts about retired features.