LLM Model Selection: A Two-Tier Strategy with Task-Level Cost Accounting

    Choosing a single "best" LLM for an entire pipeline is usually the wrong approach. This article explains how to split model capability into a deep-reasoning tier and a high-throughput tier, break a workflow into independently verifiable steps, and route each step accordingly. It also introduces a three-ledger cost model (input, cache-hit input, output) that accounts for retries and human rework, a one-day A/B experiment across three common scenarios, and a gradual rollout path supported by logging, monitoring, and message queues.

    1. The Problem: Why “Pick the Strongest Model” Is the Wrong Question

    When a team gets access to a new generation of models, the most common move is to open a leaderboard, pick the option with the highest overall score, and switch the entire pipeline over to it. The problem with this approach is that real business work is not a single task. It is a pipeline made up of multiple stages: requirement understanding, code retrieval, defect localization, patch generation, test execution, documentation Q&A, and evidence collection. Each stage places different demands on the model, while an overall leaderboard only provides a single averaged number. It cannot answer the question “who should handle this particular stage?”

    A more reasonable abstraction is to view model capability as two layers. The first layer is the deep reasoning tier, which excels at long-context progression, cross-module causal inference, and specialized tasks that require extended continuous work. The second layer is the high-throughput efficiency tier, which excels at high-frequency, short-chain, clearly defined routine tasks and emphasizes output speed per unit of cost. The two are not substitutes for each other; they are different workstations on the same pipeline.

    2. Understanding the Capability Layers Correctly

    The value of deep reasoning models shows up on “hard to localize” problems: cross-service failures, intermittent timeouts, and data inconsistencies. These problems are characterized by a large search space, sparse clues, and repeated hypothesis-and-verification cycles. The value of efficiency models shows up on “high-frequency repetition” problems: adding tests according to a specification, batch-rewriting API fields, and answering verifiable questions based on existing documentation.

    It is worth emphasizing that the gap between the two tiers shrinks on most routine tasks. Public industry evaluations repeatedly show a similar pattern: on real code repository modification tasks, when both models are set to their maximum reasoning level, the score gap can be less than half a tier, while the cost of completing the same task can differ by several times. This indicates that the key variable in model selection is often not “who is smarter,” but “does this stage actually require deep reasoning.”

    3. Breaking Tasks into Stages: An Actionable Template

    The recommended breakdown follows four steps:

    1. List the stages: Write a business flow as 5–8 steps that can be accepted independently.
    2. Mark the failure cost: Distinguish stages where “a mistake can be rolled back automatically” from those where “a mistake requires human fallback.”
    3. Mark the degree of parallelism: Give batchable stages that can run in parallel to the efficiency tier first.
    4. Mark the context length: Assign stages that must ingest a large amount of material at once and maintain internal consistency to the deep reasoning tier.

    An illustrative routing configuration (pseudocode, expressing only the layering idea):

    1. def route(step):
    2. if step.needs_long_context or step.failure_cost == "high":
    3. return "deep_reasoning_model"
    4. if step.batchable and step.verifiable:
    5. return "throughput_model"
    6. return "throughput_model" # default to the low-cost path

    4. Cost Accounting: The Three-Ledger Method

    Comparing only the “price per million tokens” can lead to serious misjudgment. The correct approach is to split cost into three ledgers:

    • Input ledger: material newly read in on each call;
    • Cache-hit input ledger: the portion served from cache when the same material is processed repeatedly, usually at a significantly lower unit price than first-time input;
    • Output ledger: generated content, usually at the highest unit price.

    This yields a simple but useful estimation formula:

    1. total cost ≈ input tokens × P_in + cache-hit tokens × P_cache + output tokens × P_out + retry count × cost per attempt

    The implication is straightforward. For scenarios that repeatedly process the same long document, the higher the cache hit rate, the more the cost structure approaches “a one-time investment plus extremely low-cost reuse.” For scenarios that read new material every time, cost is determined almost entirely by the input ledger. In addition, the number of human rework rounds must be converted into total cost; otherwise the real expense of a “cheap model” will be underestimated.

    5. A Three-Scenario Comparison: Run It in a Day

    Do not replace the entire workflow at once. Start with three common tasks and run an A/B comparison:

    1. Fix a known defect: Record whether it passed on the first attempt, how many rounds of human edits were needed, and the test pass rate.
    2. Answer verifiable questions from old documentation: Record the proportion of verifiable answers and whether citations are traceable.
    3. Run a multi-step task that requires tool calls: Record the step completion rate, the number of times it got stuck midway, and the total time and total cost.

    The experiment protocol should fix three variables: the same input, the same acceptance criteria, and the same concurrency conditions. Repeat each item at least three times and take the median to avoid a single fluctuation misleading the decision. The recording table can be minimal:

    1. scenario | model tier | correct result | human rounds | input tokens | cache hits | output tokens | total cost

    6. Implementation Path: Layered Routing plus Observability

    A gradual rollout is recommended: first let the efficiency tier handle the routine parts, then single out the steps where it repeatedly gets stuck and hand them to the deep reasoning tier. After two weeks, review the routing hit rate and the cost curve, then decide whether to expand the coverage of the deep reasoning tier.

    Three supporting capabilities are needed in engineering: a logging service to record the stage label and token composition of each call; monitoring and alerting to set thresholds for failure rate and rework rounds; and a message queue to absorb batchable parallel tasks and smooth out peak traffic. If an organization already uses relevant general-purpose capabilities from Baidu AI Cloud (such as object storage for holding material, a container platform for hosting the inference gateway, and a logging and monitoring system for attribution), it can reuse the existing accounting system directly instead of building a separate set of metrics.

    7. Common Pitfalls

    • Pitfall 1: Switching everything because of a high leaderboard score. This ignores stage differences, so cost rises while the experience stays the same.
    • Pitfall 2: Counting unit price but not rework. Human rounds are the most easily missed cost item.
    • Pitfall 3: Ignoring caching. In long-document reuse scenarios, the cache hit rate directly determines the order of magnitude of cost.
    • Pitfall 4: Replacing the entire workflow at once. This makes it impossible to attribute where the gains came from and makes rollback difficult.

    8. Conclusion

    When a new generation of models enters production, the right move is not to “pick one” but to “allocate a set.” With task decomposition as the skeleton, three-ledger accounting as the measuring stick, the three-scenario comparison as evidence, and layered routing as the implementation form, you can achieve a balance among capability, latency, and cost that is explainable and reproducible.