How to Evaluate a Frontier LLM Scientifically: A Five-Step Framework from Metrics to Cost
A practical five-step framework for evaluating large language models: define evaluation goals, build a four-dimension scorecard, create a private test set, interpret public leaderboards correctly, and calculate true per-task cost.
1. Start with Clear Evaluation Goals
Before evaluating any large language model, write down exactly what problem it needs to solve. The same model can perform very differently across code completion, long-document Q&A, video content understanding, and copywriting, so evaluation should start from your business tasks and work backward to parameters and metrics.
Define your evaluation goals with three items:
- Business task: Something specific like “generate unit tests for internal Java services,” rather than the vague “write code.”
- Success criteria: For example, “the generated tests compile successfully and cover the main branches of the target methods.”
- Constraints: For example, a per-request cost cap, a first-token latency limit, or a rule that inputs must not contain user privacy data.
Success criteria must be quantifiable. Statements like “the answers are more professional” cannot be scored. Break them into actionable rules, such as “referenced interface names match the codebase.”
2. Build a Scorecard Across Four Dimensions
A scorecard should cover four dimension types, each with its own metrics:
| Dimension | Key Question | Common Metrics |
|---|---|---|
| Capability | How well are tasks completed? | Accuracy, step-level accuracy on multi-step reasoning, long-horizon task completion rate |
| Cost | How much does each successful result cost? | Cost per successful task, cache hit rate, average output length |
| Stability & Latency | Are results reproducible and fast enough? | Consistency rate across repeated runs on the same input, P50 and P95 latency |
| Safety & Compliance | Are outputs within bounds and data under control? | Proper refusal rate, number of sensitive-information leakage cases, data retention policies |
Keep measurement conditions fixed. Temperature, system prompts, context length, and tool configurations should stay consistent. Run each sample at least 3 times and record the result distribution instead of relying on a single output.
3. Build Your Own Evaluation Set
Public benchmark questions may not reflect your actual business, so you need a private evaluation set. Each sample can include these fields:
- ID: e.g., T-CODE-001
- Task type: e.g., code completion
- Input: e.g., a function signature plus 40 lines of preceding context
- Scoring rule: e.g., the completion passes the project’s existing unit tests
- Difficulty: easy, medium, or hard
- Source: sanitized historical tickets or code snippets
Write edge cases into your samples. For example, in long-document Q&A with a contract as input, every answer must correspond to a clause in the source text. If the text contains no answer, the correct output should be “not mentioned in the document.” Track these samples separately so the model cannot score by guessing.
Prepare roughly 100 samples per task type, covering all three difficulty tiers. With too few samples, random variation masks real differences. Your evaluation set must never appear in any model’s training data or prompt examples. Sanitize all data before sending it to third-party APIs.
4. Read Public Leaderboards with Their Statistical Assumptions in Mind
Leaderboard rankings are useful references, but verify their premises first. Check the following questions one by one:
- Are the benchmark questions public? Public questions may already exist in training data, inflating scores.
- What is the scoring method? Automated scoring, human review, and LLM-as-judge differ in stability. If an LLM judge is used, confirm which judge model it is.
- How large is the sample? With few samples, score gaps are often just noise.
- Are error bars or multi-run results reported?
- Are prompt templates, few-shot example counts, and tool access consistent across models?
- Is the score gap larger than the error margin?
- Who reproduced the results? Treat vendor self-reported numbers and independent third-party reproductions differently.
Example: with 80% accuracy on 200 samples, a binomial approximation (assuming independent samples) gives a standard error of about 2.8 percentage points and a 95% confidence interval of roughly ±5.5 percentage points. If two models differ by only 2 percentage points, you cannot conclude which one is stronger.
5. Calculate Real Costs
The cost of a single call has two components: input and output. Cache-hit input tokens are typically cheaper than cache-miss tokens. Using unit prices per million tokens:
Cost per attempt = (cache-miss input tokens × input price + cache-hit input tokens × cache price + output tokens × output price) ÷ 1,000,000
Cost per successful task = cost per attempt ÷ pass rate
Failed tasks usually require retries or manual fixes, so the pass rate must be the denominator. A model with a low unit price but a low pass rate may end up costing more per successful result.
Here is a worked example with hypothetical prices that do not represent any provider’s actual pricing. Assume prices per million tokens of 10 for cache-miss input, 2 for cache-hit input, and 40 for output. A call uses 2,000 input tokens—1,500 hitting the cache and 500 missing it—and produces 400 output tokens:
Cost per attempt = (500 × 10 + 1500 × 2 + 400 × 40) ÷ 1,000,000 = 0.024
With a 75% pass rate, cost per successful task = 0.024 ÷ 0.75 = 0.032, or about 32 per 1,000 successful tasks.
When calculating costs, confirm the following:
- Whether a reasoning model’s thinking tokens are billed as output tokens.
- Whether long-context input uses tiered pricing.
- What the cache-hit conditions are—for example, whether the prefix must match exactly, and the minimum cacheable length.
- Providers may calculate billing differently, so final numbers should be based on actual measured invoices.
Once these five steps are complete, you can compare different models’ capability, cost, stability, and compliance using the same yardstick.
