Lightweight LLM Comparison: Model Selection and Cost Optimization for Office Tasks
This article explains why a lower per-token price does not always mean lower total cost when choosing lightweight large language models for office workflows. It presents a four-dimension evaluation framework, a reproducible task set design, score normalization methods, common interpretation pitfalls, and engineering techniques such as prefix caching, tiered routing, and output constraints for controlling costs.
1. Background: Why “Half the Unit Price” Does Not Mean “More Savings”
In discussions about selecting lightweight large language models, the metric most easily amplified is unit price. A Flash-class model often charges significantly less for standard input and output than the off-peak price of a flagship model from the same generation, and the gap is even wider compared with peak hours. This price gradient is reasonable in itself: vendors convert idle compute into low-cost supply through off-peak scheduling, resource reuse, and more aggressive quantization.
But treating unit price as the sole decision criterion is a typical measurement mismatch. What an enterprise actually pays for is the “cost of completing a task,” not the “price per thousand tokens.” Task cost can be roughly expressed as:
cost per task ≈ (input tokens × input price + output tokens × output price) × retry factorretry factor = 1 / (1 - failure rate) + extra calls caused by validation rework
This formula shows three things. First, output price is usually more sensitive than input price, because generation length cannot be compressed. Second, the failure rate enters the denominator, and a 5% versus 20% failure rate can make actual costs differ by several times. Third, steps that require manual rework usually carry hidden costs higher than the model call fee itself. Therefore, a serious comparison must first define the task and acceptance criteria before discussing price.
2. Evaluation Framework: Four Dimensions and Weight Settings
It is advisable to place candidate models in a unified four-dimension coordinate system:
- Quality (accuracy, structural compliance rate, factual consistency)
- Cost (task unit price converted from the actual token distribution)
- Latency (percentiles of time to first token and overall completion time)
- Stability (rate-limiting probability, long-context degradation, output format drift)
Weights should vary by scenario. Batch document summarization is throughput-first, so the latency weight can be low; interactive writing assistance is experience-first, so the time-to-first-token weight needs to be raised; structured extraction is quality-first, and the format compliance rate should be set as a veto item.
3. Task Set Design: Making Office Scenarios Reproducible
Office scenarios may look scattered, but they can actually be grouped into five types of high-frequency tasks, and each type should have 30–50 samples with standard answers:
- Structured information extraction: extracting fields from meeting notes and contracts, with strict JSON output.
- Long-text compression and summarization: generating layered key points from multi-page material, without losing key numbers.
- Text rewriting and style unification: standardizing terminology, tone, and forms of address.
- Table and semi-structured conversion: turning narrative descriptions into tables, or generating explanations in reverse.
- Multi-turn revision: making targeted changes based on feedback, testing instruction retention.
The key to sample design is “automatic scoring.” For example, extraction tasks use field-level F1, summarization tasks use key entity recall, and rewriting tasks use terminology consistency plus manual spot-check scores. Relying only on subjective scoring makes the comparison impossible to reproduce.
{"task_id": "extract_017","type": "structured_extraction","input_tokens_est": 1800,"output_tokens_est": 260,"metric": "field_f1","pass_threshold": 0.92,"retry_policy": "max_2"}
4. Score Normalization: Putting Different Scales on the Same Basis
Let the lowest cost of a task across the candidate model set be the full-score baseline for that task. The cost score can then be written as score_cost = min_cost / cost_i; the quality score is the pass rate directly; the latency score uses a weighted inverse of p50 and p95 and is normalized. The composite score is:
Total_i = w_q × quality_i + w_c × cost_i + w_l × latency_i + w_s × stability_i
Two points need emphasis. First, weighting must follow the real token distribution. Office input contexts tend to be long while outputs tend to be short; estimating with an average distribution underestimates the cost of long-context models. Second, the “tail failure cost” must be counted separately, meaning the proportion of samples that trigger retries and human intervention. This part is often ignored but directly determines the bill after launch.
5. Common Pitfalls in Interpreting Results
The first pitfall is looking only at the average score. The capability distribution of lightweight models is usually more uneven. When average scores are close, a model with a longer low-score tail will cause more complaints in production. It is recommended to report 10th-percentile performance as well.
The second pitfall is ignoring prompt adaptation cost. Performance differences of the same prompt across different models may be larger than the inherent gap between the models. The fair approach is to give each candidate model an equal prompt-tuning budget before comparing results.
The third pitfall is treating demo performance as production performance. Demo samples are often short, clean, and unambiguous; production data is full of abbreviations, typos, and cross-paragraph references. The evaluation set must include noisy samples.
6. Engineering Techniques for Cost Optimization
Even after a model is selected, there is still substantial room for optimization:
- Prefix caching: place the system prompt, glossary, and templates in a stable prefix, reuse computation results, and reduce repeated input overhead.
- Tiered routing: use a lightweight model for most requests and escalate only low-confidence results to a stronger model, forming a cascade structure.
- Output constraints: use restricted decoding or strict mode to constrain JSON structure and reduce retries caused by parsing failures.
- Batching and off-peak scheduling: put non-real-time tasks in a queue, use idle resources, and combine message queues with task scheduling for peak shaving.
- Observability: collect token usage, failure rate, and latency percentiles through logging services and monitoring alerts to build a cost dashboard.
def route(prompt, ctx):# Try the lightweight model first, escalate when confidence is insufficientr = light_model(prompt, ctx, json_mode=True)if r.valid and r.confidence >= 0.85:return r.textreturn strong_model(prompt, ctx).text
7. Implementation Advice and Acceptance Checklist
When implementing on Baidu AI Cloud, you can combine general capabilities such as model services, object storage, message queues, container platforms, and monitoring alerts to build a dual-channel architecture of “batch processing + online inference”: the online channel guarantees interactive latency, the batch channel handles long documents and bulk extraction, and both share the same evaluation set and prompt version management.
The pre-launch acceptance checklist should include: evaluation set pass rate meeting the target, p95 latency within budget, no regression in format compliance rate, retry rate below the threshold, and the cost dashboard being splittable by business line. Re-evaluate monthly after launch, because model versions and pricing strategies change, and the shelf life of a one-time comparison conclusion is usually only one quarter.
8. Conclusion
The value of lightweight models lies not in the unit price number, but in whether they can stably handle high-frequency, standardized office tasks with acceptable quality, leaving complex tasks to stronger models. Building a reproducible task set, unified normalized scoring, and continuous cost observation is the reliable basis for selection decisions; a price advantage only translates into real savings on the bill after failure rates and rework rates are brought under control.
