Comparing Lightweight LLMs for Office Workloads: A Framework for Model Selection and Cost Optimization

    This article presents a vendor-neutral methodology for evaluating lightweight large language models in office scenarios such as meeting note cleanup, email polishing, field extraction, ticket routing, and contract comparison. It explains how to build a realistic evaluation set from actual business tasks, score models across four dimensions (instruction and format adherence, long-context recall, structured and tool-calling ability, and effective cost per valid output), and interpret the capability boundaries of lightweight models. It also covers engineering practices for reliable deployment, including schema validation, repair-style retries, tiered routing to stronger models, prefix caching, off-peak batching, context trimming, and output budgets, along with a reproducible evaluation workflow for continuous integration.

    1. Why Lightweight Models Have Become a Key Variable in Office Infrastructure

    Much of the text work inside enterprises does not require top-tier reasoning: cleaning up meeting notes, polishing emails, extracting form fields, classifying tickets, summarizing weekly reports, and comparing contract clauses. These tasks run frequently, usually involve short contexts, are sensitive to latency, and demand highly stable output formats. Putting the most expensive model on every one of these steps often delivers a poor return on investment.

    Office workloads also have a pronounced tidal pattern: weekday mornings and afternoons are peak hours, while late nights and holidays are nearly idle. Vendors apply time-of-day pricing to the same tier of lightweight models, and peak versus off-peak unit prices can differ by several times. As a result, making decisions from the “price per million tokens” column alone almost guarantees a misjudgment. What actually determines the bill is task success rate, retry rate, context length distribution, cache hit rate, and the share of traffic that lands in peak hours.

    This article therefore discusses no specific products. Instead, it abstracts the lightweight model comparison into an actionable methodology: first define a unified evaluation set for office tasks, then score candidates across four dimensions, and finally use engineering techniques to bring costs down.

    2. Evaluation Design: Turning “Office Scenarios” into Measurable Metrics

    2.1 Principles for Building the Task Set

    The evaluation set must come from real business, not constructed toy examples. Sample in layers across four task categories, with no fewer than 50 items per category, and preserve the original noise (typos, colloquial phrasing, mixed Chinese and English, leftover artifacts from pasted tables):

    • Extraction: pull fields such as dates, amounts, responsible parties, and deadlines from emails, notices, and contracts;
    • Generation: expand bullet points into a formal notice, or compress a long document into three key points;
    • Classification and routing: ticket intent recognition, priority assignment, and dispatch to the responsible team;
    • Transformation: turn a meeting transcript into a three-part structure of “conclusions — action items — risks”.

    Every sample needs a reference answer or validation rule that can be checked automatically; otherwise the evaluation cannot be used for regression.

    2.2 Four Core Dimensions

    1. Instruction following and format stability: can the model reliably emit valid JSON, with no missing fields and no out-of-range enum values;
    2. Long-context utilization: does recall of key information degrade when the input is 20,000 to 80,000 tokens;
    3. Structured output and tool-calling ability: are function arguments complete, are types correct, and does the model invent fields with no basis;
    4. Cost per unit of valid output: not the unit price, but the “total spend per 1,000 qualified tasks completed”.

    The fourth point is the most easily overlooked. Suppose model A costs half as much per call as model B, but A’s pass rate is only 90% and it needs 1.3 retries on average to deliver, and those retries tend to land in peak hours. A’s real cost may actually be higher. The following approximation applies:

    1. def effective_cost(unit_price, pass_rate, avg_retry, peak_ratio, peak_factor):
    2. # unit_price: average price per call (converted to cost per 1K tokens)
    3. # pass_rate: first-attempt pass rate
    4. # avg_retry: average number of attempts including the first
    5. # peak_ratio: share of calls that fall in peak hours
    6. # peak_factor: peak price as a multiple of the off-peak price
    7. time_factor = peak_ratio * peak_factor + (1 - peak_ratio)
    8. return unit_price * avg_retry * time_factor / pass_rate

    3. Reading the Results: Where the Capability Boundary of Lightweight Models Lies

    In horizontal comparisons within the same lightweight tier, three stable patterns usually emerge and can serve as priors for selection.

    First, on tasks with short contexts and clearly defined formats, the gap between models is small. Pass rates for field extraction and short-text classification are typically good enough for use, so price and latency should become the main decision criteria.

    Second, the gap concentrates in composite tasks that combine “long input plus multiple constraints”. When a prompt simultaneously contains a role definition, an output template, forbidden words, a word limit, and examples, lightweight models tend to drop constraints: omitting a field, ignoring the word limit, or copying the example content as the actual body. These failures are not capability problems but constraint-management problems, and they can be substantially mitigated with structured prompts and post-validation.

    Third, lightweight models are extremely sensitive to ambiguity in prompts. One poorly defined enum value, or one vague phrase such as “as appropriate” or “as much as possible”, is enough to shift the output distribution. Writing rules in a decidable form yields far more benefit than switching to a more expensive model.

    4. Engineering Implementation: Making Stability Independent of Model Self-Discipline

    4.1 Constraints First: Define Output with Templates and Schemas

    Do not let the model improvise the format. Provide an explicit schema and enforce it server-side:

    1. import json
    2. from jsonschema import validate
    3. schema = {
    4. "type": "object",
    5. "required": ["title", "todos", "risks"],
    6. "properties": {
    7. "title": {"type": "string", "maxLength": 40},
    8. "todos": {"type": "array", "items": {"type": "string"}, "maxItems": 5},
    9. "risks": {"type": "array", "items": {"type": "string"}}
    10. }
    11. }
    12. def parse_and_check(raw: str) -> dict:
    13. data = json.loads(raw)
    14. validate(data, schema)
    15. return data

    When validation fails, do not blindly retry the same prompt. Feed the validation error back to the model for one “repair-style retry”, which saves more tokens than rerunning the whole task.

    4.2 Tiered Routing: Reserve Expensive Models for Genuinely Hard Cases

    Handle all requests with a lightweight model first, then use a lightweight classifier to decide whether an escalation is needed. Escalation signals include: input length above a threshold, low confidence in extracted fields, two consecutive validation failures, or involvement of monetary amounts or legal clauses. Illustrative logic:

    1. def route(task):
    2. if task.input_tokens > 30000 or task.has_legal_clause:
    3. return "strong_model"
    4. if task.retry_count >= 2:
    5. return "strong_model"
    6. return "flash_model"

    This kind of routing typically pushes high-price calls down to 5% to 15% of total volume, while the overall pass rate barely drops.

    4.3 Cost Control Toolbox

    • Prefix caching: keep the system prompt, templates, and glossary in a stable prefix, so repeated content is not billed or is billed at a lower rate;
    • Batching and off-peak scheduling: queue non-real-time summarization and labeling tasks for idle hours, which combined with time-of-day pricing significantly dilutes the unit price;
    • Context trimming: retrieve relevant passages first and send only those to the model, instead of stuffing in an entire document;
    • Semantic deduplication: build cache keys for frequent similar requests (normalized text plus template version number) and return cached results on a hit;
    • Output budget: explicitly cap the maximum generation length to avoid verbose explanations inflating output-side cost, since output tokens are usually more expensive than input tokens.

    5. A Reproducible Evaluation Workflow

    1. Fix the evaluation set and random seed, and freeze the prompt version number;
    2. Run each model three times, recording pass rate, average latency at P50/P95, and the input/output token distribution;
    3. Use a unified script to compute “cost per 1,000 qualified tasks”, and list two traffic assumptions separately for peak and off-peak;
    4. Classify failure causes for failed samples: format errors, missed constraints, factual errors, hallucinated fields;
    5. Change prompts or add validation only for the two most common failure categories, then run the regression again.

    Wire this workflow into continuous integration so it runs on every model or prompt change. Model selection then shifts from a one-off decision to a continuously optimizable engineering metric.

    6. Conclusion

    The value of lightweight models in office infrastructure lies not in peak performance on any single point, but in reliably absorbing high-frequency, format-driven text processing at a controllable cost. The rational approach is to evaluate with a real task set, decide based on cost per unit of valid output rather than unit price, cover format risk with schema validation and repair-style retries, and use tiered routing plus caching and off-peak scheduling to bring the bill into a reasonable range. If an enterprise already uses model services on Baidu AI Cloud, the same framework applies, with object storage for evaluation set version management, a message queue for smoothing off-peak tasks, and logging, monitoring, and alerting for pass-rate and cost dashboards, forming a closed loop.