One prompt, different models
The same prompt can pass on one model and fail on the next. Watch a blind model swap break a school's report card app, then see a small test set catch every problem before the switch, and learn what carries over between models and what you must test again.
11 minFree
- Send the prompt
- Model output
- Test
- Decide
Press Play to watch it run, or step through with ← →. Then switch to Practice and run it yourself.
You help the office of Vidya Mandir School write report card notes.
Read the marks in <marks> and write a short remark for the parents.
If the child is struggling, a meeting with the class teacher could help.
Answer in JSON with the fields remark and needs_meeting.
<marks>
{{student_marks}}
</marks>What came back, and the test scores
Nothing yet. Press Play.
Background: the idea in plain words
You write a prompt, you test it, and it works. But it works on one model. Sooner or later the model changes. A newer version comes out, a cheaper one appears, or your company moves to another vendor (a company that makes models, such as Google, Anthropic or OpenAI).
A model change looks tiny: one name in a settings file. But the model is the reader of your prompt, and a new reader reads differently. Every model is trained in its own way. So each one has its own habits for the things your prompt did not say: how long to write, whether to add a friendly first line, how to lay out the answer, how much to guess about what you meant.
This means every prompt has two kinds of content. Some of it is said plainly: the task, the rules, the format, the examples. That part travels well from model to model. The rest is left to habit. Your old model filled those gaps in a way you liked, and you never noticed the gaps were there. A new model fills them in its own way.
So which parts of your prompt will survive a model change? You cannot tell by reading the prompt. You can only tell by running it. That is why the answer in this lesson is a method, not a list of tips: keep a test set (a small collection of saved inputs, each with checks for a good output) and run it again every time the model changes.
The running example is the office of a school. An app reads a child's marks and asks a model for a short note to the parents, as JSON (a text format that code can read) with two fields: a remark, and a flag that says if the parents should be called for a meeting.
Press Play to watch a blind model swap fail twice, once loudly and once silently. Then switch Try it to After: run the test set, then switch, and last to the vendor move.
What to notice
- The prompt did not change. The reader did. Model B received the same words as model A. "Answer in JSON" never said "only JSON", and the hint about meetings was never a rule. Model A filled both gaps the way the school wanted. Model B did not.
- The silent failure is the dangerous one. The parse error was found in an hour. The wrong flag raised no error at all. Only a test with a known right answer can catch it.
- A model change is tested like a prompt change. The same six cases ran on the old pair and on the new pair. The score showed the problems before any parent saw them.
- The fix was plain clarity. Prompt v2 states the rule with a number, states the format, and shows one example. That is the advice every vendor gives for every model.
- Even a clear prompt needs the test run. On the third model, five of six cases passed and one remark ran long. Most of a good prompt carries over. The test set finds the part that does not.
Go deeperWhat carries over
The three vendors' guides agree on the basics. These are safe to keep when you change models.
| What | What the guides say |
|---|---|
| Clear, specific instructions | Anthropic: be clear and direct, and be specific about the output format. Google: prompts that are direct, well structured and that clearly define the task. OpenAI: precise instructions |
| Context | Give the model the information and the reasons it needs. Do not assume it knows them |
| Examples | Google recommends always including few-shot examples. Anthropic suggests 3 to 5, varied and relevant. OpenAI suggests a handful that cover a range of inputs |
| Structure | All three suggest XML-style tags or Markdown headings to keep instructions, context and data apart |
| Long material first, question last | Both Anthropic and Google give this order for long documents |
These are the subjects of the earlier lessons in this track. They carry over because they remove gaps. A prompt with fewer gaps leaves less to each model's habits.
Go deeperWhat you must test again
| What | Why it differs | From the docs |
|---|---|---|
| Formatting habits | Models differ in default length, tone, and extras such as a greeting or a code fence | Google says its recent models give direct, efficient answers by default. Anthropic notes that default length differs even between its own models |
| How literally instructions are read | Some models fill gaps generously. Some do exactly what the words say | Anthropic says its recent models are trained for precise instruction following, and that you should ask plainly for anything beyond the strict task |
| Strong wording | Capital letters and "MUST" that were needed on an older model can make a newer one overdo it | Anthropic advises softening such language when moving to newer models |
| Thinking features | Whether the model reasons before answering, and how you control it, is set per vendor and per model | Google: its models think internally, so you need not ask for reasoning steps in the answer. Anthropic: an effort setting. OpenAI: reasoning models and GPT models respond best to different styles of prompt |
| Sampling settings | A setting your old model obeyed may be ignored by the new one | Google says its newest Gemini models ignore custom temperature, top_p and top_k values |
| Where the system text goes | The field has a different name with each vendor | system (Anthropic), system_instruction (Google), a developer message or the instructions parameter (OpenAI) |
| Token counts | Each model family cuts text into tokens in its own way | Anthropic notes that one of its newer tokenizers produces roughly 30 percent more tokens for the same text than its earlier models, and says to recount on the model you plan to use |
Read the new model's own guide Advice that names a model was measured on that model. Anthropic's guide says to treat such advice that way and to check it against your own tests before you apply it to another model. Tips from a blog post about last year's model may be wrong for this year's.
Go deeperThe method: keep a test set, run it again
- Build the test set once. Save real inputs, with the checks a good output must pass. Include the edge cases: here, a child with exactly 35 marks, and a report with only one subject. Testing prompts with evals shows how.
- Record the baseline. Run the current prompt on the current model and keep the score.
- Change one thing. First only the model. Run the test set. Now any change in the score comes from the model.
- Fix by saying more plainly. Read the failed cases. Most failures point at something the old prompt left unsaid. Debugging a failing prompt covers how to find it.
- Run again, on both models. The new prompt must pass on the new model. It should also still pass on the old one, in case you have to go back.
- Switch the prompt and the model together. They were tested as a pair, so they go live as a pair.
OpenAI's docs recommend two habits that fit this method. Pin your production app to a specific model snapshot (a fixed, dated copy of a model), so the model changes only when you choose. And build tests that measure how your prompt behaves, so you can watch the score as you change the prompt or upgrade the model.
A test run costs tokens and a little time. Six cases on three combinations is 18 calls. Compare that with the cost of the first scenario: a broken results day, and parents who were never called.
Go deeperWhere to go next
This is the last lesson of the Prompt Engineering track. You can now build a prompt from its parts, make it reliable, test it, and keep it working when the model changes.
Two tracks build on this:
- Building with LLMs: call a model from code, get structured output, and connect tools and your own data.
- Agent Development Kit: build agents where the model plans, calls tools and works in steps. The tool descriptions and agent prompts from the previous lesson are used there in every lesson.
Go deeperWords to know
| Word | Meaning in simple words |
|---|---|
| Vendor | A company that makes and sells access to models |
| Model snapshot | A fixed, dated copy of a model that does not change under you |
| Default behaviour | What a model does when your prompt says nothing about it, such as how long it writes |
| Test set | A small collection of saved inputs, each with checks for a good output |
| Baseline | The score of your current prompt on your current model, kept for comparison |
| Silent failure | A wrong answer that raises no error, so nobody notices |
Check your understanding
Sources: the official documentation
This lesson is based on the official documentation. Check it for the latest details.
Something wrong or unclear in this lesson? Tell us, it gets fixed.