You change a word in a promptPromptThe text you give a model to work on, from a short question to long instructions with a role, context, examples and a required format. The quality of the output follows the clarity of the prompt more than its length., try it twice, the output looks better, you ship it. A week later cases that used to work fail. The judgement rested on two examples, and the model does not give the same output every time. Evaluate prompts the way you test code: a fixed set of cases and a result you can count.
Step 1: a test set
Collect twenty to fifty real inputs, with personal dataPersonally identifiable information (PII)Any information that points to a specific person: name, email, phone, address, ID number. Keep it out of logs and out of prompts sent to a model unless needed, and redact it when you can. removed: the usual cases, edge cases (empty, very long, another language), cases that failed before, and at least one injectionPrompt injectionText that slips into a model's input (from a user, a web page or a file) and tries to change its instructions, such as "ignore the above". The defence is treating outside text as data, with strict limits on permissions. attempt. Keep them in a file in the repositoryRepositoryThe project's folder with its full history in Git: code, docs and settings. It can be on your machine alone or on a platform such as GitHub, public for everyone to see or private..
Step 2: what "correct" means
Exact match for classification; code checks (the JSONJSONA text format for exchanging data, with objects in curly braces, lists in square brackets, and text and number values. Every programming language reads it, and it is the usual format for API requests and structured model output. matches the schema, a word is present, a length cap holds); or a short list of conditions for open tasks such as summaries. Start with what code can check: cheaper, faster and steadier than a human.
Step 3: run and compare
Run the current prompt on the whole set and record the pass rate, then the new version on the same set. Adopt the change only if the rate goes up (or holds with a gain you want, such as shorter output or lower cost) and nothing that passed now fails without a reason you accept. Run important cases more than once, and lower the temperatureTemperatureA setting that controls how random the model's choice of the next word is. Low gives steadier, more repeatable answers; high gives more variety and more mistakes. where you want stable output.
A model judging a model
For open tasks a second model can grade the output against your conditions. Useful, but it errs too: review a sample of its verdicts and keep deterministic code checks where you can.
Make it a habit
Add every productionEnvironmentA place the app runs with its own settings: development on your machine, preview for trying things, production for users. Each has its own variables and database, so do not experiment on production. failure to the set, change one thing at a time, and record each prompt version with its result. A prompt in your app is code like any other.