LLM Selection and Cost Optimization: A Dual-Task Benchmarking Practice

    Choosing the right large language model is a "technology × cost" decision, not a purely technical one. This article presents a reusable dual-task benchmarking method that compares models of different tiers under identical rules, covering structured content generation and code generation. It explains how to calculate the true per-task cost (including hidden costs from multi-turn fixes), provides a task-based model routing strategy, and offers practical tips for optimizing quota spending.

    LLM Selection and Cost Optimization: A Dual-Task Benchmarking Practice

    When deploying large language models in real applications, “which model should we use” is rarely a purely technical question—it’s a combined “technology × cost” decision. For the same task, a lightweight model may cost very little, while a high-tier model may cost several times more, yet the delivered quality doesn’t always scale proportionally. This article walks through a reusable dual-task benchmarking approach that systematically compares models under unified rules, and shares best practices for quota allocation.

    Why Run Controlled Tests: Same Task, Different Models Only

    Teams often fall into two traps when selecting models:

    • Selecting by reputation: Hearing that a model is “very strong” and routing all tasks to it, only to see quota consumption explode with limited gains.
    • Selecting by a single trial: Drawing conclusions from one or two casually written prompts—too small a sample to be reliable.

    A sound selection method is the controlled variable approach: fix the task, the prompt, and the acceptance criteria, with the model as the only variable. Only then do the observed capability differences reflect the models’ true capabilities, rather than interference from prompt engineering or input material differences.

    Therefore, the first iron rule of benchmarking is: in the same round of testing, use identical source materials, prompts, and acceptance criteria—do not optimize instructions for any specific model or provide differentiated reference materials.

    Test Design: Three Model Tiers and Quota Multipliers

    This benchmark selects three representative model tiers: two lightweight models (quota consumption multiplier of 0.01x each) and one enhanced model (quota consumption multiplier of 0.08x). In other words, each call to the enhanced model consumes 8 times the quota of a lightweight model.

    This multiplier difference is the core tension in model selection:

    1. If the 8x cost buys roughly equivalent quality, the lightweight model is the obvious choice;
    2. If the 8x cost buys a qualitative leap (e.g., complex reasoning pass rates rising from 40% to 95%), then paying the premium on critical tasks is worthwhile.

    Preparation before testing includes:

    • Unified input: All tasks share the same original requirements document and the same prompt template;
    • Unified acceptance criteria: Define quantifiable metrics in advance, such as code executability, number of requirement points covered, factual error count, and format compliance;
    • Blind evaluation: Where possible, have reviewers unaware of which model produced which output, avoiding preconceived bias.

    Task 1: Structured Content Generation

    The first task is typical structured content generation—producing a requirements specification document containing background, objectives, feature lists, and acceptance conditions based on given product requirement materials.

    This type of task is characterized by mature patterns, clear templates, and low demands on deep reasoning. The results confirmed this:

    • Both lightweight models consistently produced well-structured documents with complete key points, with only minor differences in heading hierarchy and wording;
    • The enhanced model had slight advantages in language polishing and edge-case coverage, but its core information points overlapped heavily with the lightweight models.

    Conclusion: For structured, highly templated generation tasks, lightweight models offer a clear cost-performance advantage. The 8x quota premium did not deliver 8x quality improvement—the actual gap was only around 10%–20%.

    Task 2: Code Generation and Logical Reasoning

    The second task steps up to code generation: implementing a utility function with boundary condition handling from a natural language description, along with unit tests. Illustrative acceptance code:

    1. def test_parse_date_range():
    2. assert parse_date_range("2024-01-01~2024-01-31") == ("2024-01-01", "2024-01-31")
    3. assert parse_date_range("") is None # empty input
    4. assert parse_date_range("bad-format") is None # invalid format
    5. assert parse_date_range("2024-01-31~2024-01-01") is None # reversed start/end

    This type of task places higher demands on logical completeness, boundary-condition awareness, and executability. Here the gaps began to show:

    • One lightweight model produced code that was correct in the main flow but missed validation for reversed start/end dates, failing the first acceptance round and requiring an additional fix-up conversation;
    • The other lightweight model covered most boundary conditions in one pass, but its unit test assertion style was non-standard;
    • The enhanced model passed all acceptance cases on the first attempt and proactively added exception handling and type annotations.

    Conclusion: On logic-intensive tasks, the differences between model tiers are significantly amplified. If you factor in “the extra quota and time consumed by multi-turn fixes,” the actual cost of a lightweight model may rise from 0.01x to 0.02x–0.03x, while the enhanced model’s one-shot 0.08x can actually be competitive in certain scenarios.

    A Cost Accounting Framework: Counting the Hidden Costs

    Combining both tasks, we recommend the following formula for cost accounting in model selection:

    True per-task cost = quota multiplier × number of interaction rounds × converted human verification time

    For concrete decisions, refer to this strategy table:

    Task Type Recommended Tier Rationale
    Document polishing, format conversion, summarization Lightweight model Highly templated, small quality gaps
    Routine code completion, simple scripts Lightweight model first Low failure cost, fast retries
    Complex algorithms, multi-constraint reasoning, architecture design Enhanced model Significantly higher first-pass rate
    Critical production paths Enhanced model + human review Stability takes priority over cost

    Practical Recommendations: Build a Tiered Invocation Mechanism

    Finally, here are three actionable quota optimization suggestions:

    1. Default to lightweight, upgrade on demand: Route all daily tasks to the lightweight model by default, upgrading to the enhanced model only when acceptance fails or a task is flagged as “high complexity”—forming a tiered invocation strategy.
    2. Build task profiles: Tag historical tasks (generation, reasoning, code, critical) and periodically review each model’s pass rate under each tag, using data to drive iteration of routing rules.
    3. Front-load acceptance criteria: Write acceptance criteria before sending requests. This significantly reduces vague “good enough” judgments and gives model comparisons an objective basis.

    Conclusion

    There is no absolute “strongest” model—only the “best match.” Controlled dual-task benchmarking shows that lightweight models are sufficient for most daily tasks, while the enhanced model’s value concentrates in high-complexity, high-risk scenarios. Spending quota where it counts essentially means grading tasks, tiering models, and making every invocation decision with data rather than intuition.