Open-Source Mid-Size Models vs. Closed-Source Flagship Models: How to Evaluate Cost-Effectiveness
Choosing between open-source mid-size LLMs and closed-source flagship models is a classic trade-off between cost and quality. This article explains how to interpret benchmark results correctly, break down the true cost of a single task, turn vague claims like "comparable quality" into measurable metrics, and follow a practical five-step evaluation process. It also includes sample Python code for aggregating evaluation records and a tiered routing strategy that combines small models, stronger fallback models, and human review.
Why This Comparison Matters
Model selection has long involved a dilemma: larger models with stronger reasoning capabilities usually come with higher per-token prices, while smaller models are cheaper to deploy but are often assumed to deliver lower-quality answers. A recent evaluation on enterprise research tasks showed that a mid-size open-source model matched a closed-source flagship model in relative answer quality, while its median cost per question was roughly one-fortieth of the flagship model’s.
This finding is directly relevant to development teams, but it needs to be understood within its test conditions before it can be transferred to your own business. The following sections first explain how to read the evaluation conditions, then provide a reusable framework for assessing both cost and quality.
Reading the Test Conditions Carefully
In this test, different models were connected to the same financial dataset and the same search environment, and each completed 245 research questions. This design eliminates interference from retrieval quality differences, so the comparison focuses purely on each model’s comprehension, summarization, and reasoning abilities.
When interpreting the results, keep the following in mind:
- The task domain is narrow: Financial research questions rely on document retrieval, numerical verification, and summarizing long texts. The results may not apply to code generation, customer support, or copywriting scenarios.
- Quality metrics need clear definitions: Both models scored a relative answer quality of 1.34, but the scoring criteria, reviewer composition, and normalization method require checking the original evaluation’s methodology. Without that context, the number only indicates the two models’ relative positions on the same benchmark.
- Median is not the same as average: Median cost reflects the typical request’s expense but hides high-cost outliers. In production, also track P90 and P95 percentiles.
- Cost accounting must be consistent: Whether you include retrieval calls, retries, context assembly, and output length directly changes the final cost ratio.
Breaking Down the True Cost of a Single Task
Many teams only compare price per million tokens, which tends to underestimate total cost. The actual expense of a single research task typically includes:
- Input tokens: The question, retrieved document chunks, system instructions, and conversation history. Longer retrieved passages mean higher input costs.
- Output tokens: Reasoning models may produce lengthy intermediate content, and output tokens are usually billed at a higher rate than input tokens.
- Tool calls: Retrieval, database queries, and web scraping each incur separate costs that must be accounted for independently.
- Retries and failures: Format errors, timeouts, and refusals trigger repeated requests, scaling costs proportionally.
- Human review: In high-risk scenarios, review time is a hidden cost that often exceeds the model invocation cost itself.
You can estimate the effective cost per question with this formula:
Effective cost per question = (model invocation cost + tool call cost) × (1 + retry rate) + amortized human review cost
The value of this formula is that it makes hidden costs explicit. If any component is missing, the comparison between two options may be distorted.
Turning “Comparable Quality” into Measurable Metrics
“Comparable quality” needs to be decomposed into scoreable dimensions. At minimum, cover these four:
- Factual accuracy: Whether key numbers, dates, and entity names match the source material.
- Evidence traceability: Whether conclusions cite the corresponding source passages.
- Completeness: Whether all sub-questions in the prompt are addressed.
- Clarity: Whether conclusions can be used directly for decision-making without ambiguity.
Scoring can combine rule-based checks with manual sampling. Numerical questions are well suited to automated script comparison, while open-ended questions should be scored by experienced reviewers on a sampled basis. To judge whether scores are reliable, also measure inter-rater agreement—for example, using Cohen’s kappa to quantify how well two reviewers’ judgments align.
A Five-Step Selection Process
- Build a representative evaluation set: Sample from real business logs, covering frequent questions, long-tail questions, and edge cases. Aim for at least 200 samples to reduce the impact of random variation.
- Standardize the run environment: Fix the retrieval configuration, prompt templates, and sampling parameters so environmental differences don’t contaminate the results.
- Record multi-dimensional metrics: For every request, log the quality score, input and output token counts, tool call counts, latency, and failure reasons.
- Compute cost per unit of quality: Divide cost by quality to measure value for money rather than price alone.
- Set escalation thresholds: When a smaller model’s quality score on a task category drops below a threshold, automatically switch to a stronger model.
Here is a sample script for aggregating evaluation records, which you can adapt as a starting point:
from dataclasses import dataclassfrom statistics import median@dataclassclass EvalRecord:model: strquality: float # quality score normalized to 0-1cost: float # effective cost per question, unit consistent with your budgetlatency_ms: float # end-to-end latency per questiondef summarize(records: list[EvalRecord], model: str) -> dict:rows = [r for r in records if r.model == model]if not rows:raise ValueError(f"No evaluation records for model {model}")avg_quality = sum(r.quality for r in rows) / len(rows)med_cost = median([r.cost for r in rows])latencies = sorted(r.latency_ms for r in rows)p95_index = min(len(latencies) - 1, int(len(latencies) * 0.95))return {"model": model,"avg_quality": round(avg_quality, 3),"median_cost": round(med_cost, 4),"cost_per_quality": round(med_cost / avg_quality, 4),"p95_latency_ms": latencies[p95_index],}
Cost per unit of quality is simple to compute, but it hides the dispersion of quality. Two models can share the same average quality while one is stable and the other fails badly on a few questions—the real risk differs. Beyond aggregate metrics, always inspect the quality distribution.
Illustrative example: a small model with a median cost of 0.01 and average quality of 0.80 versus a large model with a median cost of 0.40 and average quality of 0.82 yields cost-per-quality values of roughly 0.0125 and 0.488 respectively. These numbers only demonstrate the calculation and are not actual measurements.
Putting It into Practice: Tiered Routing with Fallback Escalation
A single-model strategy is rarely optimal. The more common approach is tiered routing, which sends requests of different difficulty to different tiers:
- Tier 1: A mid-size or small model handles routine requests, covering most of the traffic.
- Tier 2: Requests that fail self-checks or show low confidence are escalated to a stronger model.
- Tier 3: Requests involving compliance judgments or high-stakes conclusions are routed to human review.
Routing rules can draw on question type, historical failure rates, and self-check results. For example:
def route_after_first_attempt(task_type: str, self_check_passed: bool) -> str:"""Decide the next step after the small model's first attempt and self-check."""if task_type in {"compliance", "high_stakes"}:return "human_review"if not self_check_passed:return "escalate_to_stronger_model"return "accept"
This tiered design lets you capture the cost advantage of smaller models on routine traffic while keeping quality and risk under control on the requests that matter most.
