How to Evaluate Speed and Cost Efficiency After Upgrading Your LLM
Evaluating a newly released Large Language Model (LLM) requires more than just comparing vendor claims. This article provides a comprehensive framework to assess output speed, cost per successful task, and capability stability. Learn how to set up reproducible benchmarks, calculate true cost efficiency, and execute a safe canary migration with clear rollback conditions.
1. Metric Definitions
First, separate the three main categories of metrics. Clearly define the start point, end point, and statistical method for each metric; otherwise, the numbers derived by different teams cannot be compared.
1.1 Output Speed
This metric answers “How long does the user wait, and how long does the task take to complete?” It is not suitable for judging the reasoning quality of the model.
- Time To First Token (TTFT): The time from sending a request to receiving the first output token. It determines the perceived responsiveness for the user.
- Generation Throughput (TPS): The number of tokens output per second during the generation phase. It determines the time required to finish writing long texts.
- End-to-end Latency: The time from sending a request to receiving the complete result, including network, queuing, and generation time.
Different scenarios focus on different metrics:
| Scenario | Primary Metric | Secondary Metric | Reason |
|---|---|---|---|
| Real-time customer service | TTFT | End-to-end latency | Users stare at the screen waiting for the first sentence |
| Long-form generation | TPS | End-to-end latency | The longer the text, the greater the impact of throughput |
| Background batch processing | End-to-end latency (Total throughput) | Success rate | Focus on completing the entire batch on time |
When vendors claim an “output speed increase of about 30%”, you should first confirm which specific metric they are referring to.
1.2 Unit Cost
This metric answers “How much does it cost to complete a task?” It is not suitable for comparisons that only look at the unit price.
LLMs typically price input and output tokens separately, with the output unit price generally higher than the input unit price. Therefore, for the same task, the cost depends on the quantity of both token types. The formula for calculating the cost of a single request is as follows:
Single Cost = Input Token Count / 1,000,000 × Input Unit Price + Output Token Count / 1,000,000 × Output Unit Price
If the new version outputs longer text, the same task will consume more output tokens, potentially offsetting the benefits of a lower unit price. Therefore, comparing only unit prices is insufficient; you need to use the “Cost per Successful Task” from Section 3 to make a judgment.
1.3 Capability Stability
This metric answers “Is the output reliable, and can it directly enter the downstream system?” Public benchmark scores only indicate a general level and cannot replace validation on your own task set. The inspection items are as follows, scored by pass rate:
- Instruction following: Whether it strictly outputs in the required format, fields, and length.
- Structured output stability: Whether the JSON can pass the target Schema validation. Record the Schema pass rate, number of retries, and final failure rate.
- Factual consistency: Whether the answer is consistent with the input materials. Mark fabricated content during spot checks.
- Refusal and safety: Whether requests that should be refused are refused, and whether requests that should not be refused are mistakenly blocked.
It is recommended to manually review a sample of no less than 200 items for each category. If the sample size is too small, the fluctuation of a single result may mask the true difference.
2. Reproducible Evaluation
Evaluation results must be reproducible; otherwise, comparing old and new versions is meaningless. For each test, fix the following parameters and record them:
- Model version: Record the full version number or snapshot name, do not just write “latest”.
- Sampling parameters: Keep temperature, top_p, and max_tokens consistent.
- Concurrency: For example, fix it at 8 concurrent requests, using the same value for both versions.
- Input length distribution: Set proportions by short, medium, and long tiers (e.g., 30% short, 50% medium, 20% long) and record the average token count for each tier.
- Repetitions: Repeat the same batch of tasks for at least 3 rounds. Report the median and P95, not just the average.
- Warmup: Send 20 requests before each round and discard the results to avoid cold start effects on the first round’s data.
- Network and time: Use the same test machine location, testing one round each during peak and off-peak hours.
The unified measurement criteria are as follows:
- TTFT: The time from sending the request to receiving the first output token.
- TPS: Total output token count divided by the generation phase duration (from the first token to the last token).
- End-to-end latency: The time from sending the request to receiving the complete response, including queuing and network.
- Success rate: The number of requests passing acceptance (both format validation and manual spot check qualified) divided by the total number of requests.
Record table template:
| Round | Version | Concurrency | Sample Size | TTFT Median | TTFT P95 | TPS Median | E2E P95 | Success Rate | Remarks |
|---|---|---|---|---|---|---|---|---|---|
| 1 | Old version snapshot | 8 | 500 | ||||||
| 1 | New version snapshot | 8 | 500 |
The blanks in the table should be filled with measured values. Do not directly enter numbers from vendor documentation.
3. Cost per Successful Task Formula
Cost per successful task is a more reasonable cost metric because it reflects unit price, output length, and success rate simultaneously:
Cost per Successful Task = Total Cost / Accepted Task Count
Total cost includes all actually billed requests, including retries, failed requests, cache misses, and allocated costs for manual reviews. Failed requests are also billed, so you cannot only calculate the spending of successful requests.
The following unit prices are hypothetical values for demonstration and do not represent any vendor’s actual prices. Each task sends one request, excluding retries:
| Solution | Input Unit Price ($/M Tokens) | Output Unit Price ($/M Tokens) | Avg Input Tokens | Avg Output Tokens | Single Cost ($) | Success Rate | Cost per Successful Task ($) |
|---|---|---|---|---|---|---|---|
| Old Version | 2 | 8 | 1200 | 600 | 0.0072 | 90% | 0.0080 |
| New Version | 1.5 | 6 | 1000 | 900 | 0.0069 | 95% | 0.0073 |
Calculation process: The old version’s single cost is 1200 × 2 / 1,000,000 + 600 × 8 / 1,000,000 = $0.0072, and the cost per successful task is 0.0072 / 0.90 = $0.0080. The new version’s single cost is 1000 × 1.5 / 1,000,000 + 900 × 6 / 1,000,000 = $0.0069, and the cost per successful task is 0.0069 / 0.95 ≈ $0.0073.
In this example, the new version’s unit price dropped by about 25%, but the longer output offset part of the benefit, resulting in a final cost per successful task that is still about 9% lower. If the new version’s output were 30% longer, the cost per successful task would rise to about $0.0090, reversing the conclusion. Therefore, the judgment must be calculated using your own task data.
4. Canary Migration and Rollback
4.1 Migration Steps
- Shadow traffic: The new version and old version process the same batch of requests simultaneously, but only the old version’s results are returned. Record the new version’s latency, token count, and format pass rate. Continue for 3 to 7 days, or cover a complete business cycle.
- Small traffic A/B: Assign 5% of real traffic to the new version, keeping the rest on the old version.
- Acceptance: Proceed to the next step after meeting the acceptance thresholds in the table below.
- Scaling: Increase traffic step-by-step at 20%, 50%, and 100%, observing for no less than 24 hours at each level.
- Wrap-up: After full rollout, retain the old version configuration for at least 2 weeks for easy rollback.
Acceptance thresholds (example values, should be adjusted according to business tolerance):
| Metric | Acceptance Condition |
|---|---|
| Success rate | No lower than the old version minus 1 percentage point |
| End-to-end latency P95 | No higher than 110% of the old version |
| TTFT P95 (Conversational) | No higher than 110% of the old version |
| JSON Schema pass rate | No lower than 99% |
| Cost per successful task | Lower than the old version |
| Manual spot check factual or safety issues | No higher than the old version |
4.2 Monitoring Metrics
- TTFT P50, P95
- Generation throughput TPS median
- End-to-end latency P95
- Error rate, including timeouts, 5xx errors, and 429 rate limiting
- JSON parsing failure rate and retry count
- Cost per successful task, statistics by day and by business line
- Manual spot check pass rate
4.3 Rollback Conditions and Actions
Roll back to the old version if any of the following conditions are met:
- Error rate is 2 percentage points higher than the old version, lasting for 15 minutes.
- 429 rate limiting ratio exceeds 1%.
- Manual spot check finds safety or factual issues exceeding 0.5%.
- Cost per successful task exceeds the budget by 20%.
During rollback, use a configuration switch to route traffic back to the old version. Retain the new version’s request logs and spot check records for post-mortem analysis; do not delete historical data.
4.4 Decision Records
A record must be left for each traffic increase:
| Date | Version | Traffic Ratio | Key Metrics | Conclusion | Owner |
|---|---|---|---|---|---|
| New version snapshot | 5% | Continue / Rollback / Pause |
4.5 Risk Warnings
- Migration failure: The new version’s understanding of the same prompt may differ; format, tone, and refusal boundaries may change. You need to run regression tests on prompts using real tasks before migration.
- Cost rollback: Long-tail requests may produce very long outputs, causing a single cost far higher than the average. Budget alerts should be set based on request percentiles.
- Rate limiting: The new version’s quota and concurrency limits may differ from the old version. Confirm quotas before migration.
- Privacy compliance: If the test set contains user data, it must be desensitized first. Do not record plaintext input and output in logs, and ensure cross-border data transmission complies with local regulations.
Vendor claims of an “output speed increase of about 30% and unit usage cost decrease of 20%” are numbers derived relative to a specific baseline. Only by measuring results according to the criteria in this article, under your own task set, parameters, and network conditions, can you determine the actual benefit for your use case.
5. Conclusion
Determining whether a new LLM version is worth migrating to requires measuring speed, cost per successful task, and capability stability separately under the same set of conditions. The recommended sequence is: first fix the evaluation parameters, then use shadow traffic and small traffic for validation, and finally scale up traffic step-by-step according to acceptance thresholds while retaining the ability to roll back at any time. As long as the team retains the records of each round, this process can be directly reused for the next release.
