LLM Selection and Retention: A Cost-Efficiency Evaluation Guide

    This guide explains why per-million-token list prices do not reflect the real cost of running general-purpose LLMs, and how to evaluate candidates using cost per task and latency per task instead. It covers building a unified evaluation baseline, tiered reasoning调度 for coding and multi-step agents, the billing impact of long-context and prompt caching, combining terse and expressive models in a pipeline, and a checklist for price windows, free-tier assumptions, and migration costs. Readers will find a practical retention checklist for keeping model choices verifiable over time.

    LLM Selection and Retention: A Cost-Efficiency Evaluation Guide

    1. The Core Problem: List Price Is Not Your Bill

    When assessing the return on investment of a general-purpose large language model (LLM), the most common mistake is looking only at the listed input/output price per million tokens. The actual bill is determined by four variables:

    1. Actual consumption per task: hidden tokens from multi-turn tool calls, retrieved snippets, and failed retries;
    2. Output verbosity: whether the model tends to produce long, padded answers, which directly inflates the most expensive side of billing, the output side;
    3. Reasoning tier: the gains from a high-intensity reasoning tier are not linear, and many general tasks already saturate at a mid tier;
    4. Context pricing structure: whether long context carries a surcharge, and whether cache reads are billed separately.

    The selection conclusion therefore has to rest on average cost per task plus average time per task under the same evaluation baseline, not on the price sheet.

    2. Establishing a Unified Evaluation Baseline

    A two-dimensional matrix works well for side-by-side comparison: cost actually paid per task on the horizontal axis, average time per task on the vertical axis, with a capability score added as an extra column. A skeletal evaluation script is shown below (pseudocode, expressing the calculation logic only):

    1. def evaluate(candidate, tasks):
    2. total_cost, total_time, scores = 0.0, 0.0, []
    3. for t in tasks:
    4. r = candidate.run(t) # returns token usage and latency
    5. total_cost += price(r.input, r.output, r.cached)
    6. total_time += r.latency
    7. scores.append(r.quality)
    8. return {
    9. "cost_per_task": total_cost / len(tasks),
    10. "time_per_task": total_time / len(tasks),
    11. "score": mean(scores),
    12. "efficiency": mean(scores) / (total_cost / len(tasks)),
    13. }

    Three points are critical: the task set must cover your real scenarios (code, long documents, multi-step tool calls, and general analysis, each in a reasonable proportion); cache reads must be counted at a separate unit price; and tokens consumed by failed retries must not be discarded.

    3. Scenario 1: Cost-Performance Trade-offs for Code and Multi-Step Agents

    For teams whose work centers on writing code, running multi-step agents, and stuffing entire repositories into long documents, the main cost is usually not a single conversation but the total token accumulation across the task chain. One multi-step agent task can easily involve dozens of tool round trips, with the output side amplified again and again.

    The practical conclusion: the default tier usually beats the highest tier. On many general tasks, a high-intensity reasoning tier yields only about a one-point score difference, yet it can multiply both output length and the total bill. An actionable strategy is tiered scheduling:

    • Requirement clarification, code completion, single-file edits: mid-to-low tiers;
    • Cross-file refactoring, complex defect localization: high tier, with a per-task budget cap;
    • Impose a hard constraint on output length (require the conclusion and change list first, then expand on demand), which directly cuts output tokens.

    4. Scenario 2: The Structural Impact of Long-Context Pricing

    Long-context capability has moved from a scarce feature to a baseline configuration, but billing structures differ enormously. Some generations double the price beyond 200,000 tokens, while others charge a flat rate across the whole range and offer a significant discount on cache reads.

    For teams that repeatedly read the same codebase or specification documents, the cache hit rate often affects the bill more than the unit price. Engineering practice should ensure that: stable prefixes (system prompt, project conventions, dependency lists) come first and are not changed needlessly; volatile content is placed at the end of the request; and caching is enabled for repeated calls. Illustration:

    1. [Stable prefix: conventions + dependencies + directory structure] <- reusable from cache
    2. [Semi-stable section: summaries of files relevant to this request]
    3. [Volatile section: user question / latest logs]

    5. Scenario 3: Hidden Savings in General Analysis and Research Tasks

    A model with a higher list price is not necessarily the most expensive. If a model is extremely terse in its output and rarely beats around the bush, its actual cost per task may be only a fraction of a similarly priced model’s, with shorter latency as well. Such models stand out on cost-performance for structured analysis, document summarization, and drafting experiment plans.

    Their typical weakness is stiff expression and poor readability, which requires an extra polishing pass. The engineering response is to decouple “generation” from “expression”: hand analysis, extraction, and computation to the terse model, and hand human-facing summaries and copy to a model with more natural expression, solving the whole problem with a pipeline rather than a single model.

    6. A Pitfall Checklist for Price Windows and Subscription Thresholds

    • Limited-time price windows: after a new generation is released, the previous flagship often gets a temporary discount. Confirm when the window closes before switching, so you do not migrate right after prices go back up.
    • Do not assume a free tier: most new models offer no free tier, and free accounts or low-tier subscriptions are usually unusable, so budget for a paid API or a higher-tier subscription.
    • Migration cost: switching models means re-running the regression task set and re-validating prompts, tool-calling protocols, and output parsing, so that the bill goes down without the success rate dropping.

    7. Retention Decision Checklist

    1. Measure cost per task and time per task for each task category under a unified baseline;
    2. Check whether the default tier already meets your needs, and downgrade whenever possible;
    3. Track the cache hit rate and optimize the stable prefix;
    4. Verify whether long context carries a surcharge and whether you are currently inside a price window;
    5. Build a combined pipeline of a “terse” model plus an “expressive” model;
    6. Re-test once per quarter with a fixed task set, so that changes in capability or pricing do not invalidate your conclusions.

    For scenarios that need elastic compute and unified metering, you can rely on general capabilities from Baidu AI Cloud, such as its container platform, object storage, logging service, and monitoring and alerting, to build a closed loop for evaluating model calls and observing cost, keeping selection conclusions continuously verifiable.