Chapter 1 · Instructions, Models and Reasoning
Provider Differences and Portability: Reading Guides, Testing Across Models
- Page 2 of 24
- 16 min read
A prompt that works well in one product can fail in another, and it can fail in the same product after a model update. The cause is rarely mysterious: models differ in how literally they follow instructions, how much they explain, and which settings they accept. This page gives you a repeatable way to handle that. Read the provider's guide, test the same cases on every target, adapt only what the tests prove must change, and write the differences down.
You need Python 3.12 or newer and the standard library only. The code blocks share variables, so type them in order. As on the previous page, every provider in the code is a toy provider, a small deterministic function that stands in for one behaviour so the test harness can be repeated exactly. Real models are less predictable, which is why you test them; a toy result says nothing about a real model.
What you will learn
- How to read a provider's official prompt guide before adopting a technique, and what to record about it.
- How to keep one shared prompt core with small, named adaptations, and how to decide whether a variant is needed.
- How to run the same test cases on several targets and on two snapshots of one target, in English and in Bangla.
- Which behaviours and features you must not depend on, and how to write a compatibility checklist and a differences record.
Read the official guide before you adopt a technique
Read official prompt guides before adopting a technique. A blog post or a screenshot tells you that a trick worked once, for someone, on some model. The provider's guide tells you what the vendor says about its own models today. Before you copy a technique into a product, fill in a small intake card.
| Question | Why it matters |
|---|---|
| Which model or mode is the advice written for? | Advice for a model that thinks before answering can hurt a model that does not. |
| What exactly does the guide say, and where? | Quote it and record the date; guides change. |
| Does it show an example you can run? | An example turns advice into a test case. |
| Do the other providers you use say the same? | Agreement across guides marks a pattern that probably transfers. |
| How will you test it on your cases? | No technique is adopted until it passes your own tests. |
Provider note (as of 2026-10-12): OpenAI's prompt-engineering guide says reasoning models do better with high-level guidance, while GPT-style models need more explicit, precise instructions, and it advises pinning production apps to specific model snapshots and building evals. Anthropic keeps per-model prompting pages and notes that behaviour differs between models, for example verbosity, how literally instructions are followed and how effort is calibrated. Google's prompting-strategies page includes advice specific to its newest model family. Open-weight models use chat templates that are described on each model's card. Guides move and old links redirect, so start from each provider's documentation home and check the current documentation.
One core, small adaptations
Maintain separate adaptations when providers behave differently, and evaluate whether a prompt needs provider-specific variants. The goal is a shared core that states the task, and a short list of extra lines per target that exist only because a test failed. Compare two ways to organise a prompt for three targets.
Weak prompt:
Classify the ticket. IMPORTANT!!! Output JSON only. No intro. No code fences. No chat. Be
literal. Think step by step but do not show steps. Never apologise. JSON ONLY!!!This is one prompt carrying every worry about every model. Nobody can tell which line fixes which failure, so nobody dares to remove one, and the next model update makes some lines wrong.
Better prompt:
Classify the support ticket as one of: billing, delivery, other.
Reply in the language of the ticket, in one short sentence.
Return a JSON object with the keys "label" and "reply".
Return no text before or after the JSON object.The first three lines are the core and belong to every target. The last line is an adaptation: it is there because a test showed that one target adds a friendly sentence before the JSON. In the next code block the adaptations live in a table keyed by target, each with its reason, and the toy targets show the idea.
Test the same cases on every target
The block defines four test cases (two in English, two in Bangla), the core prompt, three toy targets and a checker. The Bangla tickets mean "My parcel has still not arrived" and "Money was taken from me twice". Each toy is a stand-in: toy_a returns bare JSON and understands Bangla keywords; toy_b adds a sentence before the JSON unless told not to, and knows English keywords only; toy_c wraps the JSON in a code fence unless told not to.
import json
LABELS = ("billing", "delivery", "other")
CASES = [ # (id, ticket, expected label, script the reply should use)
("en-late", "My parcel is late again.", "delivery", "latin"),
("en-twice", "I was charged twice. Please refund one payment.", "billing", "latin"),
("bn-late", "আমার পার্সেল এখনো আসেনি।", "delivery", "bengali"), # my parcel has not arrived yet
("bn-twice", "আমার কাছ থেকে দুইবার টাকা কেটে নেওয়া হয়েছে।", "billing", "bengali"), # money taken twice
]
CORE = ("Classify the support ticket as one of: billing, delivery, other.\n"
"Reply in the language of the ticket, in one short sentence.\n"
'Return a JSON object with the keys "label" and "reply".\n')
ADAPT = { # target -> (extra line, reason it exists)
"toy_a": ("", "none needed"),
"toy_b": ("Return no text before or after the JSON object.", "adds an intro sentence"),
"toy_c": ("Use no code fence.", "wraps the JSON in a fence"),
}
BENGALI = range(0x0980, 0x0A00)
def answer(prompt, knows_bangla, fix=str):
ticket = prompt.split("Ticket:\n")[1]
words = {"billing": ["refund", "charged"], "delivery": ["parcel", "late"]}
if knows_bangla:
words["billing"].append("টাকা")
words["delivery"].append("পার্সেল")
label = next((k for k, ws in words.items() if any(w in ticket.lower() for w in ws)), "other")
bn = any(ord(c) in BENGALI for c in ticket)
reply = "আপনার অনুরোধ পেয়েছি।" if bn else "We received your request." # the Bangla text says the same
return json.dumps({"label": fix(label), "reply": reply}, ensure_ascii=False)
def toy_a(prompt): return answer(prompt, True)
def toy_a_v2(prompt): return answer(prompt, True, str.upper) # a later snapshot of toy_a
def toy_b(prompt):
out = answer(prompt, False)
return out if "no text before or after" in prompt else "Sure! Here is the JSON:\n" + out
def toy_c(prompt):
out = answer(prompt, True)
return out if "no code fence" in prompt else "```json\n" + out + "\n```"
def check(reply, label, script):
try:
data = json.loads(reply)
except ValueError:
return "not-json"
if not isinstance(data, dict) or set(data) != {"label", "reply"}:
return "bad-keys"
if data["label"] not in LABELS:
return "bad-label"
if data["label"] != label:
return "wrong-label"
if any(ord(c) in BENGALI for c in data["reply"]) != (script == "bengali"):
return "wrong-script"
return "ok"
def run(targets, adapted):
rows = {}
for cid, ticket, label, script in CASES:
rows[cid] = {}
for name, fn in targets.items():
extra = ADAPT[name.split("_v")[0]][0] # a snapshot shares its target's line
prompt = CORE + (extra + "\n" if adapted and extra else "")
rows[cid][name] = check(fn(prompt + "Ticket:\n" + ticket), label, script)
return rows
def show(rows):
names = sorted(next(iter(rows.values())))
print("case".ljust(10) + "".join(n.ljust(13) for n in names))
for cid, cells in rows.items():
print(cid.ljust(10) + "".join(cells[n].ljust(13) for n in names))
TARGETS = {"toy_a": toy_a, "toy_b": toy_b, "toy_c": toy_c}
before, after = run(TARGETS, False), run(TARGETS, True)
print("core prompt only"); show(before)
print("core + adaptations"); show(after)core prompt only
case toy_a toy_b toy_c
en-late ok not-json not-json
en-twice ok not-json not-json
bn-late ok not-json not-json
bn-twice ok not-json not-json
core + adaptations
case toy_a toy_b toy_c
en-late ok ok ok
en-twice ok ok ok
bn-late ok wrong-label ok
bn-twice ok wrong-label ok Read the two tables as test reports. With the core prompt alone, toy_b and toy_c fail every case with not-json, although both "know" the answer: only the wrapping is wrong. One extra line fixes each of them, so those two are prompt differences and a small variant is the right response. After adaptation toy_b still fails both Bangla cases with wrong-label. No wording fixes that, because the stand-in does not understand the language. That is a capability gap: the right response is a different model for those tickets, a routing rule, or a documented limit, not a longer prompt.
The checker is also your prompt compatibility checklist, written as code so it is applied the same way every time:
| Checklist item | Check in the code |
|---|---|
| Output is only the requested format | not-json |
| Exact keys, no extra fields | bad-keys |
| Allowed values only (an enum) | bad-label |
| Correct decision on known cases | wrong-label |
| Reply in the user's language and script | wrong-script |
| Prompt, model identifier and date recorded with every result | the snapshot and tested fields in the records below |
Add rows from your own failures: a length limit, a refusal that should not happen, a stop reason that signals a cut-off.
Two snapshots of one target
Compare model snapshots using the same test cases. Providers publish dated or numbered snapshots of a model, and an alias such as "latest" can move to a new one without any change on your side. Pin the snapshot you tested, and rerun the unchanged cases before you move. Here toy_a_v2 is a stand-in for a later snapshot of toy_a that changed one small thing:
snaps = run({"toy_a": toy_a, "toy_a_v2": toy_a_v2}, False)
for cid, cells in snaps.items():
print(cid.ljust(10) + cells["toy_a"].ljust(8) + cells["toy_a_v2"])en-late ok bad-label
en-twice ok bad-label
bn-late ok bad-label
bn-twice ok bad-labelNothing in the prompt changed, yet every case now fails, because the new snapshot writes the label in capital letters. A strict checker catches it at once; a person reading a few replies by eye would call them fine. Real snapshot changes are usually subtler (a little longer, a little more cautious), which is why the case set must be fixed and stored, and why every stored result carries the model identifier.
Instruction following in English and in a second language
Test instruction following across English and a second language, here Bangla. Put the same task in both languages in one test set and keep the instructions in English, as the prompts in this tutorial do, unless you have a reason to translate them. Compare the languages on four things: the decision (label), the format (JSON keys), the reply language, and the script of the reply. The matrix above did exactly this, and it found a failure that English-only tests would hide: toy_b passes both English cases and fails both Bangla ones.
Two cautions for real models. Mixed-language and Romanised input (Bangla written in Latin letters) is a separate test case with its own expected behaviour; see Prompting in Your Own Language: Native Script, Romanised and Mixed Text. And do not assume how much a Bangla text costs in tokens or context: measure it with your provider's token counter, because it differs by provider and model.
Behaviour you must not depend on
Avoid depending on undocumented prompt behaviours, and identify model-specific features that cannot be ported directly. An undocumented behaviour is something that happens to work today and that no guide promises: a phrase that "makes it concentrate", a hidden sampling default, the exact words of a refusal. Treat it as a favour that the vendor can take away at the next update.
| You are relying on | Safer approach |
|---|---|
| A magic phrase or capital letters | State the requirement plainly and test it |
| The exact wording of a reply | Check structure and values, not sentences |
| A setting's default value | Set what you need explicitly, if the model accepts it |
| Output you saw once | Run the case set several times and count |
| A feature only one provider has (thinking depth, cache markers, schema-constrained output) | Keep it in the adapter layer, with a prompt-and-validator fallback in the core |
Provider note (as of 2026-10-12): Thinking depth has a different vocabulary per provider. OpenAI documents a
reasoning.effortsetting. Anthropic documents adaptive thinking with aneffortsetting, and says the older manualbudget_tokensis deprecated and returns an error on its newest models. Google documentsthinking_level. Sampling settings also differ: OpenAI says to removetemperatureandtop_pwhen reasoning effort is notnone; Anthropic says a non-defaulttemperature,top_portop_kreturns an error on some current models; Google recommends keeping them at their defaults for its newest family. Cache markers and structured-output schemas are also provider-specific, and each supports only a subset of JSON Schema. Check the current documentation.
Recording known differences
Record known differences between tested models so the next person does not rediscover them, and so the decision about variants has evidence behind it. The function below turns the two matrices into records and applies one rule from this page: no failure means the shared prompt works; failures that disappear after an adaptation mean keep a small variant; failures that remain mean the variant is not enough.
def decide(bad_before, bad_after):
if not bad_before:
return "shared prompt works"
return "keep a small variant" if not bad_after else "variant is not enough: change model or route"
records = []
for name in sorted(TARGETS):
bad_before = [c for c, cells in before.items() if cells[name] != "ok"]
bad_after = [c for c, cells in after.items() if cells[name] != "ok"]
records.append({"target": name, "snapshot": "toy-1", "tested": "2026-10-12",
"fails_core": bad_before, "fails_adapted": bad_after,
"decision": decide(bad_before, bad_after)})
for record in records:
print(json.dumps(record, ensure_ascii=False, sort_keys=True)){"decision": "shared prompt works", "fails_adapted": [], "fails_core": [], "snapshot": "toy-1", "target": "toy_a", "tested": "2026-10-12"}
{"decision": "variant is not enough: change model or route", "fails_adapted": ["bn-late", "bn-twice"], "fails_core": ["en-late", "en-twice", "bn-late", "bn-twice"], "snapshot": "toy-1", "target": "toy_b", "tested": "2026-10-12"}
{"decision": "keep a small variant", "fails_adapted": [], "fails_core": ["en-late", "en-twice", "bn-late", "bn-twice"], "snapshot": "toy-1", "target": "toy_c", "tested": "2026-10-12"}Store these lines next to the prompt (a JSONL file in version control works well; see Git, APIs and Backend for AI: Advanced for prompt and model version tracking). When a snapshot changes, rerun, add new lines, and keep the old ones: the history shows which differences are stable and which move.
Where this shows up at work
A team that supports two model vendors for resilience keeps one core prompt, a table of per-target lines with reasons, and a nightly run of the case set. A migration to a new model snapshot is then a pull request with a before-and-after matrix. A product that serves Bangla and English customers includes both in every release test, because a language gap is invisible to an English-only team.
Common mistakes
- Copying a technique from a post without reading the guide. It may be written for another model or mode. Read the source, record the date, run your cases.
- One prompt with every fix inside. Nobody knows which line matters. Keep a core plus named adaptations, each with its reason.
- Trying to fix a capability gap with wording. If longer prompts do not move a failing case, change the model, route those cases, or document the limit.
- Testing in English only. Add every language you serve to the case set, with an expected result for each.
- Using an alias and no record. Pin the tested snapshot and store its identifier with every result.
Try it yourself
Use the code from this page; the blocks share one namespace. The exercises revisit the adapter idea from Instruction Hierarchy and Message Roles: System, Developer and User.
- Easy. Look at the "core prompt only" table. Name each failure kind that appears and say, for each, whether a prompt line or a different model is the right response.
- Medium. Add a stand-in snapshot
toy_c_v2that behaves liketoy_cbut returns an extra key"confidence". Run the adapted matrix fortoy_candtoy_c_v2and say what the failure tells you. - Hard. Adapt one prompt to three provider interfaces. Write
adapt(rules, ticket, shape)for three neutral shapes:role_message(rules as a message with roledeveloper),system_field(rules in a top-levelsystemfield) andsingle_box(no separate rules slot: one user text with labelled sections, plus the extra "no text before or after" line). Print all three as JSON and check that the ticket text is identical in all of them.
Answers
Easy. not-json (toy_b and toy_c) is a format difference, so add one line per target. wrong-label for the Bangla tickets of toy_b appears only after the format is fixed, and it is a capability gap, so route or change the model. Pass checklist: you separated format failures from capability failures, and you saw that fixing the first kind exposed the second.
Medium.
def toy_c_v2(prompt):
data = json.loads(toy_c(prompt))
data["confidence"] = 0.9
return json.dumps(data, ensure_ascii=False)
for cid, cells in run({"toy_c": toy_c, "toy_c_v2": toy_c_v2}, True).items():
print(cid.ljust(10) + cells["toy_c"].ljust(8) + cells["toy_c_v2"])en-late ok bad-keys
en-twice ok bad-keys
bn-late ok bad-keys
bn-twice ok bad-keysPass checklist: toy_c_v2 fails with bad-keys on all cases although its labels are right; you explained that a downstream parser would break on an unexpected field, so the checker, not eyeballing, found it; you decided whether to add a prompt line ("use exactly these two keys") or to allow extra keys in the checker.
Hard. One possible solution:
RULES = CORE.split("Ticket:")[0] + ADAPT["toy_b"][0]
def adapt(rules, ticket, shape):
if shape == "role_message":
return {"input": [{"role": "developer", "content": rules}, {"role": "user", "content": ticket}]}
if shape == "system_field":
return {"system": rules, "messages": [{"role": "user", "content": ticket}]}
return {"messages": [{"role": "user", "content": "Rules:\n" + rules + "\n\nTicket:\n" + ticket}]}
ticket = CASES[2][1]
built = {s: adapt(RULES, ticket, s) for s in ("role_message", "system_field", "single_box")}
for shape, request in built.items():
print(shape, sorted(request), len(json.dumps(request, ensure_ascii=False)))
print(all(ticket in json.dumps(r, ensure_ascii=False) for r in built.values()))role_message ['input'] 341
system_field ['messages', 'system'] 320
single_box ['messages'] 327
TruePass checklist: the rules string is built once; only the wrapping differs between shapes; the ticket appears unchanged in all three; the field names are neutral labels and the real names for each provider come from its documentation. In a real project you would run the same case matrix through each of the three wrappers before use.
Summary
- Read the provider's guide and record the model, the quote and the date before you adopt a technique; then test it on your own cases.
- Keep a shared core plus small named adaptations. Separate prompt differences (fixable with a line) from capability gaps (not fixable by wording).
- Run the same fixed cases on every target and on every snapshot, in English and in each other language you serve, and check results with code.
- Do not depend on undocumented behaviour; keep provider-only features in an adapter layer with a fallback.
- Record differences with the snapshot and date, and rerun when anything changes.
Next: Reasoning Task Design: Decomposition, Rationales and Intermediate Schemas shows how to design tasks that need several steps, and when a direct instruction is enough.

