Lightweight LLM Comparison: Model Selection and Cost Optimization for Office Workloads

    This article compares lightweight large language models for everyday office tasks and shows why a low per-token price does not always mean a lower total bill. It defines a practical capability checklist for office workloads, outlines a reproducible evaluation plan with task sampling, metrics, and parameter control, and provides vendor-neutral Python snippets for running tasks and calculating per-task cost with cache discounts. It also summarizes three typical comparison outcomes and gives deployment advice for treating models as replaceable components behind a unified gateway.

    1. Background: Why “Cheap” Does Not Mean “Cost-Effective”

    In discussions about choosing a lightweight large language model, price is usually the first metric on the table. A typical model’s published API pricing has three parts: a standard input rate, an output rate, and a cached input rate, where the cache price is often only a few percent of the standard input price. In a side-by-side comparison, a lightweight model positioned as office infrastructure may cost about one-half (off-peak) to one-quarter (peak hours) of a comparable high-value model for standard input and output.

    But a low unit price does not automatically mean a low total cost. The cost of real office tasks is determined by four variables:

    • Input length per task (long documents, meeting notes, and email threads significantly increase input-side costs);
    • Output length (summarization and rewriting produce short outputs, while code generation and proposal writing produce long ones);
    • Cache hit rate (whether system prompts, templates, and knowledge base snippets can be reused consistently);
    • Call distribution (whether calls concentrate in peak hours and whether there is a clear peak/off-peak gap).

    So the first principle of model selection is: define the task and cost model first, then compare unit prices.

    2. Abstracting an “Office Infrastructure Model” into a Capability Checklist

    Office infrastructure refers to high-frequency capabilities that are called repeatedly and embedded in daily workflows, not occasional complex reasoning. They can be grouped into five categories:

    1. Text compression: long-document summarization, meeting note distillation, key point extraction;
    2. Text transformation: tone rewriting, format conversion, multilingual translation;
    3. Structured extraction: pulling fields from contracts and outputting a format programs can consume;
    4. Classification and routing: ticket grading, intent recognition, workflow dispatch;
    5. Constrained generation: producing a first draft within a given template and word limit.

    These tasks share common traits: long context, short output, high call volume, and a controllable cost per failure but a high cumulative cost. This means evaluation should focus on stability, format compliance, and cost per task rather than peak capability on a single point.

    3. Evaluation Design: Reproducibility Is Key

    3.1 Building the Task Set

    Sample from real business data, stratified by the five capability categories, with no fewer than several dozen items per stratum, and keep the original noise (typos, colloquial expressions, semi-structured formatting). It is recommended to fix a “golden set” for regression and a separate “holdout set” for final validation to avoid overfitting during tuning.

    3.2 Metric Definitions

    • Effectiveness metrics: key point coverage, field extraction accuracy, format compliance rate;
    • Stability metrics: consistency of results across repeated calls with the same input;
    • Latency metrics: percentiles of time to first token and overall completion time (not averages);
    • Cost metrics: cost per task = input cost + output cost - cache discount.

    3.3 Prompt and Parameter Control

    Use a unified system prompt and fix sampling parameters such as temperature to avoid mistaking prompt engineering differences for model capability differences. Example call logic:

    1. def run_task(client, system_prompt, user_content, cache_hint=None):
    2. messages = [{"role": "system", "content": system_prompt}]
    3. if cache_hint:
    4. # Put the reusable long template first to improve cache hit probability
    5. messages.append({"role": "system", "content": cache_hint})
    6. messages.append({"role": "user", "content": user_content})
    7. resp = client.chat.create(
    8. messages=messages,
    9. temperature=0.2,
    10. max_tokens=512,
    11. )
    12. return resp.text, resp.usage

    4. Writing the Cost Model in Code

    Writing billing rules into code avoids judging “cheap” by intuition. Below is a vendor-neutral general accounting skeleton:

    1. def task_cost(usage, price):
    2. in_cost = usage.prompt_tokens / 1_000_000 * price["input"]
    3. out_cost = usage.completion_tokens / 1_000_000 * price["output"]
    4. cached = getattr(usage, "cached_tokens", 0)
    5. save = cached / 1_000_000 * (price["input"] - price["cached_input"])
    6. return in_cost + out_cost - max(save, 0.0)

    Here price is injected from configuration and contains three unit rates: standard input, output, and cached input, and can switch between off-peak and peak configurations. This way, when switching models you only replace the configuration and client while keeping the evaluation criteria unchanged.

    5. Interpreting Results: Three Typical Conclusions

    In comparisons among similar lightweight models, three types of conclusions usually emerge and are worth anticipating:

    • On output-limited tasks, the gap between models is small. For tasks with short outputs such as summarization and rewriting, cost is mainly determined by the input side, and the benefit of caching is amplified.
    • For structured extraction, format compliance matters more than “writing quality.” A model that can reliably output in an agreed format has the lowest engineering rework cost.
    • Peak-hour price differences are significantly amplified. If business calls concentrate in the same period, the off-peak price advantage may disappear entirely, requiring off-peak scheduling and queuing strategies.

    6. Deployment Advice: Treat the Model as a Replaceable Component

    1. Abstract a unified gateway layer to hide API differences across models and enable plug-in replacement;
    2. Build a cache-friendly prompt structure that keeps long templates and knowledge snippets at the front and stable;
    3. Manage unit rates and time-window strategies with a configuration center so costs are recalculated automatically as prices change;
    4. Set quality gates that automatically retry or fall back to a stronger model when format compliance fails;
    5. Continuously collect real call distribution and rerun the golden set regression quarterly.

    7. Conclusion

    Selecting a lightweight model is essentially a constrained optimization problem: minimize cost per task and latency percentiles while meeting effectiveness requirements. Once the task set, metrics, and billing rules are all codified, any new model entering the candidate pool can produce comparable conclusions within hours. If you need managed model services, unified resource scheduling, and monitoring and alerting capabilities, you can look into the general cloud product categories offered by Baidu AI Cloud, using standard APIs for integration and observability without being locked into a single implementation.