Model Selection Guide: From Single Models to AI Agents

    This article provides a practical guide for evaluating and selecting large language models as the industry shifts from standalone models to agent-based systems. It covers three key architectural advances—mixture-of-experts, sparse attention, and residual connections—along with their trade-offs in real-world deployment. The guide outlines a framework for assessing three core capabilities: long-horizon task execution, multimodal understanding, and long-context memory, including concrete testing methods for each. It also compares standardized benchmarks, human evaluation, and scenario-based testing, and presents a step-by-step process for building an effective evaluation pipeline. Finally, it breaks down API cost calculation with a concrete example, offering a structured approach to model selection that balances capability, reliability, and cost.

    I. Three Key Architectural Shifts

    This section explains three common techniques in next-generation flagship models, the problems they solve, the costs they introduce, and their applicable boundaries.

    Mixture-of-Experts (MoE)

    Mixture-of-experts architecture splits the feed-forward network into multiple expert sub-networks. A router (gating network) selects a small subset of experts to process each token. While the total parameter count is large, only a fraction of parameters are activated per token. This means the computation per inference step is determined by activated parameters, not the total parameter count.

    The trade-offs are clear. All weights must still fit in VRAM or RAM. Expert load can be unbalanced, leaving some experts permanently idle. Deployment requires multi-GPU parallelism and careful consideration of communication overhead introduced by expert parallelism.

    Sparse Attention

    Standard attention’s computational cost grows quadratically with sequence length. Sparse attention computes attention only for a subset of token pairs—for example, using local windows augmented with a small number of global tokens—reducing the cost to near-linear. This addresses the computational burden of processing extremely long sequences.

    The cost is that long-range dependencies may be missed. “Needle-in-a-haystack” style tests are therefore necessary to verify whether critical information is still retrievable by the model.

    Residual Connections

    Residual connections are a network architecture design choice rather than part of the attention mechanism itself. They add each layer’s output to its input, mitigating gradient vanishing and information decay in deep networks. They are a fundamental component of the Transformer architecture.

    Their contribution to long-sequence processing is indirect, primarily stabilizing deep-network training. Residual connections alone cannot guarantee that a model preserves all information across long contexts.

    II. Three Core Capabilities: Input, Output, and Failure Boundaries

    Long-Horizon Task Execution

    Example input: “An open-source project’s memory usage keeps rising after extended runtime. Identify the leak and provide a fix. Tests must pass after the fix.”

    Expected output: Reproduction steps, analysis of the suspected leaked objects, a code patch, test results, and the rationale behind each step.

    Constraints: The model needs to invoke compilation, testing, and analysis tools. When tools report errors, the model may fall into repeated retry loops. Set a maximum step count and timeout. Add human approval gates for operations such as writing to the code repository or deleting files.

    Verification method: Run tests in a separate branch, compare memory growth curves before and after the fix using memory analysis tools, and check that the patch does not modify unrelated files.

    Agent Workflow Design

    Developers must define input/output schemas for each tool, record state at every step for checkpoint recovery, and set retry limits for tool errors. The prompt is only one part of the workflow; state management and exception handling are equally critical to task completion.

    Multimodal Understanding

    Example input: A screenshot of a login page, with the task of generating the corresponding front-end component code.

    Expected output: Structured HTML and style code, with button text matching the screenshot and the same number of form fields.

    Failure scenarios include: low-resolution screenshots causing OCR errors; occluded elements in the screenshot; hover, loading, and other dynamic states that cannot be inferred from a static image; color values that are estimated from the image and may be inaccurate; and the target project using a component library different from the one the model is familiar with.

    Verification method: Render the generated code and perform pixel-diff comparison against the original image, or have a human review item by item. Understanding images and generating images are two distinct capabilities and should be evaluated separately during model selection.

    Long-Context Memory

    Long context windows allow feeding in large volumes of documents at once, but accuracy typically degrades as context length grows. Information located in the middle of the context is especially prone to being overlooked.

    Example: Embed 10 known facts in a 200-page research report, distributed at the beginning, middle, and end. Measure the model’s recall rate for each fact.

    Verification method: Group tests by fact position and document length, recording recall per group. Looking at a single average score can mask the mid-context failure mode.

    III. Choosing an Evaluation Method

    Three common evaluation approaches serve different purposes and cannot replace one another.

    Method Stage Main Advantages Main Limitations Common Misuse
    Standardized benchmarks Initial screening of candidates Reproducible, enables horizontal comparison Test items may overlap with training data; may be detached from real business use Treating leaderboard rankings as direct evidence for production deployment
    Human blind evaluation Comparing output style and usability Reflects real reading experience High cost; evaluation criteria can drift over time Too few reviewers, leading to unstable conclusions
    Scenario-based evaluation Pre-deployment decisions Directly maps to business metrics High construction cost; requires expert annotation Selecting only ideal-case samples

    To run scenario-based evaluation, follow this process:

    1. Sample 200–300 real, de-identified records from production logs, stratified by task type.
    2. Define acceptance criteria in advance—for example, a task success rate of no less than 80% and a per-task cost under a defined ceiling.
    3. Use identical prompts and a fixed temperature for all candidate models, recording model version numbers and invocation timestamps.
    4. Strip model identifiers from outputs and have at least two reviewers evaluate blindly, recording inter-reviewer agreement.
    5. Calculate metrics and report confidence intervals. With a sample size of 200 and a success rate near 50%, the 95% confidence interval is approximately ±7 percentage points.
    6. Categorize errors on failed samples, then decide whether to adjust prompts, switch models, or add human review.

    IV. Cost, Licensing, and Deployment

    API Cost Calculation

    The per-call cost can be estimated with the following formula:

    Per-call cost = (uncached input tokens × uncached input price) + (cached input tokens × cached input price) + (output tokens × output price)

    Here is a hypothetical example—prices are expressed in CNY per million tokens and do not reflect any vendor’s actual pricing. A single call sends 10,000 input tokens, of which 8,000 hit the cache, and generates 1,000 output tokens. The uncached input price is 2 CNY, the cached input price is 0.2 CNY, and the output price is 8 CNY.

    Cost = 2,000 × 2 ÷ 1,000,000 + 8,000 × 0.2 ÷ 1,000,000 + 1,000 × 8 ÷ 1,000,000 = 0.0136 CNY

    Cache hits depend on exact prefix matching. To maximize cache effectiveness, place static content such as system prompts and fixed documents at the beginning of the prompt, with user input and variable content at the end.