Versioned Prompt
El prompt como artefacto desplegado
Escrito por Darjus Kazakevic · revisado el
A prompt edit is a deploy.
Prompts get edited casually: a word here, a new rule there, often straight in production. Then a user reports a wrong answer from Tuesday. Nobody can say what the model was asked, because the prompt has changed twice since.
Versioning is the fix. Keep each prompt in the repo, give it a version, and log that version with every request, next to the model id and settings. Then an eval score belongs to one specific prompt, and a regression can be traced to the edit that caused it.
En esencia — Version the prompt and log which version answered, or you cannot reproduce, compare or roll back anything the model said.
Cuándo recurrir a él
Recurre a él cuando
- The prompt ships to users: that alone is enough
- More than one person edits it, or two versions run at once
- You run evals, which need a version to attach each score to
Reconsidéralo cuando
- Early prototyping, where the process costs more than it saves
- A tiny, stable prompt that is really a constant
- As a replacement for evals: a version says which, not whether it is better
The parts
- The version
- An identifier that pins the exact template text: a number, a content hash, or the commit it shipped in. It must name one immutable text that you can still read later.
- The record
- What you log with each request: prompt version, model id, settings, and enough input to reproduce it. A change in any of these can change the answer, so all of them belong in the row.
- The rollout
- How a new version reaches production: behind a flag, to a percentage of traffic, after an eval run. A prompt change alters behaviour for every user at once, so treat it like a code deploy.
Reglas de diseño
- Log the version with every output
- Store the answer with the prompt version, the model id and the settings. Without those fields, "the assistant said something wrong last week" is a question nobody can answer.
- Keep prompts in the repo
- Reviewed, diffed and tagged with the release. A prompt in a database, edited through an admin screen, has no history, no review and no rollback, and someone will edit it during an incident.
- Score a version, never “the prompt”
- An eval score means nothing without the version it ran on. With versions, scores form a series you can compare over time.
- Change one thing at a time
- A model upgrade shipped with three prompt edits gives a result you cannot attribute to either. Ship the model change, measure, then ship the prompt change.
Errores habituales
- Prompts edited live in a database, with no history
- Logging the answer but not the prompt version that produced it
- Ignoring the model id, then blaming the prompt for a silent model update