LLM Version Retirement: Replacement Model Evaluation and Canary Migration
When an LLM version is retired, teams need a structured way to evaluate replacement models and migrate traffic safely. This article covers the drivers behind frequent version retirements, four evaluation dimensions—quality, cost, latency, and stability—a reusable evaluation workflow with sample code, methods to control reasoning-output costs, a step-by-step canary migration process with stable hashing, common pitfalls, and a suggested timeline.
1. Why Model Versions Are Retired Frequently
Large language model services usually expose capabilities by version. Each version is tied to specific inference resources, billing standards, and behavioral characteristics. Once a new version matures, the service provider gradually reduces investment in older versions and sets a clear retirement date. This is common in the industry and is mainly driven by three factors.
The first is cost structure. A high-performance tier consumes significantly more compute per inference than a lightweight tier. When the intensity of certain calls continues to rise, the provider may want to shift primary traffic to a more cost-effective version and reduce compute losses.
The second is resource competition. Inference clusters are shared resources. A small number of high-intensity callers can consume substantial compute and increase response latency for other users. Providers often reallocate resources by adjusting quotas, adding rate limits, or retiring older versions.
The third is technical iteration. Improvements in model architecture and inference infrastructure may allow a new version to outperform an older one in both speed and quality. As the marginal benefit of maintaining the old version declines, migration becomes a natural choice.
For users, a retirement notice means evaluation and cutover must be completed within a limited time window. Building an evaluation framework in advance is more reliable than reacting at the last minute.
2. Four Evaluation Dimensions for Replacement Models
When evaluating candidate models, do not rely only on general benchmark scores. It is better to break the evaluation into four dimensions: quality, cost, latency, and stability. Each dimension should have quantifiable metrics.
2.1 Quality
Quality metrics should map directly to business outcomes. For code generation tasks, measure unit test pass rate. For customer service tasks, measure human ratings and issue resolution rate. For information extraction tasks, measure field-level accuracy. General benchmark scores can serve as references, but they cannot replace business-specific testing.
2.2 Cost
The cost of a single call is determined by the number of input tokens, the number of output tokens, and their respective unit prices. Some models include reasoning-process tokens in their output, and those tokens are also billed. As a result, the actual cost of the same task on two models can differ significantly even when their listed prices are close.
Estimate per-task cost as follows:
Per-task cost = input tokens × input unit price + output tokens × output unit price
The output token count must include tokens used by the reasoning process; otherwise, the estimate will be systematically low.
2.3 Latency
Latency should be split into two metrics. Time to first token (TTFT) determines the response speed perceived by users and is especially important in streaming scenarios. Tokens per second (TPS) determines the total time required to return long text. Both metrics should be observed at percentiles such as P50, P95, and P99, not just averages. Averages hide long-tail requests, while user complaints usually concentrate in the long tail.
2.4 Stability
Stability includes rate-limiting frequency, timeout rate, error code distribution, and output consistency for the same prompt across different time periods. These metrics determine whether a model can enter the production path directly.
3. Building a Reusable Evaluation Workflow
The sample code below shows a simplified evaluation workflow. It calls both the candidate model and the current model with the same set of samples and records accuracy, per-task cost, and tail latency. The client, model identifiers, and judge function are placeholders and should be replaced with the team’s own wrappers in actual use.
import timefrom dataclasses import dataclass@dataclassclass Sample:prompt: strexpected: str@dataclassclass CaseResult:correct: boollatency_s: floatinput_tokens: intoutput_tokens: intdef run_case(client, model_name, sample, judge):# This records total call latency. To measure TTFT, use a streaming interface and record the arrival time of the first chunk.start = time.perf_counter()resp = client.complete(model=model_name, prompt=sample.prompt)latency = time.perf_counter() - startreturn CaseResult(correct=judge(resp.text, sample.expected),latency_s=latency,input_tokens=resp.usage.input_tokens,output_tokens=resp.usage.output_tokens,)def summarize(results, price_in, price_out):n = len(results)accuracy = sum(r.correct for r in results) / ncost_per_task = sum(r.input_tokens * price_in + r.output_tokens * price_outfor r in results) / nlatencies = sorted(r.latency_s for r in results)p95_latency = latencies[min(int(0.95 * (n - 1)), n - 1)]return {"accuracy": accuracy,"cost_per_task": cost_per_task,"p95_latency_s": p95_latency,}
When using this workflow, keep three points in mind.
First, the sample set should be stratified by business scenario and include at least simple, medium, and complex tasks. Using only simple samples will overestimate model capability, while using only complex samples will underestimate cost-effectiveness.
Second, the old and new models must use exactly the same prompts, parameters, and judging criteria. Otherwise, the comparison is meaningless.
Third, the sample size must be large enough to support percentile statistics. With too few samples, P95 is almost equivalent to the maximum value, and conclusions become unstable.
4. Controlling the Cost of Reasoning Output
Some models produce a long reasoning process before giving an answer. This type of output is helpful for complex problems but often wasteful for simple ones. Common governance methods include the following four approaches.
- Task-tier routing. Route simple tasks to lightweight models and send only complex tasks to high-performance models. Tiering can be based on task type, input length, or historical failure rate.
- Output length constraints. Specify answer format and length requirements clearly in the prompt. If the API supports an output limit parameter, determine a reasonable threshold during evaluation.
- Result caching. Reuse historical results for identical or highly similar requests to reduce costs caused by repeated inference.
- Prompt simplification. Remove redundant background descriptions and examples to reduce input token count.
Note that setting the output limit too low can truncate valid content. Thresholds must be validated with an evaluation set rather than set by experience alone.
5. Implementation Steps for Canary Migration
Migration should not switch all traffic at once. The following four steps are recommended.
Step 1: Abstract the model invocation layer. Business code should not hardcode model identifiers; instead, read them from configuration. This way, switching models only requires a configuration change, not a code redeployment.
Step 2: Run shadow comparisons. For a period of time, send the same request to both the old and new models. Return only the old model’s result to users, and store the new model’s result offline for quality and cost comparison.
Step 3: Roll out a small canary percentage. Bucket by user or request and gradually increase the new model’s traffic share, for example starting at 5%. At each stage, observe accuracy, latency percentiles, and error rate.
Step 4: Keep a rollback switch. If a key metric crosses a predefined threshold, it should be possible to restore the old configuration within minutes.
Use a stable hash function for bucketing so that the same user consistently hits the same model during the canary period and does not experience inconsistent behavior. Sample code:
import hashlibdef pick_model(user_id: str, canary_ratio: float) -> str:# Stable hash bucketing based on user ID; the same user's assignment remains unchanged during the canary period.digest = hashlib.sha256(user_id.encode("utf-8")).hexdigest()bucket = int(digest[:8], 16) / 0xFFFFFFFFreturn "candidate-model" if bucket < canary_ratio else "current-model"
6. Common Pitfalls
Pitfall 1: Looking only at unit price. A low unit price does not mean a low per-task cost. Output length, reasoning process, and retry count all affect total cost.
Pitfall 2: Looking only at average latency. Averages hide long-tail requests; P95 and P99 are closer to the real user experience.
Pitfall 3: Using general benchmarks instead of business evaluation. The task distribution in benchmarks may differ greatly from business data, so conclusions need to be validated with your own samples.
Pitfall 4: Hardcoding model identifiers in code. When versions iterate frequently, this turns every switch into a code change.
7. Suggested Timeline
After a retirement announcement is published, the following pace can be used. The exact timing should be adjusted according to the actual announcement.
- Week 1: Organize business samples, build a stratified evaluation set, and record baseline metrics for the current model.
- Week 2: Run offline evaluations on candidate models, compare accuracy, per-task cost, and tail latency, and determine the routing strategy.
- Week 3: Complete the model invocation layer refactor, enable shadow comparisons, and collect online data.
- Week 4: Increase the canary ratio in stages and prepare for the version retirement deadline.
