Lightweight LLM Comparison: Model Selection and Cost Optimization for Office Use Cases
This article presents a vendor-neutral methodology for choosing lightweight (Flash-class) large language models in office scenarios. It shows why a low price per token does not guarantee a low bill, breaks office work into four measurable task types, provides a cost formula that accounts for cache hit rate and first-pass yield, and outlines observability requirements and a prioritized list of optimization tactics. Readers will learn how to build a reproducible evaluation set and reduce effective cost per successful output.
1. The Problem: A Low Price Is Not a Low Cost
Pricing for lightweight (Flash-class) large language models is falling quickly. As an example of a published billing structure, one class of models charges roughly CNY 0.5 per million input tokens and CNY 2 per million output tokens, while cache-hit input can drop to CNY 0.02. Compared with another model positioned on price-performance, its standard input and output unit prices are roughly half of the competitor’s off-peak rate and one quarter of its peak rate.
Unit price, however, is only one factor on paper. A real bill is determined by four variables:
- Task structure: how much of the input is repeated, stable context;
- Cache hit rate: whether system prompts, knowledge snippets, and templates are reused consistently;
- Peak/off-peak distribution: whether calls concentrate in periods of tight compute capacity;
- Quality rework rate: a low first-pass rate multiplies token consumption.
The goal of an evaluation, then, should not be “who is cheaper” but “which option has the lowest cost per unit of effective output at a given quality threshold.” This article strips the product attributes out of the original comparison and abstracts them into a methodology for selecting lightweight models in office scenarios.
2. Evaluation Design: Breaking Office Tasks into Measurable Units
Office work looks miscellaneous but reduces to four categories, each with entirely different quality criteria and cost characteristics:
| Task type | Typical input | Quality criteria | Cost characteristics |
|---|---|---|---|
| Structured extraction | Contracts, invoices, forms | Field-level accuracy, format compliance | Long input, short output, high cache benefit |
| Long-document summarization | Meeting notes, reports | Point coverage, no hallucination | Very long input, prefix reuse is critical |
| Rewriting and polishing | Emails, notices, official documents | Tone consistency, factual fidelity | Balanced input and output |
| Multi-turn Q&A | Policy lookup, customer support | Traceable citations, correct refusal | Context accumulates across turns |
Three variables must be fixed or the conclusions will not be reproducible: sampling parameters such as temperature, prompt version, and the evaluation set plus scoring script. Prepare 50–100 samples with reference answers per task type, and hold back 10% as a “regression sentinel set” to re-run after every model or prompt change.
3. Cost Model: Writing the Bill as a Computable Formula
Let a single request have input $I$ and output $O$ (in millions of tokens), standard input price $p_i$, output price $p_o$, cache-hit input price $p_c$, and cache hit rate $h$. The cost of one request is:
cost = I * ((1 - h) * p_i + h * p_c) + O * p_o
Effective cost divides further by the first-pass rate $q$:
effective_cost = cost / q
This explains two counter-intuitive results:
- In long-input tasks, caching matters more than unit price. When $I \gg O$ and $h$ rises from 0.2 to 0.8, input-side spend can fall by an order of magnitude, far exceeding the unit-price gap between models.
- A 10% quality drop can flip the cost ranking. If a model is half the price but its first-pass rate falls from 0.9 to 0.45, effective cost goes up instead.
Illustrative implementation (pseudocode, interface names kept neutral):
def estimate_cost(input_mtok, output_mtok, hit_ratio,p_in=0.5, p_out=2.0, p_cache=0.02):in_cost = input_mtok * ((1 - hit_ratio) * p_in+ hit_ratio * p_cache)return in_cost + output_mtok * p_outdef effective_cost(..., pass_rate):return estimate_cost(...) / max(pass_rate, 1e-6)
4. Observability: Measure First, Optimize Second
Cost optimization depends on three kinds of data, none of which can be skipped:
- Token metering: record input, output, and cache-hit usage separately rather than only total tokens;
- Quality metrics: field accuracy, point coverage, human spot-check pass rate;
- Latency distribution: P50/P95, with office applications especially sensitive to P95.
On Baidu AI Cloud, this is typically carried by a combination of log services, monitoring and alerting, and object storage: call details go to logs, metrics go to a monitoring dashboard, and evaluation samples and results are archived to object storage, forming an evaluation pipeline that can be traced back over time.
5. Optimizations and Their Priority
Ordered by return on investment, proceed as follows:
- Prefix stabilization: keep system prompts, tool descriptions, and background knowledge at the front and avoid volatile concatenation such as timestamps, maximizing cache hits;
- Tiered task routing: send extraction and rewriting to lightweight models, escalate complex reasoning and long-chain tasks to stronger models;
- Output constraints: use structured output and field whitelists to shrink $O$ while lowering parse failure rates;
- Peak/off-peak scheduling: move non-real-time batch work (nightly archiving, bulk summarization) into off-peak windows;
- Regression gate: wire the sentinel set into continuous integration and block releases when quality falls below threshold.
6. Conclusion
The real competitiveness of a lightweight model lies not in its list price but in the product of cache friendliness, first-pass rate, and scheduling flexibility. Only by building a reproducible evaluation set, expressing cost as a formula, and putting quality into the release gate can you reliably achieve low cost and high availability in office infrastructure — which is exactly how a model access platform (such as the model services, logs, and monitoring capabilities offered by Baidu AI Cloud) should be used.
