LLM Selection Guide: Evaluating Cost and Effectiveness Together
This guide helps engineering teams turn the subjective feeling that an LLM “works well” into measurable selection criteria. It covers five evaluation dimensions, how to interpret public usage and cost data, how to build a representative eval set, and how to calculate the real cost of a single task—including retries, context expansion, and manual review.
Breaking “Feels Right” into Measurable Metrics
“Feels right” is subjective, but it usually comes from several objective factors: whether answers are accurate, whether responses are fast enough, whether a single task is affordable, and whether the model can be integrated into existing systems reliably. Without separating these factors, model selection easily turns into personal preference or a trending-topic debate, and the conclusion is hard to reuse or defend.
The first step is to convert “feels right” into a set of measurable indicators. At minimum, cover five categories:
- Task quality: accuracy on real business samples, code pass rate, and instruction-following rate.
- Cost: input and output token consumption per task, plus the corresponding billed amount.
- Latency: time to first token and total output time, which determine whether the interaction is acceptable.
- Stability: performance with long contexts, consistent output formatting, and result variance across repeated identical inputs.
- Engineering fit: support for tool calling, structured output, streaming responses, and data compliance requirements.
How to Read the Relationship Between Usage and Cost
Public model usage leaderboards often report both usage and cost. The relationship between those two numbers deserves separate attention.
Usage reflects how often a model is called. It is influenced by product integration, price, task type, and developer habits; it is not a direct measure of model quality. Cost is the actual amount paid, and it equals token volume multiplied by unit price. Therefore, the ratio of a model’s cost share to its usage share can be used as an approximate relative unit price:
relative unit price index = cost share ÷ usage share
If the index is clearly greater than 1, the model has a higher per-token price, and users are paying a premium for its capability or stability. If it is clearly less than 1, the model is handling a large volume of requests at a lower unit price. This “high volume, low price” or “low volume, high price” structure cannot by itself determine whether a model is good or bad; it must be considered together with task quality.
Three caveats are worth noting when reading leaderboards:
- Most leaderboard figures are estimates; the counting method and time window affect the results.
- High usage may simply mean that a model is the default choice in a popular tool.
- Different versions of the same model can differ significantly in price and performance, so versions must be aligned when comparing.
Build Your Own Evaluation Set
Public leaderboards answer “what is everyone else using?” Model selection should answer “what is best for my workload?” The most effective way is to build an evaluation set aligned with your own use cases.
3.1 Collecting Samples
Extract samples from real logs or business workflows, and cover the main task types:
- Code generation and modification.
- Document summarization and information extraction.
- Knowledge-base Q&A.
- Strict structured output, such as JSON field extraction.
- Instruction following in multi-turn conversations.
Aim for at least 30 cases per category, with expected results or scoring criteria. The sample size does not need to be huge at the start, but it must be representative. Avoid selecting only easy tasks, because that will systematically overestimate model capability.
3.2 Scoring Methods
Scoring can be done at three levels:
- Rule-based scoring: suitable for tasks with standard answers, such as checking whether required fields are present, whether generated code passes unit tests, or whether numeric values are correct.
- Human review: suitable for open-ended answers. Define a clear rubric, have at least two reviewers score independently, and calculate the agreement between reviewers.
- Model-assisted review: one model can score another model’s output, but watch for preference bias, such as a tendency to prefer longer responses, and use human checks on sampled results.
The following is a minimal evaluation skeleton. The model call function is passed in by the caller, so it can adapt to any API:
from dataclasses import dataclass@dataclassclass EvalCase:prompt: strexpected: strdef run_eval(model_call, cases):passed = 0for case in cases:output = model_call(case.prompt)if case.expected in output:passed += 1return passed / len(cases)
In a real project, keyword matching can be replaced by stricter validation, such as parsing JSON structure with a parser, or running generated code and checking test results.
Calculate the True Cost of a Single Task
Most models charge separately for input tokens and output tokens, and output tokens are usually more expensive. Therefore, cost comparison should be based on “cost per task” rather than the unit price list alone.
def estimate_cost(input_tokens, output_tokens,price_in_per_m, price_out_per_m):"""price_*_per_m is the price per million tokens; the currency unit follows the input."""return (input_tokens / 1_000_000 * price_in_per_m+ output_tokens / 1_000_000 * price_out_per_m)
Suppose a model costs 2 yuan per million input tokens and 8 yuan per million output tokens. A task with 3,000 input tokens and 800 output tokens has a single-task cost of:
3000 / 1,000,000 × 2 + 800 / 1,000,000 × 8 = 0.0124 yuan
These prices are only for illustration; use the provider’s published billing rules for actual values.
The calculation should also account for:
- Costs from retries and failed requests.
- Input expansion caused by context concatenation, especially in multi-turn and retrieval-augmented workflows.
- Discounts from cache hits and batch calls.
- Cost of manual review. A model with lower token spend may increase human time.
Using cost per valid result, defined as single-task cost ÷ task pass rate, often reflects cost-effectiveness better than price alone. For example, if one model has a lower cost per call but only half the pass rate of another, the actual cost per valid result is higher.
