By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Nobody keeps a model forever. The provider deprecates a snapshot, a cheaper model appears, a tenant contract demands data residency in another region, or a capability the product needs only exists elsewhere. A model or provider migration is a release with two systems in it and a data contract between them, and the failures it causes are rarely crashes. They are quieter: structured output that parses slightly differently, a tokenizer that changes costs and truncation, tool-call shapes that move, refusals on requests that used to be allowed, a p95 that doubles under the same load.
Step 24 gave you versioned prompts, models and configs, and step 25 gave you canaries. This lesson is the operating procedure that uses both: an eval-and-shadow ladder, a comparison of the dimensions that actually differ between models, a rule to change one variable at a time, and a rollback that is a configuration flip rather than a deploy.
| Dimension | How it breaks | What to check |
|---|---|---|
| Tokenizer and context limit | The same text costs different tokens, and a long prompt starts truncating — often silently, before the model is even called | Truncation counters, long-case evals, tokens per request against the old snapshot |
| Structured output | Schemas that used to validate now fail, or the model fills optional fields differently | Parse-failure rate in eval and shadow, schema conformance per field |
| Tool calling | Argument shapes, ordering or parallel calls change, and the approval gate sees a shape it does not recognise | Tool-contract tests against the approval path, not just against the model |
| Refusals and policy | Legitimate requests are refused, or safety coverage weakens on the slices that matter | Safety slice results and the refusal rate on the golden set |
| Cost and latency | Unit economics move: the candidate is cheaper per token but longer per answer | Cost per successful request and p95 end-to-end, not price per token |
| Residency and retention | The new provider logs or stores data somewhere the tenant contract does not allow | Vendor register, DPA terms and the retention configuration |
The gate compares candidate and baseline directly, and it fails closed on safety before it looks at the average. A migration that improves the mean while breaking one approval case is not a migration you promote; it is a finding.
from dataclasses import dataclass
@dataclass(frozen=True)
class EvalRun:
alias: str
passed: int
total: int
safety_passed: bool
p95_ms: int
def migration_gate(baseline: EvalRun, candidate: EvalRun) -> dict:
baseline_score = baseline.passed / baseline.total
candidate_score = candidate.passed / candidate.total
checks = {
"safety_cases_pass": candidate.safety_passed,
"score_not_worse": candidate_score >= baseline_score - 0.005,
"latency_within_budget": candidate.p95_ms <= int(baseline.p95_ms * 1.25),
}
return {
"candidate": candidate.alias,
"score": round(candidate_score, 3),
"checks": checks,
"promote": all(checks.values()),
}
baseline = EvalRun("wp-update@v8", passed=108, total=120, safety_passed=True, p95_ms=1800)
candidates = [
EvalRun("candidate-a@v1", passed=106, total=120, safety_passed=True, p95_ms=2100),
EvalRun("candidate-b@v1", passed=112, total=120, safety_passed=False, p95_ms=1700),
EvalRun("candidate-c@v1", passed=110, total=120, safety_passed=True, p95_ms=2150),
]
for candidate in candidates:
print(migration_gate(baseline, candidate))A migration mixes two variables: the model contract and the prompt written for the old contract. If you change both at once, a score movement cannot be attributed and a rollback has to restore two things. Prefer this order: adapt the prompt on the old model first and ship it through the normal gate; then swap the model with the prompt frozen. If the prompt genuinely only works on the new model, the change is a combined release: full offline eval, shadow, canary, and an explicit note that attribution is limited.
During the canary, resist the urge to tune the prompt in response to individual complaints. Each edit creates a new fingerprint and invalidates the evidence the ramp is based on. Collect the cases, fix them in the next version, and run the ladder again.
Production never calls a floating latest. It calls a logical alias that resolves through a versioned alias map to a pinned snapshot. The trace records both the requested alias and the resolved snapshot, so an auditor can reconstruct exactly what served a request. Rollback is editing the alias map back to the previous snapshot, recording a new manifest and re-running the smoke eval. No deploy, no prompt edit, no rebuild.
Rehearse the flip before the migration window opens. A rollback path that has never been exercised is a diagram, and provider-side deprecations can make the old snapshot unavailable exactly when you need it. Keep the fallback ladder from step 8 updated with the new provider and its break-glass behaviour.
Key takeaways
A model migration is a release with two systems: freeze the baseline, then move through offline eval, shadow, canary and alias cut-over with recorded exit criteria.
Compare the dimensions that break quietly — tokenizer and truncation, structured output, tool-call shapes, refusals, unit cost and latency, residency and retention.
Fail closed on safety before reading the average, and read per-slice scores so a better mean cannot hide a broken approval case.
Change one variable at a time; if the prompt must change for the new model, run a prompt-only release first or declare the combined release and limit attribution.
Rollback is a versioned alias flip to a pinned snapshot, rehearsed before the migration window and visible in every trace.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.