Benchmarking Lightweight LLMs: A Practical Guide to Building Low-Cost Office AI Infrastructure
This article presents a reproducible framework for evaluating lightweight (Flash-class) language models for office workloads such as document summarization, meeting notes, email polishing, field extraction, and knowledge base Q&A. It explains how to model the real cost per task from input, cached-input, and output pricing, and why cache hit rate, output ratio, and peak/off-peak pricing matter more than headline unit prices. You will find a four-dimension evaluation methodology covering task quality, cost, engineering, and stability, common selection pitfalls, and a production architecture based on layered routing and cache-first design.
1. Why “Office Infrastructure Models” Are Becoming a Selection Focus
In enterprise applications, office scenarios—document summarization, meeting note organization, email polishing, table field extraction, and knowledge base Q&A—share three distinct characteristics: high request volume, relatively short context per request, and sensitivity to latency, while requiring limited extreme reasoning depth. This means the objective function for model selection is not the “highest benchmark score,” but a balance among cost per task, response latency, and output stability.
Over the past year, a large number of lightweight (Flash-class) models have emerged, with vendors commonly promoting “lower input/output unit prices plus cache hit discounts.” However, as engineering practice has repeatedly confirmed: a low unit price does not mean a low total cost, and a low total cost does not mean the task can be completed. Therefore, this article does not recommend any specific product. Instead, it abstracts the problem into: how to scientifically benchmark a group of lightweight language models and reliably embed them into an office business pipeline.
2. The Correct Cost Model: From Unit Price to Cost per Task
The pricing structure given in the source material (0.5 CNY per million input tokens, 2 CNY per million output tokens, and 0.02 CNY per million cached input tokens) is very typical in the industry and can be abstracted into the following general billing pattern:
Cost per request = (I_miss * P_in + I_hit * P_cache + O * P_out) / 1_000_000where:I_miss = number of input tokens that miss the cacheI_hit = number of input tokens that hit the cacheO = number of output tokensP_in = input unit price (CNY per million tokens)P_cache = cached input unit price (CNY per million tokens)P_out = output unit price (CNY per million tokens)
In engineering practice, three derived metrics matter most:
- Cache Hit Rate: In office scenarios, system prompts, templates, and knowledge base snippets are highly repetitive, and the hit rate can often reach 60%–90%. The cached unit price is usually only 3%–5% of the input unit price, so every 10 percentage point increase in hit rate can reduce overall cost far more than “halving the input unit price.”
- Output Ratio: Office task outputs are mostly short structured text, with output tokens often accounting for 10%–30% of input tokens. Since the output unit price is typically 3–5 times the input unit price, compressing redundant output (for example, restricting fields or requiring JSON) is more cost-effective than compressing input.
- Peak/Off-Peak Differences: Some platforms use time-based pricing, where peak prices can be 2–4 times off-peak prices. Scheduling offline batch tasks (generating daily reports at night, batch archiving) into off-peak windows is a direct cost reduction measure with zero quality loss.
An example of a practical estimation script:
def estimate_cost(reqs, p_in, p_cache, p_out):total = 0.0for r in reqs:total += (r["i_miss"] * p_in +r["i_hit"] * p_cache +r["out"] * p_out) / 1e6return total# Compare two options: high cache hit rate vs. no cacheprint(estimate_cost(sample_reqs, 0.5, 0.02, 2.0))
Conclusion: The first table in a benchmark should not be a unit price table, but a “cost per task table under a real traffic profile.”
3. Benchmarking Methodology: A Four-Dimension Evaluation Framework
To make the benchmark reproducible, fix the following four dimensions:
3.1 Task Quality Dimension
Do not use general leaderboards. Use a self-built office task set (recommended: 200–500 items) covering:
- Long document summarization (information coverage, factual consistency)
- Structured extraction (field accuracy, JSON validity rate)
- Tone rewriting (style consistency, semantic fidelity)
- Multi-turn table Q&A (numerical calculation correctness, citation location)
Scoring should combine “rule-based validation + model review + manual spot checks” to avoid single-reviewer bias.
3.2 Cost Dimension
Calculate the cost per task using the model in Section 2, and additionally record the cache hit rate and average output length.
3.3 Engineering Dimension
This includes time to first token (TTFT), overall P95 latency, concurrency throttling strategy, retry cost on failure, and whether the context window limit meets long-document requirements.
3.4 Stability and Controllability Dimension
Structured output compliance, refusal rate, consistency in handling sensitive content, and regression performance after version changes.
{"task": "meeting_summary","metrics": {"field_accuracy": 0.93,"json_valid_rate": 0.99,"avg_cost_per_task": 0.0021,"cache_hit_rate": 0.78,"p95_latency_ms": 2400}}
4. Common Pitfalls and Rigorous Reasoning
Pitfall 1: Half the unit price means half the cost.
Not true. If one option has a cache hit rate of only 20% while another reaches 85%, the latter’s input-side spending may be only one-third of the former’s, enough to offset the unit price disadvantage.
Pitfall 2: Lightweight models cannot handle office tasks.
This needs scenario-by-scenario analysis. Office tasks are mostly “rewriting, extraction, and summarization”—low-depth, high-breadth tasks. With sufficient prompt engineering and template constraints, lightweight models can usually meet requirements. For tasks involving complex multi-step reasoning and long-chain numerical analysis, larger models should still be used, forming a “layered routing of large and small models.”
Pitfall 3: Selecting a model based only on average score.
Introduce a “task success rate distribution.” If Model A has a slightly higher average score but double the P95 latency, the experience in real-time office plugin scenarios may actually be worse.
5. Engineering Implementation: Layered Routing and Cache First
Recommended architecture:
User request-> Intent classification (lightweight model/rules)-> Cache layer hit (semantic cache + prefix cache)-> Routing decision: simple task -> lightweight model; complex task -> large model-> Structured validation and retry (fallback on failure)-> Logging and cost accounting feedback
Key practices:
- Prefix Stabilization: Placing system prompts, templates, and knowledge base snippets at the very front of the context and keeping them byte-level stable is the most effective way to improve cache hit rate.
- Semantic Cache: Reuse vector retrieval for high-frequency similar questions, and set similarity thresholds and expiration policies to avoid stale answers.
- Output Constraints: Enforce a JSON Schema and limit maximum output length to directly reduce output-side costs.
- Observability: Incorporate token usage, cache hits, latency, and failure rate into monitoring, alerting, and logging services to form a cost dashboard.
When implementing on the cloud, you can combine a container platform to host the inference gateway, object storage to store evaluation corpora, a message queue for offline batch processing to smooth peaks, and logging and monitoring/alerting services for cost attribution. The general cloud infrastructure capabilities provided by Baidu AI Cloud can serve as the hosting environment for such an office AI foundation, helping enterprises turn model capabilities into operable, auditable, and continuously optimizable engineering assets.
6. Selection Conclusions and Action Checklist
- Build a real traffic profile; calculate cost per task first, then compare unit prices;
- Use a self-built office task set for a four-dimension benchmark, and output a reproducible metrics table;
- Prioritize investment in caching and prompt stabilization—the highest cost-performance optimization point;
- Adopt layered routing of large and small models to balance cost and complex task quality;
- Include cost, latency, and quality curves in the launch criteria simultaneously, and keep regressing.
Following this path, enterprises can reduce the unit cost of office AI applications to an acceptable range without sacrificing task completion rate, and build a truly sustainable “office infrastructure” capability.
